ccgo_linux_ppc64le.go 963 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802
  1. // Code generated for linux/ppc64le 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/debian/src/modernc.org/builder/.exclude/modernc.org/libbsd/include/linux/ppc64le -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 && ppc64le
  3. package libexpat
  4. import (
  5. "reflect"
  6. "unsafe"
  7. "modernc.org/libc"
  8. )
  9. var _ reflect.Type
  10. var _ unsafe.Pointer
  11. const m_ARG_MAX = 131072
  12. const m_ASCII_0 = 48
  13. const m_ASCII_1 = 49
  14. const m_ASCII_2 = 50
  15. const m_ASCII_3 = 51
  16. const m_ASCII_4 = 0x34
  17. const m_ASCII_5 = 0x35
  18. const m_ASCII_6 = 0x36
  19. const m_ASCII_7 = 0x37
  20. const m_ASCII_8 = 56
  21. const m_ASCII_9 = 57
  22. const m_ASCII_A = 65
  23. const m_ASCII_AMP = 0x26
  24. const m_ASCII_APOS = 0x27
  25. const m_ASCII_B = 0x42
  26. const m_ASCII_C = 67
  27. const m_ASCII_COLON = 58
  28. const m_ASCII_COMMA = 44
  29. const m_ASCII_D = 68
  30. const m_ASCII_E = 69
  31. const m_ASCII_EQUALS = 61
  32. const m_ASCII_EXCL = 33
  33. const m_ASCII_F = 70
  34. const m_ASCII_FF = 12
  35. const m_ASCII_G = 0x47
  36. const m_ASCII_GT = 0x3E
  37. const m_ASCII_H = 0x48
  38. const m_ASCII_HASH = 35
  39. const m_ASCII_I = 73
  40. const m_ASCII_J = 0x4A
  41. const m_ASCII_K = 75
  42. const m_ASCII_L = 76
  43. const m_ASCII_LPAREN = 40
  44. const m_ASCII_LSQB = 0x5B
  45. const m_ASCII_LT = 0x3C
  46. const m_ASCII_M = 77
  47. const m_ASCII_MINUS = 0x2D
  48. const m_ASCII_N = 78
  49. const m_ASCII_O = 79
  50. const m_ASCII_P = 0x50
  51. const m_ASCII_PERIOD = 46
  52. const m_ASCII_PIPE = 124
  53. const m_ASCII_Q = 0x51
  54. const m_ASCII_QUOT = 0x22
  55. const m_ASCII_R = 82
  56. const m_ASCII_RPAREN = 41
  57. const m_ASCII_RSQB = 0x5D
  58. const m_ASCII_S = 83
  59. const m_ASCII_SEMI = 0x3B
  60. const m_ASCII_SLASH = 47
  61. const m_ASCII_SPACE = 0x20
  62. const m_ASCII_T = 84
  63. const m_ASCII_TAB = 0x09
  64. const m_ASCII_U = 0x55
  65. const m_ASCII_UNDERSCORE = 0x5F
  66. const m_ASCII_V = 0x56
  67. const m_ASCII_W = 0x57
  68. const m_ASCII_X = 88
  69. const m_ASCII_Y = 89
  70. const m_ASCII_Z = 0x5A
  71. const m_ASCII_a = 97
  72. const m_ASCII_b = 0x62
  73. const m_ASCII_c = 99
  74. const m_ASCII_d = 0x64
  75. const m_ASCII_e = 101
  76. const m_ASCII_f = 0x66
  77. const m_ASCII_g = 103
  78. const m_ASCII_h = 104
  79. const m_ASCII_i = 0x69
  80. const m_ASCII_j = 0x6A
  81. const m_ASCII_k = 0x6B
  82. const m_ASCII_l = 108
  83. const m_ASCII_m = 109
  84. const m_ASCII_n = 110
  85. const m_ASCII_o = 111
  86. const m_ASCII_p = 112
  87. const m_ASCII_q = 0x71
  88. const m_ASCII_r = 114
  89. const m_ASCII_s = 115
  90. const m_ASCII_t = 116
  91. const m_ASCII_u = 0x75
  92. const m_ASCII_v = 0x76
  93. const m_ASCII_w = 119
  94. const m_ASCII_x = 120
  95. const m_ASCII_y = 0x79
  96. const m_ASCII_z = 0x7A
  97. const m_AT_EACCESS = 0x200
  98. const m_AT_EMPTY_PATH = 0x1000
  99. const m_AT_NO_AUTOMOUNT = 0x800
  100. const m_AT_RECURSIVE = 0x8000
  101. const m_AT_REMOVEDIR = 0x200
  102. const m_AT_STATX_DONT_SYNC = 0x4000
  103. const m_AT_STATX_FORCE_SYNC = 0x2000
  104. const m_AT_STATX_SYNC_AS_STAT = 0x0000
  105. const m_AT_STATX_SYNC_TYPE = 0x6000
  106. const m_AT_SYMLINK_FOLLOW = 0x400
  107. const m_AT_SYMLINK_NOFOLLOW = 0x100
  108. const m_BC_BASE_MAX = 99
  109. const m_BC_DIM_MAX = 2048
  110. const m_BC_SCALE_MAX = 99
  111. const m_BC_STRING_MAX = 1000
  112. const m_BIG_ENDIAN = "__BIG_ENDIAN"
  113. const m_BUFSIZ = 1024
  114. const m_BYTEORDER = 1234
  115. const m_BYTE_ORDER = "__BYTE_ORDER"
  116. const m_CHARCLASS_NAME_MAX = 14
  117. const m_CHAR_BIT = 8
  118. const m_CHAR_MAX = 255
  119. const m_CHAR_MIN = 0
  120. const m_COLL_WEIGHTS_MAX = 2
  121. const m_DELAYTIMER_MAX = 0x7fffffff
  122. const m_DN_ACCESS = 0x00000001
  123. const m_DN_ATTRIB = 0x00000020
  124. const m_DN_CREATE = 0x00000004
  125. const m_DN_DELETE = 0x00000008
  126. const m_DN_MODIFY = 0x00000002
  127. const m_DN_MULTISHOT = 0x80000000
  128. const m_DN_RENAME = 0x00000010
  129. const m_E2BIG = 7
  130. const m_EACCES = 13
  131. const m_EADDRINUSE = 98
  132. const m_EADDRNOTAVAIL = 99
  133. const m_EADV = 68
  134. const m_EAFNOSUPPORT = 97
  135. const m_EAGAIN = 11
  136. const m_EALREADY = 114
  137. const m_EBADE = 52
  138. const m_EBADF = 9
  139. const m_EBADFD = 77
  140. const m_EBADMSG = 74
  141. const m_EBADR = 53
  142. const m_EBADRQC = 56
  143. const m_EBADSLT = 57
  144. const m_EBFONT = 59
  145. const m_EBUSY = 16
  146. const m_ECANCELED = 125
  147. const m_ECHILD = 10
  148. const m_ECHRNG = 44
  149. const m_ECOMM = 70
  150. const m_ECONNABORTED = 103
  151. const m_ECONNREFUSED = 111
  152. const m_ECONNRESET = 104
  153. const m_EDEADLK = 35
  154. const m_EDEADLOCK = 58
  155. const m_EDESTADDRREQ = 89
  156. const m_EDOM = 33
  157. const m_EDOTDOT = 73
  158. const m_EDQUOT = 122
  159. const m_EEXIST = 17
  160. const m_EFAULT = 14
  161. const m_EFBIG = 27
  162. const m_EHOSTDOWN = 112
  163. const m_EHOSTUNREACH = 113
  164. const m_EHWPOISON = 133
  165. const m_EIDRM = 43
  166. const m_EILSEQ = 84
  167. const m_EINPROGRESS = 115
  168. const m_EINTR = 4
  169. const m_EINVAL = 22
  170. const m_EIO = 5
  171. const m_EISCONN = 106
  172. const m_EISDIR = 21
  173. const m_EISNAM = 120
  174. const m_EKEYEXPIRED = 127
  175. const m_EKEYREJECTED = 129
  176. const m_EKEYREVOKED = 128
  177. const m_EL2HLT = 51
  178. const m_EL2NSYNC = 45
  179. const m_EL3HLT = 46
  180. const m_EL3RST = 47
  181. const m_ELIBACC = 79
  182. const m_ELIBBAD = 80
  183. const m_ELIBEXEC = 83
  184. const m_ELIBMAX = 82
  185. const m_ELIBSCN = 81
  186. const m_ELNRNG = 48
  187. const m_ELOOP = 40
  188. const m_EMEDIUMTYPE = 124
  189. const m_EMFILE = 24
  190. const m_EMLINK = 31
  191. const m_EMSGSIZE = 90
  192. const m_EMULTIHOP = 72
  193. const m_ENAMETOOLONG = 36
  194. const m_ENAVAIL = 119
  195. const m_ENETDOWN = 100
  196. const m_ENETRESET = 102
  197. const m_ENETUNREACH = 101
  198. const m_ENFILE = 23
  199. const m_ENOANO = 55
  200. const m_ENOBUFS = 105
  201. const m_ENOCSI = 50
  202. const m_ENODATA = 61
  203. const m_ENODEV = 19
  204. const m_ENOENT = 2
  205. const m_ENOEXEC = 8
  206. const m_ENOKEY = 126
  207. const m_ENOLCK = 37
  208. const m_ENOLINK = 67
  209. const m_ENOMEDIUM = 123
  210. const m_ENOMEM = 12
  211. const m_ENOMSG = 42
  212. const m_ENONET = 64
  213. const m_ENOPKG = 65
  214. const m_ENOPROTOOPT = 92
  215. const m_ENOSPC = 28
  216. const m_ENOSR = 63
  217. const m_ENOSTR = 60
  218. const m_ENOSYS = 38
  219. const m_ENOTBLK = 15
  220. const m_ENOTCONN = 107
  221. const m_ENOTDIR = 20
  222. const m_ENOTEMPTY = 39
  223. const m_ENOTNAM = 118
  224. const m_ENOTRECOVERABLE = 131
  225. const m_ENOTSOCK = 88
  226. const m_ENOTSUP = "EOPNOTSUPP"
  227. const m_ENOTTY = 25
  228. const m_ENOTUNIQ = 76
  229. const m_ENXIO = 6
  230. const m_EOPNOTSUPP = 95
  231. const m_EOVERFLOW = 75
  232. const m_EOWNERDEAD = 130
  233. const m_EPERM = 1
  234. const m_EPFNOSUPPORT = 96
  235. const m_EPIPE = 32
  236. const m_EPROTO = 71
  237. const m_EPROTONOSUPPORT = 93
  238. const m_EPROTOTYPE = 91
  239. const m_ERANGE = 34
  240. const m_EREMCHG = 78
  241. const m_EREMOTE = 66
  242. const m_EREMOTEIO = 121
  243. const m_ERESTART = 85
  244. const m_ERFKILL = 132
  245. const m_EROFS = 30
  246. const m_ESHUTDOWN = 108
  247. const m_ESOCKTNOSUPPORT = 94
  248. const m_ESPIPE = 29
  249. const m_ESRCH = 3
  250. const m_ESRMNT = 69
  251. const m_ESTALE = 116
  252. const m_ESTRPIPE = 86
  253. const m_ETIME = 62
  254. const m_ETIMEDOUT = 110
  255. const m_ETOOMANYREFS = 109
  256. const m_ETXTBSY = 26
  257. const m_EUCLEAN = 117
  258. const m_EUNATCH = 49
  259. const m_EUSERS = 87
  260. const m_EWOULDBLOCK = "EAGAIN"
  261. const m_EXDEV = 18
  262. const m_EXFULL = 54
  263. const m_EXIT_FAILURE = 1
  264. const m_EXIT_SUCCESS = 0
  265. const m_EXPAND_SPARE = 24
  266. const m_EXPR_NEST_MAX = 32
  267. const m_Expat_External_INCLUDED = 1
  268. const m_Expat_INCLUDED = 1
  269. const m_FALLOC_FL_KEEP_SIZE = 1
  270. const m_FALLOC_FL_PUNCH_HOLE = 2
  271. const m_FAPPEND = "O_APPEND"
  272. const m_FASYNC = "O_ASYNC"
  273. const m_FD_CLOEXEC = 1
  274. const m_FD_SETSIZE = 1024
  275. const m_FFSYNC = "O_SYNC"
  276. const m_FILENAME_MAX = 4096
  277. const m_FILESIZEBITS = 64
  278. const m_FNDELAY = "O_NDELAY"
  279. const m_FNONBLOCK = "O_NONBLOCK"
  280. const m_FOPEN_MAX = 1000
  281. const m_F_ADD_SEALS = 1033
  282. const m_F_CANCELLK = 1029
  283. const m_F_DUPFD = 0
  284. const m_F_DUPFD_CLOEXEC = 1030
  285. const m_F_GETFD = 1
  286. const m_F_GETFL = 3
  287. const m_F_GETLEASE = 1025
  288. const m_F_GETLK = 5
  289. const m_F_GETOWN = 9
  290. const m_F_GETOWNER_UIDS = 17
  291. const m_F_GETOWN_EX = 16
  292. const m_F_GETPIPE_SZ = 1032
  293. const m_F_GETSIG = 11
  294. const m_F_GET_FILE_RW_HINT = 1037
  295. const m_F_GET_RW_HINT = 1035
  296. const m_F_GET_SEALS = 1034
  297. const m_F_LOCK = 1
  298. const m_F_NOTIFY = 1026
  299. const m_F_OFD_GETLK = 36
  300. const m_F_OFD_SETLK = 37
  301. const m_F_OFD_SETLKW = 38
  302. const m_F_OK = 0
  303. const m_F_OWNER_GID = 2
  304. const m_F_OWNER_PGRP = 2
  305. const m_F_OWNER_PID = 1
  306. const m_F_OWNER_TID = 0
  307. const m_F_RDLCK = 0
  308. const m_F_SEAL_FUTURE_WRITE = 0x0010
  309. const m_F_SEAL_GROW = 0x0004
  310. const m_F_SEAL_SEAL = 0x0001
  311. const m_F_SEAL_SHRINK = 0x0002
  312. const m_F_SEAL_WRITE = 0x0008
  313. const m_F_SETFD = 2
  314. const m_F_SETFL = 4
  315. const m_F_SETLEASE = 1024
  316. const m_F_SETLK = 6
  317. const m_F_SETLKW = 7
  318. const m_F_SETOWN = 8
  319. const m_F_SETOWN_EX = 15
  320. const m_F_SETPIPE_SZ = 1031
  321. const m_F_SETSIG = 10
  322. const m_F_SET_FILE_RW_HINT = 1038
  323. const m_F_SET_RW_HINT = 1036
  324. const m_F_TEST = 3
  325. const m_F_TLOCK = 2
  326. const m_F_ULOCK = 0
  327. const m_F_UNLCK = 2
  328. const m_F_WRLCK = 1
  329. const m_GRND_INSECURE = 0x0004
  330. const m_GRND_NONBLOCK = 1
  331. const m_GRND_RANDOM = 0x0002
  332. const m_HAVE_CONFIG_H = 1
  333. const m_HAVE_DLFCN_H = 1
  334. const m_HAVE_EXPAT_CONFIG_H = 1
  335. const m_HAVE_FCNTL_H = 1
  336. const m_HAVE_GETPAGESIZE = 1
  337. const m_HAVE_GETRANDOM = 1
  338. const m_HAVE_INTTYPES_H = 1
  339. const m_HAVE_MEMORY_H = 1
  340. const m_HAVE_MMAP = 1
  341. const m_HAVE_STDINT_H = 1
  342. const m_HAVE_STDLIB_H = 1
  343. const m_HAVE_STRINGS_H = 1
  344. const m_HAVE_STRING_H = 1
  345. const m_HAVE_SYSCALL_GETRANDOM = 1
  346. const m_HAVE_SYS_PARAM_H = 1
  347. const m_HAVE_SYS_STAT_H = 1
  348. const m_HAVE_SYS_TYPES_H = 1
  349. const m_HAVE_UNISTD_H = 1
  350. const m_HOST_NAME_MAX = 255
  351. const m_INIT_ATTS_SIZE = 16
  352. const m_INIT_ATTS_VERSION = 4294967295
  353. const m_INIT_BLOCK_SIZE = 1024
  354. const m_INIT_BUFFER_SIZE = 1024
  355. const m_INIT_DATA_BUF_SIZE = 1024
  356. const m_INIT_POWER = 6
  357. const m_INIT_SCAFFOLD_ELEMENTS = 32
  358. const m_INIT_TAG_BUF_SIZE = 32
  359. const m_INT16_MAX = 0x7fff
  360. const m_INT32_MAX = 0x7fffffff
  361. const m_INT64_MAX = 0x7fffffffffffffff
  362. const m_INT8_MAX = 0x7f
  363. const m_INTMAX_MAX = "INT64_MAX"
  364. const m_INTMAX_MIN = "INT64_MIN"
  365. const m_INTPTR_MAX = "INT64_MAX"
  366. const m_INTPTR_MIN = "INT64_MIN"
  367. const m_INT_FAST16_MAX = "INT32_MAX"
  368. const m_INT_FAST16_MIN = "INT32_MIN"
  369. const m_INT_FAST32_MAX = "INT32_MAX"
  370. const m_INT_FAST32_MIN = "INT32_MIN"
  371. const m_INT_FAST64_MAX = "INT64_MAX"
  372. const m_INT_FAST64_MIN = "INT64_MIN"
  373. const m_INT_FAST8_MAX = "INT8_MAX"
  374. const m_INT_FAST8_MIN = "INT8_MIN"
  375. const m_INT_LEAST16_MAX = "INT16_MAX"
  376. const m_INT_LEAST16_MIN = "INT16_MIN"
  377. const m_INT_LEAST32_MAX = "INT32_MAX"
  378. const m_INT_LEAST32_MIN = "INT32_MIN"
  379. const m_INT_LEAST64_MAX = "INT64_MAX"
  380. const m_INT_LEAST64_MIN = "INT64_MIN"
  381. const m_INT_LEAST8_MAX = "INT8_MAX"
  382. const m_INT_LEAST8_MIN = "INT8_MIN"
  383. const m_INT_MAX = 2147483647
  384. const m_IOV_MAX = 1024
  385. const m_ITIMER_PROF = 2
  386. const m_ITIMER_REAL = 0
  387. const m_ITIMER_VIRTUAL = 1
  388. const m_LINE_MAX = 4096
  389. const m_LITTLE_ENDIAN = "__LITTLE_ENDIAN"
  390. const m_LLONG_MAX = 0x7fffffffffffffff
  391. const m_LOGIN_NAME_MAX = 256
  392. const m_LONG_BIT = 64
  393. const m_LONG_MAX = "__LONG_MAX"
  394. const m_LT_OBJDIR = ".libs/"
  395. const m_L_INCR = 1
  396. const m_L_SET = 0
  397. const m_L_XTND = 2
  398. const m_L_ctermid = 20
  399. const m_L_cuserid = 20
  400. const m_L_tmpnam = 20
  401. const m_MAX_HANDLE_SZ = 128
  402. const m_MB_LEN_MAX = 4
  403. const m_MQ_PRIO_MAX = 32768
  404. const m_NAME_MAX = 255
  405. const m_NDEBUG = 1
  406. const m_NGROUPS_MAX = 32
  407. const m_NL_ARGMAX = 9
  408. const m_NL_LANGMAX = 32
  409. const m_NL_MSGMAX = 32767
  410. const m_NL_NMAX = 16
  411. const m_NL_SETMAX = 255
  412. const m_NL_TEXTMAX = 2048
  413. const m_NZERO = 20
  414. const m_O_APPEND = 02000
  415. const m_O_ASYNC = 020000
  416. const m_O_CLOEXEC = 02000000
  417. const m_O_CREAT = 0100
  418. const m_O_DIRECT = 0400000
  419. const m_O_DIRECTORY = 040000
  420. const m_O_DSYNC = 010000
  421. const m_O_EXCL = 0200
  422. const m_O_EXEC = "O_PATH"
  423. const m_O_LARGEFILE = 0200000
  424. const m_O_NDELAY = "O_NONBLOCK"
  425. const m_O_NOATIME = 01000000
  426. const m_O_NOCTTY = 0400
  427. const m_O_NOFOLLOW = 0100000
  428. const m_O_NONBLOCK = 04000
  429. const m_O_PATH = 010000000
  430. const m_O_RDONLY = 0
  431. const m_O_RDWR = 02
  432. const m_O_RSYNC = 04010000
  433. const m_O_SEARCH = "O_PATH"
  434. const m_O_SYNC = 04010000
  435. const m_O_TMPFILE = 020040000
  436. const m_O_TRUNC = 01000
  437. const m_O_TTY_INIT = 0
  438. const m_O_WRONLY = 01
  439. const m_PACKAGE = "expat"
  440. const m_PACKAGE_BUGREPORT = "expat-bugs@libexpat.org"
  441. const m_PACKAGE_NAME = "expat"
  442. const m_PACKAGE_STRING = "expat 2.2.10"
  443. const m_PACKAGE_TARNAME = "expat"
  444. const m_PACKAGE_URL = ""
  445. const m_PACKAGE_VERSION = "2.2.10"
  446. const m_PATH_MAX = 4096
  447. const m_PDP_ENDIAN = "__PDP_ENDIAN"
  448. const m_PIPE_BUF = 4096
  449. const m_POSIX_CLOSE_RESTART = 0
  450. const m_POSIX_FADV_DONTNEED = 4
  451. const m_POSIX_FADV_NOREUSE = 5
  452. const m_POSIX_FADV_NORMAL = 0
  453. const m_POSIX_FADV_RANDOM = 1
  454. const m_POSIX_FADV_SEQUENTIAL = 2
  455. const m_POSIX_FADV_WILLNEED = 3
  456. const m_PTHREAD_DESTRUCTOR_ITERATIONS = 4
  457. const m_PTHREAD_KEYS_MAX = 128
  458. const m_PTHREAD_STACK_MIN = 2048
  459. const m_PTRDIFF_MAX = "INT64_MAX"
  460. const m_PTRDIFF_MIN = "INT64_MIN"
  461. const m_P_tmpdir = "/tmp"
  462. const m_RAND_MAX = 0x7fffffff
  463. const m_RE_DUP_MAX = 255
  464. const m_RWF_WRITE_LIFE_NOT_SET = 0
  465. const m_RWH_WRITE_LIFE_EXTREME = 5
  466. const m_RWH_WRITE_LIFE_LONG = 4
  467. const m_RWH_WRITE_LIFE_MEDIUM = 3
  468. const m_RWH_WRITE_LIFE_NONE = 1
  469. const m_RWH_WRITE_LIFE_SHORT = 2
  470. const m_R_OK = 4
  471. const m_SCHAR_MAX = 127
  472. const m_SEEK_DATA = 3
  473. const m_SEEK_HOLE = 4
  474. const m_SEM_NSEMS_MAX = 256
  475. const m_SEM_VALUE_MAX = 0x7fffffff
  476. const m_SHRT_MAX = 0x7fff
  477. const m_SIG_ATOMIC_MAX = "INT32_MAX"
  478. const m_SIG_ATOMIC_MIN = "INT32_MIN"
  479. const m_SIP_KEYLEN = 16
  480. const m_SIZE_MAX = "UINT64_MAX"
  481. const m_SPLICE_F_GIFT = 8
  482. const m_SPLICE_F_MORE = 4
  483. const m_SPLICE_F_MOVE = 1
  484. const m_SPLICE_F_NONBLOCK = 2
  485. const m_SSIZE_MAX = "LONG_MAX"
  486. const m_STDC_HEADERS = 1
  487. const m_STDERR_FILENO = 2
  488. const m_STDIN_FILENO = 0
  489. const m_STDOUT_FILENO = 1
  490. const m_SYMLOOP_MAX = 40
  491. const m_SYNC_FILE_RANGE_WAIT_AFTER = 4
  492. const m_SYNC_FILE_RANGE_WAIT_BEFORE = 1
  493. const m_SYNC_FILE_RANGE_WRITE = 2
  494. const m_S_IRGRP = 0040
  495. const m_S_IROTH = 0004
  496. const m_S_IRUSR = 0400
  497. const m_S_IRWXG = 0070
  498. const m_S_IRWXO = 0007
  499. const m_S_IRWXU = 0700
  500. const m_S_ISGID = 02000
  501. const m_S_ISUID = 04000
  502. const m_S_ISVTX = 01000
  503. const m_S_IWGRP = 0020
  504. const m_S_IWOTH = 0002
  505. const m_S_IWUSR = 0200
  506. const m_S_IXGRP = 0010
  507. const m_S_IXOTH = 0001
  508. const m_S_IXUSR = 0100
  509. const m_TMP_MAX = 10000
  510. const m_TTY_NAME_MAX = 32
  511. const m_TZNAME_MAX = 6
  512. const m_UCHAR_MAX = 255
  513. const m_UINT16_MAX = 0xffff
  514. const m_UINT32_MAX = "0xffffffffu"
  515. const m_UINT64_MAX = "0xffffffffffffffffu"
  516. const m_UINT8_MAX = 0xff
  517. const m_UINTMAX_MAX = "UINT64_MAX"
  518. const m_UINTPTR_MAX = "UINT64_MAX"
  519. const m_UINT_FAST16_MAX = "UINT32_MAX"
  520. const m_UINT_FAST32_MAX = "UINT32_MAX"
  521. const m_UINT_FAST64_MAX = "UINT64_MAX"
  522. const m_UINT_FAST8_MAX = "UINT8_MAX"
  523. const m_UINT_LEAST16_MAX = "UINT16_MAX"
  524. const m_UINT_LEAST32_MAX = "UINT32_MAX"
  525. const m_UINT_LEAST64_MAX = "UINT64_MAX"
  526. const m_UINT_LEAST8_MAX = "UINT8_MAX"
  527. const m_UINT_MAX = 0xffffffff
  528. const m_USHRT_MAX = 0xffff
  529. const m_VERSION = "2.2.10"
  530. const m_WINT_MAX = "UINT32_MAX"
  531. const m_WINT_MIN = 0
  532. const m_WNOHANG = 1
  533. const m_WORD_BIT = 32
  534. const m_WUNTRACED = 2
  535. const m_W_OK = 2
  536. const m_XML_ATTRIBUTE_VALUE_LITERAL = 0
  537. const m_XML_BUILDING_EXPAT = 1
  538. const m_XML_CDATA_SECTION_STATE = 2
  539. const m_XML_CONTENT_STATE = 1
  540. const m_XML_CONTEXT_BYTES = 1024
  541. const m_XML_DEV_URANDOM = 1
  542. const m_XML_DTD = 1
  543. const m_XML_ENABLE_VISIBILITY = 1
  544. const m_XML_ENCODE_MAX = "XML_UTF8_ENCODE_MAX"
  545. const m_XML_ENTITY_VALUE_LITERAL = 1
  546. const m_XML_GetErrorByteIndex = "XML_GetCurrentByteIndex"
  547. const m_XML_GetErrorColumnNumber = "XML_GetCurrentColumnNumber"
  548. const m_XML_GetErrorLineNumber = "XML_GetCurrentLineNumber"
  549. const m_XML_IGNORE_SECTION_STATE = 3
  550. const m_XML_MAJOR_VERSION = 2
  551. const m_XML_MICRO_VERSION = 10
  552. const m_XML_MINOR_VERSION = 2
  553. const m_XML_NS = 1
  554. const m_XML_N_LITERAL_TYPES = 2
  555. const m_XML_N_STATES = 4
  556. const m_XML_PROLOG_STATE = 0
  557. const m_XML_TOK_ATTRIBUTE_VALUE_S = 39
  558. const m_XML_TOK_BOM = 14
  559. const m_XML_TOK_CDATA_SECT_CLOSE = 40
  560. const m_XML_TOK_CDATA_SECT_OPEN = 8
  561. const m_XML_TOK_CHAR_REF = 10
  562. const m_XML_TOK_CLOSE_BRACKET = 26
  563. const m_XML_TOK_CLOSE_PAREN = 24
  564. const m_XML_TOK_CLOSE_PAREN_ASTERISK = 36
  565. const m_XML_TOK_CLOSE_PAREN_PLUS = 37
  566. const m_XML_TOK_CLOSE_PAREN_QUESTION = 35
  567. const m_XML_TOK_COMMA = 38
  568. const m_XML_TOK_COMMENT = 13
  569. const m_XML_TOK_COND_SECT_CLOSE = 34
  570. const m_XML_TOK_COND_SECT_OPEN = 33
  571. const m_XML_TOK_DATA_CHARS = 6
  572. const m_XML_TOK_DATA_NEWLINE = 7
  573. const m_XML_TOK_DECL_CLOSE = 17
  574. const m_XML_TOK_DECL_OPEN = 16
  575. const m_XML_TOK_EMPTY_ELEMENT_NO_ATTS = 4
  576. const m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS = 3
  577. const m_XML_TOK_END_TAG = 5
  578. const m_XML_TOK_ENTITY_REF = 9
  579. const m_XML_TOK_IGNORE_SECT = 42
  580. const m_XML_TOK_INSTANCE_START = 29
  581. const m_XML_TOK_INVALID = 0
  582. const m_XML_TOK_LITERAL = 27
  583. const m_XML_TOK_NAME = 18
  584. const m_XML_TOK_NAME_ASTERISK = 31
  585. const m_XML_TOK_NAME_PLUS = 32
  586. const m_XML_TOK_NAME_QUESTION = 30
  587. const m_XML_TOK_NMTOKEN = 19
  588. const m_XML_TOK_OPEN_BRACKET = 25
  589. const m_XML_TOK_OPEN_PAREN = 23
  590. const m_XML_TOK_OR = 21
  591. const m_XML_TOK_PARAM_ENTITY_REF = 28
  592. const m_XML_TOK_PERCENT = 22
  593. const m_XML_TOK_PI = 11
  594. const m_XML_TOK_POUND_NAME = 20
  595. const m_XML_TOK_PREFIXED_NAME = 41
  596. const m_XML_TOK_PROLOG_S = 15
  597. const m_XML_TOK_START_TAG_NO_ATTS = 2
  598. const m_XML_TOK_START_TAG_WITH_ATTS = 1
  599. const m_XML_TOK_XML_DECL = 12
  600. const m_XML_UTF16_ENCODE_MAX = 2
  601. const m_XML_UTF8_ENCODE_MAX = 4
  602. const m_X_OK = 1
  603. const m_XmlConvert = "XmlUtf8Convert"
  604. const m_XmlEncode = "XmlUtf8Encode"
  605. const m_XmlGetInternalEncoding = "XmlGetUtf8InternalEncoding"
  606. const m_XmlGetInternalEncodingNS = "XmlGetUtf8InternalEncodingNS"
  607. const m_XmlRole_INCLUDED = 1
  608. const m_XmlTok_INCLUDED = 1
  609. const m__ARCH_PPC = 1
  610. const m__ARCH_PPC64 = 1
  611. const m__ARCH_PPCGR = 1
  612. const m__ARCH_PPCSQ = 1
  613. const m__ARCH_PWR4 = 1
  614. const m__ARCH_PWR5 = 1
  615. const m__ARCH_PWR5X = 1
  616. const m__ARCH_PWR6 = 1
  617. const m__ARCH_PWR7 = 1
  618. const m__ARCH_PWR8 = 1
  619. const m__CALL_ELF = 2
  620. const m__CALL_LINUX = 1
  621. const m__CS_GNU_LIBC_VERSION = 2
  622. const m__CS_GNU_LIBPTHREAD_VERSION = 3
  623. const m__CS_PATH = 0
  624. const m__CS_POSIX_V5_WIDTH_RESTRICTED_ENVS = 4
  625. const m__CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116
  626. const m__CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117
  627. const m__CS_POSIX_V6_ILP32_OFF32_LIBS = 1118
  628. const m__CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119
  629. const m__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120
  630. const m__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121
  631. const m__CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122
  632. const m__CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  633. const m__CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124
  634. const m__CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125
  635. const m__CS_POSIX_V6_LP64_OFF64_LIBS = 1126
  636. const m__CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127
  637. const m__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128
  638. const m__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129
  639. const m__CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130
  640. const m__CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  641. const m__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 1
  642. const m__CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132
  643. const m__CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133
  644. const m__CS_POSIX_V7_ILP32_OFF32_LIBS = 1134
  645. const m__CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135
  646. const m__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136
  647. const m__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137
  648. const m__CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138
  649. const m__CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  650. const m__CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140
  651. const m__CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141
  652. const m__CS_POSIX_V7_LP64_OFF64_LIBS = 1142
  653. const m__CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143
  654. const m__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144
  655. const m__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145
  656. const m__CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146
  657. const m__CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  658. const m__CS_POSIX_V7_THREADS_CFLAGS = 1150
  659. const m__CS_POSIX_V7_THREADS_LDFLAGS = 1151
  660. const m__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS = 5
  661. const m__CS_V6_ENV = 1148
  662. const m__CS_V7_ENV = 1149
  663. const m__GNU_SOURCE = 1
  664. const m__IOFBF = 0
  665. const m__IOLBF = 1
  666. const m__IONBF = 2
  667. const m__LITTLE_ENDIAN = 1
  668. const m__LP64 = 1
  669. const m__PC_2_SYMLINKS = 20
  670. const m__PC_ALLOC_SIZE_MIN = 18
  671. const m__PC_ASYNC_IO = 10
  672. const m__PC_CHOWN_RESTRICTED = 6
  673. const m__PC_FILESIZEBITS = 13
  674. const m__PC_LINK_MAX = 0
  675. const m__PC_MAX_CANON = 1
  676. const m__PC_MAX_INPUT = 2
  677. const m__PC_NAME_MAX = 3
  678. const m__PC_NO_TRUNC = 7
  679. const m__PC_PATH_MAX = 4
  680. const m__PC_PIPE_BUF = 5
  681. const m__PC_PRIO_IO = 11
  682. const m__PC_REC_INCR_XFER_SIZE = 14
  683. const m__PC_REC_MAX_XFER_SIZE = 15
  684. const m__PC_REC_MIN_XFER_SIZE = 16
  685. const m__PC_REC_XFER_ALIGN = 17
  686. const m__PC_SOCK_MAXBUF = 12
  687. const m__PC_SYMLINK_MAX = 19
  688. const m__PC_SYNC_IO = 9
  689. const m__PC_VDISABLE = 8
  690. const m__POSIX2_BC_BASE_MAX = 99
  691. const m__POSIX2_BC_DIM_MAX = 2048
  692. const m__POSIX2_BC_SCALE_MAX = 99
  693. const m__POSIX2_BC_STRING_MAX = 1000
  694. const m__POSIX2_CHARCLASS_NAME_MAX = 14
  695. const m__POSIX2_COLL_WEIGHTS_MAX = 2
  696. const m__POSIX2_C_BIND = "_POSIX_VERSION"
  697. const m__POSIX2_EXPR_NEST_MAX = 32
  698. const m__POSIX2_LINE_MAX = 2048
  699. const m__POSIX2_RE_DUP_MAX = 255
  700. const m__POSIX2_VERSION = "_POSIX_VERSION"
  701. const m__POSIX_ADVISORY_INFO = "_POSIX_VERSION"
  702. const m__POSIX_AIO_LISTIO_MAX = 2
  703. const m__POSIX_AIO_MAX = 1
  704. const m__POSIX_ARG_MAX = 4096
  705. const m__POSIX_ASYNCHRONOUS_IO = "_POSIX_VERSION"
  706. const m__POSIX_BARRIERS = "_POSIX_VERSION"
  707. const m__POSIX_CHILD_MAX = 25
  708. const m__POSIX_CHOWN_RESTRICTED = 1
  709. const m__POSIX_CLOCKRES_MIN = 20000000
  710. const m__POSIX_CLOCK_SELECTION = "_POSIX_VERSION"
  711. const m__POSIX_CPUTIME = "_POSIX_VERSION"
  712. const m__POSIX_DELAYTIMER_MAX = 32
  713. const m__POSIX_FSYNC = "_POSIX_VERSION"
  714. const m__POSIX_HOST_NAME_MAX = 255
  715. const m__POSIX_IPV6 = "_POSIX_VERSION"
  716. const m__POSIX_JOB_CONTROL = 1
  717. const m__POSIX_LINK_MAX = 8
  718. const m__POSIX_LOGIN_NAME_MAX = 9
  719. const m__POSIX_MAPPED_FILES = "_POSIX_VERSION"
  720. const m__POSIX_MAX_CANON = 255
  721. const m__POSIX_MAX_INPUT = 255
  722. const m__POSIX_MEMLOCK = "_POSIX_VERSION"
  723. const m__POSIX_MEMLOCK_RANGE = "_POSIX_VERSION"
  724. const m__POSIX_MEMORY_PROTECTION = "_POSIX_VERSION"
  725. const m__POSIX_MESSAGE_PASSING = "_POSIX_VERSION"
  726. const m__POSIX_MONOTONIC_CLOCK = "_POSIX_VERSION"
  727. const m__POSIX_MQ_OPEN_MAX = 8
  728. const m__POSIX_MQ_PRIO_MAX = 32
  729. const m__POSIX_NAME_MAX = 14
  730. const m__POSIX_NGROUPS_MAX = 8
  731. const m__POSIX_NO_TRUNC = 1
  732. const m__POSIX_OPEN_MAX = 20
  733. const m__POSIX_PATH_MAX = 256
  734. const m__POSIX_PIPE_BUF = 512
  735. const m__POSIX_RAW_SOCKETS = "_POSIX_VERSION"
  736. const m__POSIX_READER_WRITER_LOCKS = "_POSIX_VERSION"
  737. const m__POSIX_REALTIME_SIGNALS = "_POSIX_VERSION"
  738. const m__POSIX_REGEXP = 1
  739. const m__POSIX_RE_DUP_MAX = 255
  740. const m__POSIX_RTSIG_MAX = 8
  741. const m__POSIX_SAVED_IDS = 1
  742. const m__POSIX_SEMAPHORES = "_POSIX_VERSION"
  743. const m__POSIX_SEM_NSEMS_MAX = 256
  744. const m__POSIX_SEM_VALUE_MAX = 32767
  745. const m__POSIX_SHARED_MEMORY_OBJECTS = "_POSIX_VERSION"
  746. const m__POSIX_SHELL = 1
  747. const m__POSIX_SIGQUEUE_MAX = 32
  748. const m__POSIX_SPAWN = "_POSIX_VERSION"
  749. const m__POSIX_SPIN_LOCKS = "_POSIX_VERSION"
  750. const m__POSIX_SSIZE_MAX = 32767
  751. const m__POSIX_SS_REPL_MAX = 4
  752. const m__POSIX_STREAM_MAX = 8
  753. const m__POSIX_SYMLINK_MAX = 255
  754. const m__POSIX_SYMLOOP_MAX = 8
  755. const m__POSIX_THREADS = "_POSIX_VERSION"
  756. const m__POSIX_THREAD_ATTR_STACKADDR = "_POSIX_VERSION"
  757. const m__POSIX_THREAD_ATTR_STACKSIZE = "_POSIX_VERSION"
  758. const m__POSIX_THREAD_CPUTIME = "_POSIX_VERSION"
  759. const m__POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4
  760. const m__POSIX_THREAD_KEYS_MAX = 128
  761. const m__POSIX_THREAD_PRIORITY_SCHEDULING = "_POSIX_VERSION"
  762. const m__POSIX_THREAD_PROCESS_SHARED = "_POSIX_VERSION"
  763. const m__POSIX_THREAD_SAFE_FUNCTIONS = "_POSIX_VERSION"
  764. const m__POSIX_THREAD_THREADS_MAX = 64
  765. const m__POSIX_TIMEOUTS = "_POSIX_VERSION"
  766. const m__POSIX_TIMERS = "_POSIX_VERSION"
  767. const m__POSIX_TIMER_MAX = 32
  768. const m__POSIX_TRACE_EVENT_NAME_MAX = 30
  769. const m__POSIX_TRACE_NAME_MAX = 8
  770. const m__POSIX_TRACE_SYS_MAX = 8
  771. const m__POSIX_TRACE_USER_EVENT_MAX = 32
  772. const m__POSIX_TTY_NAME_MAX = 9
  773. const m__POSIX_TZNAME_MAX = 6
  774. const m__POSIX_V6_LP64_OFF64 = 1
  775. const m__POSIX_V7_LP64_OFF64 = 1
  776. const m__POSIX_VDISABLE = 0
  777. const m__POSIX_VERSION = 200809
  778. const m__SC_2_CHAR_TERM = 95
  779. const m__SC_2_C_BIND = 47
  780. const m__SC_2_C_DEV = 48
  781. const m__SC_2_FORT_DEV = 49
  782. const m__SC_2_FORT_RUN = 50
  783. const m__SC_2_LOCALEDEF = 52
  784. const m__SC_2_PBS = 168
  785. const m__SC_2_PBS_ACCOUNTING = 169
  786. const m__SC_2_PBS_CHECKPOINT = 175
  787. const m__SC_2_PBS_LOCATE = 170
  788. const m__SC_2_PBS_MESSAGE = 171
  789. const m__SC_2_PBS_TRACK = 172
  790. const m__SC_2_SW_DEV = 51
  791. const m__SC_2_UPE = 97
  792. const m__SC_2_VERSION = 46
  793. const m__SC_ADVISORY_INFO = 132
  794. const m__SC_AIO_LISTIO_MAX = 23
  795. const m__SC_AIO_MAX = 24
  796. const m__SC_AIO_PRIO_DELTA_MAX = 25
  797. const m__SC_ARG_MAX = 0
  798. const m__SC_ASYNCHRONOUS_IO = 12
  799. const m__SC_ATEXIT_MAX = 87
  800. const m__SC_AVPHYS_PAGES = 86
  801. const m__SC_BARRIERS = 133
  802. const m__SC_BC_BASE_MAX = 36
  803. const m__SC_BC_DIM_MAX = 37
  804. const m__SC_BC_SCALE_MAX = 38
  805. const m__SC_BC_STRING_MAX = 39
  806. const m__SC_CHILD_MAX = 1
  807. const m__SC_CLK_TCK = 2
  808. const m__SC_CLOCK_SELECTION = 137
  809. const m__SC_COLL_WEIGHTS_MAX = 40
  810. const m__SC_CPUTIME = 138
  811. const m__SC_DELAYTIMER_MAX = 26
  812. const m__SC_EXPR_NEST_MAX = 42
  813. const m__SC_FSYNC = 15
  814. const m__SC_GETGR_R_SIZE_MAX = 69
  815. const m__SC_GETPW_R_SIZE_MAX = 70
  816. const m__SC_HOST_NAME_MAX = 180
  817. const m__SC_IOV_MAX = 60
  818. const m__SC_IPV6 = 235
  819. const m__SC_JOB_CONTROL = 7
  820. const m__SC_LINE_MAX = 43
  821. const m__SC_LOGIN_NAME_MAX = 71
  822. const m__SC_MAPPED_FILES = 16
  823. const m__SC_MEMLOCK = 17
  824. const m__SC_MEMLOCK_RANGE = 18
  825. const m__SC_MEMORY_PROTECTION = 19
  826. const m__SC_MESSAGE_PASSING = 20
  827. const m__SC_MINSIGSTKSZ = 249
  828. const m__SC_MONOTONIC_CLOCK = 149
  829. const m__SC_MQ_OPEN_MAX = 27
  830. const m__SC_MQ_PRIO_MAX = 28
  831. const m__SC_NGROUPS_MAX = 3
  832. const m__SC_NPROCESSORS_CONF = 83
  833. const m__SC_NPROCESSORS_ONLN = 84
  834. const m__SC_NZERO = 109
  835. const m__SC_OPEN_MAX = 4
  836. const m__SC_PAGESIZE = 30
  837. const m__SC_PAGE_SIZE = 30
  838. const m__SC_PASS_MAX = 88
  839. const m__SC_PHYS_PAGES = 85
  840. const m__SC_PRIORITIZED_IO = 13
  841. const m__SC_PRIORITY_SCHEDULING = 10
  842. const m__SC_RAW_SOCKETS = 236
  843. const m__SC_READER_WRITER_LOCKS = 153
  844. const m__SC_REALTIME_SIGNALS = 9
  845. const m__SC_REGEXP = 155
  846. const m__SC_RE_DUP_MAX = 44
  847. const m__SC_RTSIG_MAX = 31
  848. const m__SC_SAVED_IDS = 8
  849. const m__SC_SEMAPHORES = 21
  850. const m__SC_SEM_NSEMS_MAX = 32
  851. const m__SC_SEM_VALUE_MAX = 33
  852. const m__SC_SHARED_MEMORY_OBJECTS = 22
  853. const m__SC_SHELL = 157
  854. const m__SC_SIGQUEUE_MAX = 34
  855. const m__SC_SIGSTKSZ = 250
  856. const m__SC_SPAWN = 159
  857. const m__SC_SPIN_LOCKS = 154
  858. const m__SC_SPORADIC_SERVER = 160
  859. const m__SC_SS_REPL_MAX = 241
  860. const m__SC_STREAMS = 174
  861. const m__SC_STREAM_MAX = 5
  862. const m__SC_SYMLOOP_MAX = 173
  863. const m__SC_SYNCHRONIZED_IO = 14
  864. const m__SC_THREADS = 67
  865. const m__SC_THREAD_ATTR_STACKADDR = 77
  866. const m__SC_THREAD_ATTR_STACKSIZE = 78
  867. const m__SC_THREAD_CPUTIME = 139
  868. const m__SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  869. const m__SC_THREAD_KEYS_MAX = 74
  870. const m__SC_THREAD_PRIORITY_SCHEDULING = 79
  871. const m__SC_THREAD_PRIO_INHERIT = 80
  872. const m__SC_THREAD_PRIO_PROTECT = 81
  873. const m__SC_THREAD_PROCESS_SHARED = 82
  874. const m__SC_THREAD_ROBUST_PRIO_INHERIT = 247
  875. const m__SC_THREAD_ROBUST_PRIO_PROTECT = 248
  876. const m__SC_THREAD_SAFE_FUNCTIONS = 68
  877. const m__SC_THREAD_SPORADIC_SERVER = 161
  878. const m__SC_THREAD_STACK_MIN = 75
  879. const m__SC_THREAD_THREADS_MAX = 76
  880. const m__SC_TIMEOUTS = 164
  881. const m__SC_TIMERS = 11
  882. const m__SC_TIMER_MAX = 35
  883. const m__SC_TRACE = 181
  884. const m__SC_TRACE_EVENT_FILTER = 182
  885. const m__SC_TRACE_EVENT_NAME_MAX = 242
  886. const m__SC_TRACE_INHERIT = 183
  887. const m__SC_TRACE_LOG = 184
  888. const m__SC_TRACE_NAME_MAX = 243
  889. const m__SC_TRACE_SYS_MAX = 244
  890. const m__SC_TRACE_USER_EVENT_MAX = 245
  891. const m__SC_TTY_NAME_MAX = 72
  892. const m__SC_TYPED_MEMORY_OBJECTS = 165
  893. const m__SC_TZNAME_MAX = 6
  894. const m__SC_UIO_MAXIOV = 60
  895. const m__SC_V6_ILP32_OFF32 = 176
  896. const m__SC_V6_ILP32_OFFBIG = 177
  897. const m__SC_V6_LP64_OFF64 = 178
  898. const m__SC_V6_LPBIG_OFFBIG = 179
  899. const m__SC_V7_ILP32_OFF32 = 237
  900. const m__SC_V7_ILP32_OFFBIG = 238
  901. const m__SC_V7_LP64_OFF64 = 239
  902. const m__SC_V7_LPBIG_OFFBIG = 240
  903. const m__SC_VERSION = 29
  904. const m__SC_XBS5_ILP32_OFF32 = 125
  905. const m__SC_XBS5_ILP32_OFFBIG = 126
  906. const m__SC_XBS5_LP64_OFF64 = 127
  907. const m__SC_XBS5_LPBIG_OFFBIG = 128
  908. const m__SC_XOPEN_CRYPT = 92
  909. const m__SC_XOPEN_ENH_I18N = 93
  910. const m__SC_XOPEN_LEGACY = 129
  911. const m__SC_XOPEN_REALTIME = 130
  912. const m__SC_XOPEN_REALTIME_THREADS = 131
  913. const m__SC_XOPEN_SHM = 94
  914. const m__SC_XOPEN_STREAMS = 246
  915. const m__SC_XOPEN_UNIX = 91
  916. const m__SC_XOPEN_VERSION = 89
  917. const m__SC_XOPEN_XCU_VERSION = 90
  918. const m__SC_XOPEN_XPG2 = 98
  919. const m__SC_XOPEN_XPG3 = 99
  920. const m__SC_XOPEN_XPG4 = 100
  921. const m__STDC_PREDEF_H = 1
  922. const m__XOPEN_ENH_I18N = 1
  923. const m__XOPEN_IOV_MAX = 16
  924. const m__XOPEN_NAME_MAX = 255
  925. const m__XOPEN_PATH_MAX = 1024
  926. const m__XOPEN_UNIX = 1
  927. const m__XOPEN_VERSION = 700
  928. const m___ALTIVEC__ = 1
  929. const m___APPLE_ALTIVEC__ = 1
  930. const m___ATOMIC_ACQUIRE = 2
  931. const m___ATOMIC_ACQ_REL = 4
  932. const m___ATOMIC_CONSUME = 1
  933. const m___ATOMIC_RELAXED = 0
  934. const m___ATOMIC_RELEASE = 3
  935. const m___ATOMIC_SEQ_CST = 5
  936. const m___BIGGEST_ALIGNMENT__ = 16
  937. const m___BIG_ENDIAN = 4321
  938. const m___BUILTIN_CPU_SUPPORTS__ = 1
  939. const m___BYTE_ORDER = 1234
  940. const m___BYTE_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  941. const m___CCGO__ = 1
  942. const m___CHAR_BIT__ = 8
  943. const m___CHAR_UNSIGNED__ = 1
  944. const m___CMODEL_MEDIUM__ = 1
  945. const m___CRYPTO__ = 1
  946. const m___DBL_DECIMAL_DIG__ = 17
  947. const m___DBL_DIG__ = 15
  948. const m___DBL_HAS_DENORM__ = 1
  949. const m___DBL_HAS_INFINITY__ = 1
  950. const m___DBL_HAS_QUIET_NAN__ = 1
  951. const m___DBL_MANT_DIG__ = 53
  952. const m___DBL_MAX_10_EXP__ = 308
  953. const m___DBL_MAX_EXP__ = 1024
  954. const m___DEC128_EPSILON__ = 1e-33
  955. const m___DEC128_MANT_DIG__ = 34
  956. const m___DEC128_MAX_EXP__ = 6145
  957. const m___DEC128_MAX__ = "9.999999999999999999999999999999999E6144"
  958. const m___DEC128_MIN__ = 1e-6143
  959. const m___DEC128_SUBNORMAL_MIN__ = 0.000000000000000000000000000000001e-6143
  960. const m___DEC32_EPSILON__ = 1e-6
  961. const m___DEC32_MANT_DIG__ = 7
  962. const m___DEC32_MAX_EXP__ = 97
  963. const m___DEC32_MAX__ = 9.999999e96
  964. const m___DEC32_MIN__ = 1e-95
  965. const m___DEC32_SUBNORMAL_MIN__ = 0.000001e-95
  966. const m___DEC64_EPSILON__ = 1e-15
  967. const m___DEC64_MANT_DIG__ = 16
  968. const m___DEC64_MAX_EXP__ = 385
  969. const m___DEC64_MAX__ = "9.999999999999999E384"
  970. const m___DEC64_MIN__ = 1e-383
  971. const m___DEC64_SUBNORMAL_MIN__ = 0.000000000000001e-383
  972. const m___DECIMAL_DIG__ = 17
  973. const m___DEC_EVAL_METHOD__ = 2
  974. const m___ELF__ = 1
  975. const m___FINITE_MATH_ONLY__ = 0
  976. const m___FLOAT128_TYPE__ = 1
  977. const m___FLOAT128__ = 1
  978. const m___FLOAT_WORD_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  979. const m___FLT128_DECIMAL_DIG__ = 36
  980. const m___FLT128_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  981. const m___FLT128_DIG__ = 33
  982. const m___FLT128_EPSILON__ = 1.92592994438723585305597794258492732e-34
  983. const m___FLT128_HAS_DENORM__ = 1
  984. const m___FLT128_HAS_INFINITY__ = 1
  985. const m___FLT128_HAS_QUIET_NAN__ = 1
  986. const m___FLT128_MANT_DIG__ = 113
  987. const m___FLT128_MAX_10_EXP__ = 4932
  988. const m___FLT128_MAX_EXP__ = 16384
  989. const m___FLT128_MAX__ = "1.18973149535723176508575932662800702e+4932"
  990. const m___FLT128_MIN__ = 3.36210314311209350626267781732175260e-4932
  991. const m___FLT128_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  992. const m___FLT32X_DECIMAL_DIG__ = 17
  993. const m___FLT32X_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  994. const m___FLT32X_DIG__ = 15
  995. const m___FLT32X_EPSILON__ = 2.22044604925031308084726333618164062e-16
  996. const m___FLT32X_HAS_DENORM__ = 1
  997. const m___FLT32X_HAS_INFINITY__ = 1
  998. const m___FLT32X_HAS_QUIET_NAN__ = 1
  999. const m___FLT32X_MANT_DIG__ = 53
  1000. const m___FLT32X_MAX_10_EXP__ = 308
  1001. const m___FLT32X_MAX_EXP__ = 1024
  1002. const m___FLT32X_MAX__ = 1.79769313486231570814527423731704357e+308
  1003. const m___FLT32X_MIN__ = 2.22507385850720138309023271733240406e-308
  1004. const m___FLT32X_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1005. const m___FLT32_DECIMAL_DIG__ = 9
  1006. const m___FLT32_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1007. const m___FLT32_DIG__ = 6
  1008. const m___FLT32_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1009. const m___FLT32_HAS_DENORM__ = 1
  1010. const m___FLT32_HAS_INFINITY__ = 1
  1011. const m___FLT32_HAS_QUIET_NAN__ = 1
  1012. const m___FLT32_MANT_DIG__ = 24
  1013. const m___FLT32_MAX_10_EXP__ = 38
  1014. const m___FLT32_MAX_EXP__ = 128
  1015. const m___FLT32_MAX__ = 3.40282346638528859811704183484516925e+38
  1016. const m___FLT32_MIN__ = 1.17549435082228750796873653722224568e-38
  1017. const m___FLT32_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1018. const m___FLT64X_DECIMAL_DIG__ = 36
  1019. const m___FLT64X_DENORM_MIN__ = 6.47517511943802511092443895822764655e-4966
  1020. const m___FLT64X_DIG__ = 33
  1021. const m___FLT64X_EPSILON__ = 1.92592994438723585305597794258492732e-34
  1022. const m___FLT64X_HAS_DENORM__ = 1
  1023. const m___FLT64X_HAS_INFINITY__ = 1
  1024. const m___FLT64X_HAS_QUIET_NAN__ = 1
  1025. const m___FLT64X_MANT_DIG__ = 113
  1026. const m___FLT64X_MAX_10_EXP__ = 4932
  1027. const m___FLT64X_MAX_EXP__ = 16384
  1028. const m___FLT64X_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1029. const m___FLT64X_MIN__ = 3.36210314311209350626267781732175260e-4932
  1030. const m___FLT64X_NORM_MAX__ = "1.18973149535723176508575932662800702e+4932"
  1031. const m___FLT64_DECIMAL_DIG__ = 17
  1032. const m___FLT64_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1033. const m___FLT64_DIG__ = 15
  1034. const m___FLT64_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1035. const m___FLT64_HAS_DENORM__ = 1
  1036. const m___FLT64_HAS_INFINITY__ = 1
  1037. const m___FLT64_HAS_QUIET_NAN__ = 1
  1038. const m___FLT64_MANT_DIG__ = 53
  1039. const m___FLT64_MAX_10_EXP__ = 308
  1040. const m___FLT64_MAX_EXP__ = 1024
  1041. const m___FLT64_MAX__ = 1.79769313486231570814527423731704357e+308
  1042. const m___FLT64_MIN__ = 2.22507385850720138309023271733240406e-308
  1043. const m___FLT64_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1044. const m___FLT_DECIMAL_DIG__ = 9
  1045. const m___FLT_DENORM_MIN__ = 1.40129846432481707092372958328991613e-45
  1046. const m___FLT_DIG__ = 6
  1047. const m___FLT_EPSILON__ = 1.19209289550781250000000000000000000e-7
  1048. const m___FLT_EVAL_METHOD_TS_18661_3__ = 0
  1049. const m___FLT_EVAL_METHOD__ = 0
  1050. const m___FLT_HAS_DENORM__ = 1
  1051. const m___FLT_HAS_INFINITY__ = 1
  1052. const m___FLT_HAS_QUIET_NAN__ = 1
  1053. const m___FLT_MANT_DIG__ = 24
  1054. const m___FLT_MAX_10_EXP__ = 38
  1055. const m___FLT_MAX_EXP__ = 128
  1056. const m___FLT_MAX__ = 3.40282346638528859811704183484516925e+38
  1057. const m___FLT_MIN__ = 1.17549435082228750796873653722224568e-38
  1058. const m___FLT_NORM_MAX__ = 3.40282346638528859811704183484516925e+38
  1059. const m___FLT_RADIX__ = 2
  1060. const m___FP_FAST_FMA = 1
  1061. const m___FP_FAST_FMAF = 1
  1062. const m___FP_FAST_FMAF32 = 1
  1063. const m___FP_FAST_FMAF32x = 1
  1064. const m___FP_FAST_FMAF64 = 1
  1065. const m___FP_FAST_FMAL = 1
  1066. const m___FUNCTION__ = "__func__"
  1067. const m___GCC_ATOMIC_BOOL_LOCK_FREE = 2
  1068. const m___GCC_ATOMIC_CHAR16_T_LOCK_FREE = 2
  1069. const m___GCC_ATOMIC_CHAR32_T_LOCK_FREE = 2
  1070. const m___GCC_ATOMIC_CHAR_LOCK_FREE = 2
  1071. const m___GCC_ATOMIC_INT_LOCK_FREE = 2
  1072. const m___GCC_ATOMIC_LLONG_LOCK_FREE = 2
  1073. const m___GCC_ATOMIC_LONG_LOCK_FREE = 2
  1074. const m___GCC_ATOMIC_POINTER_LOCK_FREE = 2
  1075. const m___GCC_ATOMIC_SHORT_LOCK_FREE = 2
  1076. const m___GCC_ATOMIC_TEST_AND_SET_TRUEVAL = 1
  1077. const m___GCC_ATOMIC_WCHAR_T_LOCK_FREE = 2
  1078. const m___GCC_HAVE_DWARF2_CFI_ASM = 1
  1079. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 = 1
  1080. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 = 1
  1081. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 = 1
  1082. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 = 1
  1083. const m___GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1
  1084. const m___GCC_IEC_559 = 2
  1085. const m___GCC_IEC_559_COMPLEX = 2
  1086. const m___GNUC_MINOR__ = 2
  1087. const m___GNUC_PATCHLEVEL__ = 1
  1088. const m___GNUC_STDC_INLINE__ = 1
  1089. const m___GNUC__ = 10
  1090. const m___GXX_ABI_VERSION = 1014
  1091. const m___HAVE_BSWAP__ = 1
  1092. const m___HAVE_SPECULATION_SAFE_VALUE = 1
  1093. const m___HTM__ = 1
  1094. const m___INT16_MAX__ = 0x7fff
  1095. const m___INT32_MAX__ = 0x7fffffff
  1096. const m___INT32_TYPE__ = "int"
  1097. const m___INT64_MAX__ = 0x7fffffffffffffff
  1098. const m___INT8_MAX__ = 0x7f
  1099. const m___INTMAX_MAX__ = 0x7fffffffffffffff
  1100. const m___INTMAX_WIDTH__ = 64
  1101. const m___INTPTR_MAX__ = 0x7fffffffffffffff
  1102. const m___INTPTR_WIDTH__ = 64
  1103. const m___INT_FAST16_MAX__ = 0x7fffffffffffffff
  1104. const m___INT_FAST16_WIDTH__ = 64
  1105. const m___INT_FAST32_MAX__ = 0x7fffffffffffffff
  1106. const m___INT_FAST32_WIDTH__ = 64
  1107. const m___INT_FAST64_MAX__ = 0x7fffffffffffffff
  1108. const m___INT_FAST64_WIDTH__ = 64
  1109. const m___INT_FAST8_MAX__ = 0x7f
  1110. const m___INT_FAST8_WIDTH__ = 8
  1111. const m___INT_LEAST16_MAX__ = 0x7fff
  1112. const m___INT_LEAST16_WIDTH__ = 16
  1113. const m___INT_LEAST32_MAX__ = 0x7fffffff
  1114. const m___INT_LEAST32_TYPE__ = "int"
  1115. const m___INT_LEAST32_WIDTH__ = 32
  1116. const m___INT_LEAST64_MAX__ = 0x7fffffffffffffff
  1117. const m___INT_LEAST64_WIDTH__ = 64
  1118. const m___INT_LEAST8_MAX__ = 0x7f
  1119. const m___INT_LEAST8_WIDTH__ = 8
  1120. const m___INT_MAX__ = 0x7fffffff
  1121. const m___INT_WIDTH__ = 32
  1122. const m___LDBL_DECIMAL_DIG__ = 17
  1123. const m___LDBL_DENORM_MIN__ = 4.94065645841246544176568792868221372e-324
  1124. const m___LDBL_DIG__ = 15
  1125. const m___LDBL_EPSILON__ = 2.22044604925031308084726333618164062e-16
  1126. const m___LDBL_HAS_DENORM__ = 1
  1127. const m___LDBL_HAS_INFINITY__ = 1
  1128. const m___LDBL_HAS_QUIET_NAN__ = 1
  1129. const m___LDBL_MANT_DIG__ = 53
  1130. const m___LDBL_MAX_10_EXP__ = 308
  1131. const m___LDBL_MAX_EXP__ = 1024
  1132. const m___LDBL_MAX__ = 1.79769313486231570814527423731704357e+308
  1133. const m___LDBL_MIN__ = 2.22507385850720138309023271733240406e-308
  1134. const m___LDBL_NORM_MAX__ = 1.79769313486231570814527423731704357e+308
  1135. const m___LITTLE_ENDIAN = 1234
  1136. const m___LITTLE_ENDIAN__ = 1
  1137. const m___LONG_LONG_MAX__ = 0x7fffffffffffffff
  1138. const m___LONG_LONG_WIDTH__ = 64
  1139. const m___LONG_MAX = 0x7fffffffffffffff
  1140. const m___LONG_MAX__ = 0x7fffffffffffffff
  1141. const m___LONG_WIDTH__ = 64
  1142. const m___LP64__ = 1
  1143. const m___NO_INLINE__ = 1
  1144. const m___ORDER_BIG_ENDIAN__ = 4321
  1145. const m___ORDER_LITTLE_ENDIAN__ = 1234
  1146. const m___ORDER_PDP_ENDIAN__ = 3412
  1147. const m___PDP_ENDIAN = 3412
  1148. const m___PIC__ = 2
  1149. const m___PIE__ = 2
  1150. const m___POWER8_VECTOR__ = 1
  1151. const m___PPC64__ = 1
  1152. const m___PPC__ = 1
  1153. const m___PRAGMA_REDEFINE_EXTNAME = 1
  1154. const m___PRETTY_FUNCTION__ = "__func__"
  1155. const m___PTRDIFF_MAX__ = 0x7fffffffffffffff
  1156. const m___PTRDIFF_WIDTH__ = 64
  1157. const m___QUAD_MEMORY_ATOMIC__ = 1
  1158. const m___RECIPF__ = 1
  1159. const m___RECIP_PRECISION__ = 1
  1160. const m___RECIP__ = 1
  1161. const m___RSQRTEF__ = 1
  1162. const m___RSQRTE__ = 1
  1163. const m___SCHAR_MAX__ = 0x7f
  1164. const m___SCHAR_WIDTH__ = 8
  1165. const m___SHRT_MAX__ = 0x7fff
  1166. const m___SHRT_WIDTH__ = 16
  1167. const m___SIG_ATOMIC_MAX__ = 0x7fffffff
  1168. const m___SIG_ATOMIC_TYPE__ = "int"
  1169. const m___SIG_ATOMIC_WIDTH__ = 32
  1170. const m___SIZEOF_DOUBLE__ = 8
  1171. const m___SIZEOF_FLOAT__ = 4
  1172. const m___SIZEOF_INT128__ = 16
  1173. const m___SIZEOF_INT__ = 4
  1174. const m___SIZEOF_LONG_DOUBLE__ = 8
  1175. const m___SIZEOF_LONG_LONG__ = 8
  1176. const m___SIZEOF_LONG__ = 8
  1177. const m___SIZEOF_POINTER__ = 8
  1178. const m___SIZEOF_PTRDIFF_T__ = 8
  1179. const m___SIZEOF_SHORT__ = 2
  1180. const m___SIZEOF_SIZE_T__ = 8
  1181. const m___SIZEOF_WCHAR_T__ = 4
  1182. const m___SIZEOF_WINT_T__ = 4
  1183. const m___SIZE_MAX__ = 0xffffffffffffffff
  1184. const m___SIZE_WIDTH__ = 64
  1185. const m___STDC_HOSTED__ = 1
  1186. const m___STDC_IEC_559_COMPLEX__ = 1
  1187. const m___STDC_IEC_559__ = 1
  1188. const m___STDC_ISO_10646__ = 201706
  1189. const m___STDC_UTF_16__ = 1
  1190. const m___STDC_UTF_32__ = 1
  1191. const m___STDC_VERSION__ = 201710
  1192. const m___STDC__ = 1
  1193. const m___STRUCT_PARM_ALIGN__ = 16
  1194. const m___TM_FENCE__ = 1
  1195. const m___UINT16_MAX__ = 0xffff
  1196. const m___UINT32_MAX__ = 0xffffffff
  1197. const m___UINT64_MAX__ = 0xffffffffffffffff
  1198. const m___UINT8_MAX__ = 0xff
  1199. const m___UINTMAX_MAX__ = 0xffffffffffffffff
  1200. const m___UINTPTR_MAX__ = 0xffffffffffffffff
  1201. const m___UINT_FAST16_MAX__ = 0xffffffffffffffff
  1202. const m___UINT_FAST32_MAX__ = 0xffffffffffffffff
  1203. const m___UINT_FAST64_MAX__ = 0xffffffffffffffff
  1204. const m___UINT_FAST8_MAX__ = 0xff
  1205. const m___UINT_LEAST16_MAX__ = 0xffff
  1206. const m___UINT_LEAST32_MAX__ = 0xffffffff
  1207. const m___UINT_LEAST64_MAX__ = 0xffffffffffffffff
  1208. const m___UINT_LEAST8_MAX__ = 0xff
  1209. const m___USE_TIME_BITS64 = 1
  1210. const m___VEC_ELEMENT_REG_ORDER__ = "__ORDER_LITTLE_ENDIAN__"
  1211. const m___VEC__ = 10206
  1212. const m___VERSION__ = "10.2.1 20210110"
  1213. const m___VSX__ = 1
  1214. const m___WCHAR_MAX__ = 0x7fffffff
  1215. const m___WCHAR_TYPE__ = "int"
  1216. const m___WCHAR_WIDTH__ = 32
  1217. const m___WINT_MAX__ = 0xffffffff
  1218. const m___WINT_MIN__ = 0
  1219. const m___WINT_WIDTH__ = 32
  1220. const m___builtin_copysignq = "__builtin_copysignf128"
  1221. const m___builtin_fabsq = "__builtin_fabsf128"
  1222. const m___builtin_huge_valq = "__builtin_huge_valf128"
  1223. const m___builtin_infq = "__builtin_inff128"
  1224. const m___builtin_nanq = "__builtin_nanf128"
  1225. const m___builtin_nansq = "__builtin_nansf128"
  1226. const m___builtin_vsx_vperm = "__builtin_vec_perm"
  1227. const m___builtin_vsx_xvmaddadp = "__builtin_vsx_xvmadddp"
  1228. const m___builtin_vsx_xvmaddasp = "__builtin_vsx_xvmaddsp"
  1229. const m___builtin_vsx_xvmaddmdp = "__builtin_vsx_xvmadddp"
  1230. const m___builtin_vsx_xvmaddmsp = "__builtin_vsx_xvmaddsp"
  1231. const m___builtin_vsx_xvmsubadp = "__builtin_vsx_xvmsubdp"
  1232. const m___builtin_vsx_xvmsubasp = "__builtin_vsx_xvmsubsp"
  1233. const m___builtin_vsx_xvmsubmdp = "__builtin_vsx_xvmsubdp"
  1234. const m___builtin_vsx_xvmsubmsp = "__builtin_vsx_xvmsubsp"
  1235. const m___builtin_vsx_xvnmaddadp = "__builtin_vsx_xvnmadddp"
  1236. const m___builtin_vsx_xvnmaddasp = "__builtin_vsx_xvnmaddsp"
  1237. const m___builtin_vsx_xvnmaddmdp = "__builtin_vsx_xvnmadddp"
  1238. const m___builtin_vsx_xvnmaddmsp = "__builtin_vsx_xvnmaddsp"
  1239. const m___builtin_vsx_xvnmsubadp = "__builtin_vsx_xvnmsubdp"
  1240. const m___builtin_vsx_xvnmsubasp = "__builtin_vsx_xvnmsubsp"
  1241. const m___builtin_vsx_xvnmsubmdp = "__builtin_vsx_xvnmsubdp"
  1242. const m___builtin_vsx_xvnmsubmsp = "__builtin_vsx_xvnmsubsp"
  1243. const m___builtin_vsx_xxland = "__builtin_vec_and"
  1244. const m___builtin_vsx_xxlandc = "__builtin_vec_andc"
  1245. const m___builtin_vsx_xxlnor = "__builtin_vec_nor"
  1246. const m___builtin_vsx_xxlor = "__builtin_vec_or"
  1247. const m___builtin_vsx_xxlxor = "__builtin_vec_xor"
  1248. const m___builtin_vsx_xxsel = "__builtin_vec_sel"
  1249. const m___float128 = "__ieee128"
  1250. const m___gnu_linux__ = 1
  1251. const m___inline = "inline"
  1252. const m___linux = 1
  1253. const m___linux__ = 1
  1254. const m___pic__ = 2
  1255. const m___pie__ = 2
  1256. const m___powerpc64__ = 1
  1257. const m___powerpc__ = 1
  1258. const m___restrict = "restrict"
  1259. const m___restrict_arr = "restrict"
  1260. const m___unix = 1
  1261. const m___unix__ = 1
  1262. const m_alloca = "__builtin_alloca"
  1263. const m_inline = "__inline"
  1264. const m_linux = 1
  1265. const m_loff_t = "off_t"
  1266. const m_static_assert = "_Static_assert"
  1267. const m_unix = 1
  1268. type t__builtin_va_list = uintptr
  1269. type t__predefined_size_t = uint64
  1270. type t__predefined_wchar_t = int32
  1271. type t__predefined_ptrdiff_t = int64
  1272. type Twchar_t = int32
  1273. type Tmax_align_t = struct {
  1274. F__ll int64
  1275. F__ld float64
  1276. }
  1277. type Tsize_t = uint64
  1278. type Tptrdiff_t = int64
  1279. type Tlocale_t = uintptr
  1280. type Tssize_t = int64
  1281. type Toff_t = int64
  1282. type Tva_list = uintptr
  1283. type t__isoc_va_list = uintptr
  1284. type Tfpos_t = struct {
  1285. F__lldata [0]int64
  1286. F__align [0]float64
  1287. F__opaque [16]uint8
  1288. }
  1289. type T_G_fpos64_t = Tfpos_t
  1290. type Tcookie_io_functions_t = struct {
  1291. Fread uintptr
  1292. Fwrite uintptr
  1293. Fseek uintptr
  1294. Fclose1 uintptr
  1295. }
  1296. type T_IO_cookie_io_functions_t = Tcookie_io_functions_t
  1297. type Tdiv_t = struct {
  1298. Fquot int32
  1299. Frem int32
  1300. }
  1301. type Tldiv_t = struct {
  1302. Fquot int64
  1303. Frem int64
  1304. }
  1305. type Tlldiv_t = struct {
  1306. Fquot int64
  1307. Frem int64
  1308. }
  1309. type Tuintptr_t = uint64
  1310. type Tintptr_t = int64
  1311. type Tint8_t = int8
  1312. type Tint16_t = int16
  1313. type Tint32_t = int32
  1314. type Tint64_t = int64
  1315. type Tintmax_t = int64
  1316. type Tuint8_t = uint8
  1317. type Tuint16_t = uint16
  1318. type Tuint32_t = uint32
  1319. type Tuint64_t = uint64
  1320. type Tuintmax_t = uint64
  1321. type Tint_fast8_t = int8
  1322. type Tint_fast64_t = int64
  1323. type Tint_least8_t = int8
  1324. type Tint_least16_t = int16
  1325. type Tint_least32_t = int32
  1326. type Tint_least64_t = int64
  1327. type Tuint_fast8_t = uint8
  1328. type Tuint_fast64_t = uint64
  1329. type Tuint_least8_t = uint8
  1330. type Tuint_least16_t = uint16
  1331. type Tuint_least32_t = uint32
  1332. type Tuint_least64_t = uint64
  1333. type Tint_fast16_t = int32
  1334. type Tint_fast32_t = int32
  1335. type Tuint_fast16_t = uint32
  1336. type Tuint_fast32_t = uint32
  1337. type Ttime_t = int64
  1338. type Tsuseconds_t = int64
  1339. type Ttimeval = struct {
  1340. Ftv_sec Ttime_t
  1341. Ftv_usec Tsuseconds_t
  1342. }
  1343. type Ttimespec = struct {
  1344. Ftv_sec Ttime_t
  1345. Ftv_nsec int64
  1346. }
  1347. type Tsigset_t = struct {
  1348. F__bits [16]uint64
  1349. }
  1350. type t__sigset_t = Tsigset_t
  1351. type Tfd_mask = uint64
  1352. type Tfd_set = struct {
  1353. Ffds_bits [16]uint64
  1354. }
  1355. type Titimerval = struct {
  1356. Fit_interval Ttimeval
  1357. Fit_value Ttimeval
  1358. }
  1359. type Ttimezone = struct {
  1360. Ftz_minuteswest int32
  1361. Ftz_dsttime int32
  1362. }
  1363. type Tregister_t = int64
  1364. type Tu_int64_t = uint64
  1365. type Tmode_t = uint32
  1366. type Tnlink_t = uint64
  1367. type Tino_t = uint64
  1368. type Tdev_t = uint64
  1369. type Tblksize_t = int64
  1370. type Tblkcnt_t = int64
  1371. type Tfsblkcnt_t = uint64
  1372. type Tfsfilcnt_t = uint64
  1373. type Ttimer_t = uintptr
  1374. type Tclockid_t = int32
  1375. type Tclock_t = int64
  1376. type Tpid_t = int32
  1377. type Tid_t = uint32
  1378. type Tuid_t = uint32
  1379. type Tgid_t = uint32
  1380. type Tkey_t = int32
  1381. type Tuseconds_t = uint32
  1382. type Tpthread_t = uintptr
  1383. type Tpthread_once_t = int32
  1384. type Tpthread_key_t = uint32
  1385. type Tpthread_spinlock_t = int32
  1386. type Tpthread_mutexattr_t = struct {
  1387. F__attr uint32
  1388. }
  1389. type Tpthread_condattr_t = struct {
  1390. F__attr uint32
  1391. }
  1392. type Tpthread_barrierattr_t = struct {
  1393. F__attr uint32
  1394. }
  1395. type Tpthread_rwlockattr_t = struct {
  1396. F__attr [2]uint32
  1397. }
  1398. type Tpthread_attr_t = struct {
  1399. F__u struct {
  1400. F__vi [0][14]int32
  1401. F__s [0][7]uint64
  1402. F__i [14]int32
  1403. }
  1404. }
  1405. type Tpthread_mutex_t = struct {
  1406. F__u struct {
  1407. F__vi [0][10]int32
  1408. F__p [0][5]uintptr
  1409. F__i [10]int32
  1410. }
  1411. }
  1412. type Tpthread_cond_t = struct {
  1413. F__u struct {
  1414. F__vi [0][12]int32
  1415. F__p [0][6]uintptr
  1416. F__i [12]int32
  1417. }
  1418. }
  1419. type Tpthread_rwlock_t = struct {
  1420. F__u struct {
  1421. F__vi [0][14]int32
  1422. F__p [0][7]uintptr
  1423. F__i [14]int32
  1424. }
  1425. }
  1426. type Tpthread_barrier_t = struct {
  1427. F__u struct {
  1428. F__vi [0][8]int32
  1429. F__p [0][4]uintptr
  1430. F__i [8]int32
  1431. }
  1432. }
  1433. type Tu_int8_t = uint8
  1434. type Tu_int16_t = uint16
  1435. type Tu_int32_t = uint32
  1436. type Tcaddr_t = uintptr
  1437. type Tu_char = uint8
  1438. type Tu_short = uint16
  1439. type Tushort = uint16
  1440. type Tu_int = uint32
  1441. type Tuint = uint32
  1442. type Tu_long = uint64
  1443. type Tulong = uint64
  1444. type Tquad_t = int64
  1445. type Tu_quad_t = uint64
  1446. type Tiovec = struct {
  1447. Fiov_base uintptr
  1448. Fiov_len Tsize_t
  1449. }
  1450. type Tflock = struct {
  1451. Fl_type int16
  1452. Fl_whence int16
  1453. Fl_start Toff_t
  1454. Fl_len Toff_t
  1455. Fl_pid Tpid_t
  1456. }
  1457. type Tfile_handle = struct {
  1458. Fhandle_bytes uint32
  1459. Fhandle_type int32
  1460. }
  1461. type Tf_owner_ex = struct {
  1462. Ftype1 int32
  1463. Fpid Tpid_t
  1464. }
  1465. type TXML_Char = uint8
  1466. type TXML_LChar = uint8
  1467. type TXML_Index = int64
  1468. type TXML_Size = uint64
  1469. type TXML_ParserStruct = struct {
  1470. Fm_userData uintptr
  1471. Fm_handlerArg uintptr
  1472. Fm_buffer uintptr
  1473. Fm_mem TXML_Memory_Handling_Suite
  1474. Fm_bufferPtr uintptr
  1475. Fm_bufferEnd uintptr
  1476. Fm_bufferLim uintptr
  1477. Fm_parseEndByteIndex TXML_Index
  1478. Fm_parseEndPtr uintptr
  1479. Fm_dataBuf uintptr
  1480. Fm_dataBufEnd uintptr
  1481. Fm_startElementHandler TXML_StartElementHandler
  1482. Fm_endElementHandler TXML_EndElementHandler
  1483. Fm_characterDataHandler TXML_CharacterDataHandler
  1484. Fm_processingInstructionHandler TXML_ProcessingInstructionHandler
  1485. Fm_commentHandler TXML_CommentHandler
  1486. Fm_startCdataSectionHandler TXML_StartCdataSectionHandler
  1487. Fm_endCdataSectionHandler TXML_EndCdataSectionHandler
  1488. Fm_defaultHandler TXML_DefaultHandler
  1489. Fm_startDoctypeDeclHandler TXML_StartDoctypeDeclHandler
  1490. Fm_endDoctypeDeclHandler TXML_EndDoctypeDeclHandler
  1491. Fm_unparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  1492. Fm_notationDeclHandler TXML_NotationDeclHandler
  1493. Fm_startNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  1494. Fm_endNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  1495. Fm_notStandaloneHandler TXML_NotStandaloneHandler
  1496. Fm_externalEntityRefHandler TXML_ExternalEntityRefHandler
  1497. Fm_externalEntityRefHandlerArg TXML_Parser
  1498. Fm_skippedEntityHandler TXML_SkippedEntityHandler
  1499. Fm_unknownEncodingHandler TXML_UnknownEncodingHandler
  1500. Fm_elementDeclHandler TXML_ElementDeclHandler
  1501. Fm_attlistDeclHandler TXML_AttlistDeclHandler
  1502. Fm_entityDeclHandler TXML_EntityDeclHandler
  1503. Fm_xmlDeclHandler TXML_XmlDeclHandler
  1504. Fm_encoding uintptr
  1505. Fm_initEncoding TINIT_ENCODING
  1506. Fm_internalEncoding uintptr
  1507. Fm_protocolEncodingName uintptr
  1508. Fm_ns TXML_Bool
  1509. Fm_ns_triplets TXML_Bool
  1510. Fm_unknownEncodingMem uintptr
  1511. Fm_unknownEncodingData uintptr
  1512. Fm_unknownEncodingHandlerData uintptr
  1513. Fm_unknownEncodingRelease uintptr
  1514. Fm_prologState TPROLOG_STATE
  1515. Fm_processor uintptr
  1516. Fm_errorCode _XML_Error
  1517. Fm_eventPtr uintptr
  1518. Fm_eventEndPtr uintptr
  1519. Fm_positionPtr uintptr
  1520. Fm_openInternalEntities uintptr
  1521. Fm_freeInternalEntities uintptr
  1522. Fm_defaultExpandInternalEntities TXML_Bool
  1523. Fm_tagLevel int32
  1524. Fm_declEntity uintptr
  1525. Fm_doctypeName uintptr
  1526. Fm_doctypeSysid uintptr
  1527. Fm_doctypePubid uintptr
  1528. Fm_declAttributeType uintptr
  1529. Fm_declNotationName uintptr
  1530. Fm_declNotationPublicId uintptr
  1531. Fm_declElementType uintptr
  1532. Fm_declAttributeId uintptr
  1533. Fm_declAttributeIsCdata TXML_Bool
  1534. Fm_declAttributeIsId TXML_Bool
  1535. Fm_dtd uintptr
  1536. Fm_curBase uintptr
  1537. Fm_tagStack uintptr
  1538. Fm_freeTagList uintptr
  1539. Fm_inheritedBindings uintptr
  1540. Fm_freeBindingList uintptr
  1541. Fm_attsSize int32
  1542. Fm_nSpecifiedAtts int32
  1543. Fm_idAttIndex int32
  1544. Fm_atts uintptr
  1545. Fm_nsAtts uintptr
  1546. Fm_nsAttsVersion uint64
  1547. Fm_nsAttsPower uint8
  1548. Fm_position TPOSITION
  1549. Fm_tempPool TSTRING_POOL
  1550. Fm_temp2Pool TSTRING_POOL
  1551. Fm_groupConnector uintptr
  1552. Fm_groupSize uint32
  1553. Fm_namespaceSeparator TXML_Char
  1554. Fm_parentParser TXML_Parser
  1555. Fm_parsingStatus TXML_ParsingStatus
  1556. Fm_isParamEntity TXML_Bool
  1557. Fm_useForeignDTD TXML_Bool
  1558. Fm_paramEntityParsing _XML_ParamEntityParsing
  1559. Fm_hash_secret_salt uint64
  1560. }
  1561. type _XML_Error = int32
  1562. const _XML_ERROR_NONE = 0
  1563. const _XML_ERROR_NO_MEMORY = 1
  1564. const _XML_ERROR_SYNTAX = 2
  1565. const _XML_ERROR_NO_ELEMENTS = 3
  1566. const _XML_ERROR_INVALID_TOKEN = 4
  1567. const _XML_ERROR_UNCLOSED_TOKEN = 5
  1568. const _XML_ERROR_PARTIAL_CHAR = 6
  1569. const _XML_ERROR_TAG_MISMATCH = 7
  1570. const _XML_ERROR_DUPLICATE_ATTRIBUTE = 8
  1571. const _XML_ERROR_JUNK_AFTER_DOC_ELEMENT = 9
  1572. const _XML_ERROR_PARAM_ENTITY_REF = 10
  1573. const _XML_ERROR_UNDEFINED_ENTITY = 11
  1574. const _XML_ERROR_RECURSIVE_ENTITY_REF = 12
  1575. const _XML_ERROR_ASYNC_ENTITY = 13
  1576. const _XML_ERROR_BAD_CHAR_REF = 14
  1577. const _XML_ERROR_BINARY_ENTITY_REF = 15
  1578. const _XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF = 16
  1579. const _XML_ERROR_MISPLACED_XML_PI = 17
  1580. const _XML_ERROR_UNKNOWN_ENCODING = 18
  1581. const _XML_ERROR_INCORRECT_ENCODING = 19
  1582. const _XML_ERROR_UNCLOSED_CDATA_SECTION = 20
  1583. const _XML_ERROR_EXTERNAL_ENTITY_HANDLING = 21
  1584. const _XML_ERROR_NOT_STANDALONE = 22
  1585. const _XML_ERROR_UNEXPECTED_STATE = 23
  1586. const _XML_ERROR_ENTITY_DECLARED_IN_PE = 24
  1587. const _XML_ERROR_FEATURE_REQUIRES_XML_DTD = 25
  1588. const _XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING = 26
  1589. const _XML_ERROR_UNBOUND_PREFIX = 27
  1590. const _XML_ERROR_UNDECLARING_PREFIX = 28
  1591. const _XML_ERROR_INCOMPLETE_PE = 29
  1592. const _XML_ERROR_XML_DECL = 30
  1593. const _XML_ERROR_TEXT_DECL = 31
  1594. const _XML_ERROR_PUBLICID = 32
  1595. const _XML_ERROR_SUSPENDED = 33
  1596. const _XML_ERROR_NOT_SUSPENDED = 34
  1597. const _XML_ERROR_ABORTED = 35
  1598. const _XML_ERROR_FINISHED = 36
  1599. const _XML_ERROR_SUSPEND_PE = 37
  1600. const _XML_ERROR_RESERVED_PREFIX_XML = 38
  1601. const _XML_ERROR_RESERVED_PREFIX_XMLNS = 39
  1602. const _XML_ERROR_RESERVED_NAMESPACE_URI = 40
  1603. const _XML_ERROR_INVALID_ARGUMENT = 41
  1604. type _XML_ParamEntityParsing = int32
  1605. const _XML_PARAM_ENTITY_PARSING_NEVER = 0
  1606. const _XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE = 1
  1607. const _XML_PARAM_ENTITY_PARSING_ALWAYS = 2
  1608. type TXML_Parser = uintptr
  1609. type TXML_Bool = uint8
  1610. type _XML_Status = int32
  1611. const _XML_STATUS_ERROR = 0
  1612. const _XML_STATUS_OK = 1
  1613. const _XML_STATUS_SUSPENDED = 2
  1614. type _XML_Content_Type = int32
  1615. const _XML_CTYPE_EMPTY = 1
  1616. const _XML_CTYPE_ANY = 2
  1617. const _XML_CTYPE_MIXED = 3
  1618. const _XML_CTYPE_NAME = 4
  1619. const _XML_CTYPE_CHOICE = 5
  1620. const _XML_CTYPE_SEQ = 6
  1621. type _XML_Content_Quant = int32
  1622. const _XML_CQUANT_NONE = 0
  1623. const _XML_CQUANT_OPT = 1
  1624. const _XML_CQUANT_REP = 2
  1625. const _XML_CQUANT_PLUS = 3
  1626. type TXML_Content = struct {
  1627. Ftype1 _XML_Content_Type
  1628. Fquant _XML_Content_Quant
  1629. Fname uintptr
  1630. Fnumchildren uint32
  1631. Fchildren uintptr
  1632. }
  1633. type TXML_cp = TXML_Content
  1634. type TXML_ElementDeclHandler = uintptr
  1635. type TXML_AttlistDeclHandler = uintptr
  1636. type TXML_XmlDeclHandler = uintptr
  1637. type TXML_Memory_Handling_Suite = struct {
  1638. Fmalloc_fcn uintptr
  1639. Frealloc_fcn uintptr
  1640. Ffree_fcn uintptr
  1641. }
  1642. type TXML_StartElementHandler = uintptr
  1643. type TXML_EndElementHandler = uintptr
  1644. type TXML_CharacterDataHandler = uintptr
  1645. type TXML_ProcessingInstructionHandler = uintptr
  1646. type TXML_CommentHandler = uintptr
  1647. type TXML_StartCdataSectionHandler = uintptr
  1648. type TXML_EndCdataSectionHandler = uintptr
  1649. type TXML_DefaultHandler = uintptr
  1650. type TXML_StartDoctypeDeclHandler = uintptr
  1651. type TXML_EndDoctypeDeclHandler = uintptr
  1652. type TXML_EntityDeclHandler = uintptr
  1653. type TXML_UnparsedEntityDeclHandler = uintptr
  1654. type TXML_NotationDeclHandler = uintptr
  1655. type TXML_StartNamespaceDeclHandler = uintptr
  1656. type TXML_EndNamespaceDeclHandler = uintptr
  1657. type TXML_NotStandaloneHandler = uintptr
  1658. type TXML_ExternalEntityRefHandler = uintptr
  1659. type TXML_SkippedEntityHandler = uintptr
  1660. type TXML_Encoding = struct {
  1661. Fmap1 [256]int32
  1662. Fdata uintptr
  1663. Fconvert uintptr
  1664. Frelease uintptr
  1665. }
  1666. type TXML_UnknownEncodingHandler = uintptr
  1667. type _XML_Parsing = int32
  1668. const _XML_INITIALIZED = 0
  1669. const _XML_PARSING = 1
  1670. const _XML_FINISHED = 2
  1671. const _XML_SUSPENDED = 3
  1672. type TXML_ParsingStatus = struct {
  1673. Fparsing _XML_Parsing
  1674. FfinalBuffer TXML_Bool
  1675. }
  1676. type TXML_Expat_Version = struct {
  1677. Fmajor int32
  1678. Fminor int32
  1679. Fmicro int32
  1680. }
  1681. type _XML_FeatureEnum = int32
  1682. const _XML_FEATURE_END = 0
  1683. const _XML_FEATURE_UNICODE = 1
  1684. const _XML_FEATURE_UNICODE_WCHAR_T = 2
  1685. const _XML_FEATURE_DTD = 3
  1686. const _XML_FEATURE_CONTEXT_BYTES = 4
  1687. const _XML_FEATURE_MIN_SIZE = 5
  1688. const _XML_FEATURE_SIZEOF_XML_CHAR = 6
  1689. const _XML_FEATURE_SIZEOF_XML_LCHAR = 7
  1690. const _XML_FEATURE_NS = 8
  1691. const _XML_FEATURE_LARGE_SIZE = 9
  1692. const _XML_FEATURE_ATTR_INFO = 10
  1693. type TXML_Feature = struct {
  1694. Ffeature _XML_FeatureEnum
  1695. Fname uintptr
  1696. Fvalue int64
  1697. }
  1698. type Tsiphash = struct {
  1699. Fv0 Tuint64_t
  1700. Fv1 Tuint64_t
  1701. Fv2 Tuint64_t
  1702. Fv3 Tuint64_t
  1703. Fbuf [8]uint8
  1704. Fp uintptr
  1705. Fc Tuint64_t
  1706. }
  1707. type Tsipkey = struct {
  1708. Fk [2]Tuint64_t
  1709. }
  1710. func _sip_tokey(tls *libc.TLS, key uintptr, src uintptr) (r uintptr) {
  1711. *(*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)
  1712. *(*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)
  1713. return key
  1714. }
  1715. func _sip_round(tls *libc.TLS, H uintptr, rounds int32) {
  1716. var i int32
  1717. _ = i
  1718. i = 0
  1719. for {
  1720. if !(i < rounds) {
  1721. break
  1722. }
  1723. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1724. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(13) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(13))
  1725. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1726. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = (*Tsiphash)(unsafe.Pointer(H)).Fv0<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv0>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1727. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1728. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(16) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(16))
  1729. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1730. *(*Tuint64_t)(unsafe.Pointer(H)) += (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1731. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = (*Tsiphash)(unsafe.Pointer(H)).Fv3<<libc.Int32FromInt32(21) | (*Tsiphash)(unsafe.Pointer(H)).Fv3>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(21))
  1732. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv0
  1733. *(*Tuint64_t)(unsafe.Pointer(H + 16)) += (*Tsiphash)(unsafe.Pointer(H)).Fv1
  1734. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = (*Tsiphash)(unsafe.Pointer(H)).Fv1<<libc.Int32FromInt32(17) | (*Tsiphash)(unsafe.Pointer(H)).Fv1>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(17))
  1735. *(*Tuint64_t)(unsafe.Pointer(H + 8)) ^= (*Tsiphash)(unsafe.Pointer(H)).Fv2
  1736. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = (*Tsiphash)(unsafe.Pointer(H)).Fv2<<libc.Int32FromInt32(32) | (*Tsiphash)(unsafe.Pointer(H)).Fv2>>(libc.Int32FromInt32(64)-libc.Int32FromInt32(32))
  1737. goto _1
  1738. _1:
  1739. ;
  1740. i++
  1741. }
  1742. }
  1743. func _sip24_init(tls *libc.TLS, H uintptr, key uintptr) (r uintptr) {
  1744. (*Tsiphash)(unsafe.Pointer(H)).Fv0 = libc.Uint64FromUint32(0x736f6d65)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x70736575) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1745. (*Tsiphash)(unsafe.Pointer(H)).Fv1 = libc.Uint64FromUint32(0x646f7261)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x6e646f6d) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1746. (*Tsiphash)(unsafe.Pointer(H)).Fv2 = libc.Uint64FromUint32(0x6c796765)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x6e657261) ^ *(*Tuint64_t)(unsafe.Pointer(key))
  1747. (*Tsiphash)(unsafe.Pointer(H)).Fv3 = libc.Uint64FromUint32(0x74656462)<<libc.Int32FromInt32(32) | libc.Uint64FromUint32(0x79746573) ^ *(*Tuint64_t)(unsafe.Pointer(key + 1*8))
  1748. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1749. (*Tsiphash)(unsafe.Pointer(H)).Fc = uint64(0)
  1750. return H
  1751. }
  1752. func _sip24_update(tls *libc.TLS, H uintptr, src uintptr, len1 Tsize_t) (r uintptr) {
  1753. var m Tuint64_t
  1754. var p, pe, v1, v2, v3 uintptr
  1755. _, _, _, _, _, _ = m, p, pe, v1, v2, v3
  1756. p = src
  1757. pe = p + uintptr(len1)
  1758. for cond := true; cond; cond = p < pe {
  1759. for p < pe && (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1760. v2 = H + 40
  1761. v1 = *(*uintptr)(unsafe.Pointer(v2))
  1762. *(*uintptr)(unsafe.Pointer(v2))++
  1763. v3 = p
  1764. p++
  1765. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  1766. }
  1767. if (*Tsiphash)(unsafe.Pointer(H)).Fp < H+32+uintptr(libc.Uint64FromInt64(8)/libc.Uint64FromInt64(1)) {
  1768. break
  1769. }
  1770. 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)
  1771. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= m
  1772. _sip_round(tls, H, int32(2))
  1773. *(*Tuint64_t)(unsafe.Pointer(H)) ^= m
  1774. (*Tsiphash)(unsafe.Pointer(H)).Fp = H + 32
  1775. *(*Tuint64_t)(unsafe.Pointer(H + 48)) += uint64(8)
  1776. }
  1777. return H
  1778. }
  1779. func _sip24_final(tls *libc.TLS, H uintptr) (r Tuint64_t) {
  1780. var b Tuint64_t
  1781. var left uint8
  1782. _, _ = b, left
  1783. left = libc.Uint8FromInt64(int64((*Tsiphash)(unsafe.Pointer(H)).Fp) - t__predefined_ptrdiff_t(H+32))
  1784. b = ((*Tsiphash)(unsafe.Pointer(H)).Fc + uint64(left)) << int32(56)
  1785. switch libc.Int32FromUint8(left) {
  1786. case int32(7):
  1787. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 6))) << int32(48)
  1788. fallthrough
  1789. case int32(6):
  1790. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 5))) << int32(40)
  1791. fallthrough
  1792. case int32(5):
  1793. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 4))) << int32(32)
  1794. fallthrough
  1795. case int32(4):
  1796. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 3))) << int32(24)
  1797. fallthrough
  1798. case int32(3):
  1799. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 2))) << int32(16)
  1800. fallthrough
  1801. case int32(2):
  1802. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32 + 1))) << int32(8)
  1803. fallthrough
  1804. case int32(1):
  1805. b |= uint64(*(*uint8)(unsafe.Pointer(H + 32))) << 0
  1806. fallthrough
  1807. case 0:
  1808. break
  1809. }
  1810. *(*Tuint64_t)(unsafe.Pointer(H + 24)) ^= b
  1811. _sip_round(tls, H, int32(2))
  1812. *(*Tuint64_t)(unsafe.Pointer(H)) ^= b
  1813. *(*Tuint64_t)(unsafe.Pointer(H + 16)) ^= uint64(0xff)
  1814. _sip_round(tls, H, int32(4))
  1815. return (*Tsiphash)(unsafe.Pointer(H)).Fv0 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv1 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv2 ^ (*Tsiphash)(unsafe.Pointer(H)).Fv3
  1816. }
  1817. func _siphash24(tls *libc.TLS, src uintptr, len1 Tsize_t, key uintptr) (r Tuint64_t) {
  1818. bp := tls.Alloc(64)
  1819. defer tls.Free(64)
  1820. var _ /* state at bp+0 */ Tsiphash
  1821. *(*Tsiphash)(unsafe.Pointer(bp)) = Tsiphash{}
  1822. return _sip24_final(tls, _sip24_update(tls, _sip24_init(tls, bp, key), src, len1))
  1823. }
  1824. func _sip24_valid(tls *libc.TLS) (r int32) {
  1825. bp := tls.Alloc(80)
  1826. defer tls.Free(80)
  1827. var i Tsize_t
  1828. var _ /* in at bp+0 */ [64]uint8
  1829. var _ /* k at bp+64 */ Tsipkey
  1830. _ = i
  1831. _sip_tokey(tls, bp+64, __ccgo_ts)
  1832. i = uint64(0)
  1833. for {
  1834. if !(i < uint64(64)) {
  1835. break
  1836. }
  1837. (*(*[64]uint8)(unsafe.Pointer(bp)))[i] = uint8(i)
  1838. 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) {
  1839. return 0
  1840. }
  1841. goto _1
  1842. _1:
  1843. ;
  1844. i++
  1845. }
  1846. return int32(1)
  1847. }
  1848. var _vectors = [64][8]uint8{
  1849. 0: {
  1850. 0: uint8(0x31),
  1851. 1: uint8(0x0e),
  1852. 2: uint8(0x0e),
  1853. 3: uint8(0xdd),
  1854. 4: uint8(0x47),
  1855. 5: uint8(0xdb),
  1856. 6: uint8(0x6f),
  1857. 7: uint8(0x72),
  1858. },
  1859. 1: {
  1860. 0: uint8(0xfd),
  1861. 1: uint8(0x67),
  1862. 2: uint8(0xdc),
  1863. 3: uint8(0x93),
  1864. 4: uint8(0xc5),
  1865. 5: uint8(0x39),
  1866. 6: uint8(0xf8),
  1867. 7: uint8(0x74),
  1868. },
  1869. 2: {
  1870. 0: uint8(0x5a),
  1871. 1: uint8(0x4f),
  1872. 2: uint8(0xa9),
  1873. 3: uint8(0xd9),
  1874. 4: uint8(0x09),
  1875. 5: uint8(0x80),
  1876. 6: uint8(0x6c),
  1877. 7: uint8(0x0d),
  1878. },
  1879. 3: {
  1880. 0: uint8(0x2d),
  1881. 1: uint8(0x7e),
  1882. 2: uint8(0xfb),
  1883. 3: uint8(0xd7),
  1884. 4: uint8(0x96),
  1885. 5: uint8(0x66),
  1886. 6: uint8(0x67),
  1887. 7: uint8(0x85),
  1888. },
  1889. 4: {
  1890. 0: uint8(0xb7),
  1891. 1: uint8(0x87),
  1892. 2: uint8(0x71),
  1893. 3: uint8(0x27),
  1894. 4: uint8(0xe0),
  1895. 5: uint8(0x94),
  1896. 6: uint8(0x27),
  1897. 7: uint8(0xcf),
  1898. },
  1899. 5: {
  1900. 0: uint8(0x8d),
  1901. 1: uint8(0xa6),
  1902. 2: uint8(0x99),
  1903. 3: uint8(0xcd),
  1904. 4: uint8(0x64),
  1905. 5: uint8(0x55),
  1906. 6: uint8(0x76),
  1907. 7: uint8(0x18),
  1908. },
  1909. 6: {
  1910. 0: uint8(0xce),
  1911. 1: uint8(0xe3),
  1912. 2: uint8(0xfe),
  1913. 3: uint8(0x58),
  1914. 4: uint8(0x6e),
  1915. 5: uint8(0x46),
  1916. 6: uint8(0xc9),
  1917. 7: uint8(0xcb),
  1918. },
  1919. 7: {
  1920. 0: uint8(0x37),
  1921. 1: uint8(0xd1),
  1922. 2: uint8(0x01),
  1923. 3: uint8(0x8b),
  1924. 4: uint8(0xf5),
  1925. 6: uint8(0x02),
  1926. 7: uint8(0xab),
  1927. },
  1928. 8: {
  1929. 0: uint8(0x62),
  1930. 1: uint8(0x24),
  1931. 2: uint8(0x93),
  1932. 3: uint8(0x9a),
  1933. 4: uint8(0x79),
  1934. 5: uint8(0xf5),
  1935. 6: uint8(0xf5),
  1936. 7: uint8(0x93),
  1937. },
  1938. 9: {
  1939. 0: uint8(0xb0),
  1940. 1: uint8(0xe4),
  1941. 2: uint8(0xa9),
  1942. 3: uint8(0x0b),
  1943. 4: uint8(0xdf),
  1944. 5: uint8(0x82),
  1945. 7: uint8(0x9e),
  1946. },
  1947. 10: {
  1948. 0: uint8(0xf3),
  1949. 1: uint8(0xb9),
  1950. 2: uint8(0xdd),
  1951. 3: uint8(0x94),
  1952. 4: uint8(0xc5),
  1953. 5: uint8(0xbb),
  1954. 6: uint8(0x5d),
  1955. 7: uint8(0x7a),
  1956. },
  1957. 11: {
  1958. 0: uint8(0xa7),
  1959. 1: uint8(0xad),
  1960. 2: uint8(0x6b),
  1961. 3: uint8(0x22),
  1962. 4: uint8(0x46),
  1963. 5: uint8(0x2f),
  1964. 6: uint8(0xb3),
  1965. 7: uint8(0xf4),
  1966. },
  1967. 12: {
  1968. 0: uint8(0xfb),
  1969. 1: uint8(0xe5),
  1970. 2: uint8(0x0e),
  1971. 3: uint8(0x86),
  1972. 4: uint8(0xbc),
  1973. 5: uint8(0x8f),
  1974. 6: uint8(0x1e),
  1975. 7: uint8(0x75),
  1976. },
  1977. 13: {
  1978. 0: uint8(0x90),
  1979. 1: uint8(0x3d),
  1980. 2: uint8(0x84),
  1981. 3: uint8(0xc0),
  1982. 4: uint8(0x27),
  1983. 5: uint8(0x56),
  1984. 6: uint8(0xea),
  1985. 7: uint8(0x14),
  1986. },
  1987. 14: {
  1988. 0: uint8(0xee),
  1989. 1: uint8(0xf2),
  1990. 2: uint8(0x7a),
  1991. 3: uint8(0x8e),
  1992. 4: uint8(0x90),
  1993. 5: uint8(0xca),
  1994. 6: uint8(0x23),
  1995. 7: uint8(0xf7),
  1996. },
  1997. 15: {
  1998. 0: uint8(0xe5),
  1999. 1: uint8(0x45),
  2000. 2: uint8(0xbe),
  2001. 3: uint8(0x49),
  2002. 4: uint8(0x61),
  2003. 5: uint8(0xca),
  2004. 6: uint8(0x29),
  2005. 7: uint8(0xa1),
  2006. },
  2007. 16: {
  2008. 0: uint8(0xdb),
  2009. 1: uint8(0x9b),
  2010. 2: uint8(0xc2),
  2011. 3: uint8(0x57),
  2012. 4: uint8(0x7f),
  2013. 5: uint8(0xcc),
  2014. 6: uint8(0x2a),
  2015. 7: uint8(0x3f),
  2016. },
  2017. 17: {
  2018. 0: uint8(0x94),
  2019. 1: uint8(0x47),
  2020. 2: uint8(0xbe),
  2021. 3: uint8(0x2c),
  2022. 4: uint8(0xf5),
  2023. 5: uint8(0xe9),
  2024. 6: uint8(0x9a),
  2025. 7: uint8(0x69),
  2026. },
  2027. 18: {
  2028. 0: uint8(0x9c),
  2029. 1: uint8(0xd3),
  2030. 2: uint8(0x8d),
  2031. 3: uint8(0x96),
  2032. 4: uint8(0xf0),
  2033. 5: uint8(0xb3),
  2034. 6: uint8(0xc1),
  2035. 7: uint8(0x4b),
  2036. },
  2037. 19: {
  2038. 0: uint8(0xbd),
  2039. 1: uint8(0x61),
  2040. 2: uint8(0x79),
  2041. 3: uint8(0xa7),
  2042. 4: uint8(0x1d),
  2043. 5: uint8(0xc9),
  2044. 6: uint8(0x6d),
  2045. 7: uint8(0xbb),
  2046. },
  2047. 20: {
  2048. 0: uint8(0x98),
  2049. 1: uint8(0xee),
  2050. 2: uint8(0xa2),
  2051. 3: uint8(0x1a),
  2052. 4: uint8(0xf2),
  2053. 5: uint8(0x5c),
  2054. 6: uint8(0xd6),
  2055. 7: uint8(0xbe),
  2056. },
  2057. 21: {
  2058. 0: uint8(0xc7),
  2059. 1: uint8(0x67),
  2060. 2: uint8(0x3b),
  2061. 3: uint8(0x2e),
  2062. 4: uint8(0xb0),
  2063. 5: uint8(0xcb),
  2064. 6: uint8(0xf2),
  2065. 7: uint8(0xd0),
  2066. },
  2067. 22: {
  2068. 0: uint8(0x88),
  2069. 1: uint8(0x3e),
  2070. 2: uint8(0xa3),
  2071. 3: uint8(0xe3),
  2072. 4: uint8(0x95),
  2073. 5: uint8(0x67),
  2074. 6: uint8(0x53),
  2075. 7: uint8(0x93),
  2076. },
  2077. 23: {
  2078. 0: uint8(0xc8),
  2079. 1: uint8(0xce),
  2080. 2: uint8(0x5c),
  2081. 3: uint8(0xcd),
  2082. 4: uint8(0x8c),
  2083. 5: uint8(0x03),
  2084. 6: uint8(0x0c),
  2085. 7: uint8(0xa8),
  2086. },
  2087. 24: {
  2088. 0: uint8(0x94),
  2089. 1: uint8(0xaf),
  2090. 2: uint8(0x49),
  2091. 3: uint8(0xf6),
  2092. 4: uint8(0xc6),
  2093. 5: uint8(0x50),
  2094. 6: uint8(0xad),
  2095. 7: uint8(0xb8),
  2096. },
  2097. 25: {
  2098. 0: uint8(0xea),
  2099. 1: uint8(0xb8),
  2100. 2: uint8(0x85),
  2101. 3: uint8(0x8a),
  2102. 4: uint8(0xde),
  2103. 5: uint8(0x92),
  2104. 6: uint8(0xe1),
  2105. 7: uint8(0xbc),
  2106. },
  2107. 26: {
  2108. 0: uint8(0xf3),
  2109. 1: uint8(0x15),
  2110. 2: uint8(0xbb),
  2111. 3: uint8(0x5b),
  2112. 4: uint8(0xb8),
  2113. 5: uint8(0x35),
  2114. 6: uint8(0xd8),
  2115. 7: uint8(0x17),
  2116. },
  2117. 27: {
  2118. 0: uint8(0xad),
  2119. 1: uint8(0xcf),
  2120. 2: uint8(0x6b),
  2121. 3: uint8(0x07),
  2122. 4: uint8(0x63),
  2123. 5: uint8(0x61),
  2124. 6: uint8(0x2e),
  2125. 7: uint8(0x2f),
  2126. },
  2127. 28: {
  2128. 0: uint8(0xa5),
  2129. 1: uint8(0xc9),
  2130. 2: uint8(0x1d),
  2131. 3: uint8(0xa7),
  2132. 4: uint8(0xac),
  2133. 5: uint8(0xaa),
  2134. 6: uint8(0x4d),
  2135. 7: uint8(0xde),
  2136. },
  2137. 29: {
  2138. 0: uint8(0x71),
  2139. 1: uint8(0x65),
  2140. 2: uint8(0x95),
  2141. 3: uint8(0x87),
  2142. 4: uint8(0x66),
  2143. 5: uint8(0x50),
  2144. 6: uint8(0xa2),
  2145. 7: uint8(0xa6),
  2146. },
  2147. 30: {
  2148. 0: uint8(0x28),
  2149. 1: uint8(0xef),
  2150. 2: uint8(0x49),
  2151. 3: uint8(0x5c),
  2152. 4: uint8(0x53),
  2153. 5: uint8(0xa3),
  2154. 6: uint8(0x87),
  2155. 7: uint8(0xad),
  2156. },
  2157. 31: {
  2158. 0: uint8(0x42),
  2159. 1: uint8(0xc3),
  2160. 2: uint8(0x41),
  2161. 3: uint8(0xd8),
  2162. 4: uint8(0xfa),
  2163. 5: uint8(0x92),
  2164. 6: uint8(0xd8),
  2165. 7: uint8(0x32),
  2166. },
  2167. 32: {
  2168. 0: uint8(0xce),
  2169. 1: uint8(0x7c),
  2170. 2: uint8(0xf2),
  2171. 3: uint8(0x72),
  2172. 4: uint8(0x2f),
  2173. 5: uint8(0x51),
  2174. 6: uint8(0x27),
  2175. 7: uint8(0x71),
  2176. },
  2177. 33: {
  2178. 0: uint8(0xe3),
  2179. 1: uint8(0x78),
  2180. 2: uint8(0x59),
  2181. 3: uint8(0xf9),
  2182. 4: uint8(0x46),
  2183. 5: uint8(0x23),
  2184. 6: uint8(0xf3),
  2185. 7: uint8(0xa7),
  2186. },
  2187. 34: {
  2188. 0: uint8(0x38),
  2189. 1: uint8(0x12),
  2190. 2: uint8(0x05),
  2191. 3: uint8(0xbb),
  2192. 4: uint8(0x1a),
  2193. 5: uint8(0xb0),
  2194. 6: uint8(0xe0),
  2195. 7: uint8(0x12),
  2196. },
  2197. 35: {
  2198. 0: uint8(0xae),
  2199. 1: uint8(0x97),
  2200. 2: uint8(0xa1),
  2201. 3: uint8(0x0f),
  2202. 4: uint8(0xd4),
  2203. 5: uint8(0x34),
  2204. 6: uint8(0xe0),
  2205. 7: uint8(0x15),
  2206. },
  2207. 36: {
  2208. 0: uint8(0xb4),
  2209. 1: uint8(0xa3),
  2210. 2: uint8(0x15),
  2211. 3: uint8(0x08),
  2212. 4: uint8(0xbe),
  2213. 5: uint8(0xff),
  2214. 6: uint8(0x4d),
  2215. 7: uint8(0x31),
  2216. },
  2217. 37: {
  2218. 0: uint8(0x81),
  2219. 1: uint8(0x39),
  2220. 2: uint8(0x62),
  2221. 3: uint8(0x29),
  2222. 4: uint8(0xf0),
  2223. 5: uint8(0x90),
  2224. 6: uint8(0x79),
  2225. 7: uint8(0x02),
  2226. },
  2227. 38: {
  2228. 0: uint8(0x4d),
  2229. 1: uint8(0x0c),
  2230. 2: uint8(0xf4),
  2231. 3: uint8(0x9e),
  2232. 4: uint8(0xe5),
  2233. 5: uint8(0xd4),
  2234. 6: uint8(0xdc),
  2235. 7: uint8(0xca),
  2236. },
  2237. 39: {
  2238. 0: uint8(0x5c),
  2239. 1: uint8(0x73),
  2240. 2: uint8(0x33),
  2241. 3: uint8(0x6a),
  2242. 4: uint8(0x76),
  2243. 5: uint8(0xd8),
  2244. 6: uint8(0xbf),
  2245. 7: uint8(0x9a),
  2246. },
  2247. 40: {
  2248. 0: uint8(0xd0),
  2249. 1: uint8(0xa7),
  2250. 2: uint8(0x04),
  2251. 3: uint8(0x53),
  2252. 4: uint8(0x6b),
  2253. 5: uint8(0xa9),
  2254. 6: uint8(0x3e),
  2255. 7: uint8(0x0e),
  2256. },
  2257. 41: {
  2258. 0: uint8(0x92),
  2259. 1: uint8(0x59),
  2260. 2: uint8(0x58),
  2261. 3: uint8(0xfc),
  2262. 4: uint8(0xd6),
  2263. 5: uint8(0x42),
  2264. 6: uint8(0x0c),
  2265. 7: uint8(0xad),
  2266. },
  2267. 42: {
  2268. 0: uint8(0xa9),
  2269. 1: uint8(0x15),
  2270. 2: uint8(0xc2),
  2271. 3: uint8(0x9b),
  2272. 4: uint8(0xc8),
  2273. 5: uint8(0x06),
  2274. 6: uint8(0x73),
  2275. 7: uint8(0x18),
  2276. },
  2277. 43: {
  2278. 0: uint8(0x95),
  2279. 1: uint8(0x2b),
  2280. 2: uint8(0x79),
  2281. 3: uint8(0xf3),
  2282. 4: uint8(0xbc),
  2283. 5: uint8(0x0a),
  2284. 6: uint8(0xa6),
  2285. 7: uint8(0xd4),
  2286. },
  2287. 44: {
  2288. 0: uint8(0xf2),
  2289. 1: uint8(0x1d),
  2290. 2: uint8(0xf2),
  2291. 3: uint8(0xe4),
  2292. 4: uint8(0x1d),
  2293. 5: uint8(0x45),
  2294. 6: uint8(0x35),
  2295. 7: uint8(0xf9),
  2296. },
  2297. 45: {
  2298. 0: uint8(0x87),
  2299. 1: uint8(0x57),
  2300. 2: uint8(0x75),
  2301. 3: uint8(0x19),
  2302. 4: uint8(0x04),
  2303. 5: uint8(0x8f),
  2304. 6: uint8(0x53),
  2305. 7: uint8(0xa9),
  2306. },
  2307. 46: {
  2308. 0: uint8(0x10),
  2309. 1: uint8(0xa5),
  2310. 2: uint8(0x6c),
  2311. 3: uint8(0xf5),
  2312. 4: uint8(0xdf),
  2313. 5: uint8(0xcd),
  2314. 6: uint8(0x9a),
  2315. 7: uint8(0xdb),
  2316. },
  2317. 47: {
  2318. 0: uint8(0xeb),
  2319. 1: uint8(0x75),
  2320. 2: uint8(0x09),
  2321. 3: uint8(0x5c),
  2322. 4: uint8(0xcd),
  2323. 5: uint8(0x98),
  2324. 6: uint8(0x6c),
  2325. 7: uint8(0xd0),
  2326. },
  2327. 48: {
  2328. 0: uint8(0x51),
  2329. 1: uint8(0xa9),
  2330. 2: uint8(0xcb),
  2331. 3: uint8(0x9e),
  2332. 4: uint8(0xcb),
  2333. 5: uint8(0xa3),
  2334. 6: uint8(0x12),
  2335. 7: uint8(0xe6),
  2336. },
  2337. 49: {
  2338. 0: uint8(0x96),
  2339. 1: uint8(0xaf),
  2340. 2: uint8(0xad),
  2341. 3: uint8(0xfc),
  2342. 4: uint8(0x2c),
  2343. 5: uint8(0xe6),
  2344. 6: uint8(0x66),
  2345. 7: uint8(0xc7),
  2346. },
  2347. 50: {
  2348. 0: uint8(0x72),
  2349. 1: uint8(0xfe),
  2350. 2: uint8(0x52),
  2351. 3: uint8(0x97),
  2352. 4: uint8(0x5a),
  2353. 5: uint8(0x43),
  2354. 6: uint8(0x64),
  2355. 7: uint8(0xee),
  2356. },
  2357. 51: {
  2358. 0: uint8(0x5a),
  2359. 1: uint8(0x16),
  2360. 2: uint8(0x45),
  2361. 3: uint8(0xb2),
  2362. 4: uint8(0x76),
  2363. 5: uint8(0xd5),
  2364. 6: uint8(0x92),
  2365. 7: uint8(0xa1),
  2366. },
  2367. 52: {
  2368. 0: uint8(0xb2),
  2369. 1: uint8(0x74),
  2370. 2: uint8(0xcb),
  2371. 3: uint8(0x8e),
  2372. 4: uint8(0xbf),
  2373. 5: uint8(0x87),
  2374. 6: uint8(0x87),
  2375. 7: uint8(0x0a),
  2376. },
  2377. 53: {
  2378. 0: uint8(0x6f),
  2379. 1: uint8(0x9b),
  2380. 2: uint8(0xb4),
  2381. 3: uint8(0x20),
  2382. 4: uint8(0x3d),
  2383. 5: uint8(0xe7),
  2384. 6: uint8(0xb3),
  2385. 7: uint8(0x81),
  2386. },
  2387. 54: {
  2388. 0: uint8(0xea),
  2389. 1: uint8(0xec),
  2390. 2: uint8(0xb2),
  2391. 3: uint8(0xa3),
  2392. 4: uint8(0x0b),
  2393. 5: uint8(0x22),
  2394. 6: uint8(0xa8),
  2395. 7: uint8(0x7f),
  2396. },
  2397. 55: {
  2398. 0: uint8(0x99),
  2399. 1: uint8(0x24),
  2400. 2: uint8(0xa4),
  2401. 3: uint8(0x3c),
  2402. 4: uint8(0xc1),
  2403. 5: uint8(0x31),
  2404. 6: uint8(0x57),
  2405. 7: uint8(0x24),
  2406. },
  2407. 56: {
  2408. 0: uint8(0xbd),
  2409. 1: uint8(0x83),
  2410. 2: uint8(0x8d),
  2411. 3: uint8(0x3a),
  2412. 4: uint8(0xaf),
  2413. 5: uint8(0xbf),
  2414. 6: uint8(0x8d),
  2415. 7: uint8(0xb7),
  2416. },
  2417. 57: {
  2418. 0: uint8(0x0b),
  2419. 1: uint8(0x1a),
  2420. 2: uint8(0x2a),
  2421. 3: uint8(0x32),
  2422. 4: uint8(0x65),
  2423. 5: uint8(0xd5),
  2424. 6: uint8(0x1a),
  2425. 7: uint8(0xea),
  2426. },
  2427. 58: {
  2428. 0: uint8(0x13),
  2429. 1: uint8(0x50),
  2430. 2: uint8(0x79),
  2431. 3: uint8(0xa3),
  2432. 4: uint8(0x23),
  2433. 5: uint8(0x1c),
  2434. 6: uint8(0xe6),
  2435. 7: uint8(0x60),
  2436. },
  2437. 59: {
  2438. 0: uint8(0x93),
  2439. 1: uint8(0x2b),
  2440. 2: uint8(0x28),
  2441. 3: uint8(0x46),
  2442. 4: uint8(0xe4),
  2443. 5: uint8(0xd7),
  2444. 6: uint8(0x06),
  2445. 7: uint8(0x66),
  2446. },
  2447. 60: {
  2448. 0: uint8(0xe1),
  2449. 1: uint8(0x91),
  2450. 2: uint8(0x5f),
  2451. 3: uint8(0x5c),
  2452. 4: uint8(0xb1),
  2453. 5: uint8(0xec),
  2454. 6: uint8(0xa4),
  2455. 7: uint8(0x6c),
  2456. },
  2457. 61: {
  2458. 0: uint8(0xf3),
  2459. 1: uint8(0x25),
  2460. 2: uint8(0x96),
  2461. 3: uint8(0x5c),
  2462. 4: uint8(0xa1),
  2463. 5: uint8(0x6d),
  2464. 6: uint8(0x62),
  2465. 7: uint8(0x9f),
  2466. },
  2467. 62: {
  2468. 0: uint8(0x57),
  2469. 1: uint8(0x5f),
  2470. 2: uint8(0xf2),
  2471. 3: uint8(0x8e),
  2472. 4: uint8(0x60),
  2473. 5: uint8(0x38),
  2474. 6: uint8(0x1b),
  2475. 7: uint8(0xe5),
  2476. },
  2477. 63: {
  2478. 0: uint8(0x72),
  2479. 1: uint8(0x45),
  2480. 2: uint8(0x06),
  2481. 3: uint8(0xeb),
  2482. 4: uint8(0x4c),
  2483. 5: uint8(0x32),
  2484. 6: uint8(0x8a),
  2485. 7: uint8(0x95),
  2486. },
  2487. }
  2488. type TICHAR = uint8
  2489. type TPOSITION = struct {
  2490. FlineNumber TXML_Size
  2491. FcolumnNumber TXML_Size
  2492. }
  2493. type Tposition = TPOSITION
  2494. type TATTRIBUTE = struct {
  2495. Fname uintptr
  2496. FvaluePtr uintptr
  2497. FvalueEnd uintptr
  2498. Fnormalized uint8
  2499. }
  2500. type Tencoding = struct {
  2501. Fscanners [4]TSCANNER
  2502. FliteralScanners [2]TSCANNER
  2503. FnameMatchesAscii uintptr
  2504. FnameLength uintptr
  2505. FskipS uintptr
  2506. FgetAtts uintptr
  2507. FcharRefNumber uintptr
  2508. FpredefinedEntityName uintptr
  2509. FupdatePosition uintptr
  2510. FisPublicId uintptr
  2511. Futf8Convert uintptr
  2512. Futf16Convert uintptr
  2513. FminBytesPerChar int32
  2514. FisUtf8 uint8
  2515. FisUtf16 uint8
  2516. }
  2517. type TENCODING = struct {
  2518. Fscanners [4]TSCANNER
  2519. FliteralScanners [2]TSCANNER
  2520. FnameMatchesAscii uintptr
  2521. FnameLength uintptr
  2522. FskipS uintptr
  2523. FgetAtts uintptr
  2524. FcharRefNumber uintptr
  2525. FpredefinedEntityName uintptr
  2526. FupdatePosition uintptr
  2527. FisPublicId uintptr
  2528. Futf8Convert uintptr
  2529. Futf16Convert uintptr
  2530. FminBytesPerChar int32
  2531. FisUtf8 uint8
  2532. FisUtf16 uint8
  2533. }
  2534. type TSCANNER = uintptr
  2535. type _XML_Convert_Result = int32
  2536. const _XML_CONVERT_COMPLETED = 0
  2537. const _XML_CONVERT_INPUT_INCOMPLETE = 1
  2538. const _XML_CONVERT_OUTPUT_EXHAUSTED = 2
  2539. type TINIT_ENCODING = struct {
  2540. FinitEnc TENCODING
  2541. FencPtr uintptr
  2542. }
  2543. type TCONVERTER = uintptr
  2544. const _XML_ROLE_ERROR = -1
  2545. const _XML_ROLE_NONE = 0
  2546. const _XML_ROLE_XML_DECL = 1
  2547. const _XML_ROLE_INSTANCE_START = 2
  2548. const _XML_ROLE_DOCTYPE_NONE = 3
  2549. const _XML_ROLE_DOCTYPE_NAME = 4
  2550. const _XML_ROLE_DOCTYPE_SYSTEM_ID = 5
  2551. const _XML_ROLE_DOCTYPE_PUBLIC_ID = 6
  2552. const _XML_ROLE_DOCTYPE_INTERNAL_SUBSET = 7
  2553. const _XML_ROLE_DOCTYPE_CLOSE = 8
  2554. const _XML_ROLE_GENERAL_ENTITY_NAME = 9
  2555. const _XML_ROLE_PARAM_ENTITY_NAME = 10
  2556. const _XML_ROLE_ENTITY_NONE = 11
  2557. const _XML_ROLE_ENTITY_VALUE = 12
  2558. const _XML_ROLE_ENTITY_SYSTEM_ID = 13
  2559. const _XML_ROLE_ENTITY_PUBLIC_ID = 14
  2560. const _XML_ROLE_ENTITY_COMPLETE = 15
  2561. const _XML_ROLE_ENTITY_NOTATION_NAME = 16
  2562. const _XML_ROLE_NOTATION_NONE = 17
  2563. const _XML_ROLE_NOTATION_NAME = 18
  2564. const _XML_ROLE_NOTATION_SYSTEM_ID = 19
  2565. const _XML_ROLE_NOTATION_NO_SYSTEM_ID = 20
  2566. const _XML_ROLE_NOTATION_PUBLIC_ID = 21
  2567. const _XML_ROLE_ATTRIBUTE_NAME = 22
  2568. const _XML_ROLE_ATTRIBUTE_TYPE_CDATA = 23
  2569. const _XML_ROLE_ATTRIBUTE_TYPE_ID = 24
  2570. const _XML_ROLE_ATTRIBUTE_TYPE_IDREF = 25
  2571. const _XML_ROLE_ATTRIBUTE_TYPE_IDREFS = 26
  2572. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITY = 27
  2573. const _XML_ROLE_ATTRIBUTE_TYPE_ENTITIES = 28
  2574. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN = 29
  2575. const _XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS = 30
  2576. const _XML_ROLE_ATTRIBUTE_ENUM_VALUE = 31
  2577. const _XML_ROLE_ATTRIBUTE_NOTATION_VALUE = 32
  2578. const _XML_ROLE_ATTLIST_NONE = 33
  2579. const _XML_ROLE_ATTLIST_ELEMENT_NAME = 34
  2580. const _XML_ROLE_IMPLIED_ATTRIBUTE_VALUE = 35
  2581. const _XML_ROLE_REQUIRED_ATTRIBUTE_VALUE = 36
  2582. const _XML_ROLE_DEFAULT_ATTRIBUTE_VALUE = 37
  2583. const _XML_ROLE_FIXED_ATTRIBUTE_VALUE = 38
  2584. const _XML_ROLE_ELEMENT_NONE = 39
  2585. const _XML_ROLE_ELEMENT_NAME = 40
  2586. const _XML_ROLE_CONTENT_ANY = 41
  2587. const _XML_ROLE_CONTENT_EMPTY = 42
  2588. const _XML_ROLE_CONTENT_PCDATA = 43
  2589. const _XML_ROLE_GROUP_OPEN = 44
  2590. const _XML_ROLE_GROUP_CLOSE = 45
  2591. const _XML_ROLE_GROUP_CLOSE_REP = 46
  2592. const _XML_ROLE_GROUP_CLOSE_OPT = 47
  2593. const _XML_ROLE_GROUP_CLOSE_PLUS = 48
  2594. const _XML_ROLE_GROUP_CHOICE = 49
  2595. const _XML_ROLE_GROUP_SEQUENCE = 50
  2596. const _XML_ROLE_CONTENT_ELEMENT = 51
  2597. const _XML_ROLE_CONTENT_ELEMENT_REP = 52
  2598. const _XML_ROLE_CONTENT_ELEMENT_OPT = 53
  2599. const _XML_ROLE_CONTENT_ELEMENT_PLUS = 54
  2600. const _XML_ROLE_PI = 55
  2601. const _XML_ROLE_COMMENT = 56
  2602. const _XML_ROLE_TEXT_DECL = 57
  2603. const _XML_ROLE_IGNORE_SECT = 58
  2604. const _XML_ROLE_INNER_PARAM_ENTITY_REF = 59
  2605. const _XML_ROLE_PARAM_ENTITY_REF = 60
  2606. type TPROLOG_STATE = struct {
  2607. Fhandler uintptr
  2608. Flevel uint32
  2609. Frole_none int32
  2610. FincludeLevel uint32
  2611. FdocumentEntity int32
  2612. FinEntityValue int32
  2613. }
  2614. type Tprolog_state = TPROLOG_STATE
  2615. type TKEY = uintptr
  2616. type TNAMED = struct {
  2617. Fname TKEY
  2618. }
  2619. type THASH_TABLE = struct {
  2620. Fv uintptr
  2621. Fpower uint8
  2622. Fsize Tsize_t
  2623. Fused Tsize_t
  2624. Fmem uintptr
  2625. }
  2626. /* For probing (after a collision) we need a step size relative prime
  2627. to the hash table size, which is a power of 2. We use double-hashing,
  2628. since we can calculate a second hash value cheaply by taking those bits
  2629. of the first hash value that were discarded (masked out) when the table
  2630. index was calculated: index = hash & mask, where mask = table->size - 1.
  2631. We limit the maximum step size to table->size / 4 (mask >> 2) and make
  2632. it odd, since odd numbers are always relative prime to a power of 2.
  2633. */
  2634. type THASH_TABLE_ITER = struct {
  2635. Fp uintptr
  2636. Fend uintptr
  2637. }
  2638. type TBINDING = struct {
  2639. Fprefix uintptr
  2640. FnextTagBinding uintptr
  2641. FprevPrefixBinding uintptr
  2642. FattId uintptr
  2643. Furi uintptr
  2644. FuriLen int32
  2645. FuriAlloc int32
  2646. }
  2647. type Tbinding = TBINDING
  2648. type TPREFIX = struct {
  2649. Fname uintptr
  2650. Fbinding uintptr
  2651. }
  2652. type Tprefix = TPREFIX
  2653. type TTAG_NAME = struct {
  2654. Fstr uintptr
  2655. FlocalPart uintptr
  2656. Fprefix uintptr
  2657. FstrLen int32
  2658. FuriLen int32
  2659. FprefixLen int32
  2660. }
  2661. // C documentation
  2662. //
  2663. // /* TAG represents an open element.
  2664. // The name of the element is stored in both the document and API
  2665. // encodings. The memory buffer 'buf' is a separately-allocated
  2666. // memory area which stores the name. During the XML_Parse()/
  2667. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2668. // version of the name (in the document encoding) is shared with the
  2669. // document buffer. If the element is open across calls to
  2670. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2671. // contain the 'raw' name as well.
  2672. //
  2673. // A parser re-uses these structures, maintaining a list of allocated
  2674. // TAG objects in a free list.
  2675. // */
  2676. type TTAG = struct {
  2677. Fparent uintptr
  2678. FrawName uintptr
  2679. FrawNameLength int32
  2680. Fname TTAG_NAME
  2681. Fbuf uintptr
  2682. FbufEnd uintptr
  2683. Fbindings uintptr
  2684. }
  2685. // C documentation
  2686. //
  2687. // /* TAG represents an open element.
  2688. // The name of the element is stored in both the document and API
  2689. // encodings. The memory buffer 'buf' is a separately-allocated
  2690. // memory area which stores the name. During the XML_Parse()/
  2691. // XMLParseBuffer() when the element is open, the memory for the 'raw'
  2692. // version of the name (in the document encoding) is shared with the
  2693. // document buffer. If the element is open across calls to
  2694. // XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to
  2695. // contain the 'raw' name as well.
  2696. //
  2697. // A parser re-uses these structures, maintaining a list of allocated
  2698. // TAG objects in a free list.
  2699. // */
  2700. type Ttag = TTAG
  2701. type TENTITY = struct {
  2702. Fname uintptr
  2703. FtextPtr uintptr
  2704. FtextLen int32
  2705. Fprocessed int32
  2706. FsystemId uintptr
  2707. Fbase uintptr
  2708. FpublicId uintptr
  2709. Fnotation uintptr
  2710. Fopen TXML_Bool
  2711. Fis_param TXML_Bool
  2712. Fis_internal TXML_Bool
  2713. }
  2714. type TCONTENT_SCAFFOLD = struct {
  2715. Ftype1 _XML_Content_Type
  2716. Fquant _XML_Content_Quant
  2717. Fname uintptr
  2718. Ffirstchild int32
  2719. Flastchild int32
  2720. Fchildcnt int32
  2721. Fnextsib int32
  2722. }
  2723. type TBLOCK = struct {
  2724. Fnext uintptr
  2725. Fsize int32
  2726. Fs [1]TXML_Char
  2727. }
  2728. type Tblock = TBLOCK
  2729. type TSTRING_POOL = struct {
  2730. Fblocks uintptr
  2731. FfreeBlocks uintptr
  2732. Fend uintptr
  2733. Fptr uintptr
  2734. Fstart uintptr
  2735. Fmem uintptr
  2736. }
  2737. // C documentation
  2738. //
  2739. // /* The XML_Char before the name is used to determine whether
  2740. // an attribute has been specified. */
  2741. type TATTRIBUTE_ID = struct {
  2742. Fname uintptr
  2743. Fprefix uintptr
  2744. FmaybeTokenized TXML_Bool
  2745. Fxmlns TXML_Bool
  2746. }
  2747. // C documentation
  2748. //
  2749. // /* The XML_Char before the name is used to determine whether
  2750. // an attribute has been specified. */
  2751. type Tattribute_id = TATTRIBUTE_ID
  2752. type TDEFAULT_ATTRIBUTE = struct {
  2753. Fid uintptr
  2754. FisCdata TXML_Bool
  2755. Fvalue uintptr
  2756. }
  2757. type TNS_ATT = struct {
  2758. Fversion uint64
  2759. Fhash uint64
  2760. FuriName uintptr
  2761. }
  2762. type TELEMENT_TYPE = struct {
  2763. Fname uintptr
  2764. Fprefix uintptr
  2765. FidAtt uintptr
  2766. FnDefaultAtts int32
  2767. FallocDefaultAtts int32
  2768. FdefaultAtts uintptr
  2769. }
  2770. type TDTD = struct {
  2771. FgeneralEntities THASH_TABLE
  2772. FelementTypes THASH_TABLE
  2773. FattributeIds THASH_TABLE
  2774. Fprefixes THASH_TABLE
  2775. Fpool TSTRING_POOL
  2776. FentityValuePool TSTRING_POOL
  2777. FkeepProcessing TXML_Bool
  2778. FhasParamEntityRefs TXML_Bool
  2779. Fstandalone TXML_Bool
  2780. FparamEntityRead TXML_Bool
  2781. FparamEntities THASH_TABLE
  2782. FdefaultPrefix TPREFIX
  2783. Fin_eldecl TXML_Bool
  2784. Fscaffold uintptr
  2785. FcontentStringLen uint32
  2786. FscaffSize uint32
  2787. FscaffCount uint32
  2788. FscaffLevel int32
  2789. FscaffIndex uintptr
  2790. }
  2791. type TOPEN_INTERNAL_ENTITY = struct {
  2792. FinternalEventPtr uintptr
  2793. FinternalEventEndPtr uintptr
  2794. Fnext uintptr
  2795. Fentity uintptr
  2796. FstartTagLevel int32
  2797. FbetweenDecl TXML_Bool
  2798. }
  2799. type Topen_internal_entity = TOPEN_INTERNAL_ENTITY
  2800. func XXML_ParserCreate(tls *libc.TLS, encodingName uintptr) (r TXML_Parser) {
  2801. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), libc.UintptrFromInt32(0))
  2802. }
  2803. func XXML_ParserCreateNS(tls *libc.TLS, encodingName uintptr, nsSep TXML_Char) (r TXML_Parser) {
  2804. bp := tls.Alloc(16)
  2805. defer tls.Free(16)
  2806. var _ /* tmp at bp+0 */ [2]TXML_Char
  2807. *(*TXML_Char)(unsafe.Pointer(bp)) = nsSep
  2808. return XXML_ParserCreate_MM(tls, encodingName, libc.UintptrFromInt32(0), bp)
  2809. }
  2810. var _implicitContext = [41]TXML_Char{
  2811. 0: uint8(m_ASCII_x),
  2812. 1: uint8(m_ASCII_m),
  2813. 2: uint8(m_ASCII_l),
  2814. 3: uint8(m_ASCII_EQUALS),
  2815. 4: uint8(m_ASCII_h),
  2816. 5: uint8(m_ASCII_t),
  2817. 6: uint8(m_ASCII_t),
  2818. 7: uint8(m_ASCII_p),
  2819. 8: uint8(m_ASCII_COLON),
  2820. 9: uint8(m_ASCII_SLASH),
  2821. 10: uint8(m_ASCII_SLASH),
  2822. 11: uint8(m_ASCII_w),
  2823. 12: uint8(m_ASCII_w),
  2824. 13: uint8(m_ASCII_w),
  2825. 14: uint8(m_ASCII_PERIOD),
  2826. 15: uint8(m_ASCII_w),
  2827. 16: uint8(m_ASCII_3),
  2828. 17: uint8(m_ASCII_PERIOD),
  2829. 18: uint8(m_ASCII_o),
  2830. 19: uint8(m_ASCII_r),
  2831. 20: uint8(m_ASCII_g),
  2832. 21: uint8(m_ASCII_SLASH),
  2833. 22: uint8(m_ASCII_X),
  2834. 23: uint8(m_ASCII_M),
  2835. 24: uint8(m_ASCII_L),
  2836. 25: uint8(m_ASCII_SLASH),
  2837. 26: uint8(m_ASCII_1),
  2838. 27: uint8(m_ASCII_9),
  2839. 28: uint8(m_ASCII_9),
  2840. 29: uint8(m_ASCII_8),
  2841. 30: uint8(m_ASCII_SLASH),
  2842. 31: uint8(m_ASCII_n),
  2843. 32: uint8(m_ASCII_a),
  2844. 33: uint8(m_ASCII_m),
  2845. 34: uint8(m_ASCII_e),
  2846. 35: uint8(m_ASCII_s),
  2847. 36: uint8(m_ASCII_p),
  2848. 37: uint8(m_ASCII_a),
  2849. 38: uint8(m_ASCII_c),
  2850. 39: uint8(m_ASCII_e),
  2851. }
  2852. /* To avoid warnings about unused functions: */
  2853. // C documentation
  2854. //
  2855. // /* Obtain entropy on Linux 3.17+ */
  2856. func _writeRandomBytes_getrandom_nonblock(tls *libc.TLS, target uintptr, count Tsize_t) (r int32) {
  2857. var bytesToWrite, bytesWrittenTotal Tsize_t
  2858. var bytesWrittenMore, success int32
  2859. var currentTarget uintptr
  2860. var getrandomFlags uint32
  2861. _, _, _, _, _, _ = bytesToWrite, bytesWrittenMore, bytesWrittenTotal, currentTarget, getrandomFlags, success
  2862. success = 0 /* full count bytes written? */
  2863. bytesWrittenTotal = uint64(0)
  2864. getrandomFlags = uint32(m_GRND_NONBLOCK)
  2865. for cond := true; cond; cond = !(success != 0) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  2866. currentTarget = target + uintptr(bytesWrittenTotal)
  2867. bytesToWrite = count - bytesWrittenTotal
  2868. bytesWrittenMore = int32(libc.Xgetrandom(tls, currentTarget, bytesToWrite, getrandomFlags))
  2869. if bytesWrittenMore > 0 {
  2870. bytesWrittenTotal += libc.Uint64FromInt32(bytesWrittenMore)
  2871. if bytesWrittenTotal >= count {
  2872. success = int32(1)
  2873. }
  2874. }
  2875. }
  2876. return success
  2877. }
  2878. // C documentation
  2879. //
  2880. // /* Extract entropy from /dev/urandom */
  2881. func _writeRandomBytes_dev_urandom(tls *libc.TLS, target uintptr, count Tsize_t) (r int32) {
  2882. var bytesToWrite, bytesWrittenTotal Tsize_t
  2883. var bytesWrittenMore Tssize_t
  2884. var currentTarget uintptr
  2885. var fd, success int32
  2886. _, _, _, _, _, _ = bytesToWrite, bytesWrittenMore, bytesWrittenTotal, currentTarget, fd, success
  2887. success = 0 /* full count bytes written? */
  2888. bytesWrittenTotal = uint64(0)
  2889. fd = libc.Xopen(tls, __ccgo_ts+17, m_O_RDONLY, 0)
  2890. if fd < 0 {
  2891. return 0
  2892. }
  2893. for cond := true; cond; cond = !(success != 0) && *(*int32)(unsafe.Pointer(libc.X__errno_location(tls))) == int32(m_EINTR) {
  2894. currentTarget = target + uintptr(bytesWrittenTotal)
  2895. bytesToWrite = count - bytesWrittenTotal
  2896. bytesWrittenMore = libc.Xread(tls, fd, currentTarget, bytesToWrite)
  2897. if bytesWrittenMore > 0 {
  2898. bytesWrittenTotal += libc.Uint64FromInt64(bytesWrittenMore)
  2899. if bytesWrittenTotal >= count {
  2900. success = int32(1)
  2901. }
  2902. }
  2903. }
  2904. libc.Xclose(tls, fd)
  2905. return success
  2906. }
  2907. func _gather_time_entropy(tls *libc.TLS) (r uint64) {
  2908. bp := tls.Alloc(16)
  2909. defer tls.Free(16)
  2910. var gettimeofday_res int32
  2911. var _ /* tv at bp+0 */ Ttimeval
  2912. _ = gettimeofday_res
  2913. gettimeofday_res = libc.Xgettimeofday(tls, bp, libc.UintptrFromInt32(0))
  2914. _ = gettimeofday_res
  2915. /* Microseconds time is <20 bits entropy */
  2916. return libc.Uint64FromInt64((*(*Ttimeval)(unsafe.Pointer(bp))).Ftv_usec)
  2917. }
  2918. func _ENTROPY_DEBUG(tls *libc.TLS, label uintptr, entropy uint64) (r uint64) {
  2919. bp := tls.Alloc(48)
  2920. defer tls.Free(48)
  2921. var EXPAT_ENTROPY_DEBUG uintptr
  2922. _ = EXPAT_ENTROPY_DEBUG
  2923. EXPAT_ENTROPY_DEBUG = libc.Xgetenv(tls, __ccgo_ts+30)
  2924. if EXPAT_ENTROPY_DEBUG != 0 && !(libc.Xstrcmp(tls, EXPAT_ENTROPY_DEBUG, __ccgo_ts+50) != 0) {
  2925. libc.Xfprintf(tls, libc.Xstderr, __ccgo_ts+52, libc.VaList(bp+8, label, libc.Int32FromInt64(8)*libc.Int32FromInt32(2), entropy, libc.Uint64FromInt64(8)))
  2926. }
  2927. return entropy
  2928. }
  2929. func _generate_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2930. bp := tls.Alloc(16)
  2931. defer tls.Free(16)
  2932. var _ /* entropy at bp+0 */ uint64
  2933. _ = parser
  2934. /* "Failproof" high quality providers: */
  2935. /* Try high quality providers first .. */
  2936. if _writeRandomBytes_getrandom_nonblock(tls, bp, uint64(8)) != 0 {
  2937. return _ENTROPY_DEBUG(tls, __ccgo_ts+89, *(*uint64)(unsafe.Pointer(bp)))
  2938. }
  2939. if _writeRandomBytes_dev_urandom(tls, bp, uint64(8)) != 0 {
  2940. return _ENTROPY_DEBUG(tls, __ccgo_ts+17, *(*uint64)(unsafe.Pointer(bp)))
  2941. }
  2942. /* .. and self-made low quality for backup: */
  2943. /* Process ID is 0 bits entropy if attacker has local access */
  2944. *(*uint64)(unsafe.Pointer(bp)) = _gather_time_entropy(tls) ^ libc.Uint64FromInt32(libc.Xgetpid(tls))
  2945. /* Factors are 2^31-1 and 2^61-1 (Mersenne primes M31 and M61) */
  2946. if uint64(8) == uint64(4) {
  2947. return _ENTROPY_DEBUG(tls, __ccgo_ts+99, *(*uint64)(unsafe.Pointer(bp))*uint64(2147483647))
  2948. } else {
  2949. return _ENTROPY_DEBUG(tls, __ccgo_ts+111, *(*uint64)(unsafe.Pointer(bp))*libc.Uint64FromUint64(2305843009213693951))
  2950. }
  2951. return r
  2952. }
  2953. func _get_hash_secret_salt(tls *libc.TLS, parser TXML_Parser) (r uint64) {
  2954. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != libc.UintptrFromInt32(0) {
  2955. return _get_hash_secret_salt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser)
  2956. }
  2957. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  2958. }
  2959. func _startParsing(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  2960. /* hash functions must be initialized before setContext() is called */
  2961. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt == uint64(0) {
  2962. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = _generate_hash_secret_salt(tls, parser)
  2963. }
  2964. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  2965. /* implicit context only set for root parser, since child
  2966. parsers (i.e. external entity parsers) will inherit it
  2967. */
  2968. return _setContext(tls, parser, uintptr(unsafe.Pointer(&_implicitContext)))
  2969. }
  2970. return libc.Uint8FromInt32(1)
  2971. }
  2972. func XXML_ParserCreate_MM(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr) (r TXML_Parser) {
  2973. return _parserCreate(tls, encodingName, memsuite, nameSep, libc.UintptrFromInt32(0))
  2974. }
  2975. func _parserCreate(tls *libc.TLS, encodingName uintptr, memsuite uintptr, nameSep uintptr, dtd uintptr) (r TXML_Parser) {
  2976. var mtemp, mtemp1 uintptr
  2977. var parser TXML_Parser
  2978. _, _, _ = mtemp, mtemp1, parser
  2979. if memsuite != 0 {
  2980. parser = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, uint64(928))
  2981. if parser != libc.UintptrFromInt32(0) {
  2982. mtemp = parser + 24
  2983. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Fmalloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn
  2984. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Frealloc_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Frealloc_fcn
  2985. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp)).Ffree_fcn = (*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Ffree_fcn
  2986. }
  2987. } else {
  2988. parser = libc.Xmalloc(tls, uint64(928))
  2989. if parser != libc.UintptrFromInt32(0) {
  2990. mtemp1 = parser + 24
  2991. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Fmalloc_fcn = __ccgo_fp(libc.Xmalloc)
  2992. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Frealloc_fcn = __ccgo_fp(libc.Xrealloc)
  2993. (*TXML_Memory_Handling_Suite)(unsafe.Pointer(mtemp1)).Ffree_fcn = __ccgo_fp(libc.Xfree)
  2994. }
  2995. }
  2996. if !(parser != 0) {
  2997. return parser
  2998. }
  2999. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = libc.UintptrFromInt32(0)
  3000. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = libc.UintptrFromInt32(0)
  3001. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = int32(m_INIT_ATTS_SIZE)
  3002. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  3003. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts == libc.UintptrFromInt32(0) {
  3004. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3005. return libc.UintptrFromInt32(0)
  3006. }
  3007. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_DATA_BUF_SIZE)*libc.Uint64FromInt64(1))
  3008. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf == libc.UintptrFromInt32(0) {
  3009. (*(*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)
  3010. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3011. return libc.UintptrFromInt32(0)
  3012. }
  3013. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf + uintptr(m_INIT_DATA_BUF_SIZE)
  3014. if dtd != 0 {
  3015. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = dtd
  3016. } else {
  3017. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd = _dtdCreate(tls, parser+24)
  3018. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd == libc.UintptrFromInt32(0) {
  3019. (*(*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)
  3020. (*(*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)
  3021. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3022. return libc.UintptrFromInt32(0)
  3023. }
  3024. }
  3025. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = libc.UintptrFromInt32(0)
  3026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3027. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3028. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  3029. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = libc.UintptrFromInt32(0)
  3030. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = libc.UintptrFromInt32(0)
  3031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = libc.UintptrFromInt32(0)
  3032. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = uint8(m_ASCII_EXCL)
  3033. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(0)
  3034. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(0)
  3035. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = libc.UintptrFromInt32(0)
  3036. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = uint64(0)
  3037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(0)
  3038. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3039. _poolInit(tls, parser+784, parser+24)
  3040. _poolInit(tls, parser+832, parser+24)
  3041. _parserInit(tls, parser, encodingName)
  3042. if encodingName != 0 && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3043. XXML_ParserFree(tls, parser)
  3044. return libc.UintptrFromInt32(0)
  3045. }
  3046. if nameSep != 0 {
  3047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns = libc.Uint8FromInt32(1)
  3048. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncodingNS(tls)
  3049. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator = *(*TXML_Char)(unsafe.Pointer(nameSep))
  3050. } else {
  3051. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding = XXmlGetUtf8InternalEncoding(tls)
  3052. }
  3053. return parser
  3054. }
  3055. func _parserInit(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) {
  3056. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologInitProcessor)
  3057. XXmlPrologStateInit(tls, parser+496)
  3058. if encodingName != libc.UintptrFromInt32(0) {
  3059. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3060. }
  3061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3062. XXmlInitEncoding(tls, parser+296, parser+288, uintptr(0))
  3063. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = libc.UintptrFromInt32(0)
  3064. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = libc.UintptrFromInt32(0)
  3065. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = libc.UintptrFromInt32(0)
  3066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = libc.UintptrFromInt32(0)
  3067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = libc.UintptrFromInt32(0)
  3068. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = libc.UintptrFromInt32(0)
  3069. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = libc.UintptrFromInt32(0)
  3070. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = libc.UintptrFromInt32(0)
  3071. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = libc.UintptrFromInt32(0)
  3072. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = libc.UintptrFromInt32(0)
  3073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3074. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = libc.UintptrFromInt32(0)
  3075. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = libc.UintptrFromInt32(0)
  3076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = libc.UintptrFromInt32(0)
  3077. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3078. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = libc.UintptrFromInt32(0)
  3079. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = libc.UintptrFromInt32(0)
  3080. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = libc.UintptrFromInt32(0)
  3081. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3082. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = libc.UintptrFromInt32(0)
  3083. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = libc.UintptrFromInt32(0)
  3084. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = libc.UintptrFromInt32(0)
  3085. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = libc.UintptrFromInt32(0)
  3086. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = libc.UintptrFromInt32(0)
  3087. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3088. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  3089. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex = 0
  3090. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = libc.UintptrFromInt32(0)
  3091. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = libc.UintptrFromInt32(0)
  3092. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = libc.UintptrFromInt32(0)
  3093. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  3094. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  3095. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0)
  3096. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  3097. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  3098. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  3099. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  3100. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  3101. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  3102. libc.Xmemset(tls, parser+768, 0, uint64(16))
  3103. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NONE)
  3104. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = libc.UintptrFromInt32(0)
  3105. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = libc.UintptrFromInt32(0)
  3106. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3107. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = libc.UintptrFromInt32(0)
  3108. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3109. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = 0
  3110. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = libc.UintptrFromInt32(0)
  3111. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings = libc.UintptrFromInt32(0)
  3112. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = 0
  3113. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = libc.UintptrFromInt32(0)
  3114. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = libc.UintptrFromInt32(0)
  3115. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = libc.UintptrFromInt32(0)
  3116. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = libc.UintptrFromInt32(0)
  3117. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_INITIALIZED)
  3118. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(0)
  3119. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  3120. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  3121. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = uint64(0)
  3122. }
  3123. // C documentation
  3124. //
  3125. // /* moves list of bindings to m_freeBindingList */
  3126. func _moveToFreeBindingList(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  3127. var b uintptr
  3128. _ = b
  3129. for bindings != 0 {
  3130. b = bindings
  3131. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  3132. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  3133. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  3134. }
  3135. }
  3136. func XXML_ParserReset(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r TXML_Bool) {
  3137. var openEntity, openEntityList, tStk, tag uintptr
  3138. _, _, _, _ = openEntity, openEntityList, tStk, tag
  3139. if parser == libc.UintptrFromInt32(0) {
  3140. return libc.Uint8FromInt32(0)
  3141. }
  3142. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3143. return libc.Uint8FromInt32(0)
  3144. }
  3145. /* move m_tagStack to m_freeTagList */
  3146. tStk = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3147. for tStk != 0 {
  3148. tag = tStk
  3149. tStk = (*TTAG)(unsafe.Pointer(tStk)).Fparent
  3150. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3151. _moveToFreeBindingList(tls, parser, (*TTAG)(unsafe.Pointer(tag)).Fbindings)
  3152. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  3153. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag
  3154. }
  3155. /* move m_openInternalEntities to m_freeInternalEntities */
  3156. openEntityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3157. for openEntityList != 0 {
  3158. openEntity = openEntityList
  3159. openEntityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  3160. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3161. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  3162. }
  3163. _moveToFreeBindingList(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings)
  3164. (*(*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)
  3165. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3166. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3167. }
  3168. _poolClear(tls, parser+784)
  3169. _poolClear(tls, parser+832)
  3170. (*(*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)
  3171. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3172. _parserInit(tls, parser, encodingName)
  3173. _dtdReset(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, parser+24)
  3174. return libc.Uint8FromInt32(1)
  3175. }
  3176. func XXML_SetEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Status) {
  3177. if parser == libc.UintptrFromInt32(0) {
  3178. return int32(_XML_STATUS_ERROR)
  3179. }
  3180. /* Block after XML_Parse()/XML_ParseBuffer() has been called.
  3181. XXX There's no way for the caller to determine which of the
  3182. XXX possible error cases caused the XML_STATUS_ERROR return.
  3183. */
  3184. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3185. return int32(_XML_STATUS_ERROR)
  3186. }
  3187. /* Get rid of any previous encoding name */
  3188. (*(*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)
  3189. if encodingName == libc.UintptrFromInt32(0) {
  3190. /* No new encoding name */
  3191. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = libc.UintptrFromInt32(0)
  3192. } else {
  3193. /* Copy the new encoding name into allocated memory */
  3194. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName = _copyString(tls, encodingName, parser+24)
  3195. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName != 0) {
  3196. return int32(_XML_STATUS_ERROR)
  3197. }
  3198. }
  3199. return int32(_XML_STATUS_OK)
  3200. }
  3201. func XXML_ExternalEntityParserCreate(tls *libc.TLS, oldParser TXML_Parser, context uintptr, encodingName uintptr) (r TXML_Parser) {
  3202. bp := tls.Alloc(16)
  3203. defer tls.Free(16)
  3204. var newDtd, oldDeclElementType, oldDtd, oldHandlerArg, oldUserData uintptr
  3205. var oldAttlistDeclHandler TXML_AttlistDeclHandler
  3206. var oldCharacterDataHandler TXML_CharacterDataHandler
  3207. var oldCommentHandler TXML_CommentHandler
  3208. var oldDefaultExpandInternalEntities, oldns_triplets TXML_Bool
  3209. var oldDefaultHandler TXML_DefaultHandler
  3210. var oldElementDeclHandler TXML_ElementDeclHandler
  3211. var oldEndCdataSectionHandler TXML_EndCdataSectionHandler
  3212. var oldEndElementHandler TXML_EndElementHandler
  3213. var oldEndNamespaceDeclHandler TXML_EndNamespaceDeclHandler
  3214. var oldEntityDeclHandler TXML_EntityDeclHandler
  3215. var oldExternalEntityRefHandler TXML_ExternalEntityRefHandler
  3216. var oldExternalEntityRefHandlerArg, parser TXML_Parser
  3217. var oldInEntityValue int32
  3218. var oldNotStandaloneHandler TXML_NotStandaloneHandler
  3219. var oldNotationDeclHandler TXML_NotationDeclHandler
  3220. var oldParamEntityParsing _XML_ParamEntityParsing
  3221. var oldProcessingInstructionHandler TXML_ProcessingInstructionHandler
  3222. var oldSkippedEntityHandler TXML_SkippedEntityHandler
  3223. var oldStartCdataSectionHandler TXML_StartCdataSectionHandler
  3224. var oldStartElementHandler TXML_StartElementHandler
  3225. var oldStartNamespaceDeclHandler TXML_StartNamespaceDeclHandler
  3226. var oldUnknownEncodingHandler TXML_UnknownEncodingHandler
  3227. var oldUnparsedEntityDeclHandler TXML_UnparsedEntityDeclHandler
  3228. var oldXmlDeclHandler TXML_XmlDeclHandler
  3229. var oldhash_secret_salt uint64
  3230. var _ /* tmp at bp+0 */ [2]TXML_Char
  3231. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  3232. parser = oldParser
  3233. newDtd = libc.UintptrFromInt32(0)
  3234. /* Validate the oldParser parameter before we pull everything out of it */
  3235. if oldParser == libc.UintptrFromInt32(0) {
  3236. return libc.UintptrFromInt32(0)
  3237. }
  3238. /* Stash the original parser contents on the stack */
  3239. oldDtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  3240. oldStartElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler
  3241. oldEndElementHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler
  3242. oldCharacterDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  3243. oldProcessingInstructionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler
  3244. oldCommentHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler
  3245. oldStartCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler
  3246. oldEndCdataSectionHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler
  3247. oldDefaultHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler
  3248. oldUnparsedEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler
  3249. oldNotationDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler
  3250. oldStartNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler
  3251. oldEndNamespaceDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler
  3252. oldNotStandaloneHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler
  3253. oldExternalEntityRefHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler
  3254. oldSkippedEntityHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler
  3255. oldUnknownEncodingHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler
  3256. oldElementDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler
  3257. oldAttlistDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler
  3258. oldEntityDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler
  3259. oldXmlDeclHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler
  3260. oldDeclElementType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType
  3261. oldUserData = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3262. oldHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg
  3263. oldDefaultExpandInternalEntities = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities
  3264. oldExternalEntityRefHandlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg
  3265. oldParamEntityParsing = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing
  3266. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  3267. oldns_triplets = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets
  3268. /* Note that the new parser shares the same hash secret as the old
  3269. parser, so that dtdCopy and copyEntityTable can lookup values
  3270. from hash tables associated with either parser without us having
  3271. to worry which hash secrets each table has.
  3272. */
  3273. oldhash_secret_salt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt
  3274. if !(context != 0) {
  3275. newDtd = oldDtd
  3276. }
  3277. /* Note that the magical uses of the pre-processor to make field
  3278. access look more like C++ require that `parser' be overwritten
  3279. here. This makes this function more painful to follow than it
  3280. would be otherwise.
  3281. */
  3282. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  3283. *(*TXML_Char)(unsafe.Pointer(bp)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  3284. parser = _parserCreate(tls, encodingName, parser+24, bp, newDtd)
  3285. } else {
  3286. parser = _parserCreate(tls, encodingName, parser+24, libc.UintptrFromInt32(0), newDtd)
  3287. }
  3288. if !(parser != 0) {
  3289. return libc.UintptrFromInt32(0)
  3290. }
  3291. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = oldStartElementHandler
  3292. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = oldEndElementHandler
  3293. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = oldCharacterDataHandler
  3294. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = oldProcessingInstructionHandler
  3295. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = oldCommentHandler
  3296. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = oldStartCdataSectionHandler
  3297. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = oldEndCdataSectionHandler
  3298. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = oldDefaultHandler
  3299. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler
  3300. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = oldNotationDeclHandler
  3301. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = oldStartNamespaceDeclHandler
  3302. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = oldEndNamespaceDeclHandler
  3303. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = oldNotStandaloneHandler
  3304. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = oldExternalEntityRefHandler
  3305. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = oldSkippedEntityHandler
  3306. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = oldUnknownEncodingHandler
  3307. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = oldElementDeclHandler
  3308. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = oldAttlistDeclHandler
  3309. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = oldEntityDeclHandler
  3310. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = oldXmlDeclHandler
  3311. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = oldDeclElementType
  3312. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = oldUserData
  3313. if oldUserData == oldHandlerArg {
  3314. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData
  3315. } else {
  3316. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3317. }
  3318. if oldExternalEntityRefHandlerArg != oldParser {
  3319. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg
  3320. }
  3321. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = oldDefaultExpandInternalEntities
  3322. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = oldns_triplets
  3323. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = oldhash_secret_salt
  3324. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser = oldParser
  3325. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = oldParamEntityParsing
  3326. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  3327. if context != 0 {
  3328. if !(_dtdCopy(tls, oldParser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, oldDtd, parser+24) != 0) || !(_setContext(tls, parser, context) != 0) {
  3329. XXML_ParserFree(tls, parser)
  3330. return libc.UintptrFromInt32(0)
  3331. }
  3332. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor)
  3333. } else {
  3334. /* The DTD instance referenced by parser->m_dtd is shared between the
  3335. document's root parser and external PE parsers, therefore one does not
  3336. need to call setContext. In addition, one also *must* not call
  3337. setContext, because this would overwrite existing prefix->binding
  3338. pointers in parser->m_dtd with ones that get destroyed with the external
  3339. PE parser. This would leave those prefixes with dangling pointers.
  3340. */
  3341. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity = libc.Uint8FromInt32(1)
  3342. XXmlPrologStateInitExternalEntity(tls, parser+496)
  3343. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntInitProcessor)
  3344. }
  3345. return parser
  3346. }
  3347. func _destroyBindings(tls *libc.TLS, bindings uintptr, parser TXML_Parser) {
  3348. var b uintptr
  3349. _ = b
  3350. for {
  3351. b = bindings
  3352. if !(b != 0) {
  3353. break
  3354. }
  3355. bindings = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  3356. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi)
  3357. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  3358. goto _1
  3359. _1:
  3360. }
  3361. }
  3362. func XXML_ParserFree(tls *libc.TLS, parser TXML_Parser) {
  3363. var entityList, openEntity, p, tagList uintptr
  3364. _, _, _, _ = entityList, openEntity, p, tagList
  3365. if parser == libc.UintptrFromInt32(0) {
  3366. return
  3367. }
  3368. /* free m_tagStack and m_freeTagList */
  3369. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  3370. for {
  3371. if tagList == libc.UintptrFromInt32(0) {
  3372. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList == libc.UintptrFromInt32(0) {
  3373. break
  3374. }
  3375. tagList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  3376. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = libc.UintptrFromInt32(0)
  3377. }
  3378. p = tagList
  3379. tagList = (*TTAG)(unsafe.Pointer(tagList)).Fparent
  3380. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TTAG)(unsafe.Pointer(p)).Fbuf)
  3381. _destroyBindings(tls, (*TTAG)(unsafe.Pointer(p)).Fbindings, parser)
  3382. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, p)
  3383. goto _1
  3384. _1:
  3385. }
  3386. /* free m_openInternalEntities and m_freeInternalEntities */
  3387. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  3388. for {
  3389. if entityList == libc.UintptrFromInt32(0) {
  3390. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities == libc.UintptrFromInt32(0) {
  3391. break
  3392. }
  3393. entityList = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  3394. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = libc.UintptrFromInt32(0)
  3395. }
  3396. openEntity = entityList
  3397. entityList = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(entityList)).Fnext
  3398. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, openEntity)
  3399. goto _2
  3400. _2:
  3401. }
  3402. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList, parser)
  3403. _destroyBindings(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_inheritedBindings, parser)
  3404. _poolDestroy(tls, parser+784)
  3405. _poolDestroy(tls, parser+832)
  3406. (*(*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)
  3407. /* external parameter entity parsers share the DTD structure
  3408. parser->m_dtd with the root parser, so we must not destroy it
  3409. */
  3410. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd != 0 {
  3411. _dtdDestroy(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd, libc.BoolUint8(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0)), parser+24)
  3412. }
  3413. (*(*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)
  3414. (*(*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)
  3415. (*(*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)
  3416. (*(*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)
  3417. (*(*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)
  3418. (*(*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)
  3419. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease != 0 {
  3420. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData)
  3421. }
  3422. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, parser)
  3423. }
  3424. func XXML_UseParserAsHandlerArg(tls *libc.TLS, parser TXML_Parser) {
  3425. if parser != libc.UintptrFromInt32(0) {
  3426. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = parser
  3427. }
  3428. }
  3429. func XXML_UseForeignDTD(tls *libc.TLS, parser TXML_Parser, useDTD TXML_Bool) (r _XML_Error) {
  3430. if parser == libc.UintptrFromInt32(0) {
  3431. return int32(_XML_ERROR_INVALID_ARGUMENT)
  3432. }
  3433. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3434. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3435. return int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING)
  3436. }
  3437. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = useDTD
  3438. return int32(_XML_ERROR_NONE)
  3439. }
  3440. func XXML_SetReturnNSTriplet(tls *libc.TLS, parser TXML_Parser, do_nst int32) {
  3441. var v1 int32
  3442. _ = v1
  3443. if parser == libc.UintptrFromInt32(0) {
  3444. return
  3445. }
  3446. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3447. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3448. return
  3449. }
  3450. if do_nst != 0 {
  3451. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  3452. } else {
  3453. v1 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  3454. }
  3455. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets = libc.Uint8FromInt32(v1)
  3456. }
  3457. func XXML_SetUserData(tls *libc.TLS, parser TXML_Parser, p uintptr) {
  3458. var v1 uintptr
  3459. _ = v1
  3460. if parser == libc.UintptrFromInt32(0) {
  3461. return
  3462. }
  3463. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData {
  3464. v1 = p
  3465. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = v1
  3466. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg = v1
  3467. } else {
  3468. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_userData = p
  3469. }
  3470. }
  3471. func XXML_SetBase(tls *libc.TLS, parser TXML_Parser, p uintptr) (r _XML_Status) {
  3472. if parser == libc.UintptrFromInt32(0) {
  3473. return int32(_XML_STATUS_ERROR)
  3474. }
  3475. if p != 0 {
  3476. p = _poolCopyString(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+160, p)
  3477. if !(p != 0) {
  3478. return int32(_XML_STATUS_ERROR)
  3479. }
  3480. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = p
  3481. } else {
  3482. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase = libc.UintptrFromInt32(0)
  3483. }
  3484. return int32(_XML_STATUS_OK)
  3485. }
  3486. func XXML_GetBase(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  3487. if parser == libc.UintptrFromInt32(0) {
  3488. return libc.UintptrFromInt32(0)
  3489. }
  3490. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  3491. }
  3492. func XXML_GetSpecifiedAttributeCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3493. if parser == libc.UintptrFromInt32(0) {
  3494. return -int32(1)
  3495. }
  3496. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts
  3497. }
  3498. func XXML_GetIdAttributeIndex(tls *libc.TLS, parser TXML_Parser) (r int32) {
  3499. if parser == libc.UintptrFromInt32(0) {
  3500. return -int32(1)
  3501. }
  3502. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex
  3503. }
  3504. func XXML_SetElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler, end TXML_EndElementHandler) {
  3505. if parser == libc.UintptrFromInt32(0) {
  3506. return
  3507. }
  3508. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3509. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3510. }
  3511. func XXML_SetStartElementHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartElementHandler) {
  3512. if parser != libc.UintptrFromInt32(0) {
  3513. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler = start
  3514. }
  3515. }
  3516. func XXML_SetEndElementHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndElementHandler) {
  3517. if parser != libc.UintptrFromInt32(0) {
  3518. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler = end
  3519. }
  3520. }
  3521. func XXML_SetCharacterDataHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CharacterDataHandler) {
  3522. if parser != libc.UintptrFromInt32(0) {
  3523. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler = handler
  3524. }
  3525. }
  3526. func XXML_SetProcessingInstructionHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ProcessingInstructionHandler) {
  3527. if parser != libc.UintptrFromInt32(0) {
  3528. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler = handler
  3529. }
  3530. }
  3531. func XXML_SetCommentHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_CommentHandler) {
  3532. if parser != libc.UintptrFromInt32(0) {
  3533. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler = handler
  3534. }
  3535. }
  3536. func XXML_SetCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler, end TXML_EndCdataSectionHandler) {
  3537. if parser == libc.UintptrFromInt32(0) {
  3538. return
  3539. }
  3540. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3541. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3542. }
  3543. func XXML_SetStartCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartCdataSectionHandler) {
  3544. if parser != libc.UintptrFromInt32(0) {
  3545. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler = start
  3546. }
  3547. }
  3548. func XXML_SetEndCdataSectionHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndCdataSectionHandler) {
  3549. if parser != libc.UintptrFromInt32(0) {
  3550. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler = end
  3551. }
  3552. }
  3553. func XXML_SetDefaultHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3554. if parser == libc.UintptrFromInt32(0) {
  3555. return
  3556. }
  3557. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3558. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(0)
  3559. }
  3560. func XXML_SetDefaultHandlerExpand(tls *libc.TLS, parser TXML_Parser, handler TXML_DefaultHandler) {
  3561. if parser == libc.UintptrFromInt32(0) {
  3562. return
  3563. }
  3564. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler = handler
  3565. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities = libc.Uint8FromInt32(1)
  3566. }
  3567. func XXML_SetDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler, end TXML_EndDoctypeDeclHandler) {
  3568. if parser == libc.UintptrFromInt32(0) {
  3569. return
  3570. }
  3571. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3572. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3573. }
  3574. func XXML_SetStartDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartDoctypeDeclHandler) {
  3575. if parser != libc.UintptrFromInt32(0) {
  3576. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler = start
  3577. }
  3578. }
  3579. func XXML_SetEndDoctypeDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndDoctypeDeclHandler) {
  3580. if parser != libc.UintptrFromInt32(0) {
  3581. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler = end
  3582. }
  3583. }
  3584. func XXML_SetUnparsedEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnparsedEntityDeclHandler) {
  3585. if parser != libc.UintptrFromInt32(0) {
  3586. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler = handler
  3587. }
  3588. }
  3589. func XXML_SetNotationDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotationDeclHandler) {
  3590. if parser != libc.UintptrFromInt32(0) {
  3591. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler = handler
  3592. }
  3593. }
  3594. func XXML_SetNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler, end TXML_EndNamespaceDeclHandler) {
  3595. if parser == libc.UintptrFromInt32(0) {
  3596. return
  3597. }
  3598. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3599. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3600. }
  3601. func XXML_SetStartNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, start TXML_StartNamespaceDeclHandler) {
  3602. if parser != libc.UintptrFromInt32(0) {
  3603. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler = start
  3604. }
  3605. }
  3606. func XXML_SetEndNamespaceDeclHandler(tls *libc.TLS, parser TXML_Parser, end TXML_EndNamespaceDeclHandler) {
  3607. if parser != libc.UintptrFromInt32(0) {
  3608. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler = end
  3609. }
  3610. }
  3611. func XXML_SetNotStandaloneHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_NotStandaloneHandler) {
  3612. if parser != libc.UintptrFromInt32(0) {
  3613. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notStandaloneHandler = handler
  3614. }
  3615. }
  3616. func XXML_SetExternalEntityRefHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_ExternalEntityRefHandler) {
  3617. if parser != libc.UintptrFromInt32(0) {
  3618. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler = handler
  3619. }
  3620. }
  3621. func XXML_SetExternalEntityRefHandlerArg(tls *libc.TLS, parser TXML_Parser, arg uintptr) {
  3622. if parser == libc.UintptrFromInt32(0) {
  3623. return
  3624. }
  3625. if arg != 0 {
  3626. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = arg
  3627. } else {
  3628. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandlerArg = parser
  3629. }
  3630. }
  3631. func XXML_SetSkippedEntityHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_SkippedEntityHandler) {
  3632. if parser != libc.UintptrFromInt32(0) {
  3633. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler = handler
  3634. }
  3635. }
  3636. func XXML_SetUnknownEncodingHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_UnknownEncodingHandler, data uintptr) {
  3637. if parser == libc.UintptrFromInt32(0) {
  3638. return
  3639. }
  3640. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler = handler
  3641. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandlerData = data
  3642. }
  3643. func XXML_SetElementDeclHandler(tls *libc.TLS, parser TXML_Parser, eldecl TXML_ElementDeclHandler) {
  3644. if parser != libc.UintptrFromInt32(0) {
  3645. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler = eldecl
  3646. }
  3647. }
  3648. func XXML_SetAttlistDeclHandler(tls *libc.TLS, parser TXML_Parser, attdecl TXML_AttlistDeclHandler) {
  3649. if parser != libc.UintptrFromInt32(0) {
  3650. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler = attdecl
  3651. }
  3652. }
  3653. func XXML_SetEntityDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_EntityDeclHandler) {
  3654. if parser != libc.UintptrFromInt32(0) {
  3655. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler = handler
  3656. }
  3657. }
  3658. func XXML_SetXmlDeclHandler(tls *libc.TLS, parser TXML_Parser, handler TXML_XmlDeclHandler) {
  3659. if parser != libc.UintptrFromInt32(0) {
  3660. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler = handler
  3661. }
  3662. }
  3663. func XXML_SetParamEntityParsing(tls *libc.TLS, parser TXML_Parser, peParsing _XML_ParamEntityParsing) (r int32) {
  3664. if parser == libc.UintptrFromInt32(0) {
  3665. return 0
  3666. }
  3667. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3668. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3669. return 0
  3670. }
  3671. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = peParsing
  3672. return int32(1)
  3673. }
  3674. func XXML_SetHashSalt(tls *libc.TLS, parser TXML_Parser, hash_salt uint64) (r int32) {
  3675. if parser == libc.UintptrFromInt32(0) {
  3676. return 0
  3677. }
  3678. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  3679. return XXML_SetHashSalt(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser, hash_salt)
  3680. }
  3681. /* block after XML_Parse()/XML_ParseBuffer() has been called */
  3682. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_PARSING) || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  3683. return 0
  3684. }
  3685. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_hash_secret_salt = hash_salt
  3686. return int32(1)
  3687. }
  3688. func XXML_Parse(tls *libc.TLS, parser TXML_Parser, s uintptr, len1 int32, isFinal int32) (r _XML_Status) {
  3689. var buff uintptr
  3690. _ = buff
  3691. if parser == libc.UintptrFromInt32(0) || len1 < 0 || s == libc.UintptrFromInt32(0) && len1 != 0 {
  3692. if parser != libc.UintptrFromInt32(0) {
  3693. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_INVALID_ARGUMENT)
  3694. }
  3695. return int32(_XML_STATUS_ERROR)
  3696. }
  3697. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3698. case int32(_XML_SUSPENDED):
  3699. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3700. return int32(_XML_STATUS_ERROR)
  3701. case int32(_XML_FINISHED):
  3702. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3703. return int32(_XML_STATUS_ERROR)
  3704. case int32(_XML_INITIALIZED):
  3705. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3706. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3707. return int32(_XML_STATUS_ERROR)
  3708. }
  3709. /* fall through */
  3710. fallthrough
  3711. default:
  3712. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3713. }
  3714. if len1 == 0 {
  3715. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3716. if !(isFinal != 0) {
  3717. return int32(_XML_STATUS_OK)
  3718. }
  3719. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3720. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3721. /* If data are left over from last buffer, and we now know that these
  3722. data are the final chunk of input, then we have to check them again
  3723. to detect errors based on that fact.
  3724. */
  3725. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3726. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode == int32(_XML_ERROR_NONE) {
  3727. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3728. case int32(_XML_SUSPENDED):
  3729. /* It is hard to be certain, but it seems that this case
  3730. * cannot occur. This code is cleaning up a previous parse
  3731. * with no new data (since len == 0). Changing the parsing
  3732. * state requires getting to execute a handler function, and
  3733. * there doesn't seem to be an opportunity for that while in
  3734. * this circumstance.
  3735. *
  3736. * Given the uncertainty, we retain the code but exclude it
  3737. * from coverage tests.
  3738. *
  3739. * LCOV_EXCL_START
  3740. */
  3741. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  3742. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3743. return int32(_XML_STATUS_SUSPENDED)
  3744. /* LCOV_EXCL_STOP */
  3745. fallthrough
  3746. case int32(_XML_INITIALIZED):
  3747. fallthrough
  3748. case int32(_XML_PARSING):
  3749. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3750. /* fall through */
  3751. fallthrough
  3752. default:
  3753. return int32(_XML_STATUS_OK)
  3754. }
  3755. }
  3756. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3757. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3758. return int32(_XML_STATUS_ERROR)
  3759. } else {
  3760. buff = XXML_GetBuffer(tls, parser, len1)
  3761. if buff == libc.UintptrFromInt32(0) {
  3762. return int32(_XML_STATUS_ERROR)
  3763. } else {
  3764. libc.Xmemcpy(tls, buff, s, libc.Uint64FromInt32(len1))
  3765. return XXML_ParseBuffer(tls, parser, len1, isFinal)
  3766. }
  3767. }
  3768. return r
  3769. }
  3770. func XXML_ParseBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32, isFinal int32) (r _XML_Status) {
  3771. var result _XML_Status
  3772. var start uintptr
  3773. _, _ = result, start
  3774. result = int32(_XML_STATUS_OK)
  3775. if parser == libc.UintptrFromInt32(0) {
  3776. return int32(_XML_STATUS_ERROR)
  3777. }
  3778. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3779. case int32(_XML_SUSPENDED):
  3780. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3781. return int32(_XML_STATUS_ERROR)
  3782. case int32(_XML_FINISHED):
  3783. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3784. return int32(_XML_STATUS_ERROR)
  3785. case int32(_XML_INITIALIZED):
  3786. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser == libc.UintptrFromInt32(0) && !(_startParsing(tls, parser) != 0) {
  3787. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3788. return int32(_XML_STATUS_ERROR)
  3789. }
  3790. /* fall through */
  3791. fallthrough
  3792. default:
  3793. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3794. }
  3795. start = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3796. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = start
  3797. *(*uintptr)(unsafe.Pointer(parser + 56)) += uintptr(len1)
  3798. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3799. *(*TXML_Index)(unsafe.Pointer(parser + 72)) += int64(len1)
  3800. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer = libc.Uint8FromInt32(isFinal)
  3801. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, start, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3802. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3803. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3804. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3805. return int32(_XML_STATUS_ERROR)
  3806. } else {
  3807. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3808. case int32(_XML_SUSPENDED):
  3809. result = int32(_XML_STATUS_SUSPENDED)
  3810. case int32(_XML_INITIALIZED):
  3811. fallthrough
  3812. case int32(_XML_PARSING):
  3813. if isFinal != 0 {
  3814. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3815. return result
  3816. }
  3817. fallthrough
  3818. default: /* should not happen */
  3819. }
  3820. }
  3821. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  3822. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  3823. return result
  3824. }
  3825. func XXML_GetBuffer(tls *libc.TLS, parser TXML_Parser, len1 int32) (r uintptr) {
  3826. var bufferSize, keep, neededSize, offset int32
  3827. var newBuf, v10, v11 uintptr
  3828. var v1, v2, v3, v4, v5, v6, v7, v8, v9 int64
  3829. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = bufferSize, keep, neededSize, newBuf, offset, v1, v10, v11, v2, v3, v4, v5, v6, v7, v8, v9
  3830. if parser == libc.UintptrFromInt32(0) {
  3831. return libc.UintptrFromInt32(0)
  3832. }
  3833. if len1 < 0 {
  3834. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3835. return libc.UintptrFromInt32(0)
  3836. }
  3837. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3838. case int32(_XML_SUSPENDED):
  3839. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3840. return libc.UintptrFromInt32(0)
  3841. case int32(_XML_FINISHED):
  3842. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3843. return libc.UintptrFromInt32(0)
  3844. default:
  3845. }
  3846. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 {
  3847. v1 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)
  3848. } else {
  3849. v1 = 0
  3850. }
  3851. if int64(len1) > v1 {
  3852. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3853. v2 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3854. } else {
  3855. v2 = 0
  3856. }
  3857. /* Do not invoke signed arithmetic overflow: */
  3858. neededSize = libc.Int32FromUint32(libc.Uint32FromInt32(len1) + libc.Uint32FromInt64(v2))
  3859. if neededSize < 0 {
  3860. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3861. return libc.UintptrFromInt32(0)
  3862. }
  3863. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3864. v3 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3865. } else {
  3866. v3 = 0
  3867. }
  3868. keep = int32(v3)
  3869. if keep > int32(m_XML_CONTEXT_BYTES) {
  3870. keep = int32(m_XML_CONTEXT_BYTES)
  3871. }
  3872. neededSize += keep
  3873. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3874. v4 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3875. } else {
  3876. v4 = 0
  3877. }
  3878. if int64(neededSize) <= v4 {
  3879. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3880. v5 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3881. } else {
  3882. v5 = 0
  3883. }
  3884. if int64(keep) < v5 {
  3885. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  3886. v6 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer)
  3887. } else {
  3888. v6 = 0
  3889. }
  3890. offset = int32(v6) - keep
  3891. /* The buffer pointers cannot be NULL here; we have at least some bytes
  3892. * in the buffer */
  3893. libc.Xmemmove(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer+uintptr(offset), libc.Uint64FromInt64(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd)-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)+int64(keep)))
  3894. *(*uintptr)(unsafe.Pointer(parser + 56)) -= uintptr(offset)
  3895. *(*uintptr)(unsafe.Pointer(parser + 48)) -= uintptr(offset)
  3896. }
  3897. } else {
  3898. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3899. v7 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3900. } else {
  3901. v7 = 0
  3902. }
  3903. bufferSize = int32(v7)
  3904. if bufferSize == 0 {
  3905. bufferSize = int32(m_INIT_BUFFER_SIZE)
  3906. }
  3907. for cond := true; cond; cond = bufferSize < neededSize && bufferSize > 0 {
  3908. /* Do not invoke signed arithmetic overflow: */
  3909. bufferSize = libc.Int32FromUint32(libc.Uint32FromUint32(2) * libc.Uint32FromInt32(bufferSize))
  3910. }
  3911. if bufferSize <= 0 {
  3912. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3913. return libc.UintptrFromInt32(0)
  3914. }
  3915. newBuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(bufferSize))
  3916. if newBuf == uintptr(0) {
  3917. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NO_MEMORY)
  3918. return libc.UintptrFromInt32(0)
  3919. }
  3920. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferLim = newBuf + uintptr(bufferSize)
  3921. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3922. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3923. v8 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3924. } else {
  3925. v8 = 0
  3926. }
  3927. libc.Xmemcpy(tls, newBuf, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr+uintptr(-keep), libc.Uint64FromInt64(v8+int64(keep)))
  3928. (*(*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)
  3929. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = newBuf
  3930. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr != 0 {
  3931. v9 = int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr)
  3932. } else {
  3933. v9 = 0
  3934. }
  3935. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(v9) + uintptr(keep)
  3936. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer + uintptr(keep)
  3937. } else {
  3938. /* This must be a brand new buffer with no data in it yet */
  3939. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd = newBuf
  3940. v10 = newBuf
  3941. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer = v10
  3942. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr = v10
  3943. }
  3944. }
  3945. v11 = libc.UintptrFromInt32(0)
  3946. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = v11
  3947. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v11
  3948. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = libc.UintptrFromInt32(0)
  3949. }
  3950. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd
  3951. }
  3952. func XXML_StopParser(tls *libc.TLS, parser TXML_Parser, resumable TXML_Bool) (r _XML_Status) {
  3953. if parser == libc.UintptrFromInt32(0) {
  3954. return int32(_XML_STATUS_ERROR)
  3955. }
  3956. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3957. case int32(_XML_SUSPENDED):
  3958. if resumable != 0 {
  3959. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPENDED)
  3960. return int32(_XML_STATUS_ERROR)
  3961. }
  3962. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3963. case int32(_XML_FINISHED):
  3964. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_FINISHED)
  3965. return int32(_XML_STATUS_ERROR)
  3966. default:
  3967. if resumable != 0 {
  3968. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 {
  3969. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_SUSPEND_PE)
  3970. return int32(_XML_STATUS_ERROR)
  3971. }
  3972. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_SUSPENDED)
  3973. } else {
  3974. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  3975. }
  3976. }
  3977. return int32(_XML_STATUS_OK)
  3978. }
  3979. func XXML_ResumeParser(tls *libc.TLS, parser TXML_Parser) (r _XML_Status) {
  3980. var result _XML_Status
  3981. _ = result
  3982. result = int32(_XML_STATUS_OK)
  3983. if parser == libc.UintptrFromInt32(0) {
  3984. return int32(_XML_STATUS_ERROR)
  3985. }
  3986. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_SUSPENDED) {
  3987. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = int32(_XML_ERROR_NOT_SUSPENDED)
  3988. return int32(_XML_STATUS_ERROR)
  3989. }
  3990. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_PARSING)
  3991. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode = (*(*func(*libc.TLS, TXML_Parser, uintptr, uintptr, uintptr) _XML_Error)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor})))(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr, parser+48)
  3992. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode != int32(_XML_ERROR_NONE) {
  3993. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  3994. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_errorProcessor)
  3995. return int32(_XML_STATUS_ERROR)
  3996. } else {
  3997. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  3998. case int32(_XML_SUSPENDED):
  3999. result = int32(_XML_STATUS_SUSPENDED)
  4000. case int32(_XML_INITIALIZED):
  4001. fallthrough
  4002. case int32(_XML_PARSING):
  4003. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0 {
  4004. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing = int32(_XML_FINISHED)
  4005. return result
  4006. }
  4007. fallthrough
  4008. default:
  4009. }
  4010. }
  4011. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr, parser+768)
  4012. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferPtr
  4013. return result
  4014. }
  4015. func XXML_GetParsingStatus(tls *libc.TLS, parser TXML_Parser, status uintptr) {
  4016. if parser == libc.UintptrFromInt32(0) {
  4017. return
  4018. }
  4019. *(*TXML_ParsingStatus)(unsafe.Pointer(status)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus
  4020. }
  4021. func XXML_GetErrorCode(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  4022. if parser == libc.UintptrFromInt32(0) {
  4023. return int32(_XML_ERROR_INVALID_ARGUMENT)
  4024. }
  4025. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  4026. }
  4027. func XXML_GetCurrentByteIndex(tls *libc.TLS, parser TXML_Parser) (r TXML_Index) {
  4028. if parser == libc.UintptrFromInt32(0) {
  4029. return int64(-int32(1))
  4030. }
  4031. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4032. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndByteIndex - (int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parseEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4033. }
  4034. return int64(-int32(1))
  4035. }
  4036. func XXML_GetCurrentByteCount(tls *libc.TLS, parser TXML_Parser) (r int32) {
  4037. if parser == libc.UintptrFromInt32(0) {
  4038. return 0
  4039. }
  4040. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 {
  4041. return int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr))
  4042. }
  4043. return 0
  4044. }
  4045. func XXML_GetInputContext(tls *libc.TLS, parser TXML_Parser, offset uintptr, size uintptr) (r uintptr) {
  4046. if parser == libc.UintptrFromInt32(0) {
  4047. return libc.UintptrFromInt32(0)
  4048. }
  4049. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer != 0 {
  4050. if offset != libc.UintptrFromInt32(0) {
  4051. *(*int32)(unsafe.Pointer(offset)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4052. }
  4053. if size != libc.UintptrFromInt32(0) {
  4054. *(*int32)(unsafe.Pointer(size)) = int32(int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_bufferEnd) - int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer))
  4055. }
  4056. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_buffer
  4057. }
  4058. return libc.UintptrFromInt32(0)
  4059. }
  4060. func XXML_GetCurrentLineNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4061. if parser == libc.UintptrFromInt32(0) {
  4062. return uint64(0)
  4063. }
  4064. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4065. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  4066. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4067. }
  4068. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FlineNumber + uint64(1)
  4069. }
  4070. func XXML_GetCurrentColumnNumber(tls *libc.TLS, parser TXML_Parser) (r TXML_Size) {
  4071. if parser == libc.UintptrFromInt32(0) {
  4072. return uint64(0)
  4073. }
  4074. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr {
  4075. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FupdatePosition})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, parser+768)
  4076. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_positionPtr = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr
  4077. }
  4078. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_position.FcolumnNumber
  4079. }
  4080. func XXML_FreeContentModel(tls *libc.TLS, parser TXML_Parser, model uintptr) {
  4081. if parser != libc.UintptrFromInt32(0) {
  4082. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, model)
  4083. }
  4084. }
  4085. func XXML_MemMalloc(tls *libc.TLS, parser TXML_Parser, size Tsize_t) (r uintptr) {
  4086. if parser == libc.UintptrFromInt32(0) {
  4087. return libc.UintptrFromInt32(0)
  4088. }
  4089. return (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, size)
  4090. }
  4091. func XXML_MemRealloc(tls *libc.TLS, parser TXML_Parser, ptr uintptr, size Tsize_t) (r uintptr) {
  4092. if parser == libc.UintptrFromInt32(0) {
  4093. return libc.UintptrFromInt32(0)
  4094. }
  4095. return (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, ptr, size)
  4096. }
  4097. func XXML_MemFree(tls *libc.TLS, parser TXML_Parser, ptr uintptr) {
  4098. if parser != libc.UintptrFromInt32(0) {
  4099. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, ptr)
  4100. }
  4101. }
  4102. func XXML_DefaultCurrent(tls *libc.TLS, parser TXML_Parser) {
  4103. if parser == libc.UintptrFromInt32(0) {
  4104. return
  4105. }
  4106. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4107. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0 {
  4108. _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)
  4109. } else {
  4110. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr)
  4111. }
  4112. }
  4113. }
  4114. func XXML_ErrorString(tls *libc.TLS, code _XML_Error) (r uintptr) {
  4115. switch code {
  4116. case int32(_XML_ERROR_NONE):
  4117. return libc.UintptrFromInt32(0)
  4118. case int32(_XML_ERROR_NO_MEMORY):
  4119. return __ccgo_ts + 123
  4120. case int32(_XML_ERROR_SYNTAX):
  4121. return __ccgo_ts + 137
  4122. case int32(_XML_ERROR_NO_ELEMENTS):
  4123. return __ccgo_ts + 150
  4124. case int32(_XML_ERROR_INVALID_TOKEN):
  4125. return __ccgo_ts + 167
  4126. case int32(_XML_ERROR_UNCLOSED_TOKEN):
  4127. return __ccgo_ts + 199
  4128. case int32(_XML_ERROR_PARTIAL_CHAR):
  4129. return __ccgo_ts + 214
  4130. case int32(_XML_ERROR_TAG_MISMATCH):
  4131. return __ccgo_ts + 232
  4132. case int32(_XML_ERROR_DUPLICATE_ATTRIBUTE):
  4133. return __ccgo_ts + 247
  4134. case int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT):
  4135. return __ccgo_ts + 267
  4136. case int32(_XML_ERROR_PARAM_ENTITY_REF):
  4137. return __ccgo_ts + 295
  4138. case int32(_XML_ERROR_UNDEFINED_ENTITY):
  4139. return __ccgo_ts + 330
  4140. case int32(_XML_ERROR_RECURSIVE_ENTITY_REF):
  4141. return __ccgo_ts + 347
  4142. case int32(_XML_ERROR_ASYNC_ENTITY):
  4143. return __ccgo_ts + 374
  4144. case int32(_XML_ERROR_BAD_CHAR_REF):
  4145. return __ccgo_ts + 394
  4146. case int32(_XML_ERROR_BINARY_ENTITY_REF):
  4147. return __ccgo_ts + 432
  4148. case int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF):
  4149. return __ccgo_ts + 459
  4150. case int32(_XML_ERROR_MISPLACED_XML_PI):
  4151. return __ccgo_ts + 501
  4152. case int32(_XML_ERROR_UNKNOWN_ENCODING):
  4153. return __ccgo_ts + 548
  4154. case int32(_XML_ERROR_INCORRECT_ENCODING):
  4155. return __ccgo_ts + 565
  4156. case int32(_XML_ERROR_UNCLOSED_CDATA_SECTION):
  4157. return __ccgo_ts + 616
  4158. case int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING):
  4159. return __ccgo_ts + 639
  4160. case int32(_XML_ERROR_NOT_STANDALONE):
  4161. return __ccgo_ts + 685
  4162. case int32(_XML_ERROR_UNEXPECTED_STATE):
  4163. return __ccgo_ts + 712
  4164. case int32(_XML_ERROR_ENTITY_DECLARED_IN_PE):
  4165. return __ccgo_ts + 763
  4166. case int32(_XML_ERROR_FEATURE_REQUIRES_XML_DTD):
  4167. return __ccgo_ts + 799
  4168. case int32(_XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING):
  4169. return __ccgo_ts + 851
  4170. /* Added in 1.95.7. */
  4171. fallthrough
  4172. case int32(_XML_ERROR_UNBOUND_PREFIX):
  4173. return __ccgo_ts + 896
  4174. /* Added in 1.95.8. */
  4175. fallthrough
  4176. case int32(_XML_ERROR_UNDECLARING_PREFIX):
  4177. return __ccgo_ts + 911
  4178. case int32(_XML_ERROR_INCOMPLETE_PE):
  4179. return __ccgo_ts + 937
  4180. case int32(_XML_ERROR_XML_DECL):
  4181. return __ccgo_ts + 975
  4182. case int32(_XML_ERROR_TEXT_DECL):
  4183. return __ccgo_ts + 1007
  4184. case int32(_XML_ERROR_PUBLICID):
  4185. return __ccgo_ts + 1040
  4186. case int32(_XML_ERROR_SUSPENDED):
  4187. return __ccgo_ts + 1074
  4188. case int32(_XML_ERROR_NOT_SUSPENDED):
  4189. return __ccgo_ts + 1091
  4190. case int32(_XML_ERROR_ABORTED):
  4191. return __ccgo_ts + 1112
  4192. case int32(_XML_ERROR_FINISHED):
  4193. return __ccgo_ts + 1128
  4194. case int32(_XML_ERROR_SUSPEND_PE):
  4195. return __ccgo_ts + 1145
  4196. /* Added in 2.0.0. */
  4197. fallthrough
  4198. case int32(_XML_ERROR_RESERVED_PREFIX_XML):
  4199. return __ccgo_ts + 1189
  4200. case int32(_XML_ERROR_RESERVED_PREFIX_XMLNS):
  4201. return __ccgo_ts + 1269
  4202. case int32(_XML_ERROR_RESERVED_NAMESPACE_URI):
  4203. return __ccgo_ts + 1328
  4204. /* Added in 2.2.5. */
  4205. fallthrough
  4206. case int32(_XML_ERROR_INVALID_ARGUMENT): /* Constant added in 2.2.1, already */
  4207. return __ccgo_ts + 1392
  4208. }
  4209. return libc.UintptrFromInt32(0)
  4210. }
  4211. func XXML_ExpatVersion(tls *libc.TLS) (r uintptr) {
  4212. /* V1 is used to string-ize the version number. However, it would
  4213. string-ize the actual version macro *names* unless we get them
  4214. substituted before being passed to V1. CPP is defined to expand
  4215. a macro, then rescan for more expansions. Thus, we use V2 to expand
  4216. the version macros, then CPP will expand the resulting V1() macro
  4217. with the correct numerals. */
  4218. /* ### I'm assuming cpp is portable in this respect... */
  4219. return __ccgo_ts + 1409
  4220. }
  4221. func XXML_ExpatVersionInfo(tls *libc.TLS) (r TXML_Expat_Version) {
  4222. var version TXML_Expat_Version
  4223. _ = version
  4224. version.Fmajor = int32(m_XML_MAJOR_VERSION)
  4225. version.Fminor = int32(m_XML_MINOR_VERSION)
  4226. version.Fmicro = int32(m_XML_MICRO_VERSION)
  4227. return version
  4228. }
  4229. func XXML_GetFeatureList(tls *libc.TLS) (r uintptr) {
  4230. return uintptr(unsafe.Pointer(&_features))
  4231. }
  4232. var _features = [6]TXML_Feature{
  4233. 0: {
  4234. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_CHAR),
  4235. Fname: __ccgo_ts + 1422,
  4236. Fvalue: int64(1),
  4237. },
  4238. 1: {
  4239. Ffeature: int32(_XML_FEATURE_SIZEOF_XML_LCHAR),
  4240. Fname: __ccgo_ts + 1439,
  4241. Fvalue: int64(1),
  4242. },
  4243. 2: {
  4244. Ffeature: int32(_XML_FEATURE_DTD),
  4245. Fname: __ccgo_ts + 1457,
  4246. },
  4247. 3: {
  4248. Ffeature: int32(_XML_FEATURE_CONTEXT_BYTES),
  4249. Fname: __ccgo_ts + 1465,
  4250. Fvalue: int64(m_XML_CONTEXT_BYTES),
  4251. },
  4252. 4: {
  4253. Ffeature: int32(_XML_FEATURE_NS),
  4254. Fname: __ccgo_ts + 1483,
  4255. },
  4256. 5: {},
  4257. }
  4258. // C documentation
  4259. //
  4260. // /* Initially tag->rawName always points into the parse buffer;
  4261. // for those TAG instances opened while the current parse buffer was
  4262. // processed, and not yet closed, we need to store tag->rawName in a more
  4263. // permanent location, since the parse buffer is about to be discarded.
  4264. // */
  4265. func _storeRawNames(tls *libc.TLS, parser TXML_Parser) (r TXML_Bool) {
  4266. var bufSize, nameLen int32
  4267. var rawNameBuf, tag, temp uintptr
  4268. _, _, _, _, _ = bufSize, nameLen, rawNameBuf, tag, temp
  4269. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4270. for tag != 0 {
  4271. nameLen = libc.Int32FromUint64(uint64(1) * libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen+libc.Int32FromInt32(1)))
  4272. rawNameBuf = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(nameLen)
  4273. /* Stop if already stored. Since m_tagStack is a stack, we can stop
  4274. at the first entry that has already been copied; everything
  4275. below it in the stack is already been accounted for in a
  4276. previous call to this function.
  4277. */
  4278. if (*TTAG)(unsafe.Pointer(tag)).FrawName == rawNameBuf {
  4279. break
  4280. }
  4281. /* For re-use purposes we need to ensure that the
  4282. size of tag->buf is a multiple of sizeof(XML_Char).
  4283. */
  4284. bufSize = libc.Int32FromUint64(libc.Uint64FromInt32(nameLen) + (libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)+(libc.Uint64FromInt64(1)-libc.Uint64FromInt32(1))) & ^(libc.Uint64FromInt64(1)-libc.Uint64FromInt32(1)))
  4285. if int64(bufSize) > int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf) {
  4286. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  4287. if temp == libc.UintptrFromInt32(0) {
  4288. return libc.Uint8FromInt32(0)
  4289. }
  4290. /* if tag->name.str points to tag->buf (only when namespace
  4291. processing is off) then we have to update it
  4292. */
  4293. if (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr == (*TTAG)(unsafe.Pointer(tag)).Fbuf {
  4294. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = temp
  4295. }
  4296. /* if tag->name.localPart is set (when namespace processing is on)
  4297. then update it as well, since it will always point into tag->buf
  4298. */
  4299. if (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart != 0 {
  4300. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = temp + uintptr(int64((*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4301. }
  4302. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4303. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4304. rawNameBuf = temp + uintptr(nameLen)
  4305. }
  4306. libc.Xmemcpy(tls, rawNameBuf, (*TTAG)(unsafe.Pointer(tag)).FrawName, libc.Uint64FromInt32((*TTAG)(unsafe.Pointer(tag)).FrawNameLength))
  4307. (*TTAG)(unsafe.Pointer(tag)).FrawName = rawNameBuf
  4308. tag = (*TTAG)(unsafe.Pointer(tag)).Fparent
  4309. }
  4310. return libc.Uint8FromInt32(1)
  4311. }
  4312. func _contentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4313. var result _XML_Error
  4314. _ = result
  4315. 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)))
  4316. if result == int32(_XML_ERROR_NONE) {
  4317. if !(_storeRawNames(tls, parser) != 0) {
  4318. return int32(_XML_ERROR_NO_MEMORY)
  4319. }
  4320. }
  4321. return result
  4322. }
  4323. func _externalEntityInitProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4324. var result _XML_Error
  4325. _ = result
  4326. result = _initializeEncoding(tls, parser)
  4327. if result != int32(_XML_ERROR_NONE) {
  4328. return result
  4329. }
  4330. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor2)
  4331. return _externalEntityInitProcessor2(tls, parser, start, end, endPtr)
  4332. }
  4333. func _externalEntityInitProcessor2(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4334. bp := tls.Alloc(16)
  4335. defer tls.Free(16)
  4336. var tok int32
  4337. var _ /* next at bp+0 */ uintptr
  4338. _ = tok
  4339. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4340. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4341. switch tok {
  4342. case int32(m_XML_TOK_BOM):
  4343. /* If we are at the end of the buffer, this would cause the next stage,
  4344. i.e. externalEntityInitProcessor3, to pass control directly to
  4345. doContent (by detecting XML_TOK_NONE) without processing any xml text
  4346. declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent.
  4347. */
  4348. if *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4349. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4350. return int32(_XML_ERROR_NONE)
  4351. }
  4352. start = *(*uintptr)(unsafe.Pointer(bp))
  4353. case -int32(1):
  4354. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4355. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4356. return int32(_XML_ERROR_NONE)
  4357. }
  4358. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4359. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4360. case -int32(2):
  4361. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4362. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4363. return int32(_XML_ERROR_NONE)
  4364. }
  4365. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4366. return int32(_XML_ERROR_PARTIAL_CHAR)
  4367. }
  4368. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityInitProcessor3)
  4369. return _externalEntityInitProcessor3(tls, parser, start, end, endPtr)
  4370. }
  4371. func _externalEntityInitProcessor3(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4372. bp := tls.Alloc(16)
  4373. defer tls.Free(16)
  4374. var result _XML_Error
  4375. var tok int32
  4376. var _ /* next at bp+0 */ uintptr
  4377. _, _ = result, tok
  4378. *(*uintptr)(unsafe.Pointer(bp)) = start /* XmlContentTok doesn't always set the last arg */
  4379. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  4380. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding + 1*8))})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, start, end, bp)
  4381. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  4382. switch tok {
  4383. case int32(m_XML_TOK_XML_DECL):
  4384. result = _processXmlDecl(tls, parser, int32(1), start, *(*uintptr)(unsafe.Pointer(bp)))
  4385. if result != int32(_XML_ERROR_NONE) {
  4386. return result
  4387. }
  4388. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4389. case int32(_XML_SUSPENDED):
  4390. *(*uintptr)(unsafe.Pointer(endPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4391. return int32(_XML_ERROR_NONE)
  4392. case int32(_XML_FINISHED):
  4393. return int32(_XML_ERROR_ABORTED)
  4394. default:
  4395. start = *(*uintptr)(unsafe.Pointer(bp))
  4396. }
  4397. case -int32(1):
  4398. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4399. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4400. return int32(_XML_ERROR_NONE)
  4401. }
  4402. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4403. case -int32(2):
  4404. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  4405. *(*uintptr)(unsafe.Pointer(endPtr)) = start
  4406. return int32(_XML_ERROR_NONE)
  4407. }
  4408. return int32(_XML_ERROR_PARTIAL_CHAR)
  4409. }
  4410. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  4411. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel = int32(1)
  4412. return _externalEntityContentProcessor(tls, parser, start, end, endPtr)
  4413. }
  4414. func _externalEntityContentProcessor(tls *libc.TLS, parser TXML_Parser, start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  4415. var result _XML_Error
  4416. _ = result
  4417. 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)))
  4418. if result == int32(_XML_ERROR_NONE) {
  4419. if !(_storeRawNames(tls, parser) != 0) {
  4420. return int32(_XML_ERROR_NO_MEMORY)
  4421. }
  4422. }
  4423. return result
  4424. }
  4425. func _doContent(tls *libc.TLS, parser TXML_Parser, startTagLevel int32, enc uintptr, _s uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  4426. bp := tls.Alloc(112)
  4427. defer tls.Free(112)
  4428. *(*uintptr)(unsafe.Pointer(bp)) = _s
  4429. var b, context, dtd, entity, eventEndPP, eventPP, localPart, name, prefix, rawName, rawName1, rawNameEnd, tag, tag1, temp, uri, v3, v4, v5, v6, v7, v9 uintptr
  4430. var bufSize, convLen, len1, n, tok int32
  4431. var charDataHandler TXML_CharacterDataHandler
  4432. var convert_res, convert_res1 _XML_Convert_Result
  4433. var noElmHandlers TXML_Bool
  4434. var result, result1, result2, result3 _XML_Error
  4435. var _ /* bindings at bp+40 */ uintptr
  4436. var _ /* buf at bp+88 */ [4]TXML_Char
  4437. var _ /* c at bp+16 */ TXML_Char
  4438. var _ /* c at bp+92 */ TXML_Char
  4439. var _ /* ch at bp+17 */ TXML_Char
  4440. var _ /* dataPtr at bp+104 */ uintptr
  4441. var _ /* dataPtr at bp+96 */ uintptr
  4442. var _ /* fromPtr at bp+32 */ uintptr
  4443. var _ /* name at bp+48 */ TTAG_NAME
  4444. var _ /* next at bp+8 */ uintptr
  4445. var _ /* toPtr at bp+24 */ uintptr
  4446. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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, v3, v4, v5, v6, v7, v9
  4447. /* save one level of indirection */
  4448. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  4449. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  4450. eventPP = parser + 544
  4451. eventEndPP = parser + 552
  4452. } else {
  4453. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  4454. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  4455. }
  4456. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4457. for {
  4458. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* XmlContentTok doesn't always set the last arg */
  4459. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 1*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  4460. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4461. switch tok {
  4462. case -int32(3):
  4463. if haveMore != 0 {
  4464. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4465. return int32(_XML_ERROR_NONE)
  4466. }
  4467. *(*uintptr)(unsafe.Pointer(eventEndPP)) = end
  4468. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4469. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  4470. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  4471. } else {
  4472. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4473. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4474. }
  4475. }
  4476. /* We are at the end of the final buffer, should we check for
  4477. XML_SUSPENDED, XML_FINISHED?
  4478. */
  4479. if startTagLevel == 0 {
  4480. return int32(_XML_ERROR_NO_ELEMENTS)
  4481. }
  4482. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4483. return int32(_XML_ERROR_ASYNC_ENTITY)
  4484. }
  4485. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4486. return int32(_XML_ERROR_NONE)
  4487. case -int32(4):
  4488. if haveMore != 0 {
  4489. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4490. return int32(_XML_ERROR_NONE)
  4491. }
  4492. if startTagLevel > 0 {
  4493. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4494. return int32(_XML_ERROR_ASYNC_ENTITY)
  4495. }
  4496. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4497. return int32(_XML_ERROR_NONE)
  4498. }
  4499. return int32(_XML_ERROR_NO_ELEMENTS)
  4500. case m_XML_TOK_INVALID:
  4501. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4502. return int32(_XML_ERROR_INVALID_TOKEN)
  4503. case -int32(1):
  4504. if haveMore != 0 {
  4505. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4506. return int32(_XML_ERROR_NONE)
  4507. }
  4508. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  4509. case -int32(2):
  4510. if haveMore != 0 {
  4511. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4512. return int32(_XML_ERROR_NONE)
  4513. }
  4514. return int32(_XML_ERROR_PARTIAL_CHAR)
  4515. case int32(m_XML_TOK_ENTITY_REF):
  4516. *(*TXML_Char)(unsafe.Pointer(bp + 17)) = libc.Uint8FromInt32((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  4517. if *(*TXML_Char)(unsafe.Pointer(bp + 17)) != 0 {
  4518. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4519. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+17, int32(1))
  4520. } else {
  4521. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4522. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4523. }
  4524. }
  4525. break
  4526. }
  4527. name = _poolStoreString(tls, dtd+160, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp + 8))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  4528. if !(name != 0) {
  4529. return int32(_XML_ERROR_NO_MEMORY)
  4530. }
  4531. entity = _lookup(tls, parser, dtd, name, uint64(0))
  4532. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  4533. /* First, determine if a check for an existing declaration is needed;
  4534. if yes, check that the entity exists, and that it is internal,
  4535. otherwise call the skipped entity or default handler.
  4536. */
  4537. if !((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  4538. if !(entity != 0) {
  4539. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  4540. } else {
  4541. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  4542. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  4543. }
  4544. }
  4545. } else {
  4546. if !(entity != 0) {
  4547. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4548. (*(*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)
  4549. } else {
  4550. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4551. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4552. }
  4553. }
  4554. break
  4555. }
  4556. }
  4557. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  4558. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  4559. }
  4560. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  4561. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  4562. }
  4563. if (*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0 {
  4564. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultExpandInternalEntities != 0) {
  4565. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  4566. (*(*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)
  4567. } else {
  4568. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4569. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4570. }
  4571. }
  4572. break
  4573. }
  4574. result = _processInternalEntity(tls, parser, entity, libc.Uint8FromInt32(0))
  4575. if result != int32(_XML_ERROR_NONE) {
  4576. return result
  4577. }
  4578. } else {
  4579. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  4580. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  4581. context = _getContext(tls, parser)
  4582. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  4583. if !(context != 0) {
  4584. return int32(_XML_ERROR_NO_MEMORY)
  4585. }
  4586. 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) {
  4587. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  4588. }
  4589. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  4590. } else {
  4591. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4592. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4593. }
  4594. }
  4595. }
  4596. case int32(m_XML_TOK_START_TAG_NO_ATTS):
  4597. /* fall through */
  4598. fallthrough
  4599. case int32(m_XML_TOK_START_TAG_WITH_ATTS):
  4600. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList != 0 {
  4601. tag = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4602. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = (*TTAG)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList)).Fparent
  4603. } else {
  4604. tag = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(88))
  4605. if !(tag != 0) {
  4606. return int32(_XML_ERROR_NO_MEMORY)
  4607. }
  4608. (*TTAG)(unsafe.Pointer(tag)).Fbuf = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(libc.Int32FromInt32(m_INIT_TAG_BUF_SIZE)))
  4609. if !((*TTAG)(unsafe.Pointer(tag)).Fbuf != 0) {
  4610. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, tag)
  4611. return int32(_XML_ERROR_NO_MEMORY)
  4612. }
  4613. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = (*TTAG)(unsafe.Pointer(tag)).Fbuf + uintptr(m_INIT_TAG_BUF_SIZE)
  4614. }
  4615. (*TTAG)(unsafe.Pointer(tag)).Fbindings = libc.UintptrFromInt32(0)
  4616. (*TTAG)(unsafe.Pointer(tag)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4617. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = tag
  4618. (*TTAG)(unsafe.Pointer(tag)).Fname.FlocalPart = libc.UintptrFromInt32(0)
  4619. (*TTAG)(unsafe.Pointer(tag)).Fname.Fprefix = libc.UintptrFromInt32(0)
  4620. (*TTAG)(unsafe.Pointer(tag)).FrawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4621. (*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)
  4622. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel++
  4623. rawNameEnd = (*TTAG)(unsafe.Pointer(tag)).FrawName + uintptr((*TTAG)(unsafe.Pointer(tag)).FrawNameLength)
  4624. *(*uintptr)(unsafe.Pointer(bp + 32)) = (*TTAG)(unsafe.Pointer(tag)).FrawName
  4625. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4626. for {
  4627. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp+32, rawNameEnd, bp+24, (*TTAG)(unsafe.Pointer(tag)).FbufEnd-uintptr(1))
  4628. convLen = int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24))) - int64((*TTAG)(unsafe.Pointer(tag)).Fbuf))
  4629. if *(*uintptr)(unsafe.Pointer(bp + 32)) >= rawNameEnd || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4630. (*TTAG)(unsafe.Pointer(tag)).Fname.FstrLen = convLen
  4631. break
  4632. }
  4633. bufSize = int32(int64((*TTAG)(unsafe.Pointer(tag)).FbufEnd)-int64((*TTAG)(unsafe.Pointer(tag)).Fbuf)) << int32(1)
  4634. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TTAG)(unsafe.Pointer(tag)).Fbuf, libc.Uint64FromInt32(bufSize))
  4635. if temp == libc.UintptrFromInt32(0) {
  4636. return int32(_XML_ERROR_NO_MEMORY)
  4637. }
  4638. (*TTAG)(unsafe.Pointer(tag)).Fbuf = temp
  4639. (*TTAG)(unsafe.Pointer(tag)).FbufEnd = temp + uintptr(bufSize)
  4640. *(*uintptr)(unsafe.Pointer(bp + 24)) = temp + uintptr(convLen)
  4641. goto _2
  4642. _2:
  4643. }
  4644. (*TTAG)(unsafe.Pointer(tag)).Fname.Fstr = (*TTAG)(unsafe.Pointer(tag)).Fbuf
  4645. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24)))) = uint8('\000')
  4646. result1 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), tag+24, tag+80)
  4647. if result1 != 0 {
  4648. return result1
  4649. }
  4650. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4651. (*(*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)
  4652. } else {
  4653. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4654. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4655. }
  4656. }
  4657. _poolClear(tls, parser+784)
  4658. case int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS):
  4659. /* fall through */
  4660. fallthrough
  4661. case int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS):
  4662. rawName = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  4663. *(*uintptr)(unsafe.Pointer(bp + 40)) = libc.UintptrFromInt32(0)
  4664. noElmHandlers = libc.Uint8FromInt32(1)
  4665. (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr = _poolStoreString(tls, parser+784, enc, rawName, rawName+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName)))
  4666. if !((*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr != 0) {
  4667. return int32(_XML_ERROR_NO_MEMORY)
  4668. }
  4669. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4670. result2 = _storeAtts(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), bp+48, bp+40)
  4671. if result2 != int32(_XML_ERROR_NONE) {
  4672. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4673. return result2
  4674. }
  4675. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  4676. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4677. (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts)
  4678. noElmHandlers = libc.Uint8FromInt32(0)
  4679. }
  4680. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4681. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startElementHandler != 0 {
  4682. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(eventEndPP))
  4683. }
  4684. (*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*(*TTAG_NAME)(unsafe.Pointer(bp + 48))).Fstr)
  4685. noElmHandlers = libc.Uint8FromInt32(0)
  4686. }
  4687. if noElmHandlers != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4688. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4689. }
  4690. _poolClear(tls, parser+784)
  4691. _freeBindings(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 40)))
  4692. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4693. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4694. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4695. } else {
  4696. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4697. }
  4698. }
  4699. case int32(m_XML_TOK_END_TAG):
  4700. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == startTagLevel {
  4701. return int32(_XML_ERROR_ASYNC_ENTITY)
  4702. } else {
  4703. tag1 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  4704. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack = (*TTAG)(unsafe.Pointer(tag1)).Fparent
  4705. (*TTAG)(unsafe.Pointer(tag1)).Fparent = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList
  4706. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeTagList = tag1
  4707. rawName1 = *(*uintptr)(unsafe.Pointer(bp)) + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2))
  4708. len1 = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, rawName1)
  4709. if len1 != (*TTAG)(unsafe.Pointer(tag1)).FrawNameLength || libc.Xmemcmp(tls, (*TTAG)(unsafe.Pointer(tag1)).FrawName, rawName1, libc.Uint64FromInt32(len1)) != 0 {
  4710. *(*uintptr)(unsafe.Pointer(eventPP)) = rawName1
  4711. return int32(_XML_ERROR_TAG_MISMATCH)
  4712. }
  4713. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel--
  4714. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endElementHandler != 0 {
  4715. localPart = (*TTAG)(unsafe.Pointer(tag1)).Fname.FlocalPart
  4716. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && localPart != 0 {
  4717. /* localPart and prefix may have been overwritten in
  4718. tag->name.str, since this points to the binding->uri
  4719. buffer which gets re-used; so we have to add them again
  4720. */
  4721. uri = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fstr + uintptr((*TTAG)(unsafe.Pointer(tag1)).Fname.FuriLen)
  4722. /* don't need to check for space - already done in storeAtts() */
  4723. for *(*TXML_Char)(unsafe.Pointer(localPart)) != 0 {
  4724. v3 = uri
  4725. uri++
  4726. v4 = localPart
  4727. localPart++
  4728. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(v4))
  4729. }
  4730. prefix = (*TTAG)(unsafe.Pointer(tag1)).Fname.Fprefix
  4731. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && prefix != 0 {
  4732. v5 = uri
  4733. uri++
  4734. *(*TXML_Char)(unsafe.Pointer(v5)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  4735. for *(*TXML_Char)(unsafe.Pointer(prefix)) != 0 {
  4736. v6 = uri
  4737. uri++
  4738. v7 = prefix
  4739. prefix++
  4740. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer(v7))
  4741. }
  4742. }
  4743. *(*TXML_Char)(unsafe.Pointer(uri)) = uint8('\000')
  4744. }
  4745. (*(*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)
  4746. } else {
  4747. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4748. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4749. }
  4750. }
  4751. for (*TTAG)(unsafe.Pointer(tag1)).Fbindings != 0 {
  4752. b = (*TTAG)(unsafe.Pointer(tag1)).Fbindings
  4753. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4754. (*(*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)
  4755. }
  4756. (*TTAG)(unsafe.Pointer(tag1)).Fbindings = (*TBINDING)(unsafe.Pointer((*TTAG)(unsafe.Pointer(tag1)).Fbindings)).FnextTagBinding
  4757. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4758. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4759. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4760. }
  4761. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel == 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing != int32(_XML_FINISHED) {
  4762. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  4763. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  4764. } else {
  4765. return _epilogProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp + 8)), end, nextPtr)
  4766. }
  4767. }
  4768. }
  4769. case int32(m_XML_TOK_CHAR_REF):
  4770. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)))
  4771. if n < 0 {
  4772. return int32(_XML_ERROR_BAD_CHAR_REF)
  4773. }
  4774. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4775. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+88, XXmlUtf8Encode(tls, n, bp+88))
  4776. } else {
  4777. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4778. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4779. }
  4780. }
  4781. case int32(m_XML_TOK_XML_DECL):
  4782. return int32(_XML_ERROR_MISPLACED_XML_PI)
  4783. case int32(m_XML_TOK_DATA_NEWLINE):
  4784. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4785. *(*TXML_Char)(unsafe.Pointer(bp + 92)) = uint8(0xA)
  4786. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+92, int32(1))
  4787. } else {
  4788. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4789. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4790. }
  4791. }
  4792. case int32(m_XML_TOK_CDATA_SECT_OPEN):
  4793. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler != 0 {
  4794. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  4795. } else {
  4796. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4797. (*(*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)
  4798. } else {
  4799. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4800. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4801. }
  4802. }
  4803. }
  4804. result3 = _doCdataSection(tls, parser, enc, bp+8, end, nextPtr, haveMore)
  4805. if result3 != int32(_XML_ERROR_NONE) {
  4806. return result3
  4807. } else {
  4808. if !(*(*uintptr)(unsafe.Pointer(bp + 8)) != 0) {
  4809. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_cdataSectionProcessor)
  4810. return result3
  4811. }
  4812. }
  4813. case -int32(5):
  4814. if haveMore != 0 {
  4815. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  4816. return int32(_XML_ERROR_NONE)
  4817. }
  4818. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  4819. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4820. *(*uintptr)(unsafe.Pointer(bp + 96)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4821. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+96, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  4822. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 96)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  4823. } else {
  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, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  4825. }
  4826. } else {
  4827. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4828. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), end)
  4829. }
  4830. }
  4831. /* We are at the end of the final buffer, should we check for
  4832. XML_SUSPENDED, XML_FINISHED?
  4833. */
  4834. if startTagLevel == 0 {
  4835. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4836. return int32(_XML_ERROR_NO_ELEMENTS)
  4837. }
  4838. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel != startTagLevel {
  4839. *(*uintptr)(unsafe.Pointer(eventPP)) = end
  4840. return int32(_XML_ERROR_ASYNC_ENTITY)
  4841. }
  4842. *(*uintptr)(unsafe.Pointer(nextPtr)) = end
  4843. return int32(_XML_ERROR_NONE)
  4844. case int32(m_XML_TOK_DATA_CHARS):
  4845. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  4846. if charDataHandler != 0 {
  4847. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  4848. for {
  4849. *(*uintptr)(unsafe.Pointer(bp + 104)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  4850. convert_res1 = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+104, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  4851. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4852. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 104)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  4853. if convert_res1 == int32(_XML_CONVERT_COMPLETED) || convert_res1 == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  4854. break
  4855. }
  4856. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  4857. goto _8
  4858. _8:
  4859. }
  4860. } else {
  4861. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  4862. }
  4863. } else {
  4864. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4865. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4866. }
  4867. }
  4868. case int32(m_XML_TOK_PI):
  4869. if !(_reportProcessingInstruction(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4870. return int32(_XML_ERROR_NO_MEMORY)
  4871. }
  4872. case int32(m_XML_TOK_COMMENT):
  4873. if !(_reportComment(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8))) != 0) {
  4874. return int32(_XML_ERROR_NO_MEMORY)
  4875. }
  4876. default:
  4877. /* All of the tokens produced by XmlContentTok() have their own
  4878. * explicit cases, so this default is not strictly necessary.
  4879. * However it is a useful safety net, so we retain the code and
  4880. * simply exclude it from the coverage tests.
  4881. *
  4882. * LCOV_EXCL_START
  4883. */
  4884. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  4885. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  4886. }
  4887. break
  4888. /* LCOV_EXCL_STOP */
  4889. }
  4890. v9 = *(*uintptr)(unsafe.Pointer(bp + 8))
  4891. *(*uintptr)(unsafe.Pointer(bp)) = v9
  4892. *(*uintptr)(unsafe.Pointer(eventPP)) = v9
  4893. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  4894. case int32(_XML_SUSPENDED):
  4895. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  4896. return int32(_XML_ERROR_NONE)
  4897. case int32(_XML_FINISHED):
  4898. return int32(_XML_ERROR_ABORTED)
  4899. default:
  4900. }
  4901. goto _1
  4902. _1:
  4903. }
  4904. /* not reached */
  4905. return r
  4906. }
  4907. // C documentation
  4908. //
  4909. // /* This function does not call free() on the allocated memory, merely
  4910. // * moving it to the parser's m_freeBindingList where it can be freed or
  4911. // * reused as appropriate.
  4912. // */
  4913. func _freeBindings(tls *libc.TLS, parser TXML_Parser, bindings uintptr) {
  4914. var b uintptr
  4915. _ = b
  4916. for bindings != 0 {
  4917. b = bindings
  4918. /* m_startNamespaceDeclHandler will have been called for this
  4919. * binding in addBindings(), so call the end handler now.
  4920. */
  4921. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endNamespaceDeclHandler != 0 {
  4922. (*(*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)
  4923. }
  4924. bindings = (*TBINDING)(unsafe.Pointer(bindings)).FnextTagBinding
  4925. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  4926. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = b
  4927. (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fbinding = (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding
  4928. }
  4929. }
  4930. // C documentation
  4931. //
  4932. // /* Precondition: all arguments must be non-NULL;
  4933. // Purpose:
  4934. // - normalize attributes
  4935. // - check attributes for well-formedness
  4936. // - generate namespace aware attribute names (URI, prefix)
  4937. // - build list of attributes for startElementHandler
  4938. // - default attributes
  4939. // - process namespace declarations (check and report them)
  4940. // - generate namespace aware element name (URI, prefix)
  4941. // */
  4942. func _storeAtts(tls *libc.TLS, parser TXML_Parser, enc uintptr, attStr uintptr, tagNamePtr uintptr, bindingsPtr uintptr) (r _XML_Error) {
  4943. bp := tls.Alloc(80)
  4944. defer tls.Free(80)
  4945. 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
  4946. var attIndex, i, j, j1, n, nDefaultAtts, nPrefixes, nsAttsSize, oldAttsSize, prefixLen, v13, v17, v2, v23, v30, v33, v38, v40, v6, v7, v8, v9 int32
  4947. var c TXML_Char
  4948. var isCdata TXML_Bool
  4949. var mask, uriHash, version, v14 uint64
  4950. var oldNsAttsPower, step, v10 uint8
  4951. var result, result1, result2 _XML_Error
  4952. var _ /* sip_key at bp+56 */ Tsipkey
  4953. var _ /* sip_state at bp+0 */ Tsiphash
  4954. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  4955. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* the attribute list for the application */
  4956. attIndex = 0
  4957. nPrefixes = 0
  4958. /* lookup the element type name */
  4959. elementType = _lookup(tls, parser, dtd+40, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr, uint64(0))
  4960. if !(elementType != 0) {
  4961. name = _poolCopyString(tls, dtd+160, (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr)
  4962. if !(name != 0) {
  4963. return int32(_XML_ERROR_NO_MEMORY)
  4964. }
  4965. elementType = _lookup(tls, parser, dtd+40, name, uint64(40))
  4966. if !(elementType != 0) {
  4967. return int32(_XML_ERROR_NO_MEMORY)
  4968. }
  4969. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 && !(_setElementTypePrefix(tls, parser, elementType) != 0) {
  4970. return int32(_XML_ERROR_NO_MEMORY)
  4971. }
  4972. }
  4973. nDefaultAtts = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FnDefaultAtts
  4974. /* get the attributes from the tokenizer */
  4975. 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)
  4976. if n+nDefaultAtts > (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize {
  4977. oldAttsSize = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize
  4978. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = n + nDefaultAtts + int32(m_INIT_ATTS_SIZE)
  4979. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts, libc.Uint64FromInt32((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize)*libc.Uint64FromInt64(32))
  4980. if temp == libc.UintptrFromInt32(0) {
  4981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attsSize = oldAttsSize
  4982. return int32(_XML_ERROR_NO_MEMORY)
  4983. }
  4984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts = temp
  4985. if n > oldAttsSize {
  4986. (*(*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)
  4987. }
  4988. }
  4989. appAtts = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts
  4990. i = 0
  4991. for {
  4992. if !(i < n) {
  4993. break
  4994. }
  4995. currAtt = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32
  4996. /* add the name and value to the attribute list */
  4997. 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)))
  4998. if !(attId != 0) {
  4999. return int32(_XML_ERROR_NO_MEMORY)
  5000. }
  5001. /* Detect duplicate attributes by their QNames. This does not work when
  5002. namespace processing is turned on and different prefixes for the same
  5003. namespace are used. For this case we have a check further down.
  5004. */
  5005. if *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) != 0 {
  5006. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5007. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fname
  5008. }
  5009. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5010. }
  5011. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5012. v2 = attIndex
  5013. attIndex++
  5014. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v2)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname
  5015. if !((*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).Fnormalized != 0) {
  5016. isCdata = libc.Uint8FromInt32(1)
  5017. /* figure out whether declared as other than CDATA */
  5018. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized != 0 {
  5019. j = 0
  5020. for {
  5021. if !(j < nDefaultAtts) {
  5022. break
  5023. }
  5024. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).Fid {
  5025. isCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(j)*24))).FisCdata
  5026. break
  5027. }
  5028. goto _3
  5029. _3:
  5030. ;
  5031. j++
  5032. }
  5033. }
  5034. /* normalize the attribute value */
  5035. result = _storeAttributeValue(tls, parser, enc, isCdata, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd, parser+784)
  5036. if result != 0 {
  5037. return result
  5038. }
  5039. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5040. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5041. } else {
  5042. /* the value did not need normalizing */
  5043. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = _poolStoreString(tls, parser+784, enc, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvaluePtr, (*(*TATTRIBUTE)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_atts + uintptr(i)*32))).FvalueEnd)
  5044. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) == uintptr(0) {
  5045. return int32(_XML_ERROR_NO_MEMORY)
  5046. }
  5047. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5048. }
  5049. /* handle prefixed attribute names */
  5050. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix != 0 {
  5051. if (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0 {
  5052. /* deal with namespace declarations here */
  5053. result1 = _addBinding(tls, parser, (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fprefix, attId, *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)), bindingsPtr)
  5054. if result1 != 0 {
  5055. return result1
  5056. }
  5057. attIndex--
  5058. } else {
  5059. /* deal with other prefixed names later */
  5060. attIndex++
  5061. nPrefixes++
  5062. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5063. }
  5064. } else {
  5065. attIndex++
  5066. }
  5067. goto _1
  5068. _1:
  5069. ;
  5070. i++
  5071. }
  5072. /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */
  5073. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nSpecifiedAtts = attIndex
  5074. 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 {
  5075. i = 0
  5076. for {
  5077. if !(i < attIndex) {
  5078. break
  5079. }
  5080. if *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) == (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FidAtt)).Fname {
  5081. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = i
  5082. break
  5083. }
  5084. goto _4
  5085. _4:
  5086. ;
  5087. i += int32(2)
  5088. }
  5089. } else {
  5090. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_idAttIndex = -int32(1)
  5091. }
  5092. /* do attribute defaulting */
  5093. i = 0
  5094. for {
  5095. if !(i < nDefaultAtts) {
  5096. break
  5097. }
  5098. da = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).FdefaultAtts + uintptr(i)*24
  5099. 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 {
  5100. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fprefix != 0 {
  5101. if (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fxmlns != 0 {
  5102. 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)
  5103. if result2 != 0 {
  5104. return result2
  5105. }
  5106. } else {
  5107. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(2)
  5108. nPrefixes++
  5109. v6 = attIndex
  5110. attIndex++
  5111. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v6)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5112. v7 = attIndex
  5113. attIndex++
  5114. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v7)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5115. }
  5116. } else {
  5117. *(*TXML_Char)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(1)
  5118. v8 = attIndex
  5119. attIndex++
  5120. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v8)*8)) = (*TATTRIBUTE_ID)(unsafe.Pointer((*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fid)).Fname
  5121. v9 = attIndex
  5122. attIndex++
  5123. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(v9)*8)) = (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(da)).Fvalue
  5124. }
  5125. }
  5126. goto _5
  5127. _5:
  5128. ;
  5129. i++
  5130. }
  5131. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(attIndex)*8)) = uintptr(0)
  5132. /* expand prefixed attribute names, check for duplicates,
  5133. and clear flags that say whether attributes were specified */
  5134. i = 0
  5135. if nPrefixes != 0 { /* hash table index */
  5136. version = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion
  5137. nsAttsSize = libc.Int32FromInt32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5138. oldNsAttsPower = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5139. /* size of hash table must be at least 2 * (# of prefixed attributes) */
  5140. if nPrefixes<<int32(1)>>(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower != 0 {
  5141. /* hash table size must also be a power of 2 and >= 8 */
  5142. for {
  5143. v11 = parser + 760
  5144. v10 = *(*uint8)(unsafe.Pointer(v11))
  5145. *(*uint8)(unsafe.Pointer(v11))++
  5146. if !(nPrefixes>>v10 != 0) {
  5147. break
  5148. }
  5149. }
  5150. if libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower) < int32(3) {
  5151. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = uint8(3)
  5152. }
  5153. nsAttsSize = libc.Int32FromInt32(1) << (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower
  5154. 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, libc.Uint64FromInt32(nsAttsSize)*libc.Uint64FromInt64(24))
  5155. if !(temp1 != 0) {
  5156. /* Restore actual size of memory in m_nsAtts */
  5157. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower = oldNsAttsPower
  5158. return int32(_XML_ERROR_NO_MEMORY)
  5159. }
  5160. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts = temp1
  5161. version = uint64(0) /* force re-initialization of m_nsAtts hash table */
  5162. }
  5163. /* using a version flag saves us from initializing m_nsAtts every time */
  5164. if !(version != 0) { /* initialize version flags when version wraps around */
  5165. version = uint64(m_INIT_ATTS_VERSION)
  5166. j1 = nsAttsSize
  5167. for {
  5168. if !(j1 != 0) {
  5169. break
  5170. }
  5171. j1--
  5172. v13 = j1
  5173. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(v13)*24))).Fversion = version
  5174. goto _12
  5175. _12:
  5176. }
  5177. }
  5178. version--
  5179. v14 = version
  5180. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsVersion = v14
  5181. /* expand prefixed names and check for duplicates */
  5182. for {
  5183. if !(i < attIndex) {
  5184. break
  5185. }
  5186. s = *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8))
  5187. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1))))) == int32(2) {
  5188. _copy_salt_to_sipkey(tls, parser, bp+56)
  5189. _sip24_init(tls, bp, bp+56)
  5190. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0) /* clear flag */
  5191. id = _lookup(tls, parser, dtd+80, s, uint64(0))
  5192. if !(id != 0) || !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  5193. /* This code is walking through the appAtts array, dealing
  5194. * with (in this case) a prefixed attribute name. To be in
  5195. * the array, the attribute must have already been bound, so
  5196. * has to have passed through the hash table lookup once
  5197. * already. That implies that an entry for it already
  5198. * exists, so the lookup above will return a pointer to
  5199. * already allocated memory. There is no opportunaity for
  5200. * the allocator to fail, so the condition above cannot be
  5201. * fulfilled.
  5202. *
  5203. * Since it is difficult to be certain that the above
  5204. * analysis is complete, we retain the test and merely
  5205. * remove the code from coverage tests.
  5206. */
  5207. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  5208. }
  5209. b = (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fbinding
  5210. if !(b != 0) {
  5211. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5212. }
  5213. j1 = 0
  5214. for {
  5215. if !(j1 < (*TBINDING)(unsafe.Pointer(b)).FuriLen) {
  5216. break
  5217. }
  5218. c = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(j1)))
  5219. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5220. v17 = 0
  5221. } else {
  5222. v19 = parser + 784 + 24
  5223. v18 = *(*uintptr)(unsafe.Pointer(v19))
  5224. *(*uintptr)(unsafe.Pointer(v19))++
  5225. *(*TXML_Char)(unsafe.Pointer(v18)) = c
  5226. v17 = libc.Int32FromInt32(1)
  5227. }
  5228. if !(v17 != 0) {
  5229. return int32(_XML_ERROR_NO_MEMORY)
  5230. }
  5231. goto _16
  5232. _16:
  5233. ;
  5234. j1++
  5235. }
  5236. _sip24_update(tls, bp, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(b)).FuriLen)*uint64(1))
  5237. for {
  5238. v20 = s
  5239. s++
  5240. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v20))) != int32(m_ASCII_COLON)) {
  5241. break
  5242. }
  5243. }
  5244. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  5245. for { /* copies null terminator */
  5246. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5247. v23 = 0
  5248. } else {
  5249. v25 = parser + 784 + 24
  5250. v24 = *(*uintptr)(unsafe.Pointer(v25))
  5251. *(*uintptr)(unsafe.Pointer(v25))++
  5252. *(*TXML_Char)(unsafe.Pointer(v24)) = *(*TXML_Char)(unsafe.Pointer(s))
  5253. v23 = libc.Int32FromInt32(1)
  5254. }
  5255. if !(v23 != 0) {
  5256. return int32(_XML_ERROR_NO_MEMORY)
  5257. }
  5258. goto _22
  5259. _22:
  5260. ;
  5261. v21 = s
  5262. s++
  5263. if !(*(*TXML_Char)(unsafe.Pointer(v21)) != 0) {
  5264. break
  5265. }
  5266. }
  5267. uriHash = _sip24_final(tls, bp)
  5268. /* Check hash table for duplicate of expanded name (uriName).
  5269. Derived from code in lookup(parser, HASH_TABLE *table, ...).
  5270. */
  5271. step = uint8(0)
  5272. mask = libc.Uint64FromInt32(nsAttsSize - int32(1))
  5273. j1 = libc.Int32FromUint64(uriHash & mask) /* index into hash table */
  5274. for (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion == version {
  5275. /* for speed we compare stored hash values first */
  5276. if uriHash == (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash {
  5277. s1 = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5278. s2 = (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName
  5279. /* s1 is null terminated, but not s2 */
  5280. for {
  5281. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2))) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) != 0) {
  5282. break
  5283. }
  5284. goto _26
  5285. _26:
  5286. ;
  5287. s1++
  5288. s2++
  5289. }
  5290. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  5291. return int32(_XML_ERROR_DUPLICATE_ATTRIBUTE)
  5292. }
  5293. }
  5294. if !(step != 0) {
  5295. step = uint8(uriHash & ^mask >> (libc.Int32FromUint8((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAttsPower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  5296. }
  5297. if j1 < libc.Int32FromUint8(step) {
  5298. j1 += nsAttsSize - libc.Int32FromUint8(step)
  5299. } else {
  5300. j1 -= libc.Int32FromUint8(step)
  5301. }
  5302. }
  5303. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 { /* append namespace separator and prefix */
  5304. *(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fptr + uintptr(-libc.Int32FromInt32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5305. s = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Fprefix)).Fname
  5306. for {
  5307. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  5308. v30 = 0
  5309. } else {
  5310. v32 = parser + 784 + 24
  5311. v31 = *(*uintptr)(unsafe.Pointer(v32))
  5312. *(*uintptr)(unsafe.Pointer(v32))++
  5313. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s))
  5314. v30 = libc.Int32FromInt32(1)
  5315. }
  5316. if !(v30 != 0) {
  5317. return int32(_XML_ERROR_NO_MEMORY)
  5318. }
  5319. goto _29
  5320. _29:
  5321. ;
  5322. v28 = s
  5323. s++
  5324. if !(*(*TXML_Char)(unsafe.Pointer(v28)) != 0) {
  5325. break
  5326. }
  5327. }
  5328. }
  5329. /* store expanded name in attribute list */
  5330. s = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  5331. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  5332. *(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) = s
  5333. /* fill empty slot with new version, uriName and hash value */
  5334. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fversion = version
  5335. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).Fhash = uriHash
  5336. (*(*TNS_ATT)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_nsAtts + uintptr(j1)*24))).FuriName = s
  5337. nPrefixes--
  5338. v33 = nPrefixes
  5339. if !(v33 != 0) {
  5340. i += int32(2)
  5341. break
  5342. }
  5343. } else { /* not prefixed */
  5344. *(*TXML_Char)(unsafe.Pointer(s + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5345. } /* clear flag */
  5346. goto _15
  5347. _15:
  5348. ;
  5349. i += int32(2)
  5350. }
  5351. }
  5352. /* clear flags for the remaining attributes */
  5353. for {
  5354. if !(i < attIndex) {
  5355. break
  5356. }
  5357. *(*TXML_Char)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(appAtts + uintptr(i)*8)) + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5358. goto _34
  5359. _34:
  5360. ;
  5361. i += int32(2)
  5362. }
  5363. binding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5364. for {
  5365. if !(binding != 0) {
  5366. break
  5367. }
  5368. *(*TXML_Char)(unsafe.Pointer((*Tattribute_id)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).FattId)).Fname + uintptr(-libc.Int32FromInt32(1)))) = uint8(0)
  5369. goto _35
  5370. _35:
  5371. ;
  5372. binding = (*TBINDING)(unsafe.Pointer(binding)).FnextTagBinding
  5373. }
  5374. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  5375. return int32(_XML_ERROR_NONE)
  5376. }
  5377. /* expand the element type name */
  5378. if (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix != 0 {
  5379. binding = (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix)).Fbinding
  5380. if !(binding != 0) {
  5381. return int32(_XML_ERROR_UNBOUND_PREFIX)
  5382. }
  5383. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5384. for {
  5385. v36 = localPart
  5386. localPart++
  5387. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v36))) != int32(m_ASCII_COLON)) {
  5388. break
  5389. }
  5390. }
  5391. } else {
  5392. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  5393. binding = (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding
  5394. localPart = (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr
  5395. } else {
  5396. return int32(_XML_ERROR_NONE)
  5397. }
  5398. }
  5399. prefixLen = 0
  5400. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns_triplets != 0 && (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname != 0 {
  5401. for {
  5402. v38 = prefixLen
  5403. prefixLen++
  5404. if !(*(*TXML_Char)(unsafe.Pointer((*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname + uintptr(v38))) != 0) {
  5405. break
  5406. }
  5407. goto _37
  5408. _37:
  5409. } /* prefixLen includes null terminator */
  5410. }
  5411. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FlocalPart = localPart
  5412. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FuriLen = (*TBINDING)(unsafe.Pointer(binding)).FuriLen
  5413. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fprefix = (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname
  5414. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).FprefixLen = prefixLen
  5415. i = 0
  5416. for {
  5417. v40 = i
  5418. i++
  5419. if !(*(*TXML_Char)(unsafe.Pointer(localPart + uintptr(v40))) != 0) {
  5420. break
  5421. }
  5422. goto _39
  5423. _39:
  5424. } /* i includes null terminator */
  5425. n = i + (*TBINDING)(unsafe.Pointer(binding)).FuriLen + prefixLen
  5426. if n > (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc {
  5427. uri = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(n+libc.Int32FromInt32(m_EXPAND_SPARE))*libc.Uint64FromInt64(1))
  5428. if !(uri != 0) {
  5429. return int32(_XML_ERROR_NO_MEMORY)
  5430. }
  5431. (*TBINDING)(unsafe.Pointer(binding)).FuriAlloc = n + int32(m_EXPAND_SPARE)
  5432. libc.Xmemcpy(tls, uri, (*TBINDING)(unsafe.Pointer(binding)).Furi, libc.Uint64FromInt32((*TBINDING)(unsafe.Pointer(binding)).FuriLen)*uint64(1))
  5433. p = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagStack
  5434. for {
  5435. if !(p != 0) {
  5436. break
  5437. }
  5438. if (*TTAG)(unsafe.Pointer(p)).Fname.Fstr == (*TBINDING)(unsafe.Pointer(binding)).Furi {
  5439. (*TTAG)(unsafe.Pointer(p)).Fname.Fstr = uri
  5440. }
  5441. goto _41
  5442. _41:
  5443. ;
  5444. p = (*TTAG)(unsafe.Pointer(p)).Fparent
  5445. }
  5446. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, (*TBINDING)(unsafe.Pointer(binding)).Furi)
  5447. (*TBINDING)(unsafe.Pointer(binding)).Furi = uri
  5448. }
  5449. /* if m_namespaceSeparator != '\0' then uri includes it already */
  5450. uri = (*TBINDING)(unsafe.Pointer(binding)).Furi + uintptr((*TBINDING)(unsafe.Pointer(binding)).FuriLen)
  5451. libc.Xmemcpy(tls, uri, localPart, libc.Uint64FromInt32(i)*uint64(1))
  5452. /* we always have a namespace separator between localPart and prefix */
  5453. if prefixLen != 0 {
  5454. uri += uintptr(i - int32(1))
  5455. *(*TXML_Char)(unsafe.Pointer(uri)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator /* replace null terminator */
  5456. libc.Xmemcpy(tls, uri+uintptr(1), (*Tprefix)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(binding)).Fprefix)).Fname, libc.Uint64FromInt32(prefixLen)*uint64(1))
  5457. }
  5458. (*TTAG_NAME)(unsafe.Pointer(tagNamePtr)).Fstr = (*TBINDING)(unsafe.Pointer(binding)).Furi
  5459. return int32(_XML_ERROR_NONE)
  5460. }
  5461. // C documentation
  5462. //
  5463. // /* addBinding() overwrites the value of prefix->binding without checking.
  5464. // Therefore one must keep track of the old value outside of addBinding().
  5465. // */
  5466. func _addBinding(tls *libc.TLS, parser TXML_Parser, prefix uintptr, attId uintptr, uri uintptr, bindingsPtr uintptr) (r _XML_Error) {
  5467. var b, temp, v3 uintptr
  5468. var isXML, isXMLNS, mustBeXML TXML_Bool
  5469. var len1, v2 int32
  5470. _, _, _, _, _, _, _, _ = b, isXML, isXMLNS, len1, mustBeXML, temp, v2, v3
  5471. mustBeXML = libc.Uint8FromInt32(0)
  5472. isXML = libc.Uint8FromInt32(1)
  5473. isXMLNS = libc.Uint8FromInt32(1)
  5474. /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */
  5475. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 {
  5476. return int32(_XML_ERROR_UNDECLARING_PREFIX)
  5477. }
  5478. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 2))) == int32(m_ASCII_l) {
  5479. /* Not allowed to bind xmlns */
  5480. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 4))) == int32(m_ASCII_s) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 5))) == int32('\000') {
  5481. return int32(_XML_ERROR_RESERVED_PREFIX_XMLNS)
  5482. }
  5483. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fname + 3))) == int32('\000') {
  5484. mustBeXML = libc.Uint8FromInt32(1)
  5485. }
  5486. }
  5487. len1 = 0
  5488. for {
  5489. if !(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1))) != 0) {
  5490. break
  5491. }
  5492. if isXML != 0 && (len1 > _xmlLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlNamespace[len1])) {
  5493. isXML = libc.Uint8FromInt32(0)
  5494. }
  5495. if !(mustBeXML != 0) && isXMLNS != 0 && (len1 > _xmlnsLen || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri + uintptr(len1)))) != libc.Int32FromUint8(_xmlnsNamespace[len1])) {
  5496. isXMLNS = libc.Uint8FromInt32(0)
  5497. }
  5498. goto _1
  5499. _1:
  5500. ;
  5501. len1++
  5502. }
  5503. isXML = libc.BoolUint8(isXML != 0 && len1 == _xmlLen)
  5504. isXMLNS = libc.BoolUint8(isXMLNS != 0 && len1 == _xmlnsLen)
  5505. if libc.Int32FromUint8(mustBeXML) != libc.Int32FromUint8(isXML) {
  5506. if mustBeXML != 0 {
  5507. v2 = int32(_XML_ERROR_RESERVED_PREFIX_XML)
  5508. } else {
  5509. v2 = int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5510. }
  5511. return v2
  5512. }
  5513. if isXMLNS != 0 {
  5514. return int32(_XML_ERROR_RESERVED_NAMESPACE_URI)
  5515. }
  5516. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5517. len1++
  5518. }
  5519. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList != 0 {
  5520. b = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList
  5521. if len1 > (*TBINDING)(unsafe.Pointer(b)).FuriAlloc {
  5522. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5523. if temp == libc.UintptrFromInt32(0) {
  5524. return int32(_XML_ERROR_NO_MEMORY)
  5525. }
  5526. (*TBINDING)(unsafe.Pointer(b)).Furi = temp
  5527. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5528. }
  5529. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeBindingList = (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding
  5530. } else {
  5531. b = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(48))
  5532. if !(b != 0) {
  5533. return int32(_XML_ERROR_NO_MEMORY)
  5534. }
  5535. (*TBINDING)(unsafe.Pointer(b)).Furi = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(1)*libc.Uint64FromInt32(len1+libc.Int32FromInt32(m_EXPAND_SPARE)))
  5536. if !((*TBINDING)(unsafe.Pointer(b)).Furi != 0) {
  5537. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Ffree_fcn})))(tls, b)
  5538. return int32(_XML_ERROR_NO_MEMORY)
  5539. }
  5540. (*TBINDING)(unsafe.Pointer(b)).FuriAlloc = len1 + int32(m_EXPAND_SPARE)
  5541. }
  5542. (*TBINDING)(unsafe.Pointer(b)).FuriLen = len1
  5543. libc.Xmemcpy(tls, (*TBINDING)(unsafe.Pointer(b)).Furi, uri, libc.Uint64FromInt32(len1)*uint64(1))
  5544. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  5545. *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer(b)).Furi + uintptr(len1-int32(1)))) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator
  5546. }
  5547. (*TBINDING)(unsafe.Pointer(b)).Fprefix = prefix
  5548. (*TBINDING)(unsafe.Pointer(b)).FattId = attId
  5549. (*TBINDING)(unsafe.Pointer(b)).FprevPrefixBinding = (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding
  5550. /* NULL binding when default namespace undeclared */
  5551. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(uri))) == int32('\000') && prefix == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd+304 {
  5552. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = libc.UintptrFromInt32(0)
  5553. } else {
  5554. (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding = b
  5555. }
  5556. (*TBINDING)(unsafe.Pointer(b)).FnextTagBinding = *(*uintptr)(unsafe.Pointer(bindingsPtr))
  5557. *(*uintptr)(unsafe.Pointer(bindingsPtr)) = b
  5558. /* if attId == NULL then we are not starting a namespace scope */
  5559. if attId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startNamespaceDeclHandler != 0 {
  5560. if (*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0 {
  5561. v3 = uri
  5562. } else {
  5563. v3 = uintptr(0)
  5564. }
  5565. (*(*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)
  5566. }
  5567. return int32(_XML_ERROR_NONE)
  5568. }
  5569. var _xmlNamespace = [37]TXML_Char{
  5570. 0: uint8(m_ASCII_h),
  5571. 1: uint8(m_ASCII_t),
  5572. 2: uint8(m_ASCII_t),
  5573. 3: uint8(m_ASCII_p),
  5574. 4: uint8(m_ASCII_COLON),
  5575. 5: uint8(m_ASCII_SLASH),
  5576. 6: uint8(m_ASCII_SLASH),
  5577. 7: uint8(m_ASCII_w),
  5578. 8: uint8(m_ASCII_w),
  5579. 9: uint8(m_ASCII_w),
  5580. 10: uint8(m_ASCII_PERIOD),
  5581. 11: uint8(m_ASCII_w),
  5582. 12: uint8(m_ASCII_3),
  5583. 13: uint8(m_ASCII_PERIOD),
  5584. 14: uint8(m_ASCII_o),
  5585. 15: uint8(m_ASCII_r),
  5586. 16: uint8(m_ASCII_g),
  5587. 17: uint8(m_ASCII_SLASH),
  5588. 18: uint8(m_ASCII_X),
  5589. 19: uint8(m_ASCII_M),
  5590. 20: uint8(m_ASCII_L),
  5591. 21: uint8(m_ASCII_SLASH),
  5592. 22: uint8(m_ASCII_1),
  5593. 23: uint8(m_ASCII_9),
  5594. 24: uint8(m_ASCII_9),
  5595. 25: uint8(m_ASCII_8),
  5596. 26: uint8(m_ASCII_SLASH),
  5597. 27: uint8(m_ASCII_n),
  5598. 28: uint8(m_ASCII_a),
  5599. 29: uint8(m_ASCII_m),
  5600. 30: uint8(m_ASCII_e),
  5601. 31: uint8(m_ASCII_s),
  5602. 32: uint8(m_ASCII_p),
  5603. 33: uint8(m_ASCII_a),
  5604. 34: uint8(m_ASCII_c),
  5605. 35: uint8(m_ASCII_e),
  5606. }
  5607. var _xmlLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(37))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5608. var _xmlnsNamespace = [30]TXML_Char{
  5609. 0: uint8(m_ASCII_h),
  5610. 1: uint8(m_ASCII_t),
  5611. 2: uint8(m_ASCII_t),
  5612. 3: uint8(m_ASCII_p),
  5613. 4: uint8(m_ASCII_COLON),
  5614. 5: uint8(m_ASCII_SLASH),
  5615. 6: uint8(m_ASCII_SLASH),
  5616. 7: uint8(m_ASCII_w),
  5617. 8: uint8(m_ASCII_w),
  5618. 9: uint8(m_ASCII_w),
  5619. 10: uint8(m_ASCII_PERIOD),
  5620. 11: uint8(m_ASCII_w),
  5621. 12: uint8(m_ASCII_3),
  5622. 13: uint8(m_ASCII_PERIOD),
  5623. 14: uint8(m_ASCII_o),
  5624. 15: uint8(m_ASCII_r),
  5625. 16: uint8(m_ASCII_g),
  5626. 17: uint8(m_ASCII_SLASH),
  5627. 18: uint8(m_ASCII_2),
  5628. 19: uint8(m_ASCII_0),
  5629. 20: uint8(m_ASCII_0),
  5630. 21: uint8(m_ASCII_0),
  5631. 22: uint8(m_ASCII_SLASH),
  5632. 23: uint8(m_ASCII_x),
  5633. 24: uint8(m_ASCII_m),
  5634. 25: uint8(m_ASCII_l),
  5635. 26: uint8(m_ASCII_n),
  5636. 27: uint8(m_ASCII_s),
  5637. 28: uint8(m_ASCII_SLASH),
  5638. }
  5639. var _xmlnsLen = libc.Int32FromUint64(libc.Uint64FromInt32(libc.Int32FromInt64(30))/libc.Uint64FromInt64(1) - libc.Uint64FromInt32(1))
  5640. // C documentation
  5641. //
  5642. // /* The idea here is to avoid using stack for each CDATA section when
  5643. // the whole file is parsed with one call.
  5644. // */
  5645. func _cdataSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5646. bp := tls.Alloc(16)
  5647. defer tls.Free(16)
  5648. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5649. var result _XML_Error
  5650. _ = result
  5651. 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)))
  5652. if result != int32(_XML_ERROR_NONE) {
  5653. return result
  5654. }
  5655. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5656. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 { /* we are parsing an external entity */
  5657. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalEntityContentProcessor)
  5658. return _externalEntityContentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5659. } else {
  5660. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  5661. return _contentProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5662. }
  5663. }
  5664. return result
  5665. }
  5666. // C documentation
  5667. //
  5668. // /* startPtr gets set to non-null if the section is closed, and to null if
  5669. // the section is not yet closed.
  5670. // */
  5671. func _doCdataSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  5672. bp := tls.Alloc(32)
  5673. defer tls.Free(32)
  5674. var charDataHandler TXML_CharacterDataHandler
  5675. var convert_res _XML_Convert_Result
  5676. var eventEndPP, eventPP, v3 uintptr
  5677. var tok int32
  5678. var _ /* c at bp+16 */ TXML_Char
  5679. var _ /* dataPtr at bp+24 */ uintptr
  5680. var _ /* next at bp+8 */ uintptr
  5681. var _ /* s at bp+0 */ uintptr
  5682. _, _, _, _, _, _ = charDataHandler, convert_res, eventEndPP, eventPP, tok, v3
  5683. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  5684. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5685. eventPP = parser + 544
  5686. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5687. eventEndPP = parser + 552
  5688. } else {
  5689. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  5690. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  5691. }
  5692. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5693. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  5694. for {
  5695. *(*uintptr)(unsafe.Pointer(bp + 8)) = *(*uintptr)(unsafe.Pointer(bp)) /* in case of XML_TOK_NONE or XML_TOK_PARTIAL */
  5696. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 2*8))})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+8)
  5697. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5698. switch tok {
  5699. case int32(m_XML_TOK_CDATA_SECT_CLOSE):
  5700. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler != 0 {
  5701. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endCdataSectionHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  5702. } else {
  5703. if libc.Bool(0 != 0) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5704. (*(*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)
  5705. } else {
  5706. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5707. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5708. }
  5709. }
  5710. }
  5711. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5712. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5713. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  5714. return int32(_XML_ERROR_ABORTED)
  5715. } else {
  5716. return int32(_XML_ERROR_NONE)
  5717. }
  5718. fallthrough
  5719. case int32(m_XML_TOK_DATA_NEWLINE):
  5720. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler != 0 {
  5721. *(*TXML_Char)(unsafe.Pointer(bp + 16)) = uint8(0xA)
  5722. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, bp+16, int32(1))
  5723. } else {
  5724. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5725. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5726. }
  5727. }
  5728. case int32(m_XML_TOK_DATA_CHARS):
  5729. charDataHandler = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_characterDataHandler
  5730. if charDataHandler != 0 {
  5731. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  5732. for {
  5733. *(*uintptr)(unsafe.Pointer(bp + 24)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  5734. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, *(*uintptr)(unsafe.Pointer(bp + 8)), bp+24, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  5735. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5736. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 24)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  5737. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  5738. break
  5739. }
  5740. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5741. goto _2
  5742. _2:
  5743. }
  5744. } else {
  5745. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{charDataHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  5746. }
  5747. } else {
  5748. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5749. _reportDefault(tls, parser, enc, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp + 8)))
  5750. }
  5751. }
  5752. case m_XML_TOK_INVALID:
  5753. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5754. return int32(_XML_ERROR_INVALID_TOKEN)
  5755. case -int32(2):
  5756. if haveMore != 0 {
  5757. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5758. return int32(_XML_ERROR_NONE)
  5759. }
  5760. return int32(_XML_ERROR_PARTIAL_CHAR)
  5761. case -int32(1):
  5762. fallthrough
  5763. case -int32(4):
  5764. if haveMore != 0 {
  5765. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5766. return int32(_XML_ERROR_NONE)
  5767. }
  5768. return int32(_XML_ERROR_UNCLOSED_CDATA_SECTION)
  5769. default:
  5770. /* Every token returned by XmlCdataSectionTok() has its own
  5771. * explicit case, so this default case will never be executed.
  5772. * We retain it as a safety net and exclude it from the coverage
  5773. * statistics.
  5774. *
  5775. * LCOV_EXCL_START
  5776. */
  5777. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5778. return int32(_XML_ERROR_UNEXPECTED_STATE)
  5779. /* LCOV_EXCL_STOP */
  5780. }
  5781. v3 = *(*uintptr)(unsafe.Pointer(bp + 8))
  5782. *(*uintptr)(unsafe.Pointer(bp)) = v3
  5783. *(*uintptr)(unsafe.Pointer(eventPP)) = v3
  5784. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  5785. case int32(_XML_SUSPENDED):
  5786. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  5787. return int32(_XML_ERROR_NONE)
  5788. case int32(_XML_FINISHED):
  5789. return int32(_XML_ERROR_ABORTED)
  5790. default:
  5791. }
  5792. goto _1
  5793. _1:
  5794. }
  5795. /* not reached */
  5796. return r
  5797. }
  5798. // C documentation
  5799. //
  5800. // /* The idea here is to avoid using stack for each IGNORE section when
  5801. // the whole file is parsed with one call.
  5802. // */
  5803. func _ignoreSectionProcessor(tls *libc.TLS, parser TXML_Parser, _start uintptr, end uintptr, endPtr uintptr) (r _XML_Error) {
  5804. bp := tls.Alloc(16)
  5805. defer tls.Free(16)
  5806. *(*uintptr)(unsafe.Pointer(bp)) = _start
  5807. var result _XML_Error
  5808. _ = result
  5809. 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)))
  5810. if result != int32(_XML_ERROR_NONE) {
  5811. return result
  5812. }
  5813. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5814. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  5815. return _prologProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, endPtr)
  5816. }
  5817. return result
  5818. }
  5819. // C documentation
  5820. //
  5821. // /* startPtr gets set to non-null is the section is closed, and to null
  5822. // if the section is not yet closed.
  5823. // */
  5824. func _doIgnoreSection(tls *libc.TLS, parser TXML_Parser, enc uintptr, startPtr uintptr, end uintptr, nextPtr uintptr, haveMore TXML_Bool) (r _XML_Error) {
  5825. bp := tls.Alloc(16)
  5826. defer tls.Free(16)
  5827. var eventEndPP, eventPP, s uintptr
  5828. var tok int32
  5829. var _ /* next at bp+0 */ uintptr
  5830. _, _, _, _ = eventEndPP, eventPP, s, tok
  5831. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(startPtr))
  5832. s = *(*uintptr)(unsafe.Pointer(startPtr))
  5833. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5834. eventPP = parser + 544
  5835. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  5836. eventEndPP = parser + 552
  5837. } else {
  5838. /* It's not entirely clear, but it seems the following two lines
  5839. * of code cannot be executed. The only occasions on which 'enc'
  5840. * is not 'encoding' are when this function is called
  5841. * from the internal entity processing, and IGNORE sections are an
  5842. * error in internal entities.
  5843. *
  5844. * Since it really isn't clear that this is true, we keep the code
  5845. * and just remove it from our coverage tests.
  5846. *
  5847. * LCOV_EXCL_START
  5848. */
  5849. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  5850. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  5851. /* LCOV_EXCL_STOP */
  5852. }
  5853. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  5854. *(*uintptr)(unsafe.Pointer(startPtr)) = libc.UintptrFromInt32(0)
  5855. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 3*8))})))(tls, enc, s, end, bp)
  5856. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5857. switch tok {
  5858. case int32(m_XML_TOK_IGNORE_SECT):
  5859. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5860. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  5861. }
  5862. *(*uintptr)(unsafe.Pointer(startPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5863. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  5864. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  5865. return int32(_XML_ERROR_ABORTED)
  5866. } else {
  5867. return int32(_XML_ERROR_NONE)
  5868. }
  5869. fallthrough
  5870. case m_XML_TOK_INVALID:
  5871. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5872. return int32(_XML_ERROR_INVALID_TOKEN)
  5873. case -int32(2):
  5874. if haveMore != 0 {
  5875. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  5876. return int32(_XML_ERROR_NONE)
  5877. }
  5878. return int32(_XML_ERROR_PARTIAL_CHAR)
  5879. case -int32(1):
  5880. fallthrough
  5881. case -int32(4):
  5882. if haveMore != 0 {
  5883. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  5884. return int32(_XML_ERROR_NONE)
  5885. }
  5886. return int32(_XML_ERROR_SYNTAX) /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
  5887. default:
  5888. /* All of the tokens that XmlIgnoreSectionTok() returns have
  5889. * explicit cases to handle them, so this default case is never
  5890. * executed. We keep it as a safety net anyway, and remove it
  5891. * from our test coverage statistics.
  5892. *
  5893. * LCOV_EXCL_START
  5894. */
  5895. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  5896. return int32(_XML_ERROR_UNEXPECTED_STATE)
  5897. /* LCOV_EXCL_STOP */
  5898. }
  5899. /* not reached */
  5900. return r
  5901. }
  5902. func _initializeEncoding(tls *libc.TLS, parser TXML_Parser) (r _XML_Error) {
  5903. var s uintptr
  5904. var v1 func(*libc.TLS, uintptr, uintptr, uintptr) int32
  5905. _, _ = s, v1
  5906. s = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName
  5907. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  5908. v1 = XXmlInitEncodingNS
  5909. } else {
  5910. v1 = XXmlInitEncoding
  5911. }
  5912. if v1(tls, parser+296, parser+288, s) != 0 {
  5913. return int32(_XML_ERROR_NONE)
  5914. }
  5915. return _handleUnknownEncoding(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName)
  5916. }
  5917. func _processXmlDecl(tls *libc.TLS, parser TXML_Parser, isGeneralTextEntity int32, s uintptr, next uintptr) (r _XML_Error) {
  5918. bp := tls.Alloc(48)
  5919. defer tls.Free(48)
  5920. var result _XML_Error
  5921. var storedEncName, storedversion uintptr
  5922. var v1 func(*libc.TLS, int32, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) int32
  5923. var _ /* encodingName at bp+0 */ uintptr
  5924. var _ /* newEncoding at bp+8 */ uintptr
  5925. var _ /* standalone at bp+32 */ int32
  5926. var _ /* version at bp+16 */ uintptr
  5927. var _ /* versionend at bp+24 */ uintptr
  5928. _, _, _, _ = result, storedEncName, storedversion, v1
  5929. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  5930. storedEncName = libc.UintptrFromInt32(0)
  5931. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  5932. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  5933. storedversion = libc.UintptrFromInt32(0)
  5934. *(*int32)(unsafe.Pointer(bp + 32)) = -int32(1)
  5935. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  5936. v1 = XXmlParseXmlDeclNS
  5937. } else {
  5938. v1 = XXmlParseXmlDecl
  5939. }
  5940. if !(v1(tls, isGeneralTextEntity, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next, parser+544, bp+16, bp+24, bp, bp+8, bp+32) != 0) {
  5941. if isGeneralTextEntity != 0 {
  5942. return int32(_XML_ERROR_TEXT_DECL)
  5943. } else {
  5944. return int32(_XML_ERROR_XML_DECL)
  5945. }
  5946. }
  5947. if !(isGeneralTextEntity != 0) && *(*int32)(unsafe.Pointer(bp + 32)) == int32(1) {
  5948. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).Fstandalone = libc.Uint8FromInt32(1)
  5949. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing == int32(_XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) {
  5950. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing = int32(_XML_PARAM_ENTITY_PARSING_NEVER)
  5951. }
  5952. }
  5953. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler != 0 {
  5954. if *(*uintptr)(unsafe.Pointer(bp)) != libc.UintptrFromInt32(0) {
  5955. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  5956. if !(storedEncName != 0) {
  5957. return int32(_XML_ERROR_NO_MEMORY)
  5958. }
  5959. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr
  5960. }
  5961. if *(*uintptr)(unsafe.Pointer(bp + 16)) != 0 {
  5962. storedversion = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24))-uintptr((*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar))
  5963. if !(storedversion != 0) {
  5964. return int32(_XML_ERROR_NO_MEMORY)
  5965. }
  5966. }
  5967. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_xmlDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, storedversion, storedEncName, *(*int32)(unsafe.Pointer(bp + 32)))
  5968. } else {
  5969. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  5970. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, next)
  5971. }
  5972. }
  5973. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_protocolEncodingName == libc.UintptrFromInt32(0) {
  5974. if *(*uintptr)(unsafe.Pointer(bp + 8)) != 0 {
  5975. /* Check that the specified encoding does not conflict with what
  5976. * the parser has already deduced. Do we have the same number
  5977. * of bytes in the smallest representation of a character? If
  5978. * this is UTF-16, is it the same endianness?
  5979. */
  5980. if (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar != (*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FminBytesPerChar || (*TENCODING)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8)))).FminBytesPerChar == int32(2) && *(*uintptr)(unsafe.Pointer(bp + 8)) != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  5981. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  5982. return int32(_XML_ERROR_INCORRECT_ENCODING)
  5983. }
  5984. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = *(*uintptr)(unsafe.Pointer(bp + 8))
  5985. } else {
  5986. if *(*uintptr)(unsafe.Pointer(bp)) != 0 {
  5987. if !(storedEncName != 0) {
  5988. storedEncName = _poolStoreString(tls, parser+832, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)), *(*uintptr)(unsafe.Pointer(bp))+uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding)).FnameLength})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, *(*uintptr)(unsafe.Pointer(bp)))))
  5989. if !(storedEncName != 0) {
  5990. return int32(_XML_ERROR_NO_MEMORY)
  5991. }
  5992. }
  5993. result = _handleUnknownEncoding(tls, parser, storedEncName)
  5994. _poolClear(tls, parser+832)
  5995. if result == int32(_XML_ERROR_UNKNOWN_ENCODING) {
  5996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  5997. }
  5998. return result
  5999. }
  6000. }
  6001. }
  6002. if storedEncName != 0 || storedversion != 0 {
  6003. _poolClear(tls, parser+832)
  6004. }
  6005. return int32(_XML_ERROR_NONE)
  6006. }
  6007. func _handleUnknownEncoding(tls *libc.TLS, parser TXML_Parser, encodingName uintptr) (r _XML_Error) {
  6008. bp := tls.Alloc(1056)
  6009. defer tls.Free(1056)
  6010. var enc uintptr
  6011. var i int32
  6012. var v2 func(*libc.TLS, uintptr, uintptr, TCONVERTER, uintptr) uintptr
  6013. var _ /* info at bp+0 */ TXML_Encoding
  6014. _, _, _ = enc, i, v2
  6015. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingHandler != 0 {
  6016. i = 0
  6017. for {
  6018. if !(i < int32(256)) {
  6019. break
  6020. }
  6021. *(*int32)(unsafe.Pointer(bp + uintptr(i)*4)) = -int32(1)
  6022. goto _1
  6023. _1:
  6024. ;
  6025. i++
  6026. }
  6027. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert = libc.UintptrFromInt32(0)
  6028. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata = libc.UintptrFromInt32(0)
  6029. (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease = libc.UintptrFromInt32(0)
  6030. 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 {
  6031. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(XXmlSizeOfUnknownEncoding(tls)))
  6032. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem != 0) {
  6033. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != 0 {
  6034. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6035. }
  6036. return int32(_XML_ERROR_NO_MEMORY)
  6037. }
  6038. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0 {
  6039. v2 = XXmlInitUnknownEncodingNS
  6040. } else {
  6041. v2 = XXmlInitUnknownEncoding
  6042. }
  6043. enc = v2(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingMem, bp, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fconvert, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6044. if enc != 0 {
  6045. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingData = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata
  6046. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unknownEncodingRelease = (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease
  6047. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding = enc
  6048. return int32(_XML_ERROR_NONE)
  6049. }
  6050. }
  6051. if (*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease != libc.UintptrFromInt32(0) {
  6052. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*(*TXML_Encoding)(unsafe.Pointer(bp))).Frelease})))(tls, (*(*TXML_Encoding)(unsafe.Pointer(bp))).Fdata)
  6053. }
  6054. }
  6055. return int32(_XML_ERROR_UNKNOWN_ENCODING)
  6056. }
  6057. func _prologInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6058. var result _XML_Error
  6059. _ = result
  6060. result = _initializeEncoding(tls, parser)
  6061. if result != int32(_XML_ERROR_NONE) {
  6062. return result
  6063. }
  6064. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6065. return _prologProcessor(tls, parser, s, end, nextPtr)
  6066. }
  6067. func _externalParEntInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6068. var result _XML_Error
  6069. _ = result
  6070. result = _initializeEncoding(tls, parser)
  6071. if result != int32(_XML_ERROR_NONE) {
  6072. return result
  6073. }
  6074. /* we know now that XML_Parse(Buffer) has been called,
  6075. so we consider the external parameter entity read */
  6076. (*TDTD)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd)).FparamEntityRead = libc.Uint8FromInt32(1)
  6077. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue != 0 {
  6078. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueInitProcessor)
  6079. return _entityValueInitProcessor(tls, parser, s, end, nextPtr)
  6080. } else {
  6081. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_externalParEntProcessor)
  6082. return _externalParEntProcessor(tls, parser, s, end, nextPtr)
  6083. }
  6084. return r
  6085. }
  6086. func _entityValueInitProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6087. bp := tls.Alloc(16)
  6088. defer tls.Free(16)
  6089. var result _XML_Error
  6090. var start uintptr
  6091. var tok int32
  6092. var _ /* next at bp+0 */ uintptr
  6093. _, _, _ = result, start, tok
  6094. start = s
  6095. *(*uintptr)(unsafe.Pointer(bp)) = start
  6096. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6097. for {
  6098. 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)
  6099. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  6100. if tok <= 0 {
  6101. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6102. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6103. return int32(_XML_ERROR_NONE)
  6104. }
  6105. switch tok {
  6106. case m_XML_TOK_INVALID:
  6107. return int32(_XML_ERROR_INVALID_TOKEN)
  6108. case -int32(1):
  6109. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6110. case -int32(2):
  6111. return int32(_XML_ERROR_PARTIAL_CHAR)
  6112. case -int32(4): /* start == end */
  6113. fallthrough
  6114. default:
  6115. break
  6116. }
  6117. /* found end of entity value - can store it now */
  6118. return _storeEntityValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, end)
  6119. } else {
  6120. if tok == int32(m_XML_TOK_XML_DECL) {
  6121. result = _processXmlDecl(tls, parser, 0, start, *(*uintptr)(unsafe.Pointer(bp)))
  6122. if result != int32(_XML_ERROR_NONE) {
  6123. return result
  6124. }
  6125. /* At this point, m_parsingStatus.parsing cannot be XML_SUSPENDED. For
  6126. * that to happen, a parameter entity parsing handler must have attempted
  6127. * to suspend the parser, which fails and raises an error. The parser can
  6128. * be aborted, but can't be suspended.
  6129. */
  6130. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  6131. return int32(_XML_ERROR_ABORTED)
  6132. }
  6133. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6134. /* stop scanning for text declaration - we found one */
  6135. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_entityValueProcessor)
  6136. return _entityValueProcessor(tls, parser, *(*uintptr)(unsafe.Pointer(bp)), end, nextPtr)
  6137. } else {
  6138. if tok == int32(m_XML_TOK_BOM) && *(*uintptr)(unsafe.Pointer(bp)) == end && !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  6139. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6140. return int32(_XML_ERROR_NONE)
  6141. } else {
  6142. if tok == int32(m_XML_TOK_INSTANCE_START) {
  6143. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  6144. return int32(_XML_ERROR_SYNTAX)
  6145. }
  6146. }
  6147. }
  6148. }
  6149. start = *(*uintptr)(unsafe.Pointer(bp))
  6150. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = start
  6151. goto _1
  6152. _1:
  6153. }
  6154. return r
  6155. }
  6156. func _externalParEntProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6157. bp := tls.Alloc(16)
  6158. defer tls.Free(16)
  6159. var tok int32
  6160. var _ /* next at bp+0 */ uintptr
  6161. _ = tok
  6162. *(*uintptr)(unsafe.Pointer(bp)) = s
  6163. 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)
  6164. if tok <= 0 {
  6165. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6166. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6167. return int32(_XML_ERROR_NONE)
  6168. }
  6169. switch tok {
  6170. case m_XML_TOK_INVALID:
  6171. return int32(_XML_ERROR_INVALID_TOKEN)
  6172. case -int32(1):
  6173. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6174. case -int32(2):
  6175. return int32(_XML_ERROR_PARTIAL_CHAR)
  6176. case -int32(4): /* start == end */
  6177. fallthrough
  6178. default:
  6179. break
  6180. }
  6181. } else {
  6182. if tok == int32(m_XML_TOK_BOM) {
  6183. s = *(*uintptr)(unsafe.Pointer(bp))
  6184. 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)
  6185. }
  6186. }
  6187. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  6188. 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))
  6189. }
  6190. func _entityValueProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6191. bp := tls.Alloc(16)
  6192. defer tls.Free(16)
  6193. var enc, start uintptr
  6194. var tok int32
  6195. var _ /* next at bp+0 */ uintptr
  6196. _, _, _ = enc, start, tok
  6197. start = s
  6198. *(*uintptr)(unsafe.Pointer(bp)) = s
  6199. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6200. for {
  6201. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, start, end, bp)
  6202. if tok <= 0 {
  6203. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) && tok != m_XML_TOK_INVALID {
  6204. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6205. return int32(_XML_ERROR_NONE)
  6206. }
  6207. switch tok {
  6208. case m_XML_TOK_INVALID:
  6209. return int32(_XML_ERROR_INVALID_TOKEN)
  6210. case -int32(1):
  6211. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6212. case -int32(2):
  6213. return int32(_XML_ERROR_PARTIAL_CHAR)
  6214. case -int32(4): /* start == end */
  6215. fallthrough
  6216. default:
  6217. break
  6218. }
  6219. /* found end of entity value - can store it now */
  6220. return _storeEntityValue(tls, parser, enc, s, end)
  6221. }
  6222. start = *(*uintptr)(unsafe.Pointer(bp))
  6223. goto _1
  6224. _1:
  6225. }
  6226. return r
  6227. }
  6228. func _prologProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  6229. bp := tls.Alloc(16)
  6230. defer tls.Free(16)
  6231. var tok int32
  6232. var _ /* next at bp+0 */ uintptr
  6233. _ = tok
  6234. *(*uintptr)(unsafe.Pointer(bp)) = s
  6235. 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)
  6236. 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))
  6237. }
  6238. 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) (r _XML_Error) {
  6239. bp := tls.Alloc(16)
  6240. defer tls.Free(16)
  6241. *(*uintptr)(unsafe.Pointer(bp)) = _next
  6242. 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
  6243. var betweenDecl, hadParamEntityRefs, hadParamEntityRefs1, handleDefault TXML_Bool
  6244. var myindex, myindex1, nameLen, role, v66, v69, v73, v76, v82, v84, v85, v88 int32
  6245. var quant _XML_Content_Quant
  6246. var result, result1, result2, result3, result4, result5 _XML_Error
  6247. var v72, v79, v83 bool
  6248. var v81 uint32
  6249. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  6250. /* save one level of indirection */
  6251. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  6252. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6253. eventPP = parser + 544
  6254. eventEndPP = parser + 552
  6255. } else {
  6256. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  6257. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  6258. }
  6259. for {
  6260. handleDefault = libc.Uint8FromInt32(1)
  6261. *(*uintptr)(unsafe.Pointer(eventPP)) = s
  6262. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6263. if tok <= 0 {
  6264. if haveMore != 0 && tok != m_XML_TOK_INVALID {
  6265. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6266. return int32(_XML_ERROR_NONE)
  6267. }
  6268. switch tok {
  6269. case m_XML_TOK_INVALID:
  6270. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  6271. return int32(_XML_ERROR_INVALID_TOKEN)
  6272. case -int32(1):
  6273. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  6274. case -int32(2):
  6275. return int32(_XML_ERROR_PARTIAL_CHAR)
  6276. case -int32(m_XML_TOK_PROLOG_S):
  6277. tok = -tok
  6278. case -int32(4):
  6279. /* for internal PE NOT referenced between declarations */
  6280. if enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding && !((*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities)).FbetweenDecl != 0) {
  6281. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6282. return int32(_XML_ERROR_NONE)
  6283. }
  6284. /* WFC: PE Between Declarations - must check that PE contains
  6285. complete markup, not only for external PEs, but also for
  6286. internal PEs if the reference occurs between declarations.
  6287. */
  6288. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  6289. if (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, -int32(4), end, end, enc) == int32(_XML_ROLE_ERROR) {
  6290. return int32(_XML_ERROR_INCOMPLETE_PE)
  6291. }
  6292. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  6293. return int32(_XML_ERROR_NONE)
  6294. }
  6295. return int32(_XML_ERROR_NO_ELEMENTS)
  6296. default:
  6297. tok = -tok
  6298. *(*uintptr)(unsafe.Pointer(bp)) = end
  6299. break
  6300. }
  6301. }
  6302. role = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TPROLOG_STATE)(unsafe.Pointer(parser + 496)).Fhandler})))(tls, parser+496, tok, s, *(*uintptr)(unsafe.Pointer(bp)), enc)
  6303. switch role {
  6304. case int32(_XML_ROLE_XML_DECL):
  6305. goto _2
  6306. case int32(_XML_ROLE_DOCTYPE_NAME):
  6307. goto _3
  6308. case int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET):
  6309. goto _4
  6310. case int32(_XML_ROLE_TEXT_DECL):
  6311. goto _5
  6312. case int32(_XML_ROLE_DOCTYPE_PUBLIC_ID):
  6313. goto _6
  6314. case int32(_XML_ROLE_ENTITY_PUBLIC_ID):
  6315. goto _7
  6316. case int32(_XML_ROLE_DOCTYPE_CLOSE):
  6317. goto _8
  6318. case int32(_XML_ROLE_INSTANCE_START):
  6319. goto _9
  6320. case int32(_XML_ROLE_ATTLIST_ELEMENT_NAME):
  6321. goto _10
  6322. case int32(_XML_ROLE_ATTRIBUTE_NAME):
  6323. goto _11
  6324. case int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA):
  6325. goto _12
  6326. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ID):
  6327. goto _13
  6328. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREF):
  6329. goto _14
  6330. case int32(_XML_ROLE_ATTRIBUTE_TYPE_IDREFS):
  6331. goto _15
  6332. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITY):
  6333. goto _16
  6334. case int32(_XML_ROLE_ATTRIBUTE_TYPE_ENTITIES):
  6335. goto _17
  6336. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN):
  6337. goto _18
  6338. case int32(_XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS):
  6339. goto _19
  6340. case int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE):
  6341. goto _20
  6342. case int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE):
  6343. goto _21
  6344. case int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE):
  6345. goto _22
  6346. case int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE):
  6347. goto _23
  6348. case int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE):
  6349. goto _24
  6350. case int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE):
  6351. goto _25
  6352. case int32(_XML_ROLE_ENTITY_VALUE):
  6353. goto _26
  6354. case int32(_XML_ROLE_DOCTYPE_SYSTEM_ID):
  6355. goto _27
  6356. case int32(_XML_ROLE_ENTITY_SYSTEM_ID):
  6357. goto _28
  6358. case int32(_XML_ROLE_ENTITY_COMPLETE):
  6359. goto _29
  6360. case int32(_XML_ROLE_ENTITY_NOTATION_NAME):
  6361. goto _30
  6362. case int32(_XML_ROLE_GENERAL_ENTITY_NAME):
  6363. goto _31
  6364. case int32(_XML_ROLE_PARAM_ENTITY_NAME):
  6365. goto _32
  6366. case int32(_XML_ROLE_NOTATION_NAME):
  6367. goto _33
  6368. case int32(_XML_ROLE_NOTATION_PUBLIC_ID):
  6369. goto _34
  6370. case int32(_XML_ROLE_NOTATION_SYSTEM_ID):
  6371. goto _35
  6372. case int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID):
  6373. goto _36
  6374. case int32(_XML_ROLE_ERROR):
  6375. goto _37
  6376. case int32(_XML_ROLE_IGNORE_SECT):
  6377. goto _38
  6378. case int32(_XML_ROLE_GROUP_OPEN):
  6379. goto _39
  6380. case int32(_XML_ROLE_GROUP_SEQUENCE):
  6381. goto _40
  6382. case int32(_XML_ROLE_GROUP_CHOICE):
  6383. goto _41
  6384. case int32(_XML_ROLE_INNER_PARAM_ENTITY_REF):
  6385. goto _42
  6386. case int32(_XML_ROLE_PARAM_ENTITY_REF):
  6387. goto _43
  6388. case int32(_XML_ROLE_ELEMENT_NAME):
  6389. goto _44
  6390. case int32(_XML_ROLE_CONTENT_EMPTY):
  6391. goto _45
  6392. case int32(_XML_ROLE_CONTENT_ANY):
  6393. goto _46
  6394. case int32(_XML_ROLE_CONTENT_PCDATA):
  6395. goto _47
  6396. case int32(_XML_ROLE_CONTENT_ELEMENT):
  6397. goto _48
  6398. case int32(_XML_ROLE_CONTENT_ELEMENT_OPT):
  6399. goto _49
  6400. case int32(_XML_ROLE_CONTENT_ELEMENT_REP):
  6401. goto _50
  6402. case int32(_XML_ROLE_CONTENT_ELEMENT_PLUS):
  6403. goto _51
  6404. case int32(_XML_ROLE_GROUP_CLOSE):
  6405. goto _52
  6406. case int32(_XML_ROLE_GROUP_CLOSE_OPT):
  6407. goto _53
  6408. case int32(_XML_ROLE_GROUP_CLOSE_REP):
  6409. goto _54
  6410. case int32(_XML_ROLE_GROUP_CLOSE_PLUS):
  6411. goto _55
  6412. case int32(_XML_ROLE_PI):
  6413. goto _56
  6414. case int32(_XML_ROLE_COMMENT):
  6415. goto _57
  6416. case int32(_XML_ROLE_NONE):
  6417. goto _58
  6418. case int32(_XML_ROLE_DOCTYPE_NONE):
  6419. goto _59
  6420. case int32(_XML_ROLE_ENTITY_NONE):
  6421. goto _60
  6422. case int32(_XML_ROLE_NOTATION_NONE):
  6423. goto _61
  6424. case int32(_XML_ROLE_ATTLIST_NONE):
  6425. goto _62
  6426. case int32(_XML_ROLE_ELEMENT_NONE):
  6427. goto _63
  6428. }
  6429. goto _64
  6430. _2:
  6431. ;
  6432. result = _processXmlDecl(tls, parser, 0, s, *(*uintptr)(unsafe.Pointer(bp)))
  6433. if result != int32(_XML_ERROR_NONE) {
  6434. return result
  6435. }
  6436. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6437. handleDefault = libc.Uint8FromInt32(0)
  6438. goto _64
  6439. _3:
  6440. ;
  6441. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6442. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6443. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0) {
  6444. return int32(_XML_ERROR_NO_MEMORY)
  6445. }
  6446. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6447. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = libc.UintptrFromInt32(0)
  6448. handleDefault = libc.Uint8FromInt32(0)
  6449. }
  6450. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = libc.UintptrFromInt32(0) /* always initialize to NULL */
  6451. goto _64
  6452. _4:
  6453. ;
  6454. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6455. (*(*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))
  6456. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName = libc.UintptrFromInt32(0)
  6457. _poolClear(tls, parser+784)
  6458. handleDefault = libc.Uint8FromInt32(0)
  6459. }
  6460. goto _64
  6461. _5:
  6462. ;
  6463. result1 = _processXmlDecl(tls, parser, int32(1), s, *(*uintptr)(unsafe.Pointer(bp)))
  6464. if result1 != int32(_XML_ERROR_NONE) {
  6465. return result1
  6466. }
  6467. enc = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding
  6468. handleDefault = libc.Uint8FromInt32(0)
  6469. goto _64
  6470. _6:
  6471. ;
  6472. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6473. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6474. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6475. return int32(_XML_ERROR_NO_MEMORY)
  6476. }
  6477. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6478. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6479. 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) {
  6480. return int32(_XML_ERROR_PUBLICID)
  6481. }
  6482. pubId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6483. if !(pubId != 0) {
  6484. return int32(_XML_ERROR_NO_MEMORY)
  6485. }
  6486. _normalizePublicId(tls, pubId)
  6487. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6488. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypePubid = pubId
  6489. handleDefault = libc.Uint8FromInt32(0)
  6490. goto alreadyChecked
  6491. }
  6492. /* fall through */
  6493. _7:
  6494. ;
  6495. 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) {
  6496. return int32(_XML_ERROR_PUBLICID)
  6497. }
  6498. goto alreadyChecked
  6499. alreadyChecked:
  6500. ;
  6501. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6502. tem = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6503. if !(tem != 0) {
  6504. return int32(_XML_ERROR_NO_MEMORY)
  6505. }
  6506. _normalizePublicId(tls, tem)
  6507. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = tem
  6508. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6509. /* Don't suppress the default handler if we fell through from
  6510. * the XML_ROLE_DOCTYPE_PUBLIC_ID case.
  6511. */
  6512. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_PUBLIC_ID) {
  6513. handleDefault = libc.Uint8FromInt32(0)
  6514. }
  6515. }
  6516. goto _64
  6517. _8:
  6518. ;
  6519. if libc.Int32FromUint8(allowClosingDoctype) != libc.Int32FromUint8(libc.Uint8FromInt32(1)) {
  6520. /* Must not close doctype from within expanded parameter entities */
  6521. return int32(_XML_ERROR_INVALID_TOKEN)
  6522. }
  6523. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeName != 0 {
  6524. (*(*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)
  6525. _poolClear(tls, parser+784)
  6526. handleDefault = libc.Uint8FromInt32(0)
  6527. }
  6528. /* parser->m_doctypeSysid will be non-NULL in the case of a previous
  6529. XML_ROLE_DOCTYPE_SYSTEM_ID, even if parser->m_startDoctypeDeclHandler
  6530. was not set, indicating an external subset
  6531. */
  6532. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0 || (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6533. hadParamEntityRefs = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6534. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6535. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6536. entity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6537. if !(entity != 0) {
  6538. /* The external subset name "#" will have already been
  6539. * inserted into the hash table at the start of the
  6540. * external entity parsing, so no allocation will happen
  6541. * and lookup() cannot fail.
  6542. */
  6543. return int32(_XML_ERROR_NO_MEMORY) /* LCOV_EXCL_LINE */
  6544. }
  6545. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6546. (*TENTITY)(unsafe.Pointer(entity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6547. }
  6548. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6549. 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) {
  6550. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6551. }
  6552. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6553. 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) {
  6554. return int32(_XML_ERROR_NOT_STANDALONE)
  6555. }
  6556. } else {
  6557. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid != 0) {
  6558. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs
  6559. }
  6560. }
  6561. /* end of DTD - no need to update dtd->keepProcessing */
  6562. }
  6563. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6564. }
  6565. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler != 0 {
  6566. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_endDoctypeDeclHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg)
  6567. handleDefault = libc.Uint8FromInt32(0)
  6568. }
  6569. goto _64
  6570. _9:
  6571. ;
  6572. /* if there is no DOCTYPE declaration then now is the
  6573. last chance to read the foreign DTD
  6574. */
  6575. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD != 0 {
  6576. hadParamEntityRefs1 = (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs
  6577. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6578. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  6579. entity1 = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6580. if !(entity1 != 0) {
  6581. return int32(_XML_ERROR_NO_MEMORY)
  6582. }
  6583. (*TENTITY)(unsafe.Pointer(entity1)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6584. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  6585. 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) {
  6586. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  6587. }
  6588. if (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0 {
  6589. 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) {
  6590. return int32(_XML_ERROR_NOT_STANDALONE)
  6591. }
  6592. } else {
  6593. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = hadParamEntityRefs1
  6594. }
  6595. /* end of DTD - no need to update dtd->keepProcessing */
  6596. }
  6597. }
  6598. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  6599. return _contentProcessor(tls, parser, s, end, nextPtr)
  6600. _10:
  6601. ;
  6602. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6603. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  6604. return int32(_XML_ERROR_NO_MEMORY)
  6605. }
  6606. goto checkAttListDeclHandler
  6607. _11:
  6608. ;
  6609. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId = _getAttributeId(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6610. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeId != 0) {
  6611. return int32(_XML_ERROR_NO_MEMORY)
  6612. }
  6613. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(0)
  6614. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = libc.UintptrFromInt32(0)
  6615. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(0)
  6616. goto checkAttListDeclHandler
  6617. _12:
  6618. ;
  6619. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata = libc.Uint8FromInt32(1)
  6620. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeCDATA))
  6621. goto checkAttListDeclHandler
  6622. _13:
  6623. ;
  6624. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsId = libc.Uint8FromInt32(1)
  6625. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeID))
  6626. goto checkAttListDeclHandler
  6627. _14:
  6628. ;
  6629. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREF))
  6630. goto checkAttListDeclHandler
  6631. _15:
  6632. ;
  6633. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeIDREFS))
  6634. goto checkAttListDeclHandler
  6635. _16:
  6636. ;
  6637. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITY))
  6638. goto checkAttListDeclHandler
  6639. _17:
  6640. ;
  6641. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeENTITIES))
  6642. goto checkAttListDeclHandler
  6643. _18:
  6644. ;
  6645. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKEN))
  6646. goto checkAttListDeclHandler
  6647. _19:
  6648. ;
  6649. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = uintptr(unsafe.Pointer(&_atypeNMTOKENS))
  6650. goto checkAttListDeclHandler
  6651. checkAttListDeclHandler:
  6652. ;
  6653. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  6654. handleDefault = libc.Uint8FromInt32(0)
  6655. }
  6656. goto _64
  6657. _21:
  6658. ;
  6659. _20:
  6660. ;
  6661. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  6662. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  6663. prefix = uintptr(unsafe.Pointer(&_enumValueSep))
  6664. } else {
  6665. if role == int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE) {
  6666. v65 = uintptr(unsafe.Pointer(&_notationPrefix))
  6667. } else {
  6668. v65 = uintptr(unsafe.Pointer(&_enumValueStart))
  6669. }
  6670. prefix = v65
  6671. }
  6672. if !(_poolAppendString(tls, parser+784, prefix) != 0) {
  6673. return int32(_XML_ERROR_NO_MEMORY)
  6674. }
  6675. if !(_poolAppend(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  6676. return int32(_XML_ERROR_NO_MEMORY)
  6677. }
  6678. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  6679. handleDefault = libc.Uint8FromInt32(0)
  6680. }
  6681. goto _64
  6682. _23:
  6683. ;
  6684. _22:
  6685. ;
  6686. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6687. 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) {
  6688. return int32(_XML_ERROR_NO_MEMORY)
  6689. }
  6690. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  6691. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  6692. /* Enumerated or Notation type */
  6693. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6694. v66 = 0
  6695. } else {
  6696. v68 = parser + 784 + 24
  6697. v67 = *(*uintptr)(unsafe.Pointer(v68))
  6698. *(*uintptr)(unsafe.Pointer(v68))++
  6699. *(*TXML_Char)(unsafe.Pointer(v67)) = uint8(m_ASCII_RPAREN)
  6700. v66 = libc.Int32FromInt32(1)
  6701. }
  6702. if v72 = !(v66 != 0); !v72 {
  6703. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6704. v69 = 0
  6705. } else {
  6706. v71 = parser + 784 + 24
  6707. v70 = *(*uintptr)(unsafe.Pointer(v71))
  6708. *(*uintptr)(unsafe.Pointer(v71))++
  6709. *(*TXML_Char)(unsafe.Pointer(v70)) = uint8('\000')
  6710. v69 = libc.Int32FromInt32(1)
  6711. }
  6712. }
  6713. if v72 || !(v69 != 0) {
  6714. return int32(_XML_ERROR_NO_MEMORY)
  6715. }
  6716. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  6717. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6718. }
  6719. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6720. (*(*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)))
  6721. _poolClear(tls, parser+784)
  6722. handleDefault = libc.Uint8FromInt32(0)
  6723. }
  6724. }
  6725. goto _64
  6726. _25:
  6727. ;
  6728. _24:
  6729. ;
  6730. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6731. result2 = _storeAttributeValue(tls, parser, enc, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeIsCdata, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), dtd+160)
  6732. if result2 != 0 {
  6733. return result2
  6734. }
  6735. attVal = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6736. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6737. /* ID attributes aren't allowed to have a default */
  6738. 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) {
  6739. return int32(_XML_ERROR_NO_MEMORY)
  6740. }
  6741. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType != 0 {
  6742. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_LPAREN) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType))) == int32(m_ASCII_N) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType + 1))) == int32(m_ASCII_O) {
  6743. /* Enumerated or Notation type */
  6744. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6745. v73 = 0
  6746. } else {
  6747. v75 = parser + 784 + 24
  6748. v74 = *(*uintptr)(unsafe.Pointer(v75))
  6749. *(*uintptr)(unsafe.Pointer(v75))++
  6750. *(*TXML_Char)(unsafe.Pointer(v74)) = uint8(m_ASCII_RPAREN)
  6751. v73 = libc.Int32FromInt32(1)
  6752. }
  6753. if v79 = !(v73 != 0); !v79 {
  6754. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  6755. v76 = 0
  6756. } else {
  6757. v78 = parser + 784 + 24
  6758. v77 = *(*uintptr)(unsafe.Pointer(v78))
  6759. *(*uintptr)(unsafe.Pointer(v78))++
  6760. *(*TXML_Char)(unsafe.Pointer(v77)) = uint8('\000')
  6761. v76 = libc.Int32FromInt32(1)
  6762. }
  6763. }
  6764. if v79 || !(v76 != 0) {
  6765. return int32(_XML_ERROR_NO_MEMORY)
  6766. }
  6767. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declAttributeType = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  6768. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6769. }
  6770. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6771. (*(*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)))
  6772. _poolClear(tls, parser+784)
  6773. handleDefault = libc.Uint8FromInt32(0)
  6774. }
  6775. }
  6776. goto _64
  6777. _26:
  6778. ;
  6779. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6780. result3 = _storeEntityValue(tls, parser, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6781. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6782. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextPtr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  6783. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FtextLen = int32(int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(dtd+208)).Fstart))
  6784. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr
  6785. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6786. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6787. (*(*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))
  6788. handleDefault = libc.Uint8FromInt32(0)
  6789. }
  6790. } else {
  6791. (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 208)).Fstart
  6792. }
  6793. if result3 != int32(_XML_ERROR_NONE) {
  6794. return result3
  6795. }
  6796. }
  6797. goto _64
  6798. _27:
  6799. ;
  6800. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_useForeignDTD = libc.Uint8FromInt32(0)
  6801. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  6802. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  6803. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6804. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid == libc.UintptrFromInt32(0) {
  6805. return int32(_XML_ERROR_NO_MEMORY)
  6806. }
  6807. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6808. handleDefault = libc.Uint8FromInt32(0)
  6809. } else {
  6810. /* use externalSubsetName to make parser->m_doctypeSysid non-NULL
  6811. for the case where no parser->m_startDoctypeDeclHandler is set */
  6812. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_doctypeSysid = uintptr(unsafe.Pointer(&_externalSubsetName))
  6813. }
  6814. 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) {
  6815. return int32(_XML_ERROR_NOT_STANDALONE)
  6816. }
  6817. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6818. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, uintptr(unsafe.Pointer(&_externalSubsetName)), uint64(64))
  6819. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6820. return int32(_XML_ERROR_NO_MEMORY)
  6821. }
  6822. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  6823. }
  6824. /* fall through */
  6825. _28:
  6826. ;
  6827. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6828. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6829. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FsystemId != 0) {
  6830. return int32(_XML_ERROR_NO_MEMORY)
  6831. }
  6832. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fbase = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_curBase
  6833. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6834. /* Don't suppress the default handler if we fell through from
  6835. * the XML_ROLE_DOCTYPE_SYSTEM_ID case.
  6836. */
  6837. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 && role == int32(_XML_ROLE_ENTITY_SYSTEM_ID) {
  6838. handleDefault = libc.Uint8FromInt32(0)
  6839. }
  6840. }
  6841. goto _64
  6842. _29:
  6843. ;
  6844. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6845. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6846. (*(*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))
  6847. handleDefault = libc.Uint8FromInt32(0)
  6848. }
  6849. goto _64
  6850. _30:
  6851. ;
  6852. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0 {
  6853. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6854. if !((*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fnotation != 0) {
  6855. return int32(_XML_ERROR_NO_MEMORY)
  6856. }
  6857. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6858. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_unparsedEntityDeclHandler != 0 {
  6859. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6860. (*(*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)
  6861. handleDefault = libc.Uint8FromInt32(0)
  6862. } else {
  6863. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6864. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6865. (*(*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)
  6866. handleDefault = libc.Uint8FromInt32(0)
  6867. }
  6868. }
  6869. }
  6870. goto _64
  6871. _31:
  6872. ;
  6873. 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 {
  6874. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6875. goto _64
  6876. }
  6877. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6878. name = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6879. if !(name != 0) {
  6880. return int32(_XML_ERROR_NO_MEMORY)
  6881. }
  6882. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd, name, uint64(64))
  6883. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6884. return int32(_XML_ERROR_NO_MEMORY)
  6885. }
  6886. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name {
  6887. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6888. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6889. } else {
  6890. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6891. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  6892. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(0)
  6893. /* if we have a parent parser or are reading an internal parameter
  6894. entity, then the entity declaration is not considered "internal"
  6895. */
  6896. (*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))
  6897. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6898. handleDefault = libc.Uint8FromInt32(0)
  6899. }
  6900. }
  6901. } else {
  6902. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6903. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6904. }
  6905. goto _64
  6906. _32:
  6907. ;
  6908. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 {
  6909. name1 = _poolStoreString(tls, dtd+160, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6910. if !(name1 != 0) {
  6911. return int32(_XML_ERROR_NO_MEMORY)
  6912. }
  6913. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = _lookup(tls, parser, dtd+264, name1, uint64(64))
  6914. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity != 0) {
  6915. return int32(_XML_ERROR_NO_MEMORY)
  6916. }
  6917. if (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fname != name1 {
  6918. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6919. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6920. } else {
  6921. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  6922. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).FpublicId = libc.UintptrFromInt32(0)
  6923. (*TENTITY)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity)).Fis_param = libc.Uint8FromInt32(1)
  6924. /* if we have a parent parser or are reading an internal parameter
  6925. entity, then the entity declaration is not considered "internal"
  6926. */
  6927. (*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))
  6928. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  6929. handleDefault = libc.Uint8FromInt32(0)
  6930. }
  6931. }
  6932. } else {
  6933. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  6934. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declEntity = libc.UintptrFromInt32(0)
  6935. }
  6936. goto _64
  6937. _33:
  6938. ;
  6939. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = libc.UintptrFromInt32(0)
  6940. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = libc.UintptrFromInt32(0)
  6941. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  6942. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName = _poolStoreString(tls, parser+784, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  6943. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0) {
  6944. return int32(_XML_ERROR_NO_MEMORY)
  6945. }
  6946. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6947. handleDefault = libc.Uint8FromInt32(0)
  6948. }
  6949. goto _64
  6950. _34:
  6951. ;
  6952. 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) {
  6953. return int32(_XML_ERROR_PUBLICID)
  6954. }
  6955. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 { /* means m_notationDeclHandler != NULL */
  6956. tem1 = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6957. if !(tem1 != 0) {
  6958. return int32(_XML_ERROR_NO_MEMORY)
  6959. }
  6960. _normalizePublicId(tls, tem1)
  6961. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId = tem1
  6962. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  6963. handleDefault = libc.Uint8FromInt32(0)
  6964. }
  6965. goto _64
  6966. _35:
  6967. ;
  6968. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationName != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  6969. systemId = _poolStoreString(tls, parser+784, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  6970. if !(systemId != 0) {
  6971. return int32(_XML_ERROR_NO_MEMORY)
  6972. }
  6973. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6974. (*(*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)
  6975. handleDefault = libc.Uint8FromInt32(0)
  6976. }
  6977. _poolClear(tls, parser+784)
  6978. goto _64
  6979. _36:
  6980. ;
  6981. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declNotationPublicId != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  6982. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  6983. (*(*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)
  6984. handleDefault = libc.Uint8FromInt32(0)
  6985. }
  6986. _poolClear(tls, parser+784)
  6987. goto _64
  6988. _37:
  6989. ;
  6990. switch tok {
  6991. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  6992. /* PE references in internal subset are
  6993. not allowed within declarations. */
  6994. return int32(_XML_ERROR_PARAM_ENTITY_REF)
  6995. case int32(m_XML_TOK_XML_DECL):
  6996. return int32(_XML_ERROR_MISPLACED_XML_PI)
  6997. default:
  6998. return int32(_XML_ERROR_SYNTAX)
  6999. }
  7000. _38:
  7001. ;
  7002. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7003. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7004. }
  7005. handleDefault = libc.Uint8FromInt32(0)
  7006. result4 = _doIgnoreSection(tls, parser, enc, bp, end, nextPtr, haveMore)
  7007. if result4 != int32(_XML_ERROR_NONE) {
  7008. return result4
  7009. } else {
  7010. if !(*(*uintptr)(unsafe.Pointer(bp)) != 0) {
  7011. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_ignoreSectionProcessor)
  7012. return result4
  7013. }
  7014. }
  7015. goto _64
  7016. _39:
  7017. ;
  7018. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel >= (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize {
  7019. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize != 0 {
  7020. p80 = parser + 888
  7021. *(*uint32)(unsafe.Pointer(p80)) *= uint32(2)
  7022. new_connector = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector, uint64(*(*uint32)(unsafe.Pointer(p80))))
  7023. if new_connector == libc.UintptrFromInt32(0) {
  7024. *(*uint32)(unsafe.Pointer(parser + 888)) /= uint32(2)
  7025. return int32(_XML_ERROR_NO_MEMORY)
  7026. }
  7027. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = new_connector
  7028. if (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0 {
  7029. new_scaff_index = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  7030. if new_scaff_index == libc.UintptrFromInt32(0) {
  7031. return int32(_XML_ERROR_NO_MEMORY)
  7032. }
  7033. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = new_scaff_index
  7034. }
  7035. } else {
  7036. v81 = libc.Uint32FromInt32(32)
  7037. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = v81
  7038. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64(v81))
  7039. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector != 0) {
  7040. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize = uint32(0)
  7041. return int32(_XML_ERROR_NO_MEMORY)
  7042. }
  7043. }
  7044. }
  7045. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(0)
  7046. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7047. myindex = _nextScaffoldPart(tls, parser)
  7048. if myindex < 0 {
  7049. return int32(_XML_ERROR_NO_MEMORY)
  7050. }
  7051. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)) = myindex
  7052. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel++
  7053. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex)*32))).Ftype1 = int32(_XML_CTYPE_SEQ)
  7054. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7055. handleDefault = libc.Uint8FromInt32(0)
  7056. }
  7057. }
  7058. goto _64
  7059. _40:
  7060. ;
  7061. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_PIPE) {
  7062. return int32(_XML_ERROR_SYNTAX)
  7063. }
  7064. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_COMMA)
  7065. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7066. handleDefault = libc.Uint8FromInt32(0)
  7067. }
  7068. goto _64
  7069. _41:
  7070. ;
  7071. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel)))) == int32(m_ASCII_COMMA) {
  7072. return int32(_XML_ERROR_SYNTAX)
  7073. }
  7074. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 && !(*(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) != 0) && (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 != int32(_XML_CTYPE_MIXED) {
  7075. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_CHOICE)
  7076. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7077. handleDefault = libc.Uint8FromInt32(0)
  7078. }
  7079. }
  7080. *(*uint8)(unsafe.Pointer((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupConnector + uintptr((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.Flevel))) = uint8(m_ASCII_PIPE)
  7081. goto _64
  7082. _43:
  7083. ;
  7084. _42:
  7085. ;
  7086. (*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs = libc.Uint8FromInt32(1)
  7087. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_paramEntityParsing != 0) {
  7088. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7089. } else {
  7090. name2 = _poolStoreString(tls, dtd+160, enc, s+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7091. if !(name2 != 0) {
  7092. return int32(_XML_ERROR_NO_MEMORY)
  7093. }
  7094. entity2 = _lookup(tls, parser, dtd+264, name2, uint64(0))
  7095. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  7096. /* first, determine if a check for an existing declaration is needed;
  7097. if yes, check that the entity exists, and that it is internal,
  7098. otherwise call the skipped entity handler
  7099. */
  7100. if v83 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v83 {
  7101. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7102. v82 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7103. } else {
  7104. v82 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7105. }
  7106. }
  7107. if v83 && v82 != 0 {
  7108. if !(entity2 != 0) {
  7109. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7110. } else {
  7111. if !((*TENTITY)(unsafe.Pointer(entity2)).Fis_internal != 0) {
  7112. /* It's hard to exhaustively search the code to be sure,
  7113. * but there doesn't seem to be a way of executing the
  7114. * following line. There are two cases:
  7115. *
  7116. * If 'standalone' is false, the DTD must have no
  7117. * parameter entities or we wouldn't have passed the outer
  7118. * 'if' statement. That measn the only entity in the hash
  7119. * table is the external subset name "#" which cannot be
  7120. * given as a parameter entity name in XML syntax, so the
  7121. * lookup must have returned NULL and we don't even reach
  7122. * the test for an internal entity.
  7123. *
  7124. * If 'standalone' is true, it does not seem to be
  7125. * possible to create entities taking this code path that
  7126. * are not internal entities, so fail the test above.
  7127. *
  7128. * Because this analysis is very uncertain, the code is
  7129. * being left in place and merely removed from the
  7130. * coverage test statistics.
  7131. */
  7132. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE) /* LCOV_EXCL_LINE */
  7133. }
  7134. }
  7135. } else {
  7136. if !(entity2 != 0) {
  7137. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7138. /* cannot report skipped entities in declarations */
  7139. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_skippedEntityHandler != 0 {
  7140. (*(*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))
  7141. handleDefault = libc.Uint8FromInt32(0)
  7142. }
  7143. goto _64
  7144. }
  7145. }
  7146. if (*TENTITY)(unsafe.Pointer(entity2)).Fopen != 0 {
  7147. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7148. }
  7149. if (*TENTITY)(unsafe.Pointer(entity2)).FtextPtr != 0 {
  7150. if role == int32(_XML_ROLE_PARAM_ENTITY_REF) {
  7151. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(1))
  7152. } else {
  7153. v84 = libc.Int32FromUint8(libc.Uint8FromInt32(0))
  7154. }
  7155. betweenDecl = libc.Uint8FromInt32(v84)
  7156. result5 = _processInternalEntity(tls, parser, entity2, betweenDecl)
  7157. if result5 != int32(_XML_ERROR_NONE) {
  7158. return result5
  7159. }
  7160. handleDefault = libc.Uint8FromInt32(0)
  7161. goto _64
  7162. }
  7163. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7164. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7165. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(1)
  7166. 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) {
  7167. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7168. return int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7169. }
  7170. (*TENTITY)(unsafe.Pointer(entity2)).Fopen = libc.Uint8FromInt32(0)
  7171. handleDefault = libc.Uint8FromInt32(0)
  7172. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7173. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7174. goto _64
  7175. }
  7176. } else {
  7177. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7178. goto _64
  7179. }
  7180. }
  7181. 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) {
  7182. return int32(_XML_ERROR_NOT_STANDALONE)
  7183. }
  7184. goto _64
  7185. /* Element declaration stuff */
  7186. _44:
  7187. ;
  7188. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7189. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType = _getElementType(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7190. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_declElementType != 0) {
  7191. return int32(_XML_ERROR_NO_MEMORY)
  7192. }
  7193. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel = 0
  7194. (*TDTD)(unsafe.Pointer(dtd)).FscaffCount = uint32(0)
  7195. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(1)
  7196. handleDefault = libc.Uint8FromInt32(0)
  7197. }
  7198. goto _64
  7199. _46:
  7200. ;
  7201. _45:
  7202. ;
  7203. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7204. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7205. content = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(32))
  7206. if !(content != 0) {
  7207. return int32(_XML_ERROR_NO_MEMORY)
  7208. }
  7209. (*TXML_Content)(unsafe.Pointer(content)).Fquant = int32(_XML_CQUANT_NONE)
  7210. (*TXML_Content)(unsafe.Pointer(content)).Fname = libc.UintptrFromInt32(0)
  7211. (*TXML_Content)(unsafe.Pointer(content)).Fnumchildren = uint32(0)
  7212. (*TXML_Content)(unsafe.Pointer(content)).Fchildren = libc.UintptrFromInt32(0)
  7213. if role == int32(_XML_ROLE_CONTENT_ANY) {
  7214. v85 = int32(_XML_CTYPE_ANY)
  7215. } else {
  7216. v85 = int32(_XML_CTYPE_EMPTY)
  7217. }
  7218. (*TXML_Content)(unsafe.Pointer(content)).Ftype1 = v85
  7219. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7220. (*(*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)
  7221. handleDefault = libc.Uint8FromInt32(0)
  7222. }
  7223. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7224. }
  7225. goto _64
  7226. _47:
  7227. ;
  7228. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7229. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32))).Ftype1 = int32(_XML_CTYPE_MIXED)
  7230. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7231. handleDefault = libc.Uint8FromInt32(0)
  7232. }
  7233. }
  7234. goto _64
  7235. _48:
  7236. ;
  7237. quant = int32(_XML_CQUANT_NONE)
  7238. goto elementContent
  7239. _49:
  7240. ;
  7241. quant = int32(_XML_CQUANT_OPT)
  7242. goto elementContent
  7243. _50:
  7244. ;
  7245. quant = int32(_XML_CQUANT_REP)
  7246. goto elementContent
  7247. _51:
  7248. ;
  7249. quant = int32(_XML_CQUANT_PLUS)
  7250. goto elementContent
  7251. elementContent:
  7252. ;
  7253. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7254. if quant == int32(_XML_CQUANT_NONE) {
  7255. v86 = *(*uintptr)(unsafe.Pointer(bp))
  7256. } else {
  7257. v86 = *(*uintptr)(unsafe.Pointer(bp)) - uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7258. }
  7259. nxt = v86
  7260. myindex1 = _nextScaffoldPart(tls, parser)
  7261. if myindex1 < 0 {
  7262. return int32(_XML_ERROR_NO_MEMORY)
  7263. }
  7264. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Ftype1 = int32(_XML_CTYPE_NAME)
  7265. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fquant = quant
  7266. el = _getElementType(tls, parser, enc, s, nxt)
  7267. if !(el != 0) {
  7268. return int32(_XML_ERROR_NO_MEMORY)
  7269. }
  7270. name3 = (*TELEMENT_TYPE)(unsafe.Pointer(el)).Fname
  7271. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(myindex1)*32))).Fname = name3
  7272. nameLen = 0
  7273. for {
  7274. v88 = nameLen
  7275. nameLen++
  7276. if !(*(*TXML_Char)(unsafe.Pointer(name3 + uintptr(v88))) != 0) {
  7277. break
  7278. }
  7279. goto _87
  7280. _87:
  7281. }
  7282. *(*uint32)(unsafe.Pointer(dtd + 336)) += libc.Uint32FromInt32(nameLen)
  7283. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7284. handleDefault = libc.Uint8FromInt32(0)
  7285. }
  7286. }
  7287. goto _64
  7288. _52:
  7289. ;
  7290. quant = int32(_XML_CQUANT_NONE)
  7291. goto closeGroup
  7292. _53:
  7293. ;
  7294. quant = int32(_XML_CQUANT_OPT)
  7295. goto closeGroup
  7296. _54:
  7297. ;
  7298. quant = int32(_XML_CQUANT_REP)
  7299. goto closeGroup
  7300. _55:
  7301. ;
  7302. quant = int32(_XML_CQUANT_PLUS)
  7303. goto closeGroup
  7304. closeGroup:
  7305. ;
  7306. if (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl != 0 {
  7307. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7308. handleDefault = libc.Uint8FromInt32(0)
  7309. }
  7310. (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel--
  7311. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel)*4)))*32))).Fquant = quant
  7312. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel == 0 {
  7313. if !(handleDefault != 0) {
  7314. model = _build_model(tls, parser)
  7315. if !(model != 0) {
  7316. return int32(_XML_ERROR_NO_MEMORY)
  7317. }
  7318. *(*uintptr)(unsafe.Pointer(eventEndPP)) = s
  7319. (*(*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)
  7320. }
  7321. (*TDTD)(unsafe.Pointer(dtd)).Fin_eldecl = libc.Uint8FromInt32(0)
  7322. (*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen = uint32(0)
  7323. }
  7324. }
  7325. goto _64
  7326. /* End element declaration stuff */
  7327. _56:
  7328. ;
  7329. if !(_reportProcessingInstruction(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7330. return int32(_XML_ERROR_NO_MEMORY)
  7331. }
  7332. handleDefault = libc.Uint8FromInt32(0)
  7333. goto _64
  7334. _57:
  7335. ;
  7336. if !(_reportComment(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7337. return int32(_XML_ERROR_NO_MEMORY)
  7338. }
  7339. handleDefault = libc.Uint8FromInt32(0)
  7340. goto _64
  7341. _58:
  7342. ;
  7343. switch tok {
  7344. case int32(m_XML_TOK_BOM):
  7345. handleDefault = libc.Uint8FromInt32(0)
  7346. break
  7347. }
  7348. goto _64
  7349. _59:
  7350. ;
  7351. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_startDoctypeDeclHandler != 0 {
  7352. handleDefault = libc.Uint8FromInt32(0)
  7353. }
  7354. goto _64
  7355. _60:
  7356. ;
  7357. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_entityDeclHandler != 0 {
  7358. handleDefault = libc.Uint8FromInt32(0)
  7359. }
  7360. goto _64
  7361. _61:
  7362. ;
  7363. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_notationDeclHandler != 0 {
  7364. handleDefault = libc.Uint8FromInt32(0)
  7365. }
  7366. goto _64
  7367. _62:
  7368. ;
  7369. if (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_attlistDeclHandler != 0 {
  7370. handleDefault = libc.Uint8FromInt32(0)
  7371. }
  7372. goto _64
  7373. _63:
  7374. ;
  7375. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_elementDeclHandler != 0 {
  7376. handleDefault = libc.Uint8FromInt32(0)
  7377. }
  7378. goto _64
  7379. _64:
  7380. ; /* end of big switch */
  7381. if handleDefault != 0 && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7382. _reportDefault(tls, parser, enc, s, *(*uintptr)(unsafe.Pointer(bp)))
  7383. }
  7384. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7385. case int32(_XML_SUSPENDED):
  7386. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7387. return int32(_XML_ERROR_NONE)
  7388. case int32(_XML_FINISHED):
  7389. return int32(_XML_ERROR_ABORTED)
  7390. default:
  7391. s = *(*uintptr)(unsafe.Pointer(bp))
  7392. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc))})))(tls, enc, s, end, bp)
  7393. }
  7394. goto _1
  7395. _1:
  7396. }
  7397. /* not reached */
  7398. return r
  7399. }
  7400. var _externalSubsetName = [2]TXML_Char{
  7401. 0: uint8(m_ASCII_HASH),
  7402. }
  7403. var _atypeCDATA = [6]TXML_Char{
  7404. 0: uint8(m_ASCII_C),
  7405. 1: uint8(m_ASCII_D),
  7406. 2: uint8(m_ASCII_A),
  7407. 3: uint8(m_ASCII_T),
  7408. 4: uint8(m_ASCII_A),
  7409. }
  7410. var _atypeID = [3]TXML_Char{
  7411. 0: uint8(m_ASCII_I),
  7412. 1: uint8(m_ASCII_D),
  7413. }
  7414. var _atypeIDREF = [6]TXML_Char{
  7415. 0: uint8(m_ASCII_I),
  7416. 1: uint8(m_ASCII_D),
  7417. 2: uint8(m_ASCII_R),
  7418. 3: uint8(m_ASCII_E),
  7419. 4: uint8(m_ASCII_F),
  7420. }
  7421. var _atypeIDREFS = [7]TXML_Char{
  7422. 0: uint8(m_ASCII_I),
  7423. 1: uint8(m_ASCII_D),
  7424. 2: uint8(m_ASCII_R),
  7425. 3: uint8(m_ASCII_E),
  7426. 4: uint8(m_ASCII_F),
  7427. 5: uint8(m_ASCII_S),
  7428. }
  7429. var _atypeENTITY = [7]TXML_Char{
  7430. 0: uint8(m_ASCII_E),
  7431. 1: uint8(m_ASCII_N),
  7432. 2: uint8(m_ASCII_T),
  7433. 3: uint8(m_ASCII_I),
  7434. 4: uint8(m_ASCII_T),
  7435. 5: uint8(m_ASCII_Y),
  7436. }
  7437. var _atypeENTITIES = [9]TXML_Char{
  7438. 0: uint8(m_ASCII_E),
  7439. 1: uint8(m_ASCII_N),
  7440. 2: uint8(m_ASCII_T),
  7441. 3: uint8(m_ASCII_I),
  7442. 4: uint8(m_ASCII_T),
  7443. 5: uint8(m_ASCII_I),
  7444. 6: uint8(m_ASCII_E),
  7445. 7: uint8(m_ASCII_S),
  7446. }
  7447. var _atypeNMTOKEN = [8]TXML_Char{
  7448. 0: uint8(m_ASCII_N),
  7449. 1: uint8(m_ASCII_M),
  7450. 2: uint8(m_ASCII_T),
  7451. 3: uint8(m_ASCII_O),
  7452. 4: uint8(m_ASCII_K),
  7453. 5: uint8(m_ASCII_E),
  7454. 6: uint8(m_ASCII_N),
  7455. }
  7456. var _atypeNMTOKENS = [9]TXML_Char{
  7457. 0: uint8(m_ASCII_N),
  7458. 1: uint8(m_ASCII_M),
  7459. 2: uint8(m_ASCII_T),
  7460. 3: uint8(m_ASCII_O),
  7461. 4: uint8(m_ASCII_K),
  7462. 5: uint8(m_ASCII_E),
  7463. 6: uint8(m_ASCII_N),
  7464. 7: uint8(m_ASCII_S),
  7465. }
  7466. var _notationPrefix = [10]TXML_Char{
  7467. 0: uint8(m_ASCII_N),
  7468. 1: uint8(m_ASCII_O),
  7469. 2: uint8(m_ASCII_T),
  7470. 3: uint8(m_ASCII_A),
  7471. 4: uint8(m_ASCII_T),
  7472. 5: uint8(m_ASCII_I),
  7473. 6: uint8(m_ASCII_O),
  7474. 7: uint8(m_ASCII_N),
  7475. 8: uint8(m_ASCII_LPAREN),
  7476. }
  7477. var _enumValueSep = [2]TXML_Char{
  7478. 0: uint8(m_ASCII_PIPE),
  7479. }
  7480. var _enumValueStart = [2]TXML_Char{
  7481. 0: uint8(m_ASCII_LPAREN),
  7482. }
  7483. func _epilogProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7484. bp := tls.Alloc(16)
  7485. defer tls.Free(16)
  7486. var tok int32
  7487. var v2 uintptr
  7488. var _ /* next at bp+0 */ uintptr
  7489. _, _ = tok, v2
  7490. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_epilogProcessor)
  7491. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = s
  7492. for {
  7493. *(*uintptr)(unsafe.Pointer(bp)) = libc.UintptrFromInt32(0)
  7494. 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)
  7495. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventEndPtr = *(*uintptr)(unsafe.Pointer(bp))
  7496. switch tok {
  7497. /* report partial linebreak - it might be the last token */
  7498. case -int32(m_XML_TOK_PROLOG_S):
  7499. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7500. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7501. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_FINISHED) {
  7502. return int32(_XML_ERROR_ABORTED)
  7503. }
  7504. }
  7505. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7506. return int32(_XML_ERROR_NONE)
  7507. case -int32(4):
  7508. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7509. return int32(_XML_ERROR_NONE)
  7510. case int32(m_XML_TOK_PROLOG_S):
  7511. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  7512. _reportDefault(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp)))
  7513. }
  7514. case int32(m_XML_TOK_PI):
  7515. if !(_reportProcessingInstruction(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7516. return int32(_XML_ERROR_NO_MEMORY)
  7517. }
  7518. case int32(m_XML_TOK_COMMENT):
  7519. if !(_reportComment(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding, s, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7520. return int32(_XML_ERROR_NO_MEMORY)
  7521. }
  7522. case m_XML_TOK_INVALID:
  7523. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7524. return int32(_XML_ERROR_INVALID_TOKEN)
  7525. case -int32(1):
  7526. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7527. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7528. return int32(_XML_ERROR_NONE)
  7529. }
  7530. return int32(_XML_ERROR_UNCLOSED_TOKEN)
  7531. case -int32(2):
  7532. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.FfinalBuffer != 0) {
  7533. *(*uintptr)(unsafe.Pointer(nextPtr)) = s
  7534. return int32(_XML_ERROR_NONE)
  7535. }
  7536. return int32(_XML_ERROR_PARTIAL_CHAR)
  7537. default:
  7538. return int32(_XML_ERROR_JUNK_AFTER_DOC_ELEMENT)
  7539. }
  7540. v2 = *(*uintptr)(unsafe.Pointer(bp))
  7541. s = v2
  7542. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = v2
  7543. switch (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing {
  7544. case int32(_XML_SUSPENDED):
  7545. *(*uintptr)(unsafe.Pointer(nextPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  7546. return int32(_XML_ERROR_NONE)
  7547. case int32(_XML_FINISHED):
  7548. return int32(_XML_ERROR_ABORTED)
  7549. default:
  7550. }
  7551. goto _1
  7552. _1:
  7553. }
  7554. return r
  7555. }
  7556. func _processInternalEntity(tls *libc.TLS, parser TXML_Parser, entity uintptr, betweenDecl TXML_Bool) (r _XML_Error) {
  7557. bp := tls.Alloc(16)
  7558. defer tls.Free(16)
  7559. var openEntity, textEnd, textStart uintptr
  7560. var result _XML_Error
  7561. var tok int32
  7562. var _ /* next at bp+0 */ uintptr
  7563. _, _, _, _, _ = openEntity, result, textEnd, textStart, tok
  7564. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities != 0 {
  7565. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7566. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7567. } else {
  7568. openEntity = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt64(40))
  7569. if !(openEntity != 0) {
  7570. return int32(_XML_ERROR_NO_MEMORY)
  7571. }
  7572. }
  7573. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7574. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = 0
  7575. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7576. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = openEntity
  7577. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity = entity
  7578. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel
  7579. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FbetweenDecl = betweenDecl
  7580. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventPtr = libc.UintptrFromInt32(0)
  7581. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FinternalEventEndPtr = libc.UintptrFromInt32(0)
  7582. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr
  7583. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7584. /* Set a safe default value in case 'next' does not get set */
  7585. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7586. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7587. 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)
  7588. 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))
  7589. } else {
  7590. result = _doContent(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0))
  7591. }
  7592. if result == int32(_XML_ERROR_NONE) {
  7593. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7594. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(textStart))
  7595. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_internalEntityProcessor)
  7596. } else {
  7597. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7598. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7599. /* put openEntity back in list of free instances */
  7600. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7601. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7602. }
  7603. }
  7604. return result
  7605. }
  7606. func _internalEntityProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7607. bp := tls.Alloc(16)
  7608. defer tls.Free(16)
  7609. var entity, openEntity, textEnd, textStart uintptr
  7610. var result _XML_Error
  7611. var tok, tok1, v1 int32
  7612. var _ /* next at bp+0 */ uintptr
  7613. _, _, _, _, _, _, _, _ = entity, openEntity, result, textEnd, textStart, tok, tok1, v1
  7614. openEntity = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  7615. if !(openEntity != 0) {
  7616. return int32(_XML_ERROR_UNEXPECTED_STATE)
  7617. }
  7618. entity = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fentity
  7619. textStart = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).Fprocessed)
  7620. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7621. /* Set a safe default value in case 'next' does not get set */
  7622. *(*uintptr)(unsafe.Pointer(bp)) = textStart
  7623. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7624. 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)
  7625. 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))
  7626. } else {
  7627. result = _doContent(tls, parser, (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).FstartTagLevel, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, textStart, textEnd, bp, libc.Uint8FromInt32(0))
  7628. }
  7629. if result != int32(_XML_ERROR_NONE) {
  7630. return result
  7631. } else {
  7632. if textEnd != *(*uintptr)(unsafe.Pointer(bp)) && (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parsingStatus.Fparsing == int32(_XML_SUSPENDED) {
  7633. (*TENTITY)(unsafe.Pointer(entity)).Fprocessed = int32(int64(*(*uintptr)(unsafe.Pointer(bp))) - int64((*TENTITY)(unsafe.Pointer(entity)).FtextPtr))
  7634. return result
  7635. } else {
  7636. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7637. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities = (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext
  7638. /* put openEntity back in list of free instances */
  7639. (*TOPEN_INTERNAL_ENTITY)(unsafe.Pointer(openEntity)).Fnext = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities
  7640. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_freeInternalEntities = openEntity
  7641. }
  7642. }
  7643. if (*TENTITY)(unsafe.Pointer(entity)).Fis_param != 0 {
  7644. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_prologProcessor)
  7645. 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)
  7646. 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))
  7647. } else {
  7648. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processor = __ccgo_fp(_contentProcessor)
  7649. /* see externalEntityContentProcessor vs contentProcessor */
  7650. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_parentParser != 0 {
  7651. v1 = int32(1)
  7652. } else {
  7653. v1 = 0
  7654. }
  7655. return _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)))
  7656. }
  7657. return r
  7658. }
  7659. func _errorProcessor(tls *libc.TLS, parser TXML_Parser, s uintptr, end uintptr, nextPtr uintptr) (r _XML_Error) {
  7660. _ = s
  7661. _ = end
  7662. _ = nextPtr
  7663. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_errorCode
  7664. }
  7665. func _storeAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr) (r _XML_Error) {
  7666. var result _XML_Error
  7667. var v1 int32
  7668. var v2, v3 uintptr
  7669. _, _, _, _ = result, v1, v2, v3
  7670. result = _appendAttributeValue(tls, parser, enc, isCdata, ptr, end, pool)
  7671. if result != 0 {
  7672. return result
  7673. }
  7674. if !(isCdata != 0) && int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) != 0 && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  7675. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr--
  7676. }
  7677. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7678. v1 = 0
  7679. } else {
  7680. v3 = pool + 24
  7681. v2 = *(*uintptr)(unsafe.Pointer(v3))
  7682. *(*uintptr)(unsafe.Pointer(v3))++
  7683. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  7684. v1 = libc.Int32FromInt32(1)
  7685. }
  7686. if !(v1 != 0) {
  7687. return int32(_XML_ERROR_NO_MEMORY)
  7688. }
  7689. return int32(_XML_ERROR_NONE)
  7690. }
  7691. func _appendAttributeValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, isCdata TXML_Bool, ptr uintptr, end uintptr, pool uintptr) (r _XML_Error) {
  7692. bp := tls.Alloc(16)
  7693. defer tls.Free(16)
  7694. var ch TXML_Char
  7695. var checkEntityDecl uint8
  7696. var dtd, entity, name, textEnd, v10, v11, v4, v5, v7, v8 uintptr
  7697. var i, n, tok, v12, v3, v6, v9 int32
  7698. var result _XML_Error
  7699. var v13 bool
  7700. var _ /* buf at bp+8 */ [4]TXML_Char
  7701. var _ /* next at bp+0 */ uintptr
  7702. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = ch, checkEntityDecl, dtd, entity, i, n, name, result, textEnd, tok, v10, v11, v12, v13, v3, v4, v5, v6, v7, v8, v9
  7703. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  7704. for {
  7705. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32))})))(tls, enc, ptr, end, bp)
  7706. switch tok {
  7707. case -int32(4):
  7708. return int32(_XML_ERROR_NONE)
  7709. case m_XML_TOK_INVALID:
  7710. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7711. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  7712. }
  7713. return int32(_XML_ERROR_INVALID_TOKEN)
  7714. case -int32(1):
  7715. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7716. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7717. }
  7718. return int32(_XML_ERROR_INVALID_TOKEN)
  7719. case int32(m_XML_TOK_CHAR_REF):
  7720. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, ptr)
  7721. if n < 0 {
  7722. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7723. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7724. }
  7725. return int32(_XML_ERROR_BAD_CHAR_REF)
  7726. }
  7727. if !(isCdata != 0) && n == int32(0x20) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  7728. break
  7729. }
  7730. n = XXmlUtf8Encode(tls, n, bp+8)
  7731. /* The XmlEncode() functions can never return 0 here. That
  7732. * error return happens if the code point passed in is either
  7733. * negative or greater than or equal to 0x110000. The
  7734. * XmlCharRefNumber() functions will all return a number
  7735. * strictly less than 0x110000 or a negative value if an error
  7736. * occurred. The negative value is intercepted above, so
  7737. * XmlEncode() is never passed a value it might return an
  7738. * error for.
  7739. */
  7740. i = 0
  7741. for {
  7742. if !(i < n) {
  7743. break
  7744. }
  7745. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7746. v3 = 0
  7747. } else {
  7748. v5 = pool + 24
  7749. v4 = *(*uintptr)(unsafe.Pointer(v5))
  7750. *(*uintptr)(unsafe.Pointer(v5))++
  7751. *(*TXML_Char)(unsafe.Pointer(v4)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  7752. v3 = libc.Int32FromInt32(1)
  7753. }
  7754. if !(v3 != 0) {
  7755. return int32(_XML_ERROR_NO_MEMORY)
  7756. }
  7757. goto _2
  7758. _2:
  7759. ;
  7760. i++
  7761. }
  7762. case int32(m_XML_TOK_DATA_CHARS):
  7763. if !(_poolAppend(tls, pool, enc, ptr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  7764. return int32(_XML_ERROR_NO_MEMORY)
  7765. }
  7766. case -int32(3):
  7767. *(*uintptr)(unsafe.Pointer(bp)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  7768. /* fall through */
  7769. fallthrough
  7770. case int32(m_XML_TOK_ATTRIBUTE_VALUE_S):
  7771. fallthrough
  7772. case int32(m_XML_TOK_DATA_NEWLINE):
  7773. if !(isCdata != 0) && (int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) == 0 || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20)) {
  7774. break
  7775. }
  7776. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7777. v6 = 0
  7778. } else {
  7779. v8 = pool + 24
  7780. v7 = *(*uintptr)(unsafe.Pointer(v8))
  7781. *(*uintptr)(unsafe.Pointer(v8))++
  7782. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8(0x20)
  7783. v6 = libc.Int32FromInt32(1)
  7784. }
  7785. if !(v6 != 0) {
  7786. return int32(_XML_ERROR_NO_MEMORY)
  7787. }
  7788. case int32(m_XML_TOK_ENTITY_REF):
  7789. ch = libc.Uint8FromInt32((*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FpredefinedEntityName})))(tls, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)))
  7790. if ch != 0 {
  7791. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  7792. v9 = 0
  7793. } else {
  7794. v11 = pool + 24
  7795. v10 = *(*uintptr)(unsafe.Pointer(v11))
  7796. *(*uintptr)(unsafe.Pointer(v11))++
  7797. *(*TXML_Char)(unsafe.Pointer(v10)) = ch
  7798. v9 = libc.Int32FromInt32(1)
  7799. }
  7800. if !(v9 != 0) {
  7801. return int32(_XML_ERROR_NO_MEMORY)
  7802. }
  7803. break
  7804. }
  7805. name = _poolStoreString(tls, parser+832, enc, ptr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7806. if !(name != 0) {
  7807. return int32(_XML_ERROR_NO_MEMORY)
  7808. }
  7809. entity = _lookup(tls, parser, dtd, name, uint64(0))
  7810. (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 832)).Fstart
  7811. /* First, determine if a check for an existing declaration is needed;
  7812. if yes, check that the entity exists, and that it is internal.
  7813. */
  7814. if pool == dtd+160 { /* are we called from prolog? */
  7815. if v13 = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FdocumentEntity != 0; v13 {
  7816. if (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0 {
  7817. v12 = libc.BoolInt32(!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities != 0))
  7818. } else {
  7819. v12 = libc.BoolInt32(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0))
  7820. }
  7821. }
  7822. checkEntityDecl = libc.BoolUint8(v13 && v12 != 0)
  7823. } else { /* if (pool == &parser->m_tempPool): we are called from content */
  7824. checkEntityDecl = libc.BoolUint8(!((*TDTD)(unsafe.Pointer(dtd)).FhasParamEntityRefs != 0) || (*TDTD)(unsafe.Pointer(dtd)).Fstandalone != 0)
  7825. }
  7826. if checkEntityDecl != 0 {
  7827. if !(entity != 0) {
  7828. return int32(_XML_ERROR_UNDEFINED_ENTITY)
  7829. } else {
  7830. if !((*TENTITY)(unsafe.Pointer(entity)).Fis_internal != 0) {
  7831. return int32(_XML_ERROR_ENTITY_DECLARED_IN_PE)
  7832. }
  7833. }
  7834. } else {
  7835. if !(entity != 0) {
  7836. /* Cannot report skipped entity here - see comments on
  7837. parser->m_skippedEntityHandler.
  7838. if (parser->m_skippedEntityHandler)
  7839. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  7840. */
  7841. /* Cannot call the default handler because this would be
  7842. out of sync with the call to the startElementHandler.
  7843. if ((pool == &parser->m_tempPool) && parser->m_defaultHandler)
  7844. reportDefault(parser, enc, ptr, next);
  7845. */
  7846. break
  7847. }
  7848. }
  7849. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  7850. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7851. /* It does not appear that this line can be executed.
  7852. *
  7853. * The "if (entity->open)" check catches recursive entity
  7854. * definitions. In order to be called with an open
  7855. * entity, it must have gone through this code before and
  7856. * been through the recursive call to
  7857. * appendAttributeValue() some lines below. That call
  7858. * sets the local encoding ("enc") to the parser's
  7859. * internal encoding (internal_utf8 or internal_utf16),
  7860. * which can never be the same as the principle encoding.
  7861. * It doesn't appear there is another code path that gets
  7862. * here with entity->open being TRUE.
  7863. *
  7864. * Since it is not certain that this logic is watertight,
  7865. * we keep the line and merely exclude it from coverage
  7866. * tests.
  7867. */
  7868. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr /* LCOV_EXCL_LINE */
  7869. }
  7870. return int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7871. }
  7872. if (*TENTITY)(unsafe.Pointer(entity)).Fnotation != 0 {
  7873. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7874. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7875. }
  7876. return int32(_XML_ERROR_BINARY_ENTITY_REF)
  7877. }
  7878. if !((*TENTITY)(unsafe.Pointer(entity)).FtextPtr != 0) {
  7879. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7880. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7881. }
  7882. return int32(_XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF)
  7883. } else {
  7884. textEnd = (*TENTITY)(unsafe.Pointer(entity)).FtextPtr + uintptr((*TENTITY)(unsafe.Pointer(entity)).FtextLen)
  7885. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7886. result = _appendAttributeValue(tls, parser, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_internalEncoding, isCdata, (*TENTITY)(unsafe.Pointer(entity)).FtextPtr, textEnd, pool)
  7887. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7888. if result != 0 {
  7889. return result
  7890. }
  7891. }
  7892. default:
  7893. /* The only token returned by XmlAttributeValueTok() that does
  7894. * not have an explicit case here is XML_TOK_PARTIAL_CHAR.
  7895. * Getting that would require an entity name to contain an
  7896. * incomplete XML character (e.g. \xE2\x82); however previous
  7897. * tokenisers will have already recognised and rejected such
  7898. * names before XmlAttributeValueTok() gets a look-in. This
  7899. * default case should be retained as a safety net, but the code
  7900. * excluded from coverage tests.
  7901. *
  7902. * LCOV_EXCL_START
  7903. */
  7904. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7905. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = ptr
  7906. }
  7907. return int32(_XML_ERROR_UNEXPECTED_STATE)
  7908. /* LCOV_EXCL_STOP */
  7909. }
  7910. ptr = *(*uintptr)(unsafe.Pointer(bp))
  7911. goto _1
  7912. _1:
  7913. }
  7914. /* not reached */
  7915. return r
  7916. }
  7917. func _storeEntityValue(tls *libc.TLS, parser TXML_Parser, enc uintptr, entityTextPtr uintptr, entityTextEnd uintptr) (r _XML_Error) {
  7918. bp := tls.Alloc(16)
  7919. defer tls.Free(16)
  7920. var dtd, entity, name, pool, v2, v3, v5, v6 uintptr
  7921. var i, n, oldInEntityValue, tok int32
  7922. var result _XML_Error
  7923. var _ /* buf at bp+8 */ [4]TXML_Char
  7924. var _ /* next at bp+0 */ uintptr
  7925. _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, entity, i, n, name, oldInEntityValue, pool, result, tok, v2, v3, v5, v6
  7926. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  7927. pool = dtd + 208
  7928. result = int32(_XML_ERROR_NONE)
  7929. oldInEntityValue = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue
  7930. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = int32(1)
  7931. /* never return Null for the value argument in EntityDeclHandler,
  7932. since this would indicate an external entity; therefore we
  7933. have to make sure that entityValuePool.start is not null */
  7934. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0) {
  7935. if !(_poolGrow(tls, pool) != 0) {
  7936. return int32(_XML_ERROR_NO_MEMORY)
  7937. }
  7938. }
  7939. for {
  7940. tok = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(enc + 32 + 1*8))})))(tls, enc, entityTextPtr, entityTextEnd, bp)
  7941. switch tok {
  7942. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  7943. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_isParamEntity != 0 || enc != (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7944. name = _poolStoreString(tls, parser+784, enc, entityTextPtr+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  7945. if !(name != 0) {
  7946. result = int32(_XML_ERROR_NO_MEMORY)
  7947. goto endEntityValue
  7948. }
  7949. entity = _lookup(tls, parser, dtd+264, name, uint64(0))
  7950. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  7951. if !(entity != 0) {
  7952. /* not a well-formedness error - see XML 1.0: WFC Entity Declared */
  7953. /* cannot report skipped entity here - see comments on
  7954. parser->m_skippedEntityHandler
  7955. if (parser->m_skippedEntityHandler)
  7956. parser->m_skippedEntityHandler(parser->m_handlerArg, name, 0);
  7957. */
  7958. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7959. goto endEntityValue
  7960. }
  7961. if (*TENTITY)(unsafe.Pointer(entity)).Fopen != 0 {
  7962. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  7963. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  7964. }
  7965. result = int32(_XML_ERROR_RECURSIVE_ENTITY_REF)
  7966. goto endEntityValue
  7967. }
  7968. if (*TENTITY)(unsafe.Pointer(entity)).FsystemId != 0 {
  7969. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_externalEntityRefHandler != 0 {
  7970. (*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead = libc.Uint8FromInt32(0)
  7971. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7972. 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) {
  7973. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7974. result = int32(_XML_ERROR_EXTERNAL_ENTITY_HANDLING)
  7975. goto endEntityValue
  7976. }
  7977. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7978. if !((*TDTD)(unsafe.Pointer(dtd)).FparamEntityRead != 0) {
  7979. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7980. }
  7981. } else {
  7982. (*TDTD)(unsafe.Pointer(dtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(dtd)).Fstandalone
  7983. }
  7984. } else {
  7985. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(1)
  7986. 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))
  7987. (*TENTITY)(unsafe.Pointer(entity)).Fopen = libc.Uint8FromInt32(0)
  7988. if result != 0 {
  7989. goto endEntityValue
  7990. }
  7991. }
  7992. break
  7993. }
  7994. /* In the internal subset, PE references are not legal
  7995. within markup declarations, e.g entity values in this case. */
  7996. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  7997. result = int32(_XML_ERROR_PARAM_ENTITY_REF)
  7998. goto endEntityValue
  7999. case -int32(4):
  8000. result = int32(_XML_ERROR_NONE)
  8001. goto endEntityValue
  8002. case int32(m_XML_TOK_ENTITY_REF):
  8003. fallthrough
  8004. case int32(m_XML_TOK_DATA_CHARS):
  8005. if !(_poolAppend(tls, pool, enc, entityTextPtr, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  8006. result = int32(_XML_ERROR_NO_MEMORY)
  8007. goto endEntityValue
  8008. }
  8009. case -int32(3):
  8010. *(*uintptr)(unsafe.Pointer(bp)) = entityTextPtr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  8011. /* fall through */
  8012. fallthrough
  8013. case int32(m_XML_TOK_DATA_NEWLINE):
  8014. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8015. result = int32(_XML_ERROR_NO_MEMORY)
  8016. goto endEntityValue
  8017. }
  8018. v3 = pool + 24
  8019. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8020. *(*uintptr)(unsafe.Pointer(v3))++
  8021. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8022. case int32(m_XML_TOK_CHAR_REF):
  8023. n = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FcharRefNumber})))(tls, enc, entityTextPtr)
  8024. if n < 0 {
  8025. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8026. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8027. }
  8028. result = int32(_XML_ERROR_BAD_CHAR_REF)
  8029. goto endEntityValue
  8030. }
  8031. n = XXmlUtf8Encode(tls, n, bp+8)
  8032. /* The XmlEncode() functions can never return 0 here. That
  8033. * error return happens if the code point passed in is either
  8034. * negative or greater than or equal to 0x110000. The
  8035. * XmlCharRefNumber() functions will all return a number
  8036. * strictly less than 0x110000 or a negative value if an error
  8037. * occurred. The negative value is intercepted above, so
  8038. * XmlEncode() is never passed a value it might return an
  8039. * error for.
  8040. */
  8041. i = 0
  8042. for {
  8043. if !(i < n) {
  8044. break
  8045. }
  8046. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr && !(_poolGrow(tls, pool) != 0) {
  8047. result = int32(_XML_ERROR_NO_MEMORY)
  8048. goto endEntityValue
  8049. }
  8050. v6 = pool + 24
  8051. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8052. *(*uintptr)(unsafe.Pointer(v6))++
  8053. *(*TXML_Char)(unsafe.Pointer(v5)) = (*(*[4]TXML_Char)(unsafe.Pointer(bp + 8)))[i]
  8054. goto _4
  8055. _4:
  8056. ;
  8057. i++
  8058. }
  8059. case -int32(1):
  8060. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8061. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8062. }
  8063. result = int32(_XML_ERROR_INVALID_TOKEN)
  8064. goto endEntityValue
  8065. case m_XML_TOK_INVALID:
  8066. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8067. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = *(*uintptr)(unsafe.Pointer(bp))
  8068. }
  8069. result = int32(_XML_ERROR_INVALID_TOKEN)
  8070. goto endEntityValue
  8071. default:
  8072. /* This default case should be unnecessary -- all the tokens
  8073. * that XmlEntityValueTok() can return have their own explicit
  8074. * cases -- but should be retained for safety. We do however
  8075. * exclude it from the coverage statistics.
  8076. *
  8077. * LCOV_EXCL_START
  8078. */
  8079. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8080. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_eventPtr = entityTextPtr
  8081. }
  8082. result = int32(_XML_ERROR_UNEXPECTED_STATE)
  8083. goto endEntityValue
  8084. /* LCOV_EXCL_STOP */
  8085. }
  8086. entityTextPtr = *(*uintptr)(unsafe.Pointer(bp))
  8087. goto _1
  8088. _1:
  8089. }
  8090. goto endEntityValue
  8091. endEntityValue:
  8092. ;
  8093. (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_prologState.FinEntityValue = oldInEntityValue
  8094. return result
  8095. }
  8096. func _normalizeLines(tls *libc.TLS, s uintptr) {
  8097. var p, v2, v3, v4, v5 uintptr
  8098. _, _, _, _, _ = p, v2, v3, v4, v5
  8099. for {
  8100. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8101. return
  8102. }
  8103. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8104. break
  8105. }
  8106. goto _1
  8107. _1:
  8108. ;
  8109. s++
  8110. }
  8111. p = s
  8112. for cond := true; cond; cond = *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  8113. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(0xD) {
  8114. v2 = p
  8115. p++
  8116. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0xA)
  8117. s++
  8118. v3 = s
  8119. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(v3))) == int32(0xA) {
  8120. s++
  8121. }
  8122. } else {
  8123. v4 = p
  8124. p++
  8125. v5 = s
  8126. s++
  8127. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(v5))
  8128. }
  8129. }
  8130. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  8131. }
  8132. func _reportProcessingInstruction(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8133. var data, target, tem uintptr
  8134. _, _, _ = data, target, tem
  8135. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_processingInstructionHandler != 0) {
  8136. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8137. _reportDefault(tls, parser, enc, start, end)
  8138. }
  8139. return int32(1)
  8140. }
  8141. start += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar * int32(2))
  8142. tem = start + uintptr((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameLength})))(tls, enc, start))
  8143. target = _poolStoreString(tls, parser+784, enc, start, tem)
  8144. if !(target != 0) {
  8145. return 0
  8146. }
  8147. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr
  8148. data = _poolStoreString(tls, parser+784, enc, (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FskipS})))(tls, enc, tem), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(2)))
  8149. if !(data != 0) {
  8150. return 0
  8151. }
  8152. _normalizeLines(tls, data)
  8153. (*(*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)
  8154. _poolClear(tls, parser+784)
  8155. return int32(1)
  8156. }
  8157. func _reportComment(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r int32) {
  8158. var data uintptr
  8159. _ = data
  8160. if !((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_commentHandler != 0) {
  8161. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler != 0 {
  8162. _reportDefault(tls, parser, enc, start, end)
  8163. }
  8164. return int32(1)
  8165. }
  8166. data = _poolStoreString(tls, parser+784, enc, start+uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(4)), end-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar*int32(3)))
  8167. if !(data != 0) {
  8168. return 0
  8169. }
  8170. _normalizeLines(tls, data)
  8171. (*(*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)
  8172. _poolClear(tls, parser+784)
  8173. return int32(1)
  8174. }
  8175. func _reportDefault(tls *libc.TLS, parser TXML_Parser, enc uintptr, _s uintptr, end uintptr) {
  8176. bp := tls.Alloc(16)
  8177. defer tls.Free(16)
  8178. *(*uintptr)(unsafe.Pointer(bp)) = _s
  8179. var convert_res _XML_Convert_Result
  8180. var eventEndPP, eventPP uintptr
  8181. var _ /* dataPtr at bp+8 */ uintptr
  8182. _, _, _ = convert_res, eventEndPP, eventPP
  8183. if !((*TENCODING)(unsafe.Pointer(enc)).FisUtf8 != 0) {
  8184. if enc == (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_encoding {
  8185. eventPP = parser + 544
  8186. eventEndPP = parser + 552
  8187. } else {
  8188. /* To get here, two things must be true; the parser must be
  8189. * using a character encoding that is not the same as the
  8190. * encoding passed in, and the encoding passed in must need
  8191. * conversion to the internal format (UTF-8 unless XML_UNICODE
  8192. * is defined). The only occasions on which the encoding passed
  8193. * in is not the same as the parser's encoding are when it is
  8194. * the internal encoding (e.g. a previously defined parameter
  8195. * entity, already converted to internal format). This by
  8196. * definition doesn't need conversion, so the whole branch never
  8197. * gets executed.
  8198. *
  8199. * For safety's sake we don't delete these lines and merely
  8200. * exclude them from coverage statistics.
  8201. *
  8202. * LCOV_EXCL_START
  8203. */
  8204. eventPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities
  8205. eventEndPP = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_openInternalEntities + 8
  8206. /* LCOV_EXCL_STOP */
  8207. }
  8208. for cond := true; cond; cond = convert_res != int32(_XML_CONVERT_COMPLETED) && convert_res != int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  8209. *(*uintptr)(unsafe.Pointer(bp + 8)) = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf
  8210. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+8, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBufEnd)
  8211. *(*uintptr)(unsafe.Pointer(eventEndPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8212. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf, int32(int64(*(*uintptr)(unsafe.Pointer(bp + 8)))-int64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dataBuf)))
  8213. *(*uintptr)(unsafe.Pointer(eventPP)) = *(*uintptr)(unsafe.Pointer(bp))
  8214. }
  8215. } else {
  8216. (*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_defaultHandler})))(tls, (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_handlerArg, *(*uintptr)(unsafe.Pointer(bp)), int32(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp)))))
  8217. }
  8218. }
  8219. func _defineAttribute(tls *libc.TLS, type1 uintptr, attId uintptr, isCdata TXML_Bool, isId TXML_Bool, value uintptr, parser TXML_Parser) (r int32) {
  8220. var att, temp uintptr
  8221. var count, i int32
  8222. _, _, _, _ = att, count, i, temp
  8223. if value != 0 || isId != 0 {
  8224. i = 0
  8225. for {
  8226. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts) {
  8227. break
  8228. }
  8229. if attId == (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr(i)*24))).Fid {
  8230. return int32(1)
  8231. }
  8232. goto _1
  8233. _1:
  8234. ;
  8235. i++
  8236. }
  8237. if isId != 0 && !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt != 0) && !((*TATTRIBUTE_ID)(unsafe.Pointer(attId)).Fxmlns != 0) {
  8238. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FidAtt = attId
  8239. }
  8240. }
  8241. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts == (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts {
  8242. if (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts == 0 {
  8243. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = int32(8)
  8244. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts)*libc.Uint64FromInt64(24))
  8245. if !((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts != 0) {
  8246. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = 0
  8247. return 0
  8248. }
  8249. } else {
  8250. count = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts * int32(2)
  8251. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts, libc.Uint64FromInt32(count)*libc.Uint64FromInt64(24))
  8252. if temp == libc.UintptrFromInt32(0) {
  8253. return 0
  8254. }
  8255. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FallocDefaultAtts = count
  8256. (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts = temp
  8257. }
  8258. }
  8259. att = (*TELEMENT_TYPE)(unsafe.Pointer(type1)).FdefaultAtts + uintptr((*TELEMENT_TYPE)(unsafe.Pointer(type1)).FnDefaultAtts)*24
  8260. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fid = attId
  8261. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).Fvalue = value
  8262. (*TDEFAULT_ATTRIBUTE)(unsafe.Pointer(att)).FisCdata = isCdata
  8263. if !(isCdata != 0) {
  8264. (*TATTRIBUTE_ID)(unsafe.Pointer(attId)).FmaybeTokenized = libc.Uint8FromInt32(1)
  8265. }
  8266. *(*int32)(unsafe.Pointer(type1 + 24)) += int32(1)
  8267. return int32(1)
  8268. }
  8269. func _setElementTypePrefix(tls *libc.TLS, parser TXML_Parser, elementType uintptr) (r int32) {
  8270. var dtd, name, prefix, s, v4, v5, v7, v8 uintptr
  8271. var v3, v6 int32
  8272. _, _, _, _, _, _, _, _, _, _ = dtd, name, prefix, s, v3, v4, v5, v6, v7, v8
  8273. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8274. name = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8275. for {
  8276. if !(*(*TXML_Char)(unsafe.Pointer(name)) != 0) {
  8277. break
  8278. }
  8279. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_COLON) {
  8280. s = (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fname
  8281. for {
  8282. if !(s != name) {
  8283. break
  8284. }
  8285. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8286. v3 = 0
  8287. } else {
  8288. v5 = dtd + 160 + 24
  8289. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8290. *(*uintptr)(unsafe.Pointer(v5))++
  8291. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  8292. v3 = libc.Int32FromInt32(1)
  8293. }
  8294. if !(v3 != 0) {
  8295. return 0
  8296. }
  8297. goto _2
  8298. _2:
  8299. ;
  8300. s++
  8301. }
  8302. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8303. v6 = 0
  8304. } else {
  8305. v8 = dtd + 160 + 24
  8306. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8307. *(*uintptr)(unsafe.Pointer(v8))++
  8308. *(*TXML_Char)(unsafe.Pointer(v7)) = uint8('\000')
  8309. v6 = libc.Int32FromInt32(1)
  8310. }
  8311. if !(v6 != 0) {
  8312. return 0
  8313. }
  8314. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8315. if !(prefix != 0) {
  8316. return 0
  8317. }
  8318. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8319. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8320. } else {
  8321. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8322. }
  8323. (*TELEMENT_TYPE)(unsafe.Pointer(elementType)).Fprefix = prefix
  8324. break
  8325. }
  8326. goto _1
  8327. _1:
  8328. ;
  8329. name++
  8330. }
  8331. return int32(1)
  8332. }
  8333. func _getAttributeId(tls *libc.TLS, parser TXML_Parser, enc uintptr, start uintptr, end uintptr) (r uintptr) {
  8334. var dtd, id, name, v10, v11, v2, v3, v7, v8 uintptr
  8335. var i, j, v1, v6, v9 int32
  8336. _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, i, id, j, name, v1, v10, v11, v2, v3, v6, v7, v8, v9
  8337. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8338. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8339. v1 = 0
  8340. } else {
  8341. v3 = dtd + 160 + 24
  8342. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8343. *(*uintptr)(unsafe.Pointer(v3))++
  8344. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8345. v1 = libc.Int32FromInt32(1)
  8346. }
  8347. if !(v1 != 0) {
  8348. return libc.UintptrFromInt32(0)
  8349. }
  8350. name = _poolStoreString(tls, dtd+160, enc, start, end)
  8351. if !(name != 0) {
  8352. return libc.UintptrFromInt32(0)
  8353. }
  8354. /* skip quotation mark - its storage will be re-used (like in name[-1]) */
  8355. name++
  8356. id = _lookup(tls, parser, dtd+80, name, uint64(24))
  8357. if !(id != 0) {
  8358. return libc.UintptrFromInt32(0)
  8359. }
  8360. if (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fname != name {
  8361. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8362. } else {
  8363. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8364. if !!((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_ns != 0) {
  8365. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name))) == int32(m_ASCII_x) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 1))) == int32(m_ASCII_m) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 2))) == int32(m_ASCII_l) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 3))) == int32(m_ASCII_n) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 4))) == int32(m_ASCII_s) && (libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32(m_ASCII_COLON)) {
  8366. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + 5))) == int32('\000') {
  8367. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = dtd + 304
  8368. } else {
  8369. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, name+uintptr(6), uint64(16))
  8370. }
  8371. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fxmlns = libc.Uint8FromInt32(1)
  8372. } else {
  8373. i = 0
  8374. for {
  8375. if !(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i))) != 0) {
  8376. break
  8377. }
  8378. /* attributes without prefix are *not* in the default namespace */
  8379. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(name + uintptr(i)))) == int32(m_ASCII_COLON) {
  8380. j = 0
  8381. for {
  8382. if !(j < i) {
  8383. break
  8384. }
  8385. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8386. v6 = 0
  8387. } else {
  8388. v8 = dtd + 160 + 24
  8389. v7 = *(*uintptr)(unsafe.Pointer(v8))
  8390. *(*uintptr)(unsafe.Pointer(v8))++
  8391. *(*TXML_Char)(unsafe.Pointer(v7)) = *(*TXML_Char)(unsafe.Pointer(name + uintptr(j)))
  8392. v6 = libc.Int32FromInt32(1)
  8393. }
  8394. if !(v6 != 0) {
  8395. return libc.UintptrFromInt32(0)
  8396. }
  8397. goto _5
  8398. _5:
  8399. ;
  8400. j++
  8401. }
  8402. if (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fend && !(_poolGrow(tls, dtd+160) != 0) {
  8403. v9 = 0
  8404. } else {
  8405. v11 = dtd + 160 + 24
  8406. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8407. *(*uintptr)(unsafe.Pointer(v11))++
  8408. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8('\000')
  8409. v9 = libc.Int32FromInt32(1)
  8410. }
  8411. if !(v9 != 0) {
  8412. return libc.UintptrFromInt32(0)
  8413. }
  8414. (*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart, uint64(16))
  8415. if !((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix != 0) {
  8416. return libc.UintptrFromInt32(0)
  8417. }
  8418. if (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(id)).Fprefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(dtd+160)).Fstart {
  8419. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  8420. } else {
  8421. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  8422. }
  8423. break
  8424. }
  8425. goto _4
  8426. _4:
  8427. ;
  8428. i++
  8429. }
  8430. }
  8431. }
  8432. }
  8433. return id
  8434. }
  8435. func _getContext(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  8436. bp := tls.Alloc(16)
  8437. defer tls.Free(16)
  8438. 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
  8439. var i, i1, len1, len11, v1, v14, v17, v21, v25, v30, v33, v5, v9 int32
  8440. var needSep TXML_Bool
  8441. var v12, v28 bool
  8442. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8443. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  8444. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  8445. needSep = libc.Uint8FromInt32(0)
  8446. if (*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding != 0 {
  8447. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8448. v1 = 0
  8449. } else {
  8450. v3 = parser + 784 + 24
  8451. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8452. *(*uintptr)(unsafe.Pointer(v3))++
  8453. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(m_ASCII_EQUALS)
  8454. v1 = libc.Int32FromInt32(1)
  8455. }
  8456. if !(v1 != 0) {
  8457. return libc.UintptrFromInt32(0)
  8458. }
  8459. len1 = (*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).FuriLen
  8460. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8461. len1--
  8462. }
  8463. i = 0
  8464. for {
  8465. if !(i < len1) {
  8466. break
  8467. }
  8468. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8469. v5 = 0
  8470. } else {
  8471. v7 = parser + 784 + 24
  8472. v6 = *(*uintptr)(unsafe.Pointer(v7))
  8473. *(*uintptr)(unsafe.Pointer(v7))++
  8474. *(*TXML_Char)(unsafe.Pointer(v6)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FdefaultPrefix.Fbinding)).Furi + uintptr(i)))
  8475. v5 = libc.Int32FromInt32(1)
  8476. }
  8477. if !(v5 != 0) {
  8478. /* Because of memory caching, I don't believe this line can be
  8479. * executed.
  8480. *
  8481. * This is part of a loop copying the default prefix binding
  8482. * URI into the parser's temporary string pool. Previously,
  8483. * that URI was copied into the same string pool, with a
  8484. * terminating NUL character, as part of setContext(). When
  8485. * the pool was cleared, that leaves a block definitely big
  8486. * enough to hold the URI on the free block list of the pool.
  8487. * The URI copy in getContext() therefore cannot run out of
  8488. * memory.
  8489. *
  8490. * If the pool is used between the setContext() and
  8491. * getContext() calls, the worst it can do is leave a bigger
  8492. * block on the front of the free list. Given that this is
  8493. * all somewhat inobvious and program logic can be changed, we
  8494. * don't delete the line but we do exclude it from the test
  8495. * coverage statistics.
  8496. */
  8497. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  8498. }
  8499. goto _4
  8500. _4:
  8501. ;
  8502. i++
  8503. }
  8504. needSep = libc.Uint8FromInt32(1)
  8505. }
  8506. _hashTableIterInit(tls, bp, dtd+120)
  8507. for {
  8508. prefix = _hashTableIterNext(tls, bp)
  8509. if !(prefix != 0) {
  8510. break
  8511. }
  8512. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding != 0) {
  8513. /* This test appears to be (justifiable) paranoia. There does
  8514. * not seem to be a way of injecting a prefix without a binding
  8515. * that doesn't get errored long before this function is called.
  8516. * The test should remain for safety's sake, so we instead
  8517. * exclude the following line from the coverage statistics.
  8518. */
  8519. goto _8 /* LCOV_EXCL_LINE */
  8520. }
  8521. if v12 = needSep != 0; v12 {
  8522. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8523. v9 = 0
  8524. } else {
  8525. v11 = parser + 784 + 24
  8526. v10 = *(*uintptr)(unsafe.Pointer(v11))
  8527. *(*uintptr)(unsafe.Pointer(v11))++
  8528. *(*TXML_Char)(unsafe.Pointer(v10)) = uint8(m_ASCII_FF)
  8529. v9 = libc.Int32FromInt32(1)
  8530. }
  8531. }
  8532. if v12 && !(v9 != 0) {
  8533. return libc.UintptrFromInt32(0)
  8534. }
  8535. s = (*TPREFIX)(unsafe.Pointer(prefix)).Fname
  8536. for {
  8537. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8538. break
  8539. }
  8540. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8541. v14 = 0
  8542. } else {
  8543. v16 = parser + 784 + 24
  8544. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8545. *(*uintptr)(unsafe.Pointer(v16))++
  8546. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8547. v14 = libc.Int32FromInt32(1)
  8548. }
  8549. if !(v14 != 0) {
  8550. return libc.UintptrFromInt32(0)
  8551. }
  8552. goto _13
  8553. _13:
  8554. ;
  8555. s++
  8556. }
  8557. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8558. v17 = 0
  8559. } else {
  8560. v19 = parser + 784 + 24
  8561. v18 = *(*uintptr)(unsafe.Pointer(v19))
  8562. *(*uintptr)(unsafe.Pointer(v19))++
  8563. *(*TXML_Char)(unsafe.Pointer(v18)) = uint8(m_ASCII_EQUALS)
  8564. v17 = libc.Int32FromInt32(1)
  8565. }
  8566. if !(v17 != 0) {
  8567. return libc.UintptrFromInt32(0)
  8568. }
  8569. len11 = (*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).FuriLen
  8570. if (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_namespaceSeparator != 0 {
  8571. len11--
  8572. }
  8573. i1 = 0
  8574. for {
  8575. if !(i1 < len11) {
  8576. break
  8577. }
  8578. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8579. v21 = 0
  8580. } else {
  8581. v23 = parser + 784 + 24
  8582. v22 = *(*uintptr)(unsafe.Pointer(v23))
  8583. *(*uintptr)(unsafe.Pointer(v23))++
  8584. *(*TXML_Char)(unsafe.Pointer(v22)) = *(*TXML_Char)(unsafe.Pointer((*TBINDING)(unsafe.Pointer((*TPREFIX)(unsafe.Pointer(prefix)).Fbinding)).Furi + uintptr(i1)))
  8585. v21 = libc.Int32FromInt32(1)
  8586. }
  8587. if !(v21 != 0) {
  8588. return libc.UintptrFromInt32(0)
  8589. }
  8590. goto _20
  8591. _20:
  8592. ;
  8593. i1++
  8594. }
  8595. needSep = libc.Uint8FromInt32(1)
  8596. goto _8
  8597. _8:
  8598. }
  8599. _hashTableIterInit(tls, bp, dtd)
  8600. for {
  8601. e = _hashTableIterNext(tls, bp)
  8602. if !(e != 0) {
  8603. break
  8604. }
  8605. if !((*TENTITY)(unsafe.Pointer(e)).Fopen != 0) {
  8606. goto _24
  8607. }
  8608. if v28 = needSep != 0; v28 {
  8609. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8610. v25 = 0
  8611. } else {
  8612. v27 = parser + 784 + 24
  8613. v26 = *(*uintptr)(unsafe.Pointer(v27))
  8614. *(*uintptr)(unsafe.Pointer(v27))++
  8615. *(*TXML_Char)(unsafe.Pointer(v26)) = uint8(m_ASCII_FF)
  8616. v25 = libc.Int32FromInt32(1)
  8617. }
  8618. }
  8619. if v28 && !(v25 != 0) {
  8620. return libc.UintptrFromInt32(0)
  8621. }
  8622. s1 = (*TENTITY)(unsafe.Pointer(e)).Fname
  8623. for {
  8624. if !(*(*TXML_Char)(unsafe.Pointer(s1)) != 0) {
  8625. break
  8626. }
  8627. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8628. v30 = 0
  8629. } else {
  8630. v32 = parser + 784 + 24
  8631. v31 = *(*uintptr)(unsafe.Pointer(v32))
  8632. *(*uintptr)(unsafe.Pointer(v32))++
  8633. *(*TXML_Char)(unsafe.Pointer(v31)) = *(*TXML_Char)(unsafe.Pointer(s1))
  8634. v30 = libc.Int32FromInt32(1)
  8635. }
  8636. if !(v30 != 0) {
  8637. return uintptr(0)
  8638. }
  8639. goto _29
  8640. _29:
  8641. ;
  8642. s1++
  8643. }
  8644. needSep = libc.Uint8FromInt32(1)
  8645. goto _24
  8646. _24:
  8647. }
  8648. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8649. v33 = 0
  8650. } else {
  8651. v35 = parser + 784 + 24
  8652. v34 = *(*uintptr)(unsafe.Pointer(v35))
  8653. *(*uintptr)(unsafe.Pointer(v35))++
  8654. *(*TXML_Char)(unsafe.Pointer(v34)) = uint8('\000')
  8655. v33 = libc.Int32FromInt32(1)
  8656. }
  8657. if !(v33 != 0) {
  8658. return libc.UintptrFromInt32(0)
  8659. }
  8660. return (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_tempPool.Fstart
  8661. }
  8662. func _setContext(tls *libc.TLS, parser TXML_Parser, context uintptr) (r TXML_Bool) {
  8663. var dtd, e, prefix, s, v10, v12, v13, v15, v16, v2, v3, v5, v6, v9 uintptr
  8664. var v1, v11, v14, v4, v8 int32
  8665. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = dtd, e, prefix, s, v1, v10, v11, v12, v13, v14, v15, v16, v2, v3, v4, v5, v6, v8, v9
  8666. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  8667. s = context
  8668. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  8669. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_FF) || libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32('\000') {
  8670. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8671. v1 = 0
  8672. } else {
  8673. v3 = parser + 784 + 24
  8674. v2 = *(*uintptr)(unsafe.Pointer(v3))
  8675. *(*uintptr)(unsafe.Pointer(v3))++
  8676. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8('\000')
  8677. v1 = libc.Int32FromInt32(1)
  8678. }
  8679. if !(v1 != 0) {
  8680. return libc.Uint8FromInt32(0)
  8681. }
  8682. e = _lookup(tls, parser, dtd, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(0))
  8683. if e != 0 {
  8684. (*TENTITY)(unsafe.Pointer(e)).Fopen = libc.Uint8FromInt32(1)
  8685. }
  8686. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) != int32('\000') {
  8687. s++
  8688. }
  8689. context = s
  8690. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8691. } else {
  8692. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) == int32(m_ASCII_EQUALS) {
  8693. if int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart) == 0 {
  8694. prefix = dtd + 304
  8695. } else {
  8696. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8697. v4 = 0
  8698. } else {
  8699. v6 = parser + 784 + 24
  8700. v5 = *(*uintptr)(unsafe.Pointer(v6))
  8701. *(*uintptr)(unsafe.Pointer(v6))++
  8702. *(*TXML_Char)(unsafe.Pointer(v5)) = uint8('\000')
  8703. v4 = libc.Int32FromInt32(1)
  8704. }
  8705. if !(v4 != 0) {
  8706. return libc.Uint8FromInt32(0)
  8707. }
  8708. prefix = _lookup(tls, parser, dtd+120, (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, uint64(16))
  8709. if !(prefix != 0) {
  8710. return libc.Uint8FromInt32(0)
  8711. }
  8712. if (*TPREFIX)(unsafe.Pointer(prefix)).Fname == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart {
  8713. (*TPREFIX)(unsafe.Pointer(prefix)).Fname = _poolCopyString(tls, dtd+160, (*TPREFIX)(unsafe.Pointer(prefix)).Fname)
  8714. if !((*TPREFIX)(unsafe.Pointer(prefix)).Fname != 0) {
  8715. return libc.Uint8FromInt32(0)
  8716. }
  8717. }
  8718. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8719. }
  8720. context = s + uintptr(1)
  8721. for {
  8722. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32(m_ASCII_FF) && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000')) {
  8723. break
  8724. }
  8725. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8726. v8 = 0
  8727. } else {
  8728. v10 = parser + 784 + 24
  8729. v9 = *(*uintptr)(unsafe.Pointer(v10))
  8730. *(*uintptr)(unsafe.Pointer(v10))++
  8731. *(*TXML_Char)(unsafe.Pointer(v9)) = *(*TXML_Char)(unsafe.Pointer(context))
  8732. v8 = libc.Int32FromInt32(1)
  8733. }
  8734. if !(v8 != 0) {
  8735. return libc.Uint8FromInt32(0)
  8736. }
  8737. goto _7
  8738. _7:
  8739. ;
  8740. context++
  8741. }
  8742. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8743. v11 = 0
  8744. } else {
  8745. v13 = parser + 784 + 24
  8746. v12 = *(*uintptr)(unsafe.Pointer(v13))
  8747. *(*uintptr)(unsafe.Pointer(v13))++
  8748. *(*TXML_Char)(unsafe.Pointer(v12)) = uint8('\000')
  8749. v11 = libc.Int32FromInt32(1)
  8750. }
  8751. if !(v11 != 0) {
  8752. return libc.Uint8FromInt32(0)
  8753. }
  8754. if _addBinding(tls, parser, prefix, libc.UintptrFromInt32(0), (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fstart, parser+704) != int32(_XML_ERROR_NONE) {
  8755. return libc.Uint8FromInt32(0)
  8756. }
  8757. (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(parser + 784)).Fstart
  8758. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(context))) != int32('\000') {
  8759. context++
  8760. }
  8761. s = context
  8762. } else {
  8763. if (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(parser+784)).Fend && !(_poolGrow(tls, parser+784) != 0) {
  8764. v14 = 0
  8765. } else {
  8766. v16 = parser + 784 + 24
  8767. v15 = *(*uintptr)(unsafe.Pointer(v16))
  8768. *(*uintptr)(unsafe.Pointer(v16))++
  8769. *(*TXML_Char)(unsafe.Pointer(v15)) = *(*TXML_Char)(unsafe.Pointer(s))
  8770. v14 = libc.Int32FromInt32(1)
  8771. }
  8772. if !(v14 != 0) {
  8773. return libc.Uint8FromInt32(0)
  8774. }
  8775. s++
  8776. }
  8777. }
  8778. }
  8779. return libc.Uint8FromInt32(1)
  8780. }
  8781. func _normalizePublicId(tls *libc.TLS, publicId uintptr) {
  8782. var p, s, v2, v3 uintptr
  8783. _, _, _, _ = p, s, v2, v3
  8784. p = publicId
  8785. s = publicId
  8786. for {
  8787. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  8788. break
  8789. }
  8790. switch libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s))) {
  8791. case int32(0x20):
  8792. fallthrough
  8793. case int32(0xD):
  8794. fallthrough
  8795. case int32(0xA):
  8796. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) != int32(0x20) {
  8797. v2 = p
  8798. p++
  8799. *(*TXML_Char)(unsafe.Pointer(v2)) = uint8(0x20)
  8800. }
  8801. default:
  8802. v3 = p
  8803. p++
  8804. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  8805. }
  8806. goto _1
  8807. _1:
  8808. ;
  8809. s++
  8810. }
  8811. if p != publicId && libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(p + uintptr(-libc.Int32FromInt32(1))))) == int32(0x20) {
  8812. p--
  8813. }
  8814. *(*TXML_Char)(unsafe.Pointer(p)) = uint8('\000')
  8815. }
  8816. func _dtdCreate(tls *libc.TLS, ms uintptr) (r uintptr) {
  8817. var p uintptr
  8818. _ = p
  8819. p = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, uint64(360))
  8820. if p == libc.UintptrFromInt32(0) {
  8821. return p
  8822. }
  8823. _poolInit(tls, p+160, ms)
  8824. _poolInit(tls, p+208, ms)
  8825. _hashTableInit(tls, p, ms)
  8826. _hashTableInit(tls, p+40, ms)
  8827. _hashTableInit(tls, p+80, ms)
  8828. _hashTableInit(tls, p+120, ms)
  8829. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  8830. _hashTableInit(tls, p+264, ms)
  8831. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  8832. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  8833. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  8834. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  8835. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  8836. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  8837. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  8838. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  8839. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  8840. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  8841. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  8842. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  8843. return p
  8844. }
  8845. func _dtdReset(tls *libc.TLS, p uintptr, ms uintptr) {
  8846. bp := tls.Alloc(16)
  8847. defer tls.Free(16)
  8848. var e uintptr
  8849. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8850. _ = e
  8851. _hashTableIterInit(tls, bp, p+40)
  8852. for {
  8853. e = _hashTableIterNext(tls, bp)
  8854. if !(e != 0) {
  8855. break
  8856. }
  8857. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  8858. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  8859. }
  8860. goto _1
  8861. _1:
  8862. }
  8863. _hashTableClear(tls, p)
  8864. (*TDTD)(unsafe.Pointer(p)).FparamEntityRead = libc.Uint8FromInt32(0)
  8865. _hashTableClear(tls, p+264)
  8866. _hashTableClear(tls, p+40)
  8867. _hashTableClear(tls, p+80)
  8868. _hashTableClear(tls, p+120)
  8869. _poolClear(tls, p+160)
  8870. _poolClear(tls, p+208)
  8871. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fname = libc.UintptrFromInt32(0)
  8872. (*TDTD)(unsafe.Pointer(p)).FdefaultPrefix.Fbinding = libc.UintptrFromInt32(0)
  8873. (*TDTD)(unsafe.Pointer(p)).Fin_eldecl = libc.Uint8FromInt32(0)
  8874. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  8875. (*TDTD)(unsafe.Pointer(p)).FscaffIndex = libc.UintptrFromInt32(0)
  8876. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  8877. (*TDTD)(unsafe.Pointer(p)).Fscaffold = libc.UintptrFromInt32(0)
  8878. (*TDTD)(unsafe.Pointer(p)).FscaffLevel = 0
  8879. (*TDTD)(unsafe.Pointer(p)).FscaffSize = uint32(0)
  8880. (*TDTD)(unsafe.Pointer(p)).FscaffCount = uint32(0)
  8881. (*TDTD)(unsafe.Pointer(p)).FcontentStringLen = uint32(0)
  8882. (*TDTD)(unsafe.Pointer(p)).FkeepProcessing = libc.Uint8FromInt32(1)
  8883. (*TDTD)(unsafe.Pointer(p)).FhasParamEntityRefs = libc.Uint8FromInt32(0)
  8884. (*TDTD)(unsafe.Pointer(p)).Fstandalone = libc.Uint8FromInt32(0)
  8885. }
  8886. func _dtdDestroy(tls *libc.TLS, p uintptr, isDocEntity TXML_Bool, ms uintptr) {
  8887. bp := tls.Alloc(16)
  8888. defer tls.Free(16)
  8889. var e uintptr
  8890. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8891. _ = e
  8892. _hashTableIterInit(tls, bp, p+40)
  8893. for {
  8894. e = _hashTableIterNext(tls, bp)
  8895. if !(e != 0) {
  8896. break
  8897. }
  8898. if (*TELEMENT_TYPE)(unsafe.Pointer(e)).FallocDefaultAtts != 0 {
  8899. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TELEMENT_TYPE)(unsafe.Pointer(e)).FdefaultAtts)
  8900. }
  8901. goto _1
  8902. _1:
  8903. }
  8904. _hashTableDestroy(tls, p)
  8905. _hashTableDestroy(tls, p+264)
  8906. _hashTableDestroy(tls, p+40)
  8907. _hashTableDestroy(tls, p+80)
  8908. _hashTableDestroy(tls, p+120)
  8909. _poolDestroy(tls, p+160)
  8910. _poolDestroy(tls, p+208)
  8911. if isDocEntity != 0 {
  8912. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).FscaffIndex)
  8913. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, (*TDTD)(unsafe.Pointer(p)).Fscaffold)
  8914. }
  8915. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Ffree_fcn})))(tls, p)
  8916. }
  8917. // C documentation
  8918. //
  8919. // /* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise.
  8920. // The new DTD has already been initialized.
  8921. // */
  8922. func _dtdCopy(tls *libc.TLS, oldParser TXML_Parser, newDtd uintptr, oldDtd uintptr, ms uintptr) (r int32) {
  8923. bp := tls.Alloc(16)
  8924. defer tls.Free(16)
  8925. var i, v3, v7 int32
  8926. var name, name1, name2, newA, newE, oldA, oldE, oldP, v4, v5 uintptr
  8927. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  8928. _, _, _, _, _, _, _, _, _, _, _, _, _ = i, name, name1, name2, newA, newE, oldA, oldE, oldP, v3, v4, v5, v7
  8929. /* Copy the prefix table. */
  8930. _hashTableIterInit(tls, bp, oldDtd+120)
  8931. for {
  8932. oldP = _hashTableIterNext(tls, bp)
  8933. if !(oldP != 0) {
  8934. break
  8935. }
  8936. name = _poolCopyString(tls, newDtd+160, (*TPREFIX)(unsafe.Pointer(oldP)).Fname)
  8937. if !(name != 0) {
  8938. return 0
  8939. }
  8940. if !(_lookup(tls, oldParser, newDtd+120, name, uint64(16)) != 0) {
  8941. return 0
  8942. }
  8943. goto _1
  8944. _1:
  8945. }
  8946. _hashTableIterInit(tls, bp, oldDtd+80)
  8947. /* Copy the attribute id table. */
  8948. for {
  8949. oldA = _hashTableIterNext(tls, bp)
  8950. if !(oldA != 0) {
  8951. break
  8952. }
  8953. /* Remember to allocate the scratch byte before the name. */
  8954. if (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(newDtd+160)).Fend && !(_poolGrow(tls, newDtd+160) != 0) {
  8955. v3 = 0
  8956. } else {
  8957. v5 = newDtd + 160 + 24
  8958. v4 = *(*uintptr)(unsafe.Pointer(v5))
  8959. *(*uintptr)(unsafe.Pointer(v5))++
  8960. *(*TXML_Char)(unsafe.Pointer(v4)) = uint8('\000')
  8961. v3 = libc.Int32FromInt32(1)
  8962. }
  8963. if !(v3 != 0) {
  8964. return 0
  8965. }
  8966. name1 = _poolCopyString(tls, newDtd+160, (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fname)
  8967. if !(name1 != 0) {
  8968. return 0
  8969. }
  8970. name1++
  8971. newA = _lookup(tls, oldParser, newDtd+80, name1, uint64(24))
  8972. if !(newA != 0) {
  8973. return 0
  8974. }
  8975. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).FmaybeTokenized = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).FmaybeTokenized
  8976. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix != 0 {
  8977. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fxmlns = (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fxmlns
  8978. if (*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix == oldDtd+304 {
  8979. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = newDtd + 304
  8980. } else {
  8981. (*TATTRIBUTE_ID)(unsafe.Pointer(newA)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TATTRIBUTE_ID)(unsafe.Pointer(oldA)).Fprefix)).Fname, uint64(0))
  8982. }
  8983. }
  8984. goto _2
  8985. _2:
  8986. }
  8987. /* Copy the element type table. */
  8988. _hashTableIterInit(tls, bp, oldDtd+40)
  8989. for {
  8990. oldE = _hashTableIterNext(tls, bp)
  8991. if !(oldE != 0) {
  8992. break
  8993. }
  8994. name2 = _poolCopyString(tls, newDtd+160, (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fname)
  8995. if !(name2 != 0) {
  8996. return 0
  8997. }
  8998. newE = _lookup(tls, oldParser, newDtd+40, name2, uint64(40))
  8999. if !(newE != 0) {
  9000. return 0
  9001. }
  9002. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts != 0 {
  9003. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(ms)).Fmalloc_fcn})))(tls, libc.Uint64FromInt32((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts)*uint64(24))
  9004. if !((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts != 0) {
  9005. return 0
  9006. }
  9007. }
  9008. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt != 0 {
  9009. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FidAtt = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FidAtt)).Fname, uint64(0))
  9010. }
  9011. v7 = (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FnDefaultAtts
  9012. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts = v7
  9013. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FallocDefaultAtts = v7
  9014. if (*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix != 0 {
  9015. (*TELEMENT_TYPE)(unsafe.Pointer(newE)).Fprefix = _lookup(tls, oldParser, newDtd+120, (*TPREFIX)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).Fprefix)).Fname, uint64(0))
  9016. }
  9017. i = 0
  9018. for {
  9019. if !(i < (*TELEMENT_TYPE)(unsafe.Pointer(newE)).FnDefaultAtts) {
  9020. break
  9021. }
  9022. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fid = _lookup(tls, oldParser, newDtd+80, (*TATTRIBUTE_ID)(unsafe.Pointer((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fid)).Fname, uint64(0))
  9023. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).FisCdata = (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).FisCdata
  9024. if (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0 {
  9025. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = _poolCopyString(tls, newDtd+160, (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(oldE)).FdefaultAtts + uintptr(i)*24))).Fvalue)
  9026. if !((*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue != 0) {
  9027. return 0
  9028. }
  9029. } else {
  9030. (*(*TDEFAULT_ATTRIBUTE)(unsafe.Pointer((*TELEMENT_TYPE)(unsafe.Pointer(newE)).FdefaultAtts + uintptr(i)*24))).Fvalue = libc.UintptrFromInt32(0)
  9031. }
  9032. goto _8
  9033. _8:
  9034. ;
  9035. i++
  9036. }
  9037. goto _6
  9038. _6:
  9039. }
  9040. /* Copy the entity tables. */
  9041. if !(_copyEntityTable(tls, oldParser, newDtd, newDtd+160, oldDtd) != 0) {
  9042. return 0
  9043. }
  9044. if !(_copyEntityTable(tls, oldParser, newDtd+264, newDtd+160, oldDtd+264) != 0) {
  9045. return 0
  9046. }
  9047. (*TDTD)(unsafe.Pointer(newDtd)).FparamEntityRead = (*TDTD)(unsafe.Pointer(oldDtd)).FparamEntityRead
  9048. (*TDTD)(unsafe.Pointer(newDtd)).FkeepProcessing = (*TDTD)(unsafe.Pointer(oldDtd)).FkeepProcessing
  9049. (*TDTD)(unsafe.Pointer(newDtd)).FhasParamEntityRefs = (*TDTD)(unsafe.Pointer(oldDtd)).FhasParamEntityRefs
  9050. (*TDTD)(unsafe.Pointer(newDtd)).Fstandalone = (*TDTD)(unsafe.Pointer(oldDtd)).Fstandalone
  9051. /* Don't want deep copying for scaffolding */
  9052. (*TDTD)(unsafe.Pointer(newDtd)).Fin_eldecl = (*TDTD)(unsafe.Pointer(oldDtd)).Fin_eldecl
  9053. (*TDTD)(unsafe.Pointer(newDtd)).Fscaffold = (*TDTD)(unsafe.Pointer(oldDtd)).Fscaffold
  9054. (*TDTD)(unsafe.Pointer(newDtd)).FcontentStringLen = (*TDTD)(unsafe.Pointer(oldDtd)).FcontentStringLen
  9055. (*TDTD)(unsafe.Pointer(newDtd)).FscaffSize = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffSize
  9056. (*TDTD)(unsafe.Pointer(newDtd)).FscaffLevel = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffLevel
  9057. (*TDTD)(unsafe.Pointer(newDtd)).FscaffIndex = (*TDTD)(unsafe.Pointer(oldDtd)).FscaffIndex
  9058. return int32(1)
  9059. }
  9060. /* End dtdCopy */
  9061. func _copyEntityTable(tls *libc.TLS, oldParser TXML_Parser, newTable uintptr, newPool uintptr, oldTable uintptr) (r int32) {
  9062. bp := tls.Alloc(16)
  9063. defer tls.Free(16)
  9064. var cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2 uintptr
  9065. var _ /* iter at bp+0 */ THASH_TABLE_ITER
  9066. _, _, _, _, _, _, _, _, _ = cachedNewBase, cachedOldBase, name, newE, oldE, tem, tem1, tem2, v2
  9067. cachedOldBase = libc.UintptrFromInt32(0)
  9068. cachedNewBase = libc.UintptrFromInt32(0)
  9069. _hashTableIterInit(tls, bp, oldTable)
  9070. for {
  9071. oldE = _hashTableIterNext(tls, bp)
  9072. if !(oldE != 0) {
  9073. break
  9074. }
  9075. name = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fname)
  9076. if !(name != 0) {
  9077. return 0
  9078. }
  9079. newE = _lookup(tls, oldParser, newTable, name, uint64(64))
  9080. if !(newE != 0) {
  9081. return 0
  9082. }
  9083. if (*TENTITY)(unsafe.Pointer(oldE)).FsystemId != 0 {
  9084. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FsystemId)
  9085. if !(tem != 0) {
  9086. return 0
  9087. }
  9088. (*TENTITY)(unsafe.Pointer(newE)).FsystemId = tem
  9089. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase != 0 {
  9090. if (*TENTITY)(unsafe.Pointer(oldE)).Fbase == cachedOldBase {
  9091. (*TENTITY)(unsafe.Pointer(newE)).Fbase = cachedNewBase
  9092. } else {
  9093. cachedOldBase = (*TENTITY)(unsafe.Pointer(oldE)).Fbase
  9094. tem = _poolCopyString(tls, newPool, cachedOldBase)
  9095. if !(tem != 0) {
  9096. return 0
  9097. }
  9098. v2 = tem
  9099. (*TENTITY)(unsafe.Pointer(newE)).Fbase = v2
  9100. cachedNewBase = v2
  9101. }
  9102. }
  9103. if (*TENTITY)(unsafe.Pointer(oldE)).FpublicId != 0 {
  9104. tem = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FpublicId)
  9105. if !(tem != 0) {
  9106. return 0
  9107. }
  9108. (*TENTITY)(unsafe.Pointer(newE)).FpublicId = tem
  9109. }
  9110. } else {
  9111. tem1 = _poolCopyStringN(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).FtextPtr, (*TENTITY)(unsafe.Pointer(oldE)).FtextLen)
  9112. if !(tem1 != 0) {
  9113. return 0
  9114. }
  9115. (*TENTITY)(unsafe.Pointer(newE)).FtextPtr = tem1
  9116. (*TENTITY)(unsafe.Pointer(newE)).FtextLen = (*TENTITY)(unsafe.Pointer(oldE)).FtextLen
  9117. }
  9118. if (*TENTITY)(unsafe.Pointer(oldE)).Fnotation != 0 {
  9119. tem2 = _poolCopyString(tls, newPool, (*TENTITY)(unsafe.Pointer(oldE)).Fnotation)
  9120. if !(tem2 != 0) {
  9121. return 0
  9122. }
  9123. (*TENTITY)(unsafe.Pointer(newE)).Fnotation = tem2
  9124. }
  9125. (*TENTITY)(unsafe.Pointer(newE)).Fis_param = (*TENTITY)(unsafe.Pointer(oldE)).Fis_param
  9126. (*TENTITY)(unsafe.Pointer(newE)).Fis_internal = (*TENTITY)(unsafe.Pointer(oldE)).Fis_internal
  9127. goto _1
  9128. _1:
  9129. }
  9130. return int32(1)
  9131. }
  9132. func _keyeq(tls *libc.TLS, s1 TKEY, s2 TKEY) (r TXML_Bool) {
  9133. for {
  9134. if !(libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s2)))) {
  9135. break
  9136. }
  9137. if libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s1))) == 0 {
  9138. return libc.Uint8FromInt32(1)
  9139. }
  9140. goto _1
  9141. _1:
  9142. ;
  9143. s1++
  9144. s2++
  9145. }
  9146. return libc.Uint8FromInt32(0)
  9147. }
  9148. func _keylen(tls *libc.TLS, s TKEY) (r Tsize_t) {
  9149. var len1 Tsize_t
  9150. _ = len1
  9151. len1 = uint64(0)
  9152. for {
  9153. if !(*(*TXML_Char)(unsafe.Pointer(s)) != 0) {
  9154. break
  9155. }
  9156. goto _1
  9157. _1:
  9158. ;
  9159. s++
  9160. len1++
  9161. }
  9162. return len1
  9163. }
  9164. func _copy_salt_to_sipkey(tls *libc.TLS, parser TXML_Parser, key uintptr) {
  9165. *(*Tuint64_t)(unsafe.Pointer(key)) = uint64(0)
  9166. *(*Tuint64_t)(unsafe.Pointer(key + 1*8)) = _get_hash_secret_salt(tls, parser)
  9167. }
  9168. func _hash(tls *libc.TLS, parser TXML_Parser, s TKEY) (r uint64) {
  9169. bp := tls.Alloc(80)
  9170. defer tls.Free(80)
  9171. var _ /* key at bp+56 */ Tsipkey
  9172. var _ /* state at bp+0 */ Tsiphash
  9173. _ = __ccgo_fp(_sip24_valid)
  9174. _copy_salt_to_sipkey(tls, parser, bp+56)
  9175. _sip24_init(tls, bp, bp+56)
  9176. _sip24_update(tls, bp, s, _keylen(tls, s)*uint64(1))
  9177. return _sip24_final(tls, bp)
  9178. }
  9179. func _lookup(tls *libc.TLS, parser TXML_Parser, table uintptr, name TKEY, createSize Tsize_t) (r uintptr) {
  9180. var h, mask, newHash, newMask uint64
  9181. var i, j, newSize, tsize, tsize1 Tsize_t
  9182. var newPower, step uint8
  9183. var newV uintptr
  9184. _, _, _, _, _, _, _, _, _, _, _, _ = h, i, j, mask, newHash, newMask, newPower, newSize, newV, step, tsize, tsize1
  9185. if (*THASH_TABLE)(unsafe.Pointer(table)).Fsize == uint64(0) {
  9186. if !(createSize != 0) {
  9187. return libc.UintptrFromInt32(0)
  9188. }
  9189. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = uint8(m_INIT_POWER)
  9190. /* table->size is a power of 2 */
  9191. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = libc.Uint64FromInt32(1) << libc.Int32FromInt32(m_INIT_POWER)
  9192. tsize = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize * uint64(8)
  9193. (*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)
  9194. if !((*THASH_TABLE)(unsafe.Pointer(table)).Fv != 0) {
  9195. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = uint64(0)
  9196. return libc.UintptrFromInt32(0)
  9197. }
  9198. libc.Xmemset(tls, (*THASH_TABLE)(unsafe.Pointer(table)).Fv, 0, tsize)
  9199. i = _hash(tls, parser, name) & ((*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1))
  9200. } else {
  9201. h = _hash(tls, parser, name)
  9202. mask = (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(1)
  9203. step = uint8(0)
  9204. i = h & mask
  9205. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9206. if _keyeq(tls, name, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname) != 0 {
  9207. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9208. }
  9209. if !(step != 0) {
  9210. step = uint8(h & ^mask >> (libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-libc.Int32FromInt32(1)) & (mask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9211. }
  9212. if i < uint64(step) {
  9213. i += (*THASH_TABLE)(unsafe.Pointer(table)).Fsize - uint64(step)
  9214. } else {
  9215. i -= uint64(step)
  9216. }
  9217. }
  9218. if !(createSize != 0) {
  9219. return libc.UintptrFromInt32(0)
  9220. }
  9221. /* check for overflow (table is half full) */
  9222. if (*THASH_TABLE)(unsafe.Pointer(table)).Fused>>(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower)-int32(1)) != 0 {
  9223. newPower = libc.Uint8FromInt32(libc.Int32FromUint8((*THASH_TABLE)(unsafe.Pointer(table)).Fpower) + int32(1))
  9224. newSize = libc.Uint64FromInt32(1) << newPower
  9225. newMask = newSize - uint64(1)
  9226. tsize1 = newSize * uint64(8)
  9227. 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)
  9228. if !(newV != 0) {
  9229. return libc.UintptrFromInt32(0)
  9230. }
  9231. libc.Xmemset(tls, newV, 0, tsize1)
  9232. i = uint64(0)
  9233. for {
  9234. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9235. break
  9236. }
  9237. if *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9238. newHash = _hash(tls, parser, (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname)
  9239. j = newHash & newMask
  9240. step = uint8(0)
  9241. for *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) != 0 {
  9242. if !(step != 0) {
  9243. step = uint8(newHash & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9244. }
  9245. if j < uint64(step) {
  9246. j += newSize - uint64(step)
  9247. } else {
  9248. j -= uint64(step)
  9249. }
  9250. }
  9251. *(*uintptr)(unsafe.Pointer(newV + uintptr(j)*8)) = *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9252. }
  9253. goto _2
  9254. _2:
  9255. ;
  9256. i++
  9257. }
  9258. (*(*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)
  9259. (*THASH_TABLE)(unsafe.Pointer(table)).Fv = newV
  9260. (*THASH_TABLE)(unsafe.Pointer(table)).Fpower = newPower
  9261. (*THASH_TABLE)(unsafe.Pointer(table)).Fsize = newSize
  9262. i = h & newMask
  9263. step = uint8(0)
  9264. for *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0 {
  9265. if !(step != 0) {
  9266. step = uint8(h & ^newMask >> (libc.Int32FromUint8(newPower)-libc.Int32FromInt32(1)) & (newMask>>libc.Int32FromInt32(2)) | libc.Uint64FromInt32(1))
  9267. }
  9268. if i < uint64(step) {
  9269. i += newSize - uint64(step)
  9270. } else {
  9271. i -= uint64(step)
  9272. }
  9273. }
  9274. }
  9275. }
  9276. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Fmalloc_fcn})))(tls, createSize)
  9277. if !(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) != 0) {
  9278. return libc.UintptrFromInt32(0)
  9279. }
  9280. libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)), 0, createSize)
  9281. (*TNAMED)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))).Fname = name
  9282. (*THASH_TABLE)(unsafe.Pointer(table)).Fused++
  9283. return *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8))
  9284. }
  9285. func _hashTableClear(tls *libc.TLS, table uintptr) {
  9286. var i Tsize_t
  9287. _ = i
  9288. i = uint64(0)
  9289. for {
  9290. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9291. break
  9292. }
  9293. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  9294. *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)) = libc.UintptrFromInt32(0)
  9295. goto _1
  9296. _1:
  9297. ;
  9298. i++
  9299. }
  9300. (*THASH_TABLE)(unsafe.Pointer(table)).Fused = uint64(0)
  9301. }
  9302. func _hashTableDestroy(tls *libc.TLS, table uintptr) {
  9303. var i Tsize_t
  9304. _ = i
  9305. i = uint64(0)
  9306. for {
  9307. if !(i < (*THASH_TABLE)(unsafe.Pointer(table)).Fsize) {
  9308. break
  9309. }
  9310. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fmem)).Ffree_fcn})))(tls, *(*uintptr)(unsafe.Pointer((*THASH_TABLE)(unsafe.Pointer(table)).Fv + uintptr(i)*8)))
  9311. goto _1
  9312. _1:
  9313. ;
  9314. i++
  9315. }
  9316. (*(*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)
  9317. }
  9318. func _hashTableInit(tls *libc.TLS, p uintptr, ms uintptr) {
  9319. (*THASH_TABLE)(unsafe.Pointer(p)).Fpower = uint8(0)
  9320. (*THASH_TABLE)(unsafe.Pointer(p)).Fsize = uint64(0)
  9321. (*THASH_TABLE)(unsafe.Pointer(p)).Fused = uint64(0)
  9322. (*THASH_TABLE)(unsafe.Pointer(p)).Fv = libc.UintptrFromInt32(0)
  9323. (*THASH_TABLE)(unsafe.Pointer(p)).Fmem = ms
  9324. }
  9325. func _hashTableIterInit(tls *libc.TLS, iter uintptr, table uintptr) {
  9326. var v1 uintptr
  9327. _ = v1
  9328. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp = (*THASH_TABLE)(unsafe.Pointer(table)).Fv
  9329. if (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != 0 {
  9330. v1 = (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp + uintptr((*THASH_TABLE)(unsafe.Pointer(table)).Fsize)*8
  9331. } else {
  9332. v1 = libc.UintptrFromInt32(0)
  9333. }
  9334. (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend = v1
  9335. }
  9336. func _hashTableIterNext(tls *libc.TLS, iter uintptr) (r uintptr) {
  9337. var tem, v1, v2 uintptr
  9338. _, _, _ = tem, v1, v2
  9339. for (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fp != (*THASH_TABLE_ITER)(unsafe.Pointer(iter)).Fend {
  9340. v2 = iter
  9341. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9342. *(*uintptr)(unsafe.Pointer(v2)) += 8
  9343. tem = *(*uintptr)(unsafe.Pointer(v1))
  9344. if tem != 0 {
  9345. return tem
  9346. }
  9347. }
  9348. return libc.UintptrFromInt32(0)
  9349. }
  9350. func _poolInit(tls *libc.TLS, pool uintptr, ms uintptr) {
  9351. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9352. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = libc.UintptrFromInt32(0)
  9353. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9354. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9355. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9356. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem = ms
  9357. }
  9358. func _poolClear(tls *libc.TLS, pool uintptr) {
  9359. var p, tem uintptr
  9360. _, _ = p, tem
  9361. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0) {
  9362. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9363. } else {
  9364. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9365. for p != 0 {
  9366. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9367. (*TBLOCK)(unsafe.Pointer(p)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9368. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = p
  9369. p = tem
  9370. }
  9371. }
  9372. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = libc.UintptrFromInt32(0)
  9373. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = libc.UintptrFromInt32(0)
  9374. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = libc.UintptrFromInt32(0)
  9375. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = libc.UintptrFromInt32(0)
  9376. }
  9377. func _poolDestroy(tls *libc.TLS, pool uintptr) {
  9378. var p, tem, tem1 uintptr
  9379. _, _, _ = p, tem, tem1
  9380. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9381. for p != 0 {
  9382. tem = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9383. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9384. p = tem
  9385. }
  9386. p = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9387. for p != 0 {
  9388. tem1 = (*TBLOCK)(unsafe.Pointer(p)).Fnext
  9389. (*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Ffree_fcn})))(tls, p)
  9390. p = tem1
  9391. }
  9392. }
  9393. func _poolAppend(tls *libc.TLS, pool uintptr, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  9394. bp := tls.Alloc(16)
  9395. defer tls.Free(16)
  9396. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  9397. var convert_res _XML_Convert_Result
  9398. _ = convert_res
  9399. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9400. return libc.UintptrFromInt32(0)
  9401. }
  9402. for {
  9403. convert_res = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, pool+24, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)
  9404. if convert_res == int32(_XML_CONVERT_COMPLETED) || convert_res == int32(_XML_CONVERT_INPUT_INCOMPLETE) {
  9405. break
  9406. }
  9407. if !(_poolGrow(tls, pool) != 0) {
  9408. return libc.UintptrFromInt32(0)
  9409. }
  9410. goto _1
  9411. _1:
  9412. }
  9413. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9414. }
  9415. func _poolCopyString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9416. var v1, v4, v5 uintptr
  9417. var v3 int32
  9418. _, _, _, _ = v1, v3, v4, v5
  9419. for {
  9420. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9421. v3 = 0
  9422. } else {
  9423. v5 = pool + 24
  9424. v4 = *(*uintptr)(unsafe.Pointer(v5))
  9425. *(*uintptr)(unsafe.Pointer(v5))++
  9426. *(*TXML_Char)(unsafe.Pointer(v4)) = *(*TXML_Char)(unsafe.Pointer(s))
  9427. v3 = libc.Int32FromInt32(1)
  9428. }
  9429. if !(v3 != 0) {
  9430. return libc.UintptrFromInt32(0)
  9431. }
  9432. goto _2
  9433. _2:
  9434. ;
  9435. v1 = s
  9436. s++
  9437. if !(*(*TXML_Char)(unsafe.Pointer(v1)) != 0) {
  9438. break
  9439. }
  9440. }
  9441. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9442. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9443. return s
  9444. }
  9445. func _poolCopyStringN(tls *libc.TLS, pool uintptr, s uintptr, n int32) (r uintptr) {
  9446. var v2 int32
  9447. var v3, v4 uintptr
  9448. _, _, _ = v2, v3, v4
  9449. if !((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != 0) && !(_poolGrow(tls, pool) != 0) {
  9450. /* The following line is unreachable given the current usage of
  9451. * poolCopyStringN(). Currently it is called from exactly one
  9452. * place to copy the text of a simple general entity. By that
  9453. * point, the name of the entity is already stored in the pool, so
  9454. * pool->ptr cannot be NULL.
  9455. *
  9456. * If poolCopyStringN() is used elsewhere as it well might be,
  9457. * this line may well become executable again. Regardless, this
  9458. * sort of check shouldn't be removed lightly, so we just exclude
  9459. * it from the coverage statistics.
  9460. */
  9461. return libc.UintptrFromInt32(0) /* LCOV_EXCL_LINE */
  9462. }
  9463. for {
  9464. if !(n > 0) {
  9465. break
  9466. }
  9467. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9468. v2 = 0
  9469. } else {
  9470. v4 = pool + 24
  9471. v3 = *(*uintptr)(unsafe.Pointer(v4))
  9472. *(*uintptr)(unsafe.Pointer(v4))++
  9473. *(*TXML_Char)(unsafe.Pointer(v3)) = *(*TXML_Char)(unsafe.Pointer(s))
  9474. v2 = libc.Int32FromInt32(1)
  9475. }
  9476. if !(v2 != 0) {
  9477. return libc.UintptrFromInt32(0)
  9478. }
  9479. goto _1
  9480. _1:
  9481. ;
  9482. n--
  9483. s++
  9484. }
  9485. s = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9486. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr
  9487. return s
  9488. }
  9489. func _poolAppendString(tls *libc.TLS, pool uintptr, s uintptr) (r uintptr) {
  9490. var v1 int32
  9491. var v2, v3 uintptr
  9492. _, _, _ = v1, v2, v3
  9493. for *(*TXML_Char)(unsafe.Pointer(s)) != 0 {
  9494. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9495. v1 = 0
  9496. } else {
  9497. v3 = pool + 24
  9498. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9499. *(*uintptr)(unsafe.Pointer(v3))++
  9500. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(s))
  9501. v1 = libc.Int32FromInt32(1)
  9502. }
  9503. if !(v1 != 0) {
  9504. return libc.UintptrFromInt32(0)
  9505. }
  9506. s++
  9507. }
  9508. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9509. }
  9510. func _poolStoreString(tls *libc.TLS, pool uintptr, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9511. var v1, v2 uintptr
  9512. _, _ = v1, v2
  9513. if !(_poolAppend(tls, pool, enc, ptr, end) != 0) {
  9514. return libc.UintptrFromInt32(0)
  9515. }
  9516. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend && !(_poolGrow(tls, pool) != 0) {
  9517. return libc.UintptrFromInt32(0)
  9518. }
  9519. v2 = pool + 24
  9520. v1 = *(*uintptr)(unsafe.Pointer(v2))
  9521. *(*uintptr)(unsafe.Pointer(v2))++
  9522. *(*TXML_Char)(unsafe.Pointer(v1)) = uint8(0)
  9523. return (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9524. }
  9525. func _poolBytesToAllocateFor(tls *libc.TLS, blockSize int32) (r Tsize_t) {
  9526. var bytesToAllocate, stretchedBlockSize int32
  9527. var stretch Tsize_t
  9528. _, _, _ = bytesToAllocate, stretch, stretchedBlockSize
  9529. /* Unprotected math would be:
  9530. ** return offsetof(BLOCK, s) + blockSize * sizeof(XML_Char);
  9531. **
  9532. ** Detect overflow, avoiding _signed_ overflow undefined behavior
  9533. ** For a + b * c we check b * c in isolation first, so that addition of a
  9534. ** on top has no chance of making us accept a small non-negative number
  9535. */
  9536. stretch = uint64(1) /* can be 4 bytes */
  9537. if blockSize <= 0 {
  9538. return uint64(0)
  9539. }
  9540. if blockSize > libc.Int32FromUint64(libc.Uint64FromInt32(m_INT_MAX)/stretch) {
  9541. return uint64(0)
  9542. }
  9543. stretchedBlockSize = blockSize * libc.Int32FromUint64(stretch)
  9544. bytesToAllocate = libc.Int32FromUint64(uint64(libc.UintptrFromInt32(0)+12) + uint64(libc.Uint32FromInt32(stretchedBlockSize)))
  9545. if bytesToAllocate < 0 {
  9546. return uint64(0)
  9547. }
  9548. return libc.Uint64FromInt32(bytesToAllocate)
  9549. return r
  9550. }
  9551. func _poolGrow(tls *libc.TLS, pool uintptr) (r TXML_Bool) {
  9552. var blockSize, blockSize1 int32
  9553. var bytesToAllocate, bytesToAllocate1 Tsize_t
  9554. var offsetInsideBlock Tptrdiff_t
  9555. var tem, tem1, temp uintptr
  9556. _, _, _, _, _, _, _, _ = blockSize, blockSize1, bytesToAllocate, bytesToAllocate1, offsetInsideBlock, tem, tem1, temp
  9557. if (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks != 0 {
  9558. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == uintptr(0) {
  9559. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9560. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9561. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fnext = libc.UintptrFromInt32(0)
  9562. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9563. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  9564. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart
  9565. return libc.Uint8FromInt32(1)
  9566. }
  9567. if int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart) < int64((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fsize) {
  9568. tem = (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext
  9569. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9570. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks
  9571. (*TSTRING_POOL)(unsafe.Pointer(pool)).FfreeBlocks = tem
  9572. libc.Xmemcpy(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1))
  9573. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  9574. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9575. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr((*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize)
  9576. return libc.Uint8FromInt32(1)
  9577. }
  9578. }
  9579. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks != 0 && (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart == (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks+12 {
  9580. blockSize = libc.Int32FromUint32(libc.Uint32FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)) * libc.Uint32FromUint32(2))
  9581. /* NOTE: Needs to be calculated prior to calling `realloc`
  9582. to avoid dangling pointers: */
  9583. offsetInsideBlock = int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart)
  9584. if blockSize < 0 {
  9585. /* This condition traps a situation where either more than
  9586. * INT_MAX/2 bytes have already been allocated. This isn't
  9587. * readily testable, since it is unlikely that an average
  9588. * machine will have that much memory, so we exclude it from the
  9589. * coverage statistics.
  9590. */
  9591. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  9592. }
  9593. bytesToAllocate = _poolBytesToAllocateFor(tls, blockSize)
  9594. if bytesToAllocate == uint64(0) {
  9595. return libc.Uint8FromInt32(0)
  9596. }
  9597. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fmem)).Frealloc_fcn})))(tls, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks, uint64(uint32(bytesToAllocate)))
  9598. if temp == libc.UintptrFromInt32(0) {
  9599. return libc.Uint8FromInt32(0)
  9600. }
  9601. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = temp
  9602. (*TBLOCK)(unsafe.Pointer((*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks)).Fsize = blockSize
  9603. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12 + uintptr(offsetInsideBlock)
  9604. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks + 12
  9605. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart + uintptr(blockSize)
  9606. } else {
  9607. blockSize1 = int32(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fend) - int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  9608. if blockSize1 < 0 {
  9609. /* This condition traps a situation where either more than
  9610. * INT_MAX bytes have already been allocated (which is prevented
  9611. * by various pieces of program logic, not least this one, never
  9612. * mind the unlikelihood of actually having that much memory) or
  9613. * the pool control fields have been corrupted (which could
  9614. * conceivably happen in an extremely buggy user handler
  9615. * function). Either way it isn't readily testable, so we
  9616. * exclude it from the coverage statistics.
  9617. */
  9618. return libc.Uint8FromInt32(0) /* LCOV_EXCL_LINE */
  9619. }
  9620. if blockSize1 < int32(m_INIT_BLOCK_SIZE) {
  9621. blockSize1 = int32(m_INIT_BLOCK_SIZE)
  9622. } else {
  9623. /* Detect overflow, avoiding _signed_ overflow undefined behavior */
  9624. if libc.Int32FromUint32(libc.Uint32FromInt32(blockSize1)*libc.Uint32FromUint32(2)) < 0 {
  9625. return libc.Uint8FromInt32(0)
  9626. }
  9627. blockSize1 *= int32(2)
  9628. }
  9629. bytesToAllocate1 = _poolBytesToAllocateFor(tls, blockSize1)
  9630. if bytesToAllocate1 == uint64(0) {
  9631. return libc.Uint8FromInt32(0)
  9632. }
  9633. 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)
  9634. if !(tem1 != 0) {
  9635. return libc.Uint8FromInt32(0)
  9636. }
  9637. (*TBLOCK)(unsafe.Pointer(tem1)).Fsize = blockSize1
  9638. (*TBLOCK)(unsafe.Pointer(tem1)).Fnext = (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks
  9639. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fblocks = tem1
  9640. if (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr != (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart {
  9641. libc.Xmemcpy(tls, tem1+12, (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart, libc.Uint64FromInt64(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))*uint64(1))
  9642. }
  9643. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr = tem1 + 12 + uintptr(int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fptr)-int64((*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart))
  9644. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fstart = tem1 + 12
  9645. (*TSTRING_POOL)(unsafe.Pointer(pool)).Fend = tem1 + 12 + uintptr(blockSize1)
  9646. }
  9647. return libc.Uint8FromInt32(1)
  9648. }
  9649. func _nextScaffoldPart(tls *libc.TLS, parser TXML_Parser) (r int32) {
  9650. var dtd, me, parent, temp, v2 uintptr
  9651. var next, v3, v4, v5 int32
  9652. var v1 uint32
  9653. _, _, _, _, _, _, _, _, _, _ = dtd, me, next, parent, temp, v1, v2, v3, v4, v5
  9654. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  9655. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  9656. (*TDTD)(unsafe.Pointer(dtd)).FscaffIndex = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, uint64((*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_groupSize)*libc.Uint64FromInt64(4))
  9657. if !((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex != 0) {
  9658. return -int32(1)
  9659. }
  9660. *(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex)) = 0
  9661. }
  9662. if (*TDTD)(unsafe.Pointer(dtd)).FscaffCount >= (*TDTD)(unsafe.Pointer(dtd)).FscaffSize {
  9663. if (*TDTD)(unsafe.Pointer(dtd)).Fscaffold != 0 {
  9664. temp = (*(*func(*libc.TLS, uintptr, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Frealloc_fcn})))(tls, (*TDTD)(unsafe.Pointer(dtd)).Fscaffold, uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffSize*libc.Uint32FromInt32(2))*libc.Uint64FromInt64(32))
  9665. if temp == libc.UintptrFromInt32(0) {
  9666. return -int32(1)
  9667. }
  9668. *(*uint32)(unsafe.Pointer(dtd + 340)) *= uint32(2)
  9669. } else {
  9670. temp = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(m_INIT_SCAFFOLD_ELEMENTS)*libc.Uint64FromInt64(32))
  9671. if temp == libc.UintptrFromInt32(0) {
  9672. return -int32(1)
  9673. }
  9674. (*TDTD)(unsafe.Pointer(dtd)).FscaffSize = uint32(m_INIT_SCAFFOLD_ELEMENTS)
  9675. }
  9676. (*TDTD)(unsafe.Pointer(dtd)).Fscaffold = temp
  9677. }
  9678. v2 = dtd + 344
  9679. v1 = *(*uint32)(unsafe.Pointer(v2))
  9680. *(*uint32)(unsafe.Pointer(v2))++
  9681. next = libc.Int32FromUint32(v1)
  9682. me = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(next)*32
  9683. if (*TDTD)(unsafe.Pointer(dtd)).FscaffLevel != 0 {
  9684. parent = (*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(*(*int32)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).FscaffIndex + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffLevel-int32(1))*4)))*32
  9685. if (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild != 0 {
  9686. (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild)*32))).Fnextsib = next
  9687. }
  9688. if !((*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt != 0) {
  9689. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Ffirstchild = next
  9690. }
  9691. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Flastchild = next
  9692. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(parent)).Fchildcnt++
  9693. }
  9694. v5 = libc.Int32FromInt32(0)
  9695. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fnextsib = v5
  9696. v4 = v5
  9697. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Fchildcnt = v4
  9698. v3 = v4
  9699. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Flastchild = v3
  9700. (*TCONTENT_SCAFFOLD)(unsafe.Pointer(me)).Ffirstchild = v3
  9701. return next
  9702. }
  9703. func _build_node(tls *libc.TLS, parser TXML_Parser, src_node int32, dest uintptr, contpos uintptr, strpos uintptr) {
  9704. var cn int32
  9705. var dtd, src, v2, v3 uintptr
  9706. var i uint32
  9707. _, _, _, _, _, _ = cn, dtd, i, src, v2, v3
  9708. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9709. (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ftype1
  9710. (*TXML_Content)(unsafe.Pointer(dest)).Fquant = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fquant
  9711. if (*TXML_Content)(unsafe.Pointer(dest)).Ftype1 == int32(_XML_CTYPE_NAME) {
  9712. (*TXML_Content)(unsafe.Pointer(dest)).Fname = *(*uintptr)(unsafe.Pointer(strpos))
  9713. src = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fname
  9714. for {
  9715. v3 = strpos
  9716. v2 = *(*uintptr)(unsafe.Pointer(v3))
  9717. *(*uintptr)(unsafe.Pointer(v3))++
  9718. *(*TXML_Char)(unsafe.Pointer(v2)) = *(*TXML_Char)(unsafe.Pointer(src))
  9719. if !(*(*TXML_Char)(unsafe.Pointer(src)) != 0) {
  9720. break
  9721. }
  9722. src++
  9723. goto _1
  9724. _1:
  9725. }
  9726. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = uint32(0)
  9727. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = libc.UintptrFromInt32(0)
  9728. } else {
  9729. (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren = libc.Uint32FromInt32((*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Fchildcnt)
  9730. (*TXML_Content)(unsafe.Pointer(dest)).Fchildren = *(*uintptr)(unsafe.Pointer(contpos))
  9731. *(*uintptr)(unsafe.Pointer(contpos)) += uintptr((*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) * 32
  9732. i = uint32(0)
  9733. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(src_node)*32))).Ffirstchild
  9734. for {
  9735. if !(i < (*TXML_Content)(unsafe.Pointer(dest)).Fnumchildren) {
  9736. break
  9737. }
  9738. _build_node(tls, parser, cn, (*TXML_Content)(unsafe.Pointer(dest)).Fchildren+uintptr(i)*32, contpos, strpos)
  9739. goto _4
  9740. _4:
  9741. ;
  9742. i++
  9743. cn = (*(*TCONTENT_SCAFFOLD)(unsafe.Pointer((*TDTD)(unsafe.Pointer(dtd)).Fscaffold + uintptr(cn)*32))).Fnextsib
  9744. }
  9745. (*TXML_Content)(unsafe.Pointer(dest)).Fname = libc.UintptrFromInt32(0)
  9746. }
  9747. }
  9748. func _build_model(tls *libc.TLS, parser TXML_Parser) (r uintptr) {
  9749. bp := tls.Alloc(16)
  9750. defer tls.Free(16)
  9751. var allocsize int32
  9752. var dtd, ret uintptr
  9753. var _ /* cpos at bp+0 */ uintptr
  9754. var _ /* str at bp+8 */ uintptr
  9755. _, _, _ = allocsize, dtd, ret
  9756. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd
  9757. allocsize = libc.Int32FromUint64(uint64((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*libc.Uint64FromInt64(32) + uint64((*TDTD)(unsafe.Pointer(dtd)).FcontentStringLen)*libc.Uint64FromInt64(1))
  9758. ret = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_mem.Fmalloc_fcn})))(tls, libc.Uint64FromInt32(allocsize))
  9759. if !(ret != 0) {
  9760. return libc.UintptrFromInt32(0)
  9761. }
  9762. *(*uintptr)(unsafe.Pointer(bp + 8)) = ret + uintptr((*TDTD)(unsafe.Pointer(dtd)).FscaffCount)*32
  9763. *(*uintptr)(unsafe.Pointer(bp)) = ret + 1*32
  9764. _build_node(tls, parser, 0, ret, bp, bp+8)
  9765. return ret
  9766. }
  9767. func _getElementType(tls *libc.TLS, parser TXML_Parser, enc uintptr, ptr uintptr, end uintptr) (r uintptr) {
  9768. var dtd, name, ret uintptr
  9769. _, _, _ = dtd, name, ret
  9770. dtd = (*TXML_ParserStruct)(unsafe.Pointer(parser)).Fm_dtd /* save one level of indirection */
  9771. name = _poolStoreString(tls, dtd+160, enc, ptr, end)
  9772. if !(name != 0) {
  9773. return libc.UintptrFromInt32(0)
  9774. }
  9775. ret = _lookup(tls, parser, dtd+40, name, uint64(40))
  9776. if !(ret != 0) {
  9777. return libc.UintptrFromInt32(0)
  9778. }
  9779. if (*TELEMENT_TYPE)(unsafe.Pointer(ret)).Fname != name {
  9780. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart
  9781. } else {
  9782. (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fstart = (*TSTRING_POOL)(unsafe.Pointer(dtd + 160)).Fptr
  9783. if !(_setElementTypePrefix(tls, parser, ret) != 0) {
  9784. return libc.UintptrFromInt32(0)
  9785. }
  9786. }
  9787. return ret
  9788. }
  9789. func _copyString(tls *libc.TLS, s uintptr, memsuite uintptr) (r uintptr) {
  9790. var charsRequired int32
  9791. var result uintptr
  9792. _, _ = charsRequired, result
  9793. charsRequired = 0
  9794. /* First determine how long the string is */
  9795. for libc.Int32FromUint8(*(*TXML_Char)(unsafe.Pointer(s + uintptr(charsRequired)))) != 0 {
  9796. charsRequired++
  9797. }
  9798. /* Include the terminator */
  9799. charsRequired++
  9800. /* Now allocate space for the copy */
  9801. result = (*(*func(*libc.TLS, Tsize_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{(*TXML_Memory_Handling_Suite)(unsafe.Pointer(memsuite)).Fmalloc_fcn})))(tls, libc.Uint64FromInt32(charsRequired)*uint64(1))
  9802. if result == libc.UintptrFromInt32(0) {
  9803. return libc.UintptrFromInt32(0)
  9804. }
  9805. /* Copy the original into place */
  9806. libc.Xmemcpy(tls, result, s, libc.Uint64FromInt32(charsRequired)*uint64(1))
  9807. return result
  9808. }
  9809. const m_ASCII_41 = 52
  9810. const m_ASCII_51 = 53
  9811. const m_ASCII_61 = 54
  9812. const m_ASCII_71 = 55
  9813. const m_ASCII_AMP1 = 38
  9814. const m_ASCII_APOS1 = 39
  9815. const m_ASCII_B1 = 66
  9816. const m_ASCII_COMMA1 = 0x2C
  9817. const m_ASCII_FF1 = 0x0C
  9818. const m_ASCII_GT1 = 62
  9819. const m_ASCII_HASH1 = 0x23
  9820. const m_ASCII_K1 = 0x4B
  9821. const m_ASCII_LPAREN1 = 0x28
  9822. const m_ASCII_LSQB1 = 91
  9823. const m_ASCII_LT1 = 60
  9824. const m_ASCII_MINUS1 = 45
  9825. const m_ASCII_N1 = 0x4E
  9826. const m_ASCII_PIPE1 = 0x7C
  9827. const m_ASCII_QUOT1 = 34
  9828. const m_ASCII_R1 = 0x52
  9829. const m_ASCII_RPAREN1 = 0x29
  9830. const m_ASCII_RSQB1 = 93
  9831. const m_ASCII_SEMI1 = 59
  9832. const m_ASCII_SLASH1 = 0x2F
  9833. const m_ASCII_SPACE1 = 32
  9834. const m_ASCII_TAB1 = 9
  9835. const m_ASCII_U1 = 85
  9836. const m_ASCII_UNDERSCORE1 = 95
  9837. const m_ASCII_Y1 = 0x59
  9838. const m_ASCII_Z1 = 90
  9839. const m_ASCII_b1 = 98
  9840. const m_ASCII_d1 = 100
  9841. const m_ASCII_f1 = 102
  9842. const m_ASCII_h1 = 0x68
  9843. const m_ASCII_i1 = 105
  9844. const m_ASCII_q1 = 113
  9845. const m_ASCII_u1 = 117
  9846. const m_ASCII_v1 = 118
  9847. const m_ASCII_w1 = 0x77
  9848. const m_ASCII_y1 = 121
  9849. const m_ASCII_z1 = 122
  9850. const m_ENCODING_MAX = 128
  9851. const m___bool_true_false_are_defined = 1
  9852. const m_false = 0
  9853. const m_true = 1
  9854. const m_utf8_isName4 = "isNever"
  9855. const m_utf8_isNmstrt4 = "isNever"
  9856. var _namingBitmap = [320]uint32{
  9857. 8: uint32(0xFFFFFFFF),
  9858. 9: uint32(0xFFFFFFFF),
  9859. 10: uint32(0xFFFFFFFF),
  9860. 11: uint32(0xFFFFFFFF),
  9861. 12: uint32(0xFFFFFFFF),
  9862. 13: uint32(0xFFFFFFFF),
  9863. 14: uint32(0xFFFFFFFF),
  9864. 15: uint32(0xFFFFFFFF),
  9865. 17: uint32(0x04000000),
  9866. 18: uint32(0x87FFFFFE),
  9867. 19: uint32(0x07FFFFFE),
  9868. 22: uint32(0xFF7FFFFF),
  9869. 23: uint32(0xFF7FFFFF),
  9870. 24: uint32(0xFFFFFFFF),
  9871. 25: uint32(0x7FF3FFFF),
  9872. 26: uint32(0xFFFFFDFE),
  9873. 27: uint32(0x7FFFFFFF),
  9874. 28: uint32(0xFFFFFFFF),
  9875. 29: uint32(0xFFFFFFFF),
  9876. 30: uint32(0xFFFFE00F),
  9877. 31: uint32(0xFC31FFFF),
  9878. 32: uint32(0x00FFFFFF),
  9879. 34: uint32(0xFFFF0000),
  9880. 35: uint32(0xFFFFFFFF),
  9881. 36: uint32(0xFFFFFFFF),
  9882. 37: uint32(0xF80001FF),
  9883. 38: uint32(0x00000003),
  9884. 44: uint32(0xFFFFD740),
  9885. 45: uint32(0xFFFFFFFB),
  9886. 46: uint32(0x547F7FFF),
  9887. 47: uint32(0x000FFFFD),
  9888. 48: uint32(0xFFFFDFFE),
  9889. 49: uint32(0xFFFFFFFF),
  9890. 50: uint32(0xDFFEFFFF),
  9891. 51: uint32(0xFFFFFFFF),
  9892. 52: uint32(0xFFFF0003),
  9893. 53: uint32(0xFFFFFFFF),
  9894. 54: uint32(0xFFFF199F),
  9895. 55: uint32(0x033FCFFF),
  9896. 57: uint32(0xFFFE0000),
  9897. 58: uint32(0x027FFFFF),
  9898. 59: uint32(0xFFFFFFFE),
  9899. 60: uint32(0x0000007F),
  9900. 62: uint32(0xFFFF0000),
  9901. 63: uint32(0x000707FF),
  9902. 65: uint32(0x07FFFFFE),
  9903. 66: uint32(0x000007FE),
  9904. 67: uint32(0xFFFE0000),
  9905. 68: uint32(0xFFFFFFFF),
  9906. 69: uint32(0x7CFFFFFF),
  9907. 70: uint32(0x002F7FFF),
  9908. 71: uint32(0x00000060),
  9909. 72: uint32(0xFFFFFFE0),
  9910. 73: uint32(0x23FFFFFF),
  9911. 74: uint32(0xFF000000),
  9912. 75: uint32(0x00000003),
  9913. 76: uint32(0xFFF99FE0),
  9914. 77: uint32(0x03C5FDFF),
  9915. 78: uint32(0xB0000000),
  9916. 79: uint32(0x00030003),
  9917. 80: uint32(0xFFF987E0),
  9918. 81: uint32(0x036DFDFF),
  9919. 82: uint32(0x5E000000),
  9920. 83: uint32(0x001C0000),
  9921. 84: uint32(0xFFFBAFE0),
  9922. 85: uint32(0x23EDFDFF),
  9923. 87: uint32(0x00000001),
  9924. 88: uint32(0xFFF99FE0),
  9925. 89: uint32(0x23CDFDFF),
  9926. 90: uint32(0xB0000000),
  9927. 91: uint32(0x00000003),
  9928. 92: uint32(0xD63DC7E0),
  9929. 93: uint32(0x03BFC718),
  9930. 96: uint32(0xFFFDDFE0),
  9931. 97: uint32(0x03EFFDFF),
  9932. 99: uint32(0x00000003),
  9933. 100: uint32(0xFFFDDFE0),
  9934. 101: uint32(0x03EFFDFF),
  9935. 102: uint32(0x40000000),
  9936. 103: uint32(0x00000003),
  9937. 104: uint32(0xFFFDDFE0),
  9938. 105: uint32(0x03FFFDFF),
  9939. 107: uint32(0x00000003),
  9940. 112: uint32(0xFFFFFFFE),
  9941. 113: uint32(0x000D7FFF),
  9942. 114: uint32(0x0000003F),
  9943. 116: uint32(0xFEF02596),
  9944. 117: uint32(0x200D6CAE),
  9945. 118: uint32(0x0000001F),
  9946. 122: uint32(0xFFFFFEFF),
  9947. 123: uint32(0x000003FF),
  9948. 133: uint32(0xFFFFFFFF),
  9949. 134: uint32(0xFFFF003F),
  9950. 135: uint32(0x007FFFFF),
  9951. 136: uint32(0x0007DAED),
  9952. 137: uint32(0x50000000),
  9953. 138: uint32(0x82315001),
  9954. 139: uint32(0x002C62AB),
  9955. 140: uint32(0x40000000),
  9956. 141: uint32(0xF580C900),
  9957. 142: uint32(0x00000007),
  9958. 143: uint32(0x02010800),
  9959. 144: uint32(0xFFFFFFFF),
  9960. 145: uint32(0xFFFFFFFF),
  9961. 146: uint32(0xFFFFFFFF),
  9962. 147: uint32(0xFFFFFFFF),
  9963. 148: uint32(0x0FFFFFFF),
  9964. 149: uint32(0xFFFFFFFF),
  9965. 150: uint32(0xFFFFFFFF),
  9966. 151: uint32(0x03FFFFFF),
  9967. 152: uint32(0x3F3FFFFF),
  9968. 153: uint32(0xFFFFFFFF),
  9969. 154: uint32(0xAAFF3F3F),
  9970. 155: uint32(0x3FFFFFFF),
  9971. 156: uint32(0xFFFFFFFF),
  9972. 157: uint32(0x5FDFFFFF),
  9973. 158: uint32(0x0FCF1FDC),
  9974. 159: uint32(0x1FDC1FFF),
  9975. 161: uint32(0x00004C40),
  9976. 164: uint32(0x00000007),
  9977. 168: uint32(0x00000080),
  9978. 169: uint32(0x000003FE),
  9979. 170: uint32(0xFFFFFFFE),
  9980. 171: uint32(0xFFFFFFFF),
  9981. 172: uint32(0x001FFFFF),
  9982. 173: uint32(0xFFFFFFFE),
  9983. 174: uint32(0xFFFFFFFF),
  9984. 175: uint32(0x07FFFFFF),
  9985. 176: uint32(0xFFFFFFE0),
  9986. 177: uint32(0x00001FFF),
  9987. 184: uint32(0xFFFFFFFF),
  9988. 185: uint32(0xFFFFFFFF),
  9989. 186: uint32(0xFFFFFFFF),
  9990. 187: uint32(0xFFFFFFFF),
  9991. 188: uint32(0xFFFFFFFF),
  9992. 189: uint32(0x0000003F),
  9993. 192: uint32(0xFFFFFFFF),
  9994. 193: uint32(0xFFFFFFFF),
  9995. 194: uint32(0xFFFFFFFF),
  9996. 195: uint32(0xFFFFFFFF),
  9997. 196: uint32(0xFFFFFFFF),
  9998. 197: uint32(0x0000000F),
  9999. 201: uint32(0x07FF6000),
  10000. 202: uint32(0x87FFFFFE),
  10001. 203: uint32(0x07FFFFFE),
  10002. 205: uint32(0x00800000),
  10003. 206: uint32(0xFF7FFFFF),
  10004. 207: uint32(0xFF7FFFFF),
  10005. 208: uint32(0x00FFFFFF),
  10006. 210: uint32(0xFFFF0000),
  10007. 211: uint32(0xFFFFFFFF),
  10008. 212: uint32(0xFFFFFFFF),
  10009. 213: uint32(0xF80001FF),
  10010. 214: uint32(0x00030003),
  10011. 216: uint32(0xFFFFFFFF),
  10012. 217: uint32(0xFFFFFFFF),
  10013. 218: uint32(0x0000003F),
  10014. 219: uint32(0x00000003),
  10015. 220: uint32(0xFFFFD7C0),
  10016. 221: uint32(0xFFFFFFFB),
  10017. 222: uint32(0x547F7FFF),
  10018. 223: uint32(0x000FFFFD),
  10019. 224: uint32(0xFFFFDFFE),
  10020. 225: uint32(0xFFFFFFFF),
  10021. 226: uint32(0xDFFEFFFF),
  10022. 227: uint32(0xFFFFFFFF),
  10023. 228: uint32(0xFFFF007B),
  10024. 229: uint32(0xFFFFFFFF),
  10025. 230: uint32(0xFFFF199F),
  10026. 231: uint32(0x033FCFFF),
  10027. 233: uint32(0xFFFE0000),
  10028. 234: uint32(0x027FFFFF),
  10029. 235: uint32(0xFFFFFFFE),
  10030. 236: uint32(0xFFFE007F),
  10031. 237: uint32(0xBBFFFFFB),
  10032. 238: uint32(0xFFFF0016),
  10033. 239: uint32(0x000707FF),
  10034. 241: uint32(0x07FFFFFE),
  10035. 242: uint32(0x0007FFFF),
  10036. 243: uint32(0xFFFF03FF),
  10037. 244: uint32(0xFFFFFFFF),
  10038. 245: uint32(0x7CFFFFFF),
  10039. 246: uint32(0xFFEF7FFF),
  10040. 247: uint32(0x03FF3DFF),
  10041. 248: uint32(0xFFFFFFEE),
  10042. 249: uint32(0xF3FFFFFF),
  10043. 250: uint32(0xFF1E3FFF),
  10044. 251: uint32(0x0000FFCF),
  10045. 252: uint32(0xFFF99FEE),
  10046. 253: uint32(0xD3C5FDFF),
  10047. 254: uint32(0xB080399F),
  10048. 255: uint32(0x0003FFCF),
  10049. 256: uint32(0xFFF987E4),
  10050. 257: uint32(0xD36DFDFF),
  10051. 258: uint32(0x5E003987),
  10052. 259: uint32(0x001FFFC0),
  10053. 260: uint32(0xFFFBAFEE),
  10054. 261: uint32(0xF3EDFDFF),
  10055. 262: uint32(0x00003BBF),
  10056. 263: uint32(0x0000FFC1),
  10057. 264: uint32(0xFFF99FEE),
  10058. 265: uint32(0xF3CDFDFF),
  10059. 266: uint32(0xB0C0398F),
  10060. 267: uint32(0x0000FFC3),
  10061. 268: uint32(0xD63DC7EC),
  10062. 269: uint32(0xC3BFC718),
  10063. 270: uint32(0x00803DC7),
  10064. 271: uint32(0x0000FF80),
  10065. 272: uint32(0xFFFDDFEE),
  10066. 273: uint32(0xC3EFFDFF),
  10067. 274: uint32(0x00603DDF),
  10068. 275: uint32(0x0000FFC3),
  10069. 276: uint32(0xFFFDDFEC),
  10070. 277: uint32(0xC3EFFDFF),
  10071. 278: uint32(0x40603DDF),
  10072. 279: uint32(0x0000FFC3),
  10073. 280: uint32(0xFFFDDFEC),
  10074. 281: uint32(0xC3FFFDFF),
  10075. 282: uint32(0x00803DCF),
  10076. 283: uint32(0x0000FFC3),
  10077. 288: uint32(0xFFFFFFFE),
  10078. 289: uint32(0x07FF7FFF),
  10079. 290: uint32(0x03FF7FFF),
  10080. 292: uint32(0xFEF02596),
  10081. 293: uint32(0x3BFF6CAE),
  10082. 294: uint32(0x03FF3F5F),
  10083. 296: uint32(0x03000000),
  10084. 297: uint32(0xC2A003FF),
  10085. 298: uint32(0xFFFFFEFF),
  10086. 299: uint32(0xFFFE03FF),
  10087. 300: uint32(0xFEBF0FDF),
  10088. 301: uint32(0x02FE3FFF),
  10089. 310: uint32(0x1FFF0000),
  10090. 311: uint32(0x00000002),
  10091. 312: uint32(0x000000A0),
  10092. 313: uint32(0x003EFFFE),
  10093. 314: uint32(0xFFFFFFFE),
  10094. 315: uint32(0xFFFFFFFF),
  10095. 316: uint32(0x661FFFFF),
  10096. 317: uint32(0xFFFFFFFE),
  10097. 318: uint32(0xFFFFFFFF),
  10098. 319: uint32(0x77FFFFFF),
  10099. }
  10100. var _nmstrtPages = [256]uint8{
  10101. 0: uint8(0x02),
  10102. 1: uint8(0x03),
  10103. 2: uint8(0x04),
  10104. 3: uint8(0x05),
  10105. 4: uint8(0x06),
  10106. 5: uint8(0x07),
  10107. 6: uint8(0x08),
  10108. 9: uint8(0x09),
  10109. 10: uint8(0x0A),
  10110. 11: uint8(0x0B),
  10111. 12: uint8(0x0C),
  10112. 13: uint8(0x0D),
  10113. 14: uint8(0x0E),
  10114. 15: uint8(0x0F),
  10115. 16: uint8(0x10),
  10116. 17: uint8(0x11),
  10117. 30: uint8(0x12),
  10118. 31: uint8(0x13),
  10119. 33: uint8(0x14),
  10120. 48: uint8(0x15),
  10121. 49: uint8(0x16),
  10122. 78: uint8(0x01),
  10123. 79: uint8(0x01),
  10124. 80: uint8(0x01),
  10125. 81: uint8(0x01),
  10126. 82: uint8(0x01),
  10127. 83: uint8(0x01),
  10128. 84: uint8(0x01),
  10129. 85: uint8(0x01),
  10130. 86: uint8(0x01),
  10131. 87: uint8(0x01),
  10132. 88: uint8(0x01),
  10133. 89: uint8(0x01),
  10134. 90: uint8(0x01),
  10135. 91: uint8(0x01),
  10136. 92: uint8(0x01),
  10137. 93: uint8(0x01),
  10138. 94: uint8(0x01),
  10139. 95: uint8(0x01),
  10140. 96: uint8(0x01),
  10141. 97: uint8(0x01),
  10142. 98: uint8(0x01),
  10143. 99: uint8(0x01),
  10144. 100: uint8(0x01),
  10145. 101: uint8(0x01),
  10146. 102: uint8(0x01),
  10147. 103: uint8(0x01),
  10148. 104: uint8(0x01),
  10149. 105: uint8(0x01),
  10150. 106: uint8(0x01),
  10151. 107: uint8(0x01),
  10152. 108: uint8(0x01),
  10153. 109: uint8(0x01),
  10154. 110: uint8(0x01),
  10155. 111: uint8(0x01),
  10156. 112: uint8(0x01),
  10157. 113: uint8(0x01),
  10158. 114: uint8(0x01),
  10159. 115: uint8(0x01),
  10160. 116: uint8(0x01),
  10161. 117: uint8(0x01),
  10162. 118: uint8(0x01),
  10163. 119: uint8(0x01),
  10164. 120: uint8(0x01),
  10165. 121: uint8(0x01),
  10166. 122: uint8(0x01),
  10167. 123: uint8(0x01),
  10168. 124: uint8(0x01),
  10169. 125: uint8(0x01),
  10170. 126: uint8(0x01),
  10171. 127: uint8(0x01),
  10172. 128: uint8(0x01),
  10173. 129: uint8(0x01),
  10174. 130: uint8(0x01),
  10175. 131: uint8(0x01),
  10176. 132: uint8(0x01),
  10177. 133: uint8(0x01),
  10178. 134: uint8(0x01),
  10179. 135: uint8(0x01),
  10180. 136: uint8(0x01),
  10181. 137: uint8(0x01),
  10182. 138: uint8(0x01),
  10183. 139: uint8(0x01),
  10184. 140: uint8(0x01),
  10185. 141: uint8(0x01),
  10186. 142: uint8(0x01),
  10187. 143: uint8(0x01),
  10188. 144: uint8(0x01),
  10189. 145: uint8(0x01),
  10190. 146: uint8(0x01),
  10191. 147: uint8(0x01),
  10192. 148: uint8(0x01),
  10193. 149: uint8(0x01),
  10194. 150: uint8(0x01),
  10195. 151: uint8(0x01),
  10196. 152: uint8(0x01),
  10197. 153: uint8(0x01),
  10198. 154: uint8(0x01),
  10199. 155: uint8(0x01),
  10200. 156: uint8(0x01),
  10201. 157: uint8(0x01),
  10202. 158: uint8(0x01),
  10203. 159: uint8(0x17),
  10204. 172: uint8(0x01),
  10205. 173: uint8(0x01),
  10206. 174: uint8(0x01),
  10207. 175: uint8(0x01),
  10208. 176: uint8(0x01),
  10209. 177: uint8(0x01),
  10210. 178: uint8(0x01),
  10211. 179: uint8(0x01),
  10212. 180: uint8(0x01),
  10213. 181: uint8(0x01),
  10214. 182: uint8(0x01),
  10215. 183: uint8(0x01),
  10216. 184: uint8(0x01),
  10217. 185: uint8(0x01),
  10218. 186: uint8(0x01),
  10219. 187: uint8(0x01),
  10220. 188: uint8(0x01),
  10221. 189: uint8(0x01),
  10222. 190: uint8(0x01),
  10223. 191: uint8(0x01),
  10224. 192: uint8(0x01),
  10225. 193: uint8(0x01),
  10226. 194: uint8(0x01),
  10227. 195: uint8(0x01),
  10228. 196: uint8(0x01),
  10229. 197: uint8(0x01),
  10230. 198: uint8(0x01),
  10231. 199: uint8(0x01),
  10232. 200: uint8(0x01),
  10233. 201: uint8(0x01),
  10234. 202: uint8(0x01),
  10235. 203: uint8(0x01),
  10236. 204: uint8(0x01),
  10237. 205: uint8(0x01),
  10238. 206: uint8(0x01),
  10239. 207: uint8(0x01),
  10240. 208: uint8(0x01),
  10241. 209: uint8(0x01),
  10242. 210: uint8(0x01),
  10243. 211: uint8(0x01),
  10244. 212: uint8(0x01),
  10245. 213: uint8(0x01),
  10246. 214: uint8(0x01),
  10247. 215: uint8(0x18),
  10248. }
  10249. var _namePages = [256]uint8{
  10250. 0: uint8(0x19),
  10251. 1: uint8(0x03),
  10252. 2: uint8(0x1A),
  10253. 3: uint8(0x1B),
  10254. 4: uint8(0x1C),
  10255. 5: uint8(0x1D),
  10256. 6: uint8(0x1E),
  10257. 9: uint8(0x1F),
  10258. 10: uint8(0x20),
  10259. 11: uint8(0x21),
  10260. 12: uint8(0x22),
  10261. 13: uint8(0x23),
  10262. 14: uint8(0x24),
  10263. 15: uint8(0x25),
  10264. 16: uint8(0x10),
  10265. 17: uint8(0x11),
  10266. 30: uint8(0x12),
  10267. 31: uint8(0x13),
  10268. 32: uint8(0x26),
  10269. 33: uint8(0x14),
  10270. 48: uint8(0x27),
  10271. 49: uint8(0x16),
  10272. 78: uint8(0x01),
  10273. 79: uint8(0x01),
  10274. 80: uint8(0x01),
  10275. 81: uint8(0x01),
  10276. 82: uint8(0x01),
  10277. 83: uint8(0x01),
  10278. 84: uint8(0x01),
  10279. 85: uint8(0x01),
  10280. 86: uint8(0x01),
  10281. 87: uint8(0x01),
  10282. 88: uint8(0x01),
  10283. 89: uint8(0x01),
  10284. 90: uint8(0x01),
  10285. 91: uint8(0x01),
  10286. 92: uint8(0x01),
  10287. 93: uint8(0x01),
  10288. 94: uint8(0x01),
  10289. 95: uint8(0x01),
  10290. 96: uint8(0x01),
  10291. 97: uint8(0x01),
  10292. 98: uint8(0x01),
  10293. 99: uint8(0x01),
  10294. 100: uint8(0x01),
  10295. 101: uint8(0x01),
  10296. 102: uint8(0x01),
  10297. 103: uint8(0x01),
  10298. 104: uint8(0x01),
  10299. 105: uint8(0x01),
  10300. 106: uint8(0x01),
  10301. 107: uint8(0x01),
  10302. 108: uint8(0x01),
  10303. 109: uint8(0x01),
  10304. 110: uint8(0x01),
  10305. 111: uint8(0x01),
  10306. 112: uint8(0x01),
  10307. 113: uint8(0x01),
  10308. 114: uint8(0x01),
  10309. 115: uint8(0x01),
  10310. 116: uint8(0x01),
  10311. 117: uint8(0x01),
  10312. 118: uint8(0x01),
  10313. 119: uint8(0x01),
  10314. 120: uint8(0x01),
  10315. 121: uint8(0x01),
  10316. 122: uint8(0x01),
  10317. 123: uint8(0x01),
  10318. 124: uint8(0x01),
  10319. 125: uint8(0x01),
  10320. 126: uint8(0x01),
  10321. 127: uint8(0x01),
  10322. 128: uint8(0x01),
  10323. 129: uint8(0x01),
  10324. 130: uint8(0x01),
  10325. 131: uint8(0x01),
  10326. 132: uint8(0x01),
  10327. 133: uint8(0x01),
  10328. 134: uint8(0x01),
  10329. 135: uint8(0x01),
  10330. 136: uint8(0x01),
  10331. 137: uint8(0x01),
  10332. 138: uint8(0x01),
  10333. 139: uint8(0x01),
  10334. 140: uint8(0x01),
  10335. 141: uint8(0x01),
  10336. 142: uint8(0x01),
  10337. 143: uint8(0x01),
  10338. 144: uint8(0x01),
  10339. 145: uint8(0x01),
  10340. 146: uint8(0x01),
  10341. 147: uint8(0x01),
  10342. 148: uint8(0x01),
  10343. 149: uint8(0x01),
  10344. 150: uint8(0x01),
  10345. 151: uint8(0x01),
  10346. 152: uint8(0x01),
  10347. 153: uint8(0x01),
  10348. 154: uint8(0x01),
  10349. 155: uint8(0x01),
  10350. 156: uint8(0x01),
  10351. 157: uint8(0x01),
  10352. 158: uint8(0x01),
  10353. 159: uint8(0x17),
  10354. 172: uint8(0x01),
  10355. 173: uint8(0x01),
  10356. 174: uint8(0x01),
  10357. 175: uint8(0x01),
  10358. 176: uint8(0x01),
  10359. 177: uint8(0x01),
  10360. 178: uint8(0x01),
  10361. 179: uint8(0x01),
  10362. 180: uint8(0x01),
  10363. 181: uint8(0x01),
  10364. 182: uint8(0x01),
  10365. 183: uint8(0x01),
  10366. 184: uint8(0x01),
  10367. 185: uint8(0x01),
  10368. 186: uint8(0x01),
  10369. 187: uint8(0x01),
  10370. 188: uint8(0x01),
  10371. 189: uint8(0x01),
  10372. 190: uint8(0x01),
  10373. 191: uint8(0x01),
  10374. 192: uint8(0x01),
  10375. 193: uint8(0x01),
  10376. 194: uint8(0x01),
  10377. 195: uint8(0x01),
  10378. 196: uint8(0x01),
  10379. 197: uint8(0x01),
  10380. 198: uint8(0x01),
  10381. 199: uint8(0x01),
  10382. 200: uint8(0x01),
  10383. 201: uint8(0x01),
  10384. 202: uint8(0x01),
  10385. 203: uint8(0x01),
  10386. 204: uint8(0x01),
  10387. 205: uint8(0x01),
  10388. 206: uint8(0x01),
  10389. 207: uint8(0x01),
  10390. 208: uint8(0x01),
  10391. 209: uint8(0x01),
  10392. 210: uint8(0x01),
  10393. 211: uint8(0x01),
  10394. 212: uint8(0x01),
  10395. 213: uint8(0x01),
  10396. 214: uint8(0x01),
  10397. 215: uint8(0x18),
  10398. }
  10399. /* A 2 byte UTF-8 representation splits the characters 11 bits between
  10400. the bottom 5 and 6 bits of the bytes. We need 8 bits to index into
  10401. pages, 3 bits to add to that index and 5 bits to generate the mask.
  10402. */
  10403. /* A 3 byte UTF-8 representation splits the characters 16 bits between
  10404. the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index
  10405. into pages, 3 bits to add to that index and 5 bits to generate the
  10406. mask.
  10407. */
  10408. /* Detection of invalid UTF-8 sequences is based on Table 3.1B
  10409. of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
  10410. with the additional restriction of not allowing the Unicode
  10411. code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE).
  10412. Implementation details:
  10413. (A & 0x80) == 0 means A < 0x80
  10414. and
  10415. (A & 0xC0) == 0xC0 means A > 0xBF
  10416. */
  10417. func _isNever(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10418. _ = enc
  10419. _ = p
  10420. return 0
  10421. }
  10422. func _utf8_isName2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10423. _ = enc
  10424. 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))))
  10425. }
  10426. func _utf8_isName3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10427. _ = enc
  10428. 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))))
  10429. }
  10430. func _utf8_isNmstrt2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10431. _ = enc
  10432. 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))))
  10433. }
  10434. func _utf8_isNmstrt3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10435. _ = enc
  10436. 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))))
  10437. }
  10438. func _utf8_isInvalid2(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10439. _ = enc
  10440. 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))
  10441. }
  10442. func _utf8_isInvalid3(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10443. var v1, v3, v4 int32
  10444. var v2, v5, v6 bool
  10445. _, _, _, _, _, _ = v1, v2, v3, v4, v5, v6
  10446. _ = enc
  10447. if v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0x80) == 0; !v2 {
  10448. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xEF) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) == int32(0xBF) {
  10449. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2))) > int32(0xBD))
  10450. } else {
  10451. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 2)))&int32(0xC0) == int32(0xC0))
  10452. }
  10453. }
  10454. if v6 = v2 || v1 != 0; !v6 {
  10455. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xE0) {
  10456. v3 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0xA0) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10457. } else {
  10458. if v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v5 {
  10459. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xED) {
  10460. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x9F))
  10461. } else {
  10462. v4 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10463. }
  10464. }
  10465. v3 = libc.BoolInt32(v5 || v4 != 0)
  10466. }
  10467. }
  10468. return libc.BoolInt32(v6 || v3 != 0)
  10469. }
  10470. func _utf8_isInvalid4(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  10471. var v1, v2 int32
  10472. var v3, v4 bool
  10473. _, _, _, _ = v1, v2, v3, v4
  10474. _ = enc
  10475. 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 {
  10476. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF0) {
  10477. v1 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) < int32(0x90) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10478. } else {
  10479. if v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0x80) == 0; !v3 {
  10480. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p))) == int32(0xF4) {
  10481. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1))) > int32(0x8F))
  10482. } else {
  10483. v2 = libc.BoolInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(p + 1)))&int32(0xC0) == int32(0xC0))
  10484. }
  10485. }
  10486. v1 = libc.BoolInt32(v3 || v2 != 0)
  10487. }
  10488. }
  10489. return libc.BoolInt32(v4 || v1 != 0)
  10490. }
  10491. type Tnormal_encoding = struct {
  10492. Fenc TENCODING
  10493. Ftype1 [256]uint8
  10494. FisName2 uintptr
  10495. FisName3 uintptr
  10496. FisName4 uintptr
  10497. FisNmstrt2 uintptr
  10498. FisNmstrt3 uintptr
  10499. FisNmstrt4 uintptr
  10500. FisInvalid2 uintptr
  10501. FisInvalid3 uintptr
  10502. FisInvalid4 uintptr
  10503. }
  10504. const _BT_NONXML = 0
  10505. const _BT_MALFORM = 1
  10506. const _BT_LT = 2
  10507. const _BT_AMP = 3
  10508. const _BT_RSQB = 4
  10509. const _BT_LEAD2 = 5
  10510. const _BT_LEAD3 = 6
  10511. const _BT_LEAD4 = 7
  10512. const _BT_TRAIL = 8
  10513. const _BT_CR = 9
  10514. const _BT_LF = 10
  10515. const _BT_GT = 11
  10516. const _BT_QUOT = 12
  10517. const _BT_APOS = 13
  10518. const _BT_EQUALS = 14
  10519. const _BT_QUEST = 15
  10520. const _BT_EXCL = 16
  10521. const _BT_SOL = 17
  10522. const _BT_SEMI = 18
  10523. const _BT_NUM = 19
  10524. const _BT_LSQB = 20
  10525. const _BT_S = 21
  10526. const _BT_NMSTRT = 22
  10527. const _BT_COLON = 23
  10528. const _BT_HEX = 24
  10529. const _BT_DIGIT = 25
  10530. const _BT_NAME = 26
  10531. const _BT_MINUS = 27
  10532. const _BT_OTHER = 28
  10533. const _BT_NONASCII = 29
  10534. const _BT_PERCNT = 30
  10535. const _BT_LPAR = 31
  10536. const _BT_RPAR = 32
  10537. const _BT_AST = 33
  10538. const _BT_PLUS = 34
  10539. const _BT_COMMA = 35
  10540. const _BT_VERBAR = 36
  10541. /*
  10542. __ __ _
  10543. ___\ \/ /_ __ __ _| |_
  10544. / _ \\ /| '_ \ / _` | __|
  10545. | __// \| |_) | (_| | |_
  10546. \___/_/\_\ .__/ \__,_|\__|
  10547. |_| XML parser
  10548. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  10549. Copyright (c) 2000-2017 Expat development team
  10550. Licensed under the MIT license:
  10551. Permission is hereby granted, free of charge, to any person obtaining
  10552. a copy of this software and associated documentation files (the
  10553. "Software"), to deal in the Software without restriction, including
  10554. without limitation the rights to use, copy, modify, merge, publish,
  10555. distribute, sublicense, and/or sell copies of the Software, and to permit
  10556. persons to whom the Software is furnished to do so, subject to the
  10557. following conditions:
  10558. The above copyright notice and this permission notice shall be included
  10559. in all copies or substantial portions of the Software.
  10560. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10561. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10562. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  10563. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  10564. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  10565. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  10566. USE OR OTHER DEALINGS IN THE SOFTWARE.
  10567. */
  10568. /* minimum bytes per character */
  10569. /* c is an ASCII character */
  10570. /* This file is included!
  10571. __ __ _
  10572. ___\ \/ /_ __ __ _| |_
  10573. / _ \\ /| '_ \ / _` | __|
  10574. | __// \| |_) | (_| | |_
  10575. \___/_/\_\ .__/ \__,_|\__|
  10576. |_| XML parser
  10577. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  10578. Copyright (c) 2000-2017 Expat development team
  10579. Licensed under the MIT license:
  10580. Permission is hereby granted, free of charge, to any person obtaining
  10581. a copy of this software and associated documentation files (the
  10582. "Software"), to deal in the Software without restriction, including
  10583. without limitation the rights to use, copy, modify, merge, publish,
  10584. distribute, sublicense, and/or sell copies of the Software, and to permit
  10585. persons to whom the Software is furnished to do so, subject to the
  10586. following conditions:
  10587. The above copyright notice and this permission notice shall be included
  10588. in all copies or substantial portions of the Software.
  10589. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10590. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10591. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  10592. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  10593. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  10594. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  10595. USE OR OTHER DEALINGS IN THE SOFTWARE.
  10596. */
  10597. /* ptr points to character following "<!-" */
  10598. func _normal_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10599. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10600. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_MINUS1)) {
  10601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10602. return m_XML_TOK_INVALID
  10603. }
  10604. ptr += uintptr(1)
  10605. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10606. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10607. case int32(_BT_LEAD2):
  10608. if int64(end)-int64(ptr) < int64(2) {
  10609. return -int32(2)
  10610. }
  10611. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  10612. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10613. return m_XML_TOK_INVALID
  10614. }
  10615. ptr += uintptr(2)
  10616. case int32(_BT_LEAD3):
  10617. if int64(end)-int64(ptr) < int64(3) {
  10618. return -int32(2)
  10619. }
  10620. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  10621. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10622. return m_XML_TOK_INVALID
  10623. }
  10624. ptr += uintptr(3)
  10625. case int32(_BT_LEAD4):
  10626. if int64(end)-int64(ptr) < int64(4) {
  10627. return -int32(2)
  10628. }
  10629. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  10630. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10631. return m_XML_TOK_INVALID
  10632. }
  10633. ptr += uintptr(4)
  10634. case int32(_BT_NONXML):
  10635. fallthrough
  10636. case int32(_BT_MALFORM):
  10637. fallthrough
  10638. case int32(_BT_TRAIL):
  10639. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10640. return m_XML_TOK_INVALID
  10641. case int32(_BT_MINUS):
  10642. ptr += uintptr(1)
  10643. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10644. return -int32(1)
  10645. }
  10646. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  10647. ptr += uintptr(1)
  10648. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10649. return -int32(1)
  10650. }
  10651. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  10652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10653. return m_XML_TOK_INVALID
  10654. }
  10655. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10656. return int32(m_XML_TOK_COMMENT)
  10657. }
  10658. default:
  10659. ptr += uintptr(1)
  10660. break
  10661. }
  10662. }
  10663. }
  10664. return -int32(1)
  10665. }
  10666. /* ptr points to character following "<!" */
  10667. func _normal_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10668. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10669. return -int32(1)
  10670. }
  10671. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10672. case int32(_BT_MINUS):
  10673. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  10674. case int32(_BT_LSQB):
  10675. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10676. return int32(m_XML_TOK_COND_SECT_OPEN)
  10677. case int32(_BT_NMSTRT):
  10678. fallthrough
  10679. case int32(_BT_HEX):
  10680. ptr += uintptr(1)
  10681. default:
  10682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10683. return m_XML_TOK_INVALID
  10684. }
  10685. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10686. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10687. case int32(_BT_PERCNT):
  10688. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  10689. return -int32(1)
  10690. }
  10691. /* don't allow <!ENTITY% foo "whatever"> */
  10692. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) {
  10693. case int32(_BT_S):
  10694. fallthrough
  10695. case int32(_BT_CR):
  10696. fallthrough
  10697. case int32(_BT_LF):
  10698. fallthrough
  10699. case int32(_BT_PERCNT):
  10700. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10701. return m_XML_TOK_INVALID
  10702. }
  10703. /* fall through */
  10704. fallthrough
  10705. case int32(_BT_S):
  10706. fallthrough
  10707. case int32(_BT_CR):
  10708. fallthrough
  10709. case int32(_BT_LF):
  10710. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10711. return int32(m_XML_TOK_DECL_OPEN)
  10712. case int32(_BT_NMSTRT):
  10713. fallthrough
  10714. case int32(_BT_HEX):
  10715. ptr += uintptr(1)
  10716. default:
  10717. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10718. return m_XML_TOK_INVALID
  10719. }
  10720. }
  10721. return -int32(1)
  10722. }
  10723. func _normal_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  10724. var upper int32
  10725. _ = upper
  10726. upper = 0
  10727. _ = enc
  10728. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  10729. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(3)) {
  10730. return int32(1)
  10731. }
  10732. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  10733. case int32(m_ASCII_x):
  10734. case int32(m_ASCII_X):
  10735. upper = int32(1)
  10736. default:
  10737. return int32(1)
  10738. }
  10739. ptr += uintptr(1)
  10740. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  10741. case int32(m_ASCII_m):
  10742. case int32(m_ASCII_M):
  10743. upper = int32(1)
  10744. default:
  10745. return int32(1)
  10746. }
  10747. ptr += uintptr(1)
  10748. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  10749. case int32(m_ASCII_l):
  10750. case int32(m_ASCII_L):
  10751. upper = int32(1)
  10752. default:
  10753. return int32(1)
  10754. }
  10755. if upper != 0 {
  10756. return 0
  10757. }
  10758. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  10759. return int32(1)
  10760. }
  10761. /* ptr points to character following "<?" */
  10762. func _normal_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10763. bp := tls.Alloc(16)
  10764. defer tls.Free(16)
  10765. var target uintptr
  10766. var _ /* tok at bp+0 */ int32
  10767. _ = target
  10768. target = ptr
  10769. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10770. return -int32(1)
  10771. }
  10772. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10773. case int32(_BT_NONASCII):
  10774. if !(libc.Int32FromInt32(0) != 0) {
  10775. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10776. return m_XML_TOK_INVALID
  10777. } /* fall through */
  10778. fallthrough
  10779. case int32(_BT_NMSTRT):
  10780. fallthrough
  10781. case int32(_BT_HEX):
  10782. ptr += uintptr(1)
  10783. case int32(_BT_LEAD2):
  10784. if int64(end)-int64(ptr) < int64(2) {
  10785. return -int32(2)
  10786. }
  10787. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  10788. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10789. return m_XML_TOK_INVALID
  10790. }
  10791. ptr += uintptr(2)
  10792. case int32(_BT_LEAD3):
  10793. if int64(end)-int64(ptr) < int64(3) {
  10794. return -int32(2)
  10795. }
  10796. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  10797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10798. return m_XML_TOK_INVALID
  10799. }
  10800. ptr += uintptr(3)
  10801. case int32(_BT_LEAD4):
  10802. if int64(end)-int64(ptr) < int64(4) {
  10803. return -int32(2)
  10804. }
  10805. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  10806. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10807. return m_XML_TOK_INVALID
  10808. }
  10809. ptr += uintptr(4)
  10810. default:
  10811. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10812. return m_XML_TOK_INVALID
  10813. }
  10814. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10815. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10816. case int32(_BT_NONASCII):
  10817. if !(libc.Int32FromInt32(0) != 0) {
  10818. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10819. return m_XML_TOK_INVALID
  10820. } /* fall through */
  10821. fallthrough
  10822. case int32(_BT_NMSTRT):
  10823. fallthrough
  10824. case int32(_BT_HEX):
  10825. fallthrough
  10826. case int32(_BT_DIGIT):
  10827. fallthrough
  10828. case int32(_BT_NAME):
  10829. fallthrough
  10830. case int32(_BT_MINUS):
  10831. ptr += uintptr(1)
  10832. case int32(_BT_LEAD2):
  10833. if int64(end)-int64(ptr) < int64(2) {
  10834. return -int32(2)
  10835. }
  10836. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  10837. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10838. return m_XML_TOK_INVALID
  10839. }
  10840. ptr += uintptr(2)
  10841. case int32(_BT_LEAD3):
  10842. if int64(end)-int64(ptr) < int64(3) {
  10843. return -int32(2)
  10844. }
  10845. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  10846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10847. return m_XML_TOK_INVALID
  10848. }
  10849. ptr += uintptr(3)
  10850. case int32(_BT_LEAD4):
  10851. if int64(end)-int64(ptr) < int64(4) {
  10852. return -int32(2)
  10853. }
  10854. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  10855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10856. return m_XML_TOK_INVALID
  10857. }
  10858. ptr += uintptr(4)
  10859. case int32(_BT_S):
  10860. fallthrough
  10861. case int32(_BT_CR):
  10862. fallthrough
  10863. case int32(_BT_LF):
  10864. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  10865. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10866. return m_XML_TOK_INVALID
  10867. }
  10868. ptr += uintptr(1)
  10869. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  10870. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10871. case int32(_BT_LEAD2):
  10872. if int64(end)-int64(ptr) < int64(2) {
  10873. return -int32(2)
  10874. }
  10875. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  10876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10877. return m_XML_TOK_INVALID
  10878. }
  10879. ptr += uintptr(2)
  10880. case int32(_BT_LEAD3):
  10881. if int64(end)-int64(ptr) < int64(3) {
  10882. return -int32(2)
  10883. }
  10884. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  10885. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10886. return m_XML_TOK_INVALID
  10887. }
  10888. ptr += uintptr(3)
  10889. case int32(_BT_LEAD4):
  10890. if int64(end)-int64(ptr) < int64(4) {
  10891. return -int32(2)
  10892. }
  10893. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  10894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10895. return m_XML_TOK_INVALID
  10896. }
  10897. ptr += uintptr(4)
  10898. case int32(_BT_NONXML):
  10899. fallthrough
  10900. case int32(_BT_MALFORM):
  10901. fallthrough
  10902. case int32(_BT_TRAIL):
  10903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10904. return m_XML_TOK_INVALID
  10905. case int32(_BT_QUEST):
  10906. ptr += uintptr(1)
  10907. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10908. return -int32(1)
  10909. }
  10910. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  10911. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10912. return *(*int32)(unsafe.Pointer(bp))
  10913. }
  10914. default:
  10915. ptr += uintptr(1)
  10916. break
  10917. }
  10918. }
  10919. return -int32(1)
  10920. case int32(_BT_QUEST):
  10921. if !(_normal_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  10922. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10923. return m_XML_TOK_INVALID
  10924. }
  10925. ptr += uintptr(1)
  10926. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10927. return -int32(1)
  10928. }
  10929. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  10930. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  10931. return *(*int32)(unsafe.Pointer(bp))
  10932. }
  10933. /* fall through */
  10934. fallthrough
  10935. default:
  10936. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10937. return m_XML_TOK_INVALID
  10938. }
  10939. }
  10940. return -int32(1)
  10941. }
  10942. func _normal_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10943. var i int32
  10944. _ = i
  10945. _ = enc
  10946. /* CDATA[ */
  10947. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(1))) {
  10948. return -int32(1)
  10949. }
  10950. i = 0
  10951. for {
  10952. if !(i < int32(6)) {
  10953. break
  10954. }
  10955. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB[i])) {
  10956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10957. return m_XML_TOK_INVALID
  10958. }
  10959. goto _1
  10960. _1:
  10961. ;
  10962. i++
  10963. ptr += uintptr(1)
  10964. }
  10965. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  10966. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  10967. }
  10968. var _CDATA_LSQB = [6]uint8{
  10969. 0: uint8(m_ASCII_C),
  10970. 1: uint8(m_ASCII_D),
  10971. 2: uint8(m_ASCII_A),
  10972. 3: uint8(m_ASCII_T),
  10973. 4: uint8(m_ASCII_A),
  10974. 5: uint8(m_ASCII_LSQB1),
  10975. }
  10976. func _normal_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  10977. var n Tsize_t
  10978. _ = n
  10979. if ptr >= end {
  10980. return -int32(4)
  10981. }
  10982. if int32(1) > int32(1) {
  10983. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  10984. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  10985. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  10986. if n == uint64(0) {
  10987. return -int32(1)
  10988. }
  10989. end = ptr + uintptr(n)
  10990. }
  10991. }
  10992. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  10993. case int32(_BT_RSQB):
  10994. ptr += uintptr(1)
  10995. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  10996. return -int32(1)
  10997. }
  10998. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  10999. break
  11000. }
  11001. ptr += uintptr(1)
  11002. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11003. return -int32(1)
  11004. }
  11005. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  11006. ptr -= uintptr(1)
  11007. break
  11008. }
  11009. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11010. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  11011. case int32(_BT_CR):
  11012. ptr += uintptr(1)
  11013. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11014. return -int32(1)
  11015. }
  11016. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  11017. ptr += uintptr(1)
  11018. }
  11019. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11020. return int32(m_XML_TOK_DATA_NEWLINE)
  11021. case int32(_BT_LF):
  11022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11023. return int32(m_XML_TOK_DATA_NEWLINE)
  11024. case int32(_BT_LEAD2):
  11025. if int64(end)-int64(ptr) < int64(2) {
  11026. return -int32(2)
  11027. }
  11028. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  11029. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11030. return m_XML_TOK_INVALID
  11031. }
  11032. ptr += uintptr(2)
  11033. case int32(_BT_LEAD3):
  11034. if int64(end)-int64(ptr) < int64(3) {
  11035. return -int32(2)
  11036. }
  11037. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  11038. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11039. return m_XML_TOK_INVALID
  11040. }
  11041. ptr += uintptr(3)
  11042. case int32(_BT_LEAD4):
  11043. if int64(end)-int64(ptr) < int64(4) {
  11044. return -int32(2)
  11045. }
  11046. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  11047. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11048. return m_XML_TOK_INVALID
  11049. }
  11050. ptr += uintptr(4)
  11051. case int32(_BT_NONXML):
  11052. fallthrough
  11053. case int32(_BT_MALFORM):
  11054. fallthrough
  11055. case int32(_BT_TRAIL):
  11056. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11057. return m_XML_TOK_INVALID
  11058. default:
  11059. ptr += uintptr(1)
  11060. break
  11061. }
  11062. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11063. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11064. case int32(_BT_LEAD2):
  11065. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  11066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11067. return int32(m_XML_TOK_DATA_CHARS)
  11068. }
  11069. ptr += uintptr(2)
  11070. case int32(_BT_LEAD3):
  11071. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  11072. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11073. return int32(m_XML_TOK_DATA_CHARS)
  11074. }
  11075. ptr += uintptr(3)
  11076. case int32(_BT_LEAD4):
  11077. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  11078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11079. return int32(m_XML_TOK_DATA_CHARS)
  11080. }
  11081. ptr += uintptr(4)
  11082. case int32(_BT_NONXML):
  11083. fallthrough
  11084. case int32(_BT_MALFORM):
  11085. fallthrough
  11086. case int32(_BT_TRAIL):
  11087. fallthrough
  11088. case int32(_BT_CR):
  11089. fallthrough
  11090. case int32(_BT_LF):
  11091. fallthrough
  11092. case int32(_BT_RSQB):
  11093. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11094. return int32(m_XML_TOK_DATA_CHARS)
  11095. default:
  11096. ptr += uintptr(1)
  11097. break
  11098. }
  11099. }
  11100. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11101. return int32(m_XML_TOK_DATA_CHARS)
  11102. }
  11103. /* ptr points to character following "</" */
  11104. func _normal_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11105. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11106. return -int32(1)
  11107. }
  11108. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11109. case int32(_BT_NONASCII):
  11110. if !(libc.Int32FromInt32(0) != 0) {
  11111. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11112. return m_XML_TOK_INVALID
  11113. } /* fall through */
  11114. fallthrough
  11115. case int32(_BT_NMSTRT):
  11116. fallthrough
  11117. case int32(_BT_HEX):
  11118. ptr += uintptr(1)
  11119. case int32(_BT_LEAD2):
  11120. if int64(end)-int64(ptr) < int64(2) {
  11121. return -int32(2)
  11122. }
  11123. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  11124. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11125. return m_XML_TOK_INVALID
  11126. }
  11127. ptr += uintptr(2)
  11128. case int32(_BT_LEAD3):
  11129. if int64(end)-int64(ptr) < int64(3) {
  11130. return -int32(2)
  11131. }
  11132. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  11133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11134. return m_XML_TOK_INVALID
  11135. }
  11136. ptr += uintptr(3)
  11137. case int32(_BT_LEAD4):
  11138. if int64(end)-int64(ptr) < int64(4) {
  11139. return -int32(2)
  11140. }
  11141. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  11142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11143. return m_XML_TOK_INVALID
  11144. }
  11145. ptr += uintptr(4)
  11146. default:
  11147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11148. return m_XML_TOK_INVALID
  11149. }
  11150. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11151. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11152. case int32(_BT_NONASCII):
  11153. goto _1
  11154. case int32(_BT_MINUS):
  11155. goto _2
  11156. case int32(_BT_NAME):
  11157. goto _3
  11158. case int32(_BT_DIGIT):
  11159. goto _4
  11160. case int32(_BT_HEX):
  11161. goto _5
  11162. case int32(_BT_NMSTRT):
  11163. goto _6
  11164. case int32(_BT_LEAD2):
  11165. goto _7
  11166. case int32(_BT_LEAD3):
  11167. goto _8
  11168. case int32(_BT_LEAD4):
  11169. goto _9
  11170. case int32(_BT_LF):
  11171. goto _10
  11172. case int32(_BT_CR):
  11173. goto _11
  11174. case int32(_BT_S):
  11175. goto _12
  11176. case int32(_BT_COLON):
  11177. goto _13
  11178. case int32(_BT_GT):
  11179. goto _14
  11180. default:
  11181. goto _15
  11182. }
  11183. goto _16
  11184. _1:
  11185. ;
  11186. if !(libc.Int32FromInt32(0) != 0) {
  11187. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11188. return m_XML_TOK_INVALID
  11189. } /* fall through */
  11190. _6:
  11191. ;
  11192. _5:
  11193. ;
  11194. _4:
  11195. ;
  11196. _3:
  11197. ;
  11198. _2:
  11199. ;
  11200. ptr += uintptr(1)
  11201. goto _16
  11202. _7:
  11203. ;
  11204. if int64(end)-int64(ptr) < int64(2) {
  11205. return -int32(2)
  11206. }
  11207. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  11208. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11209. return m_XML_TOK_INVALID
  11210. }
  11211. ptr += uintptr(2)
  11212. goto _16
  11213. _8:
  11214. ;
  11215. if int64(end)-int64(ptr) < int64(3) {
  11216. return -int32(2)
  11217. }
  11218. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  11219. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11220. return m_XML_TOK_INVALID
  11221. }
  11222. ptr += uintptr(3)
  11223. goto _16
  11224. _9:
  11225. ;
  11226. if int64(end)-int64(ptr) < int64(4) {
  11227. return -int32(2)
  11228. }
  11229. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  11230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11231. return m_XML_TOK_INVALID
  11232. }
  11233. ptr += uintptr(4)
  11234. goto _16
  11235. _12:
  11236. ;
  11237. _11:
  11238. ;
  11239. _10:
  11240. ;
  11241. ptr += uintptr(1)
  11242. _19:
  11243. ;
  11244. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11245. goto _17
  11246. }
  11247. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11248. case int32(_BT_S):
  11249. fallthrough
  11250. case int32(_BT_CR):
  11251. fallthrough
  11252. case int32(_BT_LF):
  11253. case int32(_BT_GT):
  11254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11255. return int32(m_XML_TOK_END_TAG)
  11256. default:
  11257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11258. return m_XML_TOK_INVALID
  11259. }
  11260. goto _18
  11261. _18:
  11262. ;
  11263. ptr += uintptr(1)
  11264. goto _19
  11265. goto _17
  11266. _17:
  11267. ;
  11268. return -int32(1)
  11269. _13:
  11270. ;
  11271. /* no need to check qname syntax here,
  11272. since end-tag must match exactly */
  11273. ptr += uintptr(1)
  11274. goto _16
  11275. _14:
  11276. ;
  11277. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11278. return int32(m_XML_TOK_END_TAG)
  11279. _15:
  11280. ;
  11281. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11282. return m_XML_TOK_INVALID
  11283. _16:
  11284. }
  11285. return -int32(1)
  11286. }
  11287. /* ptr points to character following "&#X" */
  11288. func _normal_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11289. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11290. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11291. case int32(_BT_DIGIT):
  11292. fallthrough
  11293. case int32(_BT_HEX):
  11294. default:
  11295. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11296. return m_XML_TOK_INVALID
  11297. }
  11298. ptr += uintptr(1)
  11299. for {
  11300. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11301. break
  11302. }
  11303. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11304. case int32(_BT_DIGIT):
  11305. fallthrough
  11306. case int32(_BT_HEX):
  11307. case int32(_BT_SEMI):
  11308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11309. return int32(m_XML_TOK_CHAR_REF)
  11310. default:
  11311. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11312. return m_XML_TOK_INVALID
  11313. }
  11314. goto _1
  11315. _1:
  11316. ;
  11317. ptr += uintptr(1)
  11318. }
  11319. }
  11320. return -int32(1)
  11321. }
  11322. /* ptr points to character following "&#" */
  11323. func _normal_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11324. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11325. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  11326. return _normal_scanHexCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11327. }
  11328. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11329. case int32(_BT_DIGIT):
  11330. default:
  11331. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11332. return m_XML_TOK_INVALID
  11333. }
  11334. ptr += uintptr(1)
  11335. for {
  11336. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11337. break
  11338. }
  11339. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11340. case int32(_BT_DIGIT):
  11341. case int32(_BT_SEMI):
  11342. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11343. return int32(m_XML_TOK_CHAR_REF)
  11344. default:
  11345. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11346. return m_XML_TOK_INVALID
  11347. }
  11348. goto _1
  11349. _1:
  11350. ;
  11351. ptr += uintptr(1)
  11352. }
  11353. }
  11354. return -int32(1)
  11355. }
  11356. /* ptr points to character following "&" */
  11357. func _normal_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11358. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11359. return -int32(1)
  11360. }
  11361. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11362. case int32(_BT_NONASCII):
  11363. if !(libc.Int32FromInt32(0) != 0) {
  11364. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11365. return m_XML_TOK_INVALID
  11366. } /* fall through */
  11367. fallthrough
  11368. case int32(_BT_NMSTRT):
  11369. fallthrough
  11370. case int32(_BT_HEX):
  11371. ptr += uintptr(1)
  11372. case int32(_BT_LEAD2):
  11373. if int64(end)-int64(ptr) < int64(2) {
  11374. return -int32(2)
  11375. }
  11376. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  11377. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11378. return m_XML_TOK_INVALID
  11379. }
  11380. ptr += uintptr(2)
  11381. case int32(_BT_LEAD3):
  11382. if int64(end)-int64(ptr) < int64(3) {
  11383. return -int32(2)
  11384. }
  11385. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  11386. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11387. return m_XML_TOK_INVALID
  11388. }
  11389. ptr += uintptr(3)
  11390. case int32(_BT_LEAD4):
  11391. if int64(end)-int64(ptr) < int64(4) {
  11392. return -int32(2)
  11393. }
  11394. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  11395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11396. return m_XML_TOK_INVALID
  11397. }
  11398. ptr += uintptr(4)
  11399. case int32(_BT_NUM):
  11400. return _normal_scanCharRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11401. default:
  11402. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11403. return m_XML_TOK_INVALID
  11404. }
  11405. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11406. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11407. case int32(_BT_NONASCII):
  11408. if !(libc.Int32FromInt32(0) != 0) {
  11409. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11410. return m_XML_TOK_INVALID
  11411. } /* fall through */
  11412. fallthrough
  11413. case int32(_BT_NMSTRT):
  11414. fallthrough
  11415. case int32(_BT_HEX):
  11416. fallthrough
  11417. case int32(_BT_DIGIT):
  11418. fallthrough
  11419. case int32(_BT_NAME):
  11420. fallthrough
  11421. case int32(_BT_MINUS):
  11422. ptr += uintptr(1)
  11423. case int32(_BT_LEAD2):
  11424. if int64(end)-int64(ptr) < int64(2) {
  11425. return -int32(2)
  11426. }
  11427. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  11428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11429. return m_XML_TOK_INVALID
  11430. }
  11431. ptr += uintptr(2)
  11432. case int32(_BT_LEAD3):
  11433. if int64(end)-int64(ptr) < int64(3) {
  11434. return -int32(2)
  11435. }
  11436. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  11437. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11438. return m_XML_TOK_INVALID
  11439. }
  11440. ptr += uintptr(3)
  11441. case int32(_BT_LEAD4):
  11442. if int64(end)-int64(ptr) < int64(4) {
  11443. return -int32(2)
  11444. }
  11445. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  11446. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11447. return m_XML_TOK_INVALID
  11448. }
  11449. ptr += uintptr(4)
  11450. case int32(_BT_SEMI):
  11451. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  11452. return int32(m_XML_TOK_ENTITY_REF)
  11453. default:
  11454. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11455. return m_XML_TOK_INVALID
  11456. }
  11457. }
  11458. return -int32(1)
  11459. }
  11460. /* ptr points to character following first character of attribute name */
  11461. func _normal_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11462. bp := tls.Alloc(16)
  11463. defer tls.Free(16)
  11464. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  11465. var hadColon, open, t, t1, tok int32
  11466. _, _, _, _, _ = hadColon, open, t, t1, tok
  11467. hadColon = 0
  11468. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11469. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11470. case int32(_BT_NONASCII):
  11471. goto _1
  11472. case int32(_BT_MINUS):
  11473. goto _2
  11474. case int32(_BT_NAME):
  11475. goto _3
  11476. case int32(_BT_DIGIT):
  11477. goto _4
  11478. case int32(_BT_HEX):
  11479. goto _5
  11480. case int32(_BT_NMSTRT):
  11481. goto _6
  11482. case int32(_BT_LEAD2):
  11483. goto _7
  11484. case int32(_BT_LEAD3):
  11485. goto _8
  11486. case int32(_BT_LEAD4):
  11487. goto _9
  11488. case int32(_BT_COLON):
  11489. goto _10
  11490. case int32(_BT_LF):
  11491. goto _11
  11492. case int32(_BT_CR):
  11493. goto _12
  11494. case int32(_BT_S):
  11495. goto _13
  11496. case int32(_BT_EQUALS):
  11497. goto _14
  11498. default:
  11499. goto _15
  11500. }
  11501. goto _16
  11502. _1:
  11503. ;
  11504. if !(libc.Int32FromInt32(0) != 0) {
  11505. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11506. return m_XML_TOK_INVALID
  11507. } /* fall through */
  11508. _6:
  11509. ;
  11510. _5:
  11511. ;
  11512. _4:
  11513. ;
  11514. _3:
  11515. ;
  11516. _2:
  11517. ;
  11518. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11519. goto _16
  11520. _7:
  11521. ;
  11522. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11523. return -int32(2)
  11524. }
  11525. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11527. return m_XML_TOK_INVALID
  11528. }
  11529. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11530. goto _16
  11531. _8:
  11532. ;
  11533. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11534. return -int32(2)
  11535. }
  11536. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11537. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11538. return m_XML_TOK_INVALID
  11539. }
  11540. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11541. goto _16
  11542. _9:
  11543. ;
  11544. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11545. return -int32(2)
  11546. }
  11547. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11548. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11549. return m_XML_TOK_INVALID
  11550. }
  11551. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11552. goto _16
  11553. _10:
  11554. ;
  11555. if hadColon != 0 {
  11556. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11557. return m_XML_TOK_INVALID
  11558. }
  11559. hadColon = int32(1)
  11560. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11561. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11562. return -int32(1)
  11563. }
  11564. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11565. case int32(_BT_NONASCII):
  11566. if !(libc.Int32FromInt32(0) != 0) {
  11567. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11568. return m_XML_TOK_INVALID
  11569. } /* fall through */
  11570. fallthrough
  11571. case int32(_BT_NMSTRT):
  11572. fallthrough
  11573. case int32(_BT_HEX):
  11574. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11575. case int32(_BT_LEAD2):
  11576. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11577. return -int32(2)
  11578. }
  11579. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11581. return m_XML_TOK_INVALID
  11582. }
  11583. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11584. case int32(_BT_LEAD3):
  11585. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11586. return -int32(2)
  11587. }
  11588. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11589. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11590. return m_XML_TOK_INVALID
  11591. }
  11592. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11593. case int32(_BT_LEAD4):
  11594. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11595. return -int32(2)
  11596. }
  11597. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11598. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11599. return m_XML_TOK_INVALID
  11600. }
  11601. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11602. default:
  11603. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11604. return m_XML_TOK_INVALID
  11605. }
  11606. goto _16
  11607. _13:
  11608. ;
  11609. _12:
  11610. ;
  11611. _11:
  11612. ;
  11613. _19:
  11614. ;
  11615. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11616. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11617. return -int32(1)
  11618. }
  11619. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  11620. if t == int32(_BT_EQUALS) {
  11621. goto _17
  11622. }
  11623. switch t {
  11624. case int32(_BT_S):
  11625. fallthrough
  11626. case int32(_BT_LF):
  11627. fallthrough
  11628. case int32(_BT_CR):
  11629. default:
  11630. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11631. return m_XML_TOK_INVALID
  11632. }
  11633. goto _18
  11634. _18:
  11635. ;
  11636. goto _19
  11637. goto _17
  11638. _17:
  11639. ;
  11640. /* fall through */
  11641. _14:
  11642. ;
  11643. hadColon = 0
  11644. for {
  11645. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11646. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11647. return -int32(1)
  11648. }
  11649. open = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  11650. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  11651. break
  11652. }
  11653. switch open {
  11654. case int32(_BT_S):
  11655. fallthrough
  11656. case int32(_BT_LF):
  11657. fallthrough
  11658. case int32(_BT_CR):
  11659. default:
  11660. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11661. return m_XML_TOK_INVALID
  11662. }
  11663. goto _20
  11664. _20:
  11665. }
  11666. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11667. /* in attribute value */
  11668. for {
  11669. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11670. return -int32(1)
  11671. }
  11672. t1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  11673. if t1 == open {
  11674. break
  11675. }
  11676. switch t1 {
  11677. case int32(_BT_LEAD2):
  11678. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11679. return -int32(2)
  11680. }
  11681. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  11682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11683. return m_XML_TOK_INVALID
  11684. }
  11685. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11686. case int32(_BT_LEAD3):
  11687. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11688. return -int32(2)
  11689. }
  11690. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  11691. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11692. return m_XML_TOK_INVALID
  11693. }
  11694. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11695. case int32(_BT_LEAD4):
  11696. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11697. return -int32(2)
  11698. }
  11699. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0 {
  11700. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11701. return m_XML_TOK_INVALID
  11702. }
  11703. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11704. case int32(_BT_NONXML):
  11705. fallthrough
  11706. case int32(_BT_MALFORM):
  11707. fallthrough
  11708. case int32(_BT_TRAIL):
  11709. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11710. return m_XML_TOK_INVALID
  11711. case int32(_BT_AMP):
  11712. tok = _normal_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(1), end, bp)
  11713. if tok <= 0 {
  11714. if tok == m_XML_TOK_INVALID {
  11715. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11716. }
  11717. return tok
  11718. }
  11719. case int32(_BT_LT):
  11720. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11721. return m_XML_TOK_INVALID
  11722. default:
  11723. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11724. break
  11725. }
  11726. goto _21
  11727. _21:
  11728. }
  11729. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11730. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11731. return -int32(1)
  11732. }
  11733. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11734. case int32(_BT_S):
  11735. fallthrough
  11736. case int32(_BT_CR):
  11737. fallthrough
  11738. case int32(_BT_LF):
  11739. case int32(_BT_SOL):
  11740. goto sol
  11741. case int32(_BT_GT):
  11742. goto gt
  11743. default:
  11744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11745. return m_XML_TOK_INVALID
  11746. }
  11747. /* ptr points to closing quote */
  11748. _24:
  11749. ;
  11750. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11751. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11752. return -int32(1)
  11753. }
  11754. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))))) {
  11755. case int32(_BT_NONASCII):
  11756. goto _25
  11757. case int32(_BT_HEX):
  11758. goto _26
  11759. case int32(_BT_NMSTRT):
  11760. goto _27
  11761. case int32(_BT_LEAD2):
  11762. goto _28
  11763. case int32(_BT_LEAD3):
  11764. goto _29
  11765. case int32(_BT_LEAD4):
  11766. goto _30
  11767. case int32(_BT_LF):
  11768. goto _31
  11769. case int32(_BT_CR):
  11770. goto _32
  11771. case int32(_BT_S):
  11772. goto _33
  11773. case int32(_BT_GT):
  11774. goto _34
  11775. case int32(_BT_SOL):
  11776. goto _35
  11777. default:
  11778. goto _36
  11779. }
  11780. goto _37
  11781. _25:
  11782. ;
  11783. if !(libc.Int32FromInt32(0) != 0) {
  11784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11785. return m_XML_TOK_INVALID
  11786. } /* fall through */
  11787. _27:
  11788. ;
  11789. _26:
  11790. ;
  11791. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11792. goto _37
  11793. _28:
  11794. ;
  11795. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  11796. return -int32(2)
  11797. }
  11798. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11800. return m_XML_TOK_INVALID
  11801. }
  11802. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  11803. goto _37
  11804. _29:
  11805. ;
  11806. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  11807. return -int32(2)
  11808. }
  11809. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11810. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11811. return m_XML_TOK_INVALID
  11812. }
  11813. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  11814. goto _37
  11815. _30:
  11816. ;
  11817. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  11818. return -int32(2)
  11819. }
  11820. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp))) != 0) {
  11821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11822. return m_XML_TOK_INVALID
  11823. }
  11824. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  11825. goto _37
  11826. _33:
  11827. ;
  11828. _32:
  11829. ;
  11830. _31:
  11831. ;
  11832. goto _23
  11833. _34:
  11834. ;
  11835. goto gt
  11836. gt:
  11837. ;
  11838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  11839. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  11840. _35:
  11841. ;
  11842. goto sol
  11843. sol:
  11844. ;
  11845. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(1)
  11846. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11847. return -int32(1)
  11848. }
  11849. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  11850. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11851. return m_XML_TOK_INVALID
  11852. }
  11853. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(1)
  11854. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  11855. _36:
  11856. ;
  11857. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11858. return m_XML_TOK_INVALID
  11859. _37:
  11860. ;
  11861. goto _22
  11862. goto _23
  11863. _23:
  11864. ;
  11865. goto _24
  11866. goto _22
  11867. _22:
  11868. ;
  11869. goto _16
  11870. _15:
  11871. ;
  11872. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  11873. return m_XML_TOK_INVALID
  11874. _16:
  11875. }
  11876. return -int32(1)
  11877. }
  11878. /* ptr points to character following "<" */
  11879. func _normal_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  11880. var hadColon int32
  11881. _ = hadColon
  11882. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11883. return -int32(1)
  11884. }
  11885. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11886. case int32(_BT_NONASCII):
  11887. if !(libc.Int32FromInt32(0) != 0) {
  11888. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11889. return m_XML_TOK_INVALID
  11890. } /* fall through */
  11891. fallthrough
  11892. case int32(_BT_NMSTRT):
  11893. fallthrough
  11894. case int32(_BT_HEX):
  11895. ptr += uintptr(1)
  11896. case int32(_BT_LEAD2):
  11897. if int64(end)-int64(ptr) < int64(2) {
  11898. return -int32(2)
  11899. }
  11900. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  11901. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11902. return m_XML_TOK_INVALID
  11903. }
  11904. ptr += uintptr(2)
  11905. case int32(_BT_LEAD3):
  11906. if int64(end)-int64(ptr) < int64(3) {
  11907. return -int32(2)
  11908. }
  11909. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  11910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11911. return m_XML_TOK_INVALID
  11912. }
  11913. ptr += uintptr(3)
  11914. case int32(_BT_LEAD4):
  11915. if int64(end)-int64(ptr) < int64(4) {
  11916. return -int32(2)
  11917. }
  11918. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  11919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11920. return m_XML_TOK_INVALID
  11921. }
  11922. ptr += uintptr(4)
  11923. case int32(_BT_EXCL):
  11924. ptr += uintptr(1)
  11925. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  11926. return -int32(1)
  11927. }
  11928. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11929. case int32(_BT_MINUS):
  11930. return _normal_scanComment(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11931. case int32(_BT_LSQB):
  11932. return _normal_scanCdataSection(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11933. }
  11934. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11935. return m_XML_TOK_INVALID
  11936. case int32(_BT_QUEST):
  11937. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11938. case int32(_BT_SOL):
  11939. return _normal_scanEndTag(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  11940. default:
  11941. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11942. return m_XML_TOK_INVALID
  11943. }
  11944. hadColon = 0
  11945. /* we have a start-tag */
  11946. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  11947. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  11948. case int32(_BT_NONASCII):
  11949. goto _1
  11950. case int32(_BT_MINUS):
  11951. goto _2
  11952. case int32(_BT_NAME):
  11953. goto _3
  11954. case int32(_BT_DIGIT):
  11955. goto _4
  11956. case int32(_BT_HEX):
  11957. goto _5
  11958. case int32(_BT_NMSTRT):
  11959. goto _6
  11960. case int32(_BT_LEAD2):
  11961. goto _7
  11962. case int32(_BT_LEAD3):
  11963. goto _8
  11964. case int32(_BT_LEAD4):
  11965. goto _9
  11966. case int32(_BT_COLON):
  11967. goto _10
  11968. case int32(_BT_LF):
  11969. goto _11
  11970. case int32(_BT_CR):
  11971. goto _12
  11972. case int32(_BT_S):
  11973. goto _13
  11974. case int32(_BT_GT):
  11975. goto _14
  11976. case int32(_BT_SOL):
  11977. goto _15
  11978. default:
  11979. goto _16
  11980. }
  11981. goto _17
  11982. _1:
  11983. ;
  11984. if !(libc.Int32FromInt32(0) != 0) {
  11985. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  11986. return m_XML_TOK_INVALID
  11987. } /* fall through */
  11988. _6:
  11989. ;
  11990. _5:
  11991. ;
  11992. _4:
  11993. ;
  11994. _3:
  11995. ;
  11996. _2:
  11997. ;
  11998. ptr += uintptr(1)
  11999. goto _17
  12000. _7:
  12001. ;
  12002. if int64(end)-int64(ptr) < int64(2) {
  12003. return -int32(2)
  12004. }
  12005. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12007. return m_XML_TOK_INVALID
  12008. }
  12009. ptr += uintptr(2)
  12010. goto _17
  12011. _8:
  12012. ;
  12013. if int64(end)-int64(ptr) < int64(3) {
  12014. return -int32(2)
  12015. }
  12016. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12017. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12018. return m_XML_TOK_INVALID
  12019. }
  12020. ptr += uintptr(3)
  12021. goto _17
  12022. _9:
  12023. ;
  12024. if int64(end)-int64(ptr) < int64(4) {
  12025. return -int32(2)
  12026. }
  12027. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12028. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12029. return m_XML_TOK_INVALID
  12030. }
  12031. ptr += uintptr(4)
  12032. goto _17
  12033. _10:
  12034. ;
  12035. if hadColon != 0 {
  12036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12037. return m_XML_TOK_INVALID
  12038. }
  12039. hadColon = int32(1)
  12040. ptr += uintptr(1)
  12041. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12042. return -int32(1)
  12043. }
  12044. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12045. case int32(_BT_NONASCII):
  12046. if !(libc.Int32FromInt32(0) != 0) {
  12047. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12048. return m_XML_TOK_INVALID
  12049. } /* fall through */
  12050. fallthrough
  12051. case int32(_BT_NMSTRT):
  12052. fallthrough
  12053. case int32(_BT_HEX):
  12054. ptr += uintptr(1)
  12055. case int32(_BT_LEAD2):
  12056. if int64(end)-int64(ptr) < int64(2) {
  12057. return -int32(2)
  12058. }
  12059. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  12060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12061. return m_XML_TOK_INVALID
  12062. }
  12063. ptr += uintptr(2)
  12064. case int32(_BT_LEAD3):
  12065. if int64(end)-int64(ptr) < int64(3) {
  12066. return -int32(2)
  12067. }
  12068. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  12069. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12070. return m_XML_TOK_INVALID
  12071. }
  12072. ptr += uintptr(3)
  12073. case int32(_BT_LEAD4):
  12074. if int64(end)-int64(ptr) < int64(4) {
  12075. return -int32(2)
  12076. }
  12077. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  12078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12079. return m_XML_TOK_INVALID
  12080. }
  12081. ptr += uintptr(4)
  12082. default:
  12083. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12084. return m_XML_TOK_INVALID
  12085. }
  12086. goto _17
  12087. _13:
  12088. ;
  12089. _12:
  12090. ;
  12091. _11:
  12092. ;
  12093. ptr += uintptr(1)
  12094. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12095. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12096. case int32(_BT_NONASCII):
  12097. if !(libc.Int32FromInt32(0) != 0) {
  12098. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12099. return m_XML_TOK_INVALID
  12100. } /* fall through */
  12101. fallthrough
  12102. case int32(_BT_NMSTRT):
  12103. fallthrough
  12104. case int32(_BT_HEX):
  12105. ptr += uintptr(1)
  12106. case int32(_BT_LEAD2):
  12107. if int64(end)-int64(ptr) < int64(2) {
  12108. return -int32(2)
  12109. }
  12110. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  12111. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12112. return m_XML_TOK_INVALID
  12113. }
  12114. ptr += uintptr(2)
  12115. case int32(_BT_LEAD3):
  12116. if int64(end)-int64(ptr) < int64(3) {
  12117. return -int32(2)
  12118. }
  12119. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  12120. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12121. return m_XML_TOK_INVALID
  12122. }
  12123. ptr += uintptr(3)
  12124. case int32(_BT_LEAD4):
  12125. if int64(end)-int64(ptr) < int64(4) {
  12126. return -int32(2)
  12127. }
  12128. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  12129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12130. return m_XML_TOK_INVALID
  12131. }
  12132. ptr += uintptr(4)
  12133. case int32(_BT_GT):
  12134. goto gt
  12135. case int32(_BT_SOL):
  12136. goto sol
  12137. case int32(_BT_S):
  12138. fallthrough
  12139. case int32(_BT_CR):
  12140. fallthrough
  12141. case int32(_BT_LF):
  12142. ptr += uintptr(1)
  12143. continue
  12144. default:
  12145. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12146. return m_XML_TOK_INVALID
  12147. }
  12148. return _normal_scanAtts(tls, enc, ptr, end, nextTokPtr)
  12149. }
  12150. return -int32(1)
  12151. _14:
  12152. ;
  12153. goto gt
  12154. gt:
  12155. ;
  12156. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12157. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  12158. _15:
  12159. ;
  12160. goto sol
  12161. sol:
  12162. ;
  12163. ptr += uintptr(1)
  12164. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12165. return -int32(1)
  12166. }
  12167. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  12168. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12169. return m_XML_TOK_INVALID
  12170. }
  12171. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12172. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  12173. _16:
  12174. ;
  12175. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12176. return m_XML_TOK_INVALID
  12177. _17:
  12178. }
  12179. return -int32(1)
  12180. }
  12181. func _normal_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12182. var n Tsize_t
  12183. _ = n
  12184. if ptr >= end {
  12185. return -int32(4)
  12186. }
  12187. if int32(1) > int32(1) {
  12188. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  12189. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  12190. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  12191. if n == uint64(0) {
  12192. return -int32(1)
  12193. }
  12194. end = ptr + uintptr(n)
  12195. }
  12196. }
  12197. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12198. case int32(_BT_LT):
  12199. return _normal_scanLt(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12200. case int32(_BT_AMP):
  12201. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12202. case int32(_BT_CR):
  12203. ptr += uintptr(1)
  12204. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12205. return -int32(3)
  12206. }
  12207. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  12208. ptr += uintptr(1)
  12209. }
  12210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12211. return int32(m_XML_TOK_DATA_NEWLINE)
  12212. case int32(_BT_LF):
  12213. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12214. return int32(m_XML_TOK_DATA_NEWLINE)
  12215. case int32(_BT_RSQB):
  12216. ptr += uintptr(1)
  12217. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12218. return -int32(5)
  12219. }
  12220. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  12221. break
  12222. }
  12223. ptr += uintptr(1)
  12224. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12225. return -int32(5)
  12226. }
  12227. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  12228. ptr -= uintptr(1)
  12229. break
  12230. }
  12231. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12232. return m_XML_TOK_INVALID
  12233. case int32(_BT_LEAD2):
  12234. if int64(end)-int64(ptr) < int64(2) {
  12235. return -int32(2)
  12236. }
  12237. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  12238. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12239. return m_XML_TOK_INVALID
  12240. }
  12241. ptr += uintptr(2)
  12242. case int32(_BT_LEAD3):
  12243. if int64(end)-int64(ptr) < int64(3) {
  12244. return -int32(2)
  12245. }
  12246. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  12247. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12248. return m_XML_TOK_INVALID
  12249. }
  12250. ptr += uintptr(3)
  12251. case int32(_BT_LEAD4):
  12252. if int64(end)-int64(ptr) < int64(4) {
  12253. return -int32(2)
  12254. }
  12255. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  12256. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12257. return m_XML_TOK_INVALID
  12258. }
  12259. ptr += uintptr(4)
  12260. case int32(_BT_NONXML):
  12261. fallthrough
  12262. case int32(_BT_MALFORM):
  12263. fallthrough
  12264. case int32(_BT_TRAIL):
  12265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12266. return m_XML_TOK_INVALID
  12267. default:
  12268. ptr += uintptr(1)
  12269. break
  12270. }
  12271. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12272. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12273. case int32(_BT_LEAD2):
  12274. if int64(end)-int64(ptr) < int64(2) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  12275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12276. return int32(m_XML_TOK_DATA_CHARS)
  12277. }
  12278. ptr += uintptr(2)
  12279. case int32(_BT_LEAD3):
  12280. if int64(end)-int64(ptr) < int64(3) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  12281. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12282. return int32(m_XML_TOK_DATA_CHARS)
  12283. }
  12284. ptr += uintptr(3)
  12285. case int32(_BT_LEAD4):
  12286. if int64(end)-int64(ptr) < int64(4) || (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  12287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12288. return int32(m_XML_TOK_DATA_CHARS)
  12289. }
  12290. ptr += uintptr(4)
  12291. case int32(_BT_RSQB):
  12292. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1)) {
  12293. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == libc.Int32FromInt32(m_ASCII_RSQB1)) {
  12294. ptr += uintptr(1)
  12295. break
  12296. }
  12297. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(1)) {
  12298. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))))) == libc.Int32FromInt32(m_ASCII_GT1)) {
  12299. ptr += uintptr(1)
  12300. break
  12301. }
  12302. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  12303. return m_XML_TOK_INVALID
  12304. }
  12305. }
  12306. /* fall through */
  12307. fallthrough
  12308. case int32(_BT_AMP):
  12309. fallthrough
  12310. case int32(_BT_LT):
  12311. fallthrough
  12312. case int32(_BT_NONXML):
  12313. fallthrough
  12314. case int32(_BT_MALFORM):
  12315. fallthrough
  12316. case int32(_BT_TRAIL):
  12317. fallthrough
  12318. case int32(_BT_CR):
  12319. fallthrough
  12320. case int32(_BT_LF):
  12321. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12322. return int32(m_XML_TOK_DATA_CHARS)
  12323. default:
  12324. ptr += uintptr(1)
  12325. break
  12326. }
  12327. }
  12328. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12329. return int32(m_XML_TOK_DATA_CHARS)
  12330. }
  12331. /* ptr points to character following "%" */
  12332. func _normal_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12333. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12334. return -int32(1)
  12335. }
  12336. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12337. case int32(_BT_NONASCII):
  12338. if !(libc.Int32FromInt32(0) != 0) {
  12339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12340. return m_XML_TOK_INVALID
  12341. } /* fall through */
  12342. fallthrough
  12343. case int32(_BT_NMSTRT):
  12344. fallthrough
  12345. case int32(_BT_HEX):
  12346. ptr += uintptr(1)
  12347. case int32(_BT_LEAD2):
  12348. if int64(end)-int64(ptr) < int64(2) {
  12349. return -int32(2)
  12350. }
  12351. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  12352. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12353. return m_XML_TOK_INVALID
  12354. }
  12355. ptr += uintptr(2)
  12356. case int32(_BT_LEAD3):
  12357. if int64(end)-int64(ptr) < int64(3) {
  12358. return -int32(2)
  12359. }
  12360. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  12361. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12362. return m_XML_TOK_INVALID
  12363. }
  12364. ptr += uintptr(3)
  12365. case int32(_BT_LEAD4):
  12366. if int64(end)-int64(ptr) < int64(4) {
  12367. return -int32(2)
  12368. }
  12369. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  12370. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12371. return m_XML_TOK_INVALID
  12372. }
  12373. ptr += uintptr(4)
  12374. case int32(_BT_S):
  12375. fallthrough
  12376. case int32(_BT_LF):
  12377. fallthrough
  12378. case int32(_BT_CR):
  12379. fallthrough
  12380. case int32(_BT_PERCNT):
  12381. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12382. return int32(m_XML_TOK_PERCENT)
  12383. default:
  12384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12385. return m_XML_TOK_INVALID
  12386. }
  12387. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12388. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12389. case int32(_BT_NONASCII):
  12390. if !(libc.Int32FromInt32(0) != 0) {
  12391. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12392. return m_XML_TOK_INVALID
  12393. } /* fall through */
  12394. fallthrough
  12395. case int32(_BT_NMSTRT):
  12396. fallthrough
  12397. case int32(_BT_HEX):
  12398. fallthrough
  12399. case int32(_BT_DIGIT):
  12400. fallthrough
  12401. case int32(_BT_NAME):
  12402. fallthrough
  12403. case int32(_BT_MINUS):
  12404. ptr += uintptr(1)
  12405. case int32(_BT_LEAD2):
  12406. if int64(end)-int64(ptr) < int64(2) {
  12407. return -int32(2)
  12408. }
  12409. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12410. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12411. return m_XML_TOK_INVALID
  12412. }
  12413. ptr += uintptr(2)
  12414. case int32(_BT_LEAD3):
  12415. if int64(end)-int64(ptr) < int64(3) {
  12416. return -int32(2)
  12417. }
  12418. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12420. return m_XML_TOK_INVALID
  12421. }
  12422. ptr += uintptr(3)
  12423. case int32(_BT_LEAD4):
  12424. if int64(end)-int64(ptr) < int64(4) {
  12425. return -int32(2)
  12426. }
  12427. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12429. return m_XML_TOK_INVALID
  12430. }
  12431. ptr += uintptr(4)
  12432. case int32(_BT_SEMI):
  12433. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12434. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  12435. default:
  12436. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12437. return m_XML_TOK_INVALID
  12438. }
  12439. }
  12440. return -int32(1)
  12441. }
  12442. func _normal_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12443. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12444. return -int32(1)
  12445. }
  12446. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12447. case int32(_BT_NONASCII):
  12448. if !(libc.Int32FromInt32(0) != 0) {
  12449. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12450. return m_XML_TOK_INVALID
  12451. } /* fall through */
  12452. fallthrough
  12453. case int32(_BT_NMSTRT):
  12454. fallthrough
  12455. case int32(_BT_HEX):
  12456. ptr += uintptr(1)
  12457. case int32(_BT_LEAD2):
  12458. if int64(end)-int64(ptr) < int64(2) {
  12459. return -int32(2)
  12460. }
  12461. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0) {
  12462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12463. return m_XML_TOK_INVALID
  12464. }
  12465. ptr += uintptr(2)
  12466. case int32(_BT_LEAD3):
  12467. if int64(end)-int64(ptr) < int64(3) {
  12468. return -int32(2)
  12469. }
  12470. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0) {
  12471. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12472. return m_XML_TOK_INVALID
  12473. }
  12474. ptr += uintptr(3)
  12475. case int32(_BT_LEAD4):
  12476. if int64(end)-int64(ptr) < int64(4) {
  12477. return -int32(2)
  12478. }
  12479. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0) {
  12480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12481. return m_XML_TOK_INVALID
  12482. }
  12483. ptr += uintptr(4)
  12484. default:
  12485. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12486. return m_XML_TOK_INVALID
  12487. }
  12488. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12489. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12490. case int32(_BT_NONASCII):
  12491. if !(libc.Int32FromInt32(0) != 0) {
  12492. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12493. return m_XML_TOK_INVALID
  12494. } /* fall through */
  12495. fallthrough
  12496. case int32(_BT_NMSTRT):
  12497. fallthrough
  12498. case int32(_BT_HEX):
  12499. fallthrough
  12500. case int32(_BT_DIGIT):
  12501. fallthrough
  12502. case int32(_BT_NAME):
  12503. fallthrough
  12504. case int32(_BT_MINUS):
  12505. ptr += uintptr(1)
  12506. case int32(_BT_LEAD2):
  12507. if int64(end)-int64(ptr) < int64(2) {
  12508. return -int32(2)
  12509. }
  12510. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12511. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12512. return m_XML_TOK_INVALID
  12513. }
  12514. ptr += uintptr(2)
  12515. case int32(_BT_LEAD3):
  12516. if int64(end)-int64(ptr) < int64(3) {
  12517. return -int32(2)
  12518. }
  12519. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12521. return m_XML_TOK_INVALID
  12522. }
  12523. ptr += uintptr(3)
  12524. case int32(_BT_LEAD4):
  12525. if int64(end)-int64(ptr) < int64(4) {
  12526. return -int32(2)
  12527. }
  12528. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12530. return m_XML_TOK_INVALID
  12531. }
  12532. ptr += uintptr(4)
  12533. case int32(_BT_CR):
  12534. fallthrough
  12535. case int32(_BT_LF):
  12536. fallthrough
  12537. case int32(_BT_S):
  12538. fallthrough
  12539. case int32(_BT_RPAR):
  12540. fallthrough
  12541. case int32(_BT_GT):
  12542. fallthrough
  12543. case int32(_BT_PERCNT):
  12544. fallthrough
  12545. case int32(_BT_VERBAR):
  12546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12547. return int32(m_XML_TOK_POUND_NAME)
  12548. default:
  12549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12550. return m_XML_TOK_INVALID
  12551. }
  12552. }
  12553. return -int32(m_XML_TOK_POUND_NAME)
  12554. }
  12555. func _normal_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12556. var t int32
  12557. _ = t
  12558. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12559. t = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  12560. switch t {
  12561. case int32(_BT_LEAD2):
  12562. if int64(end)-int64(ptr) < int64(2) {
  12563. return -int32(2)
  12564. }
  12565. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  12566. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12567. return m_XML_TOK_INVALID
  12568. }
  12569. ptr += uintptr(2)
  12570. case int32(_BT_LEAD3):
  12571. if int64(end)-int64(ptr) < int64(3) {
  12572. return -int32(2)
  12573. }
  12574. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  12575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12576. return m_XML_TOK_INVALID
  12577. }
  12578. ptr += uintptr(3)
  12579. case int32(_BT_LEAD4):
  12580. if int64(end)-int64(ptr) < int64(4) {
  12581. return -int32(2)
  12582. }
  12583. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  12584. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12585. return m_XML_TOK_INVALID
  12586. }
  12587. ptr += uintptr(4)
  12588. case int32(_BT_NONXML):
  12589. fallthrough
  12590. case int32(_BT_MALFORM):
  12591. fallthrough
  12592. case int32(_BT_TRAIL):
  12593. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12594. return m_XML_TOK_INVALID
  12595. case int32(_BT_QUOT):
  12596. fallthrough
  12597. case int32(_BT_APOS):
  12598. ptr += uintptr(1)
  12599. if t != open {
  12600. break
  12601. }
  12602. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12603. return -int32(m_XML_TOK_LITERAL)
  12604. }
  12605. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12606. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12607. case int32(_BT_S):
  12608. fallthrough
  12609. case int32(_BT_CR):
  12610. fallthrough
  12611. case int32(_BT_LF):
  12612. fallthrough
  12613. case int32(_BT_GT):
  12614. fallthrough
  12615. case int32(_BT_PERCNT):
  12616. fallthrough
  12617. case int32(_BT_LSQB):
  12618. return int32(m_XML_TOK_LITERAL)
  12619. default:
  12620. return m_XML_TOK_INVALID
  12621. }
  12622. fallthrough
  12623. default:
  12624. ptr += uintptr(1)
  12625. break
  12626. }
  12627. }
  12628. return -int32(1)
  12629. }
  12630. func _normal_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  12631. var n Tsize_t
  12632. var tok int32
  12633. _, _ = n, tok
  12634. if ptr >= end {
  12635. return -int32(4)
  12636. }
  12637. if int32(1) > int32(1) {
  12638. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  12639. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  12640. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  12641. if n == uint64(0) {
  12642. return -int32(1)
  12643. }
  12644. end = ptr + uintptr(n)
  12645. }
  12646. }
  12647. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12648. case int32(_BT_QUOT):
  12649. goto _1
  12650. case int32(_BT_APOS):
  12651. goto _2
  12652. case int32(_BT_LT):
  12653. goto _3
  12654. case int32(_BT_CR):
  12655. goto _4
  12656. case int32(_BT_LF):
  12657. goto _5
  12658. case int32(_BT_S):
  12659. goto _6
  12660. case int32(_BT_PERCNT):
  12661. goto _7
  12662. case int32(_BT_COMMA):
  12663. goto _8
  12664. case int32(_BT_LSQB):
  12665. goto _9
  12666. case int32(_BT_RSQB):
  12667. goto _10
  12668. case int32(_BT_LPAR):
  12669. goto _11
  12670. case int32(_BT_RPAR):
  12671. goto _12
  12672. case int32(_BT_VERBAR):
  12673. goto _13
  12674. case int32(_BT_GT):
  12675. goto _14
  12676. case int32(_BT_NUM):
  12677. goto _15
  12678. case int32(_BT_LEAD2):
  12679. goto _16
  12680. case int32(_BT_LEAD3):
  12681. goto _17
  12682. case int32(_BT_LEAD4):
  12683. goto _18
  12684. case int32(_BT_HEX):
  12685. goto _19
  12686. case int32(_BT_NMSTRT):
  12687. goto _20
  12688. case int32(_BT_COLON):
  12689. goto _21
  12690. case int32(_BT_MINUS):
  12691. goto _22
  12692. case int32(_BT_NAME):
  12693. goto _23
  12694. case int32(_BT_DIGIT):
  12695. goto _24
  12696. case int32(_BT_NONASCII):
  12697. goto _25
  12698. default:
  12699. goto _26
  12700. }
  12701. goto _27
  12702. _1:
  12703. ;
  12704. return _normal_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(1), end, nextTokPtr)
  12705. _2:
  12706. ;
  12707. return _normal_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(1), end, nextTokPtr)
  12708. _3:
  12709. ;
  12710. ptr += uintptr(1)
  12711. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12712. return -int32(1)
  12713. }
  12714. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12715. case int32(_BT_EXCL):
  12716. return _normal_scanDecl(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12717. case int32(_BT_QUEST):
  12718. return _normal_scanPi(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12719. case int32(_BT_NMSTRT):
  12720. fallthrough
  12721. case int32(_BT_HEX):
  12722. fallthrough
  12723. case int32(_BT_NONASCII):
  12724. fallthrough
  12725. case int32(_BT_LEAD2):
  12726. fallthrough
  12727. case int32(_BT_LEAD3):
  12728. fallthrough
  12729. case int32(_BT_LEAD4):
  12730. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(1)
  12731. return int32(m_XML_TOK_INSTANCE_START)
  12732. }
  12733. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12734. return m_XML_TOK_INVALID
  12735. _4:
  12736. ;
  12737. if ptr+uintptr(1) == end {
  12738. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  12739. /* indicate that this might be part of a CR/LF pair */
  12740. return -int32(m_XML_TOK_PROLOG_S)
  12741. }
  12742. /* fall through */
  12743. _6:
  12744. ;
  12745. _5:
  12746. ;
  12747. _30:
  12748. ;
  12749. ptr += uintptr(1)
  12750. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12751. goto _28
  12752. }
  12753. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12754. case int32(_BT_S):
  12755. fallthrough
  12756. case int32(_BT_LF):
  12757. case int32(_BT_CR):
  12758. /* don't split CR/LF pair */
  12759. if ptr+uintptr(1) != end {
  12760. break
  12761. }
  12762. /* fall through */
  12763. fallthrough
  12764. default:
  12765. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12766. return int32(m_XML_TOK_PROLOG_S)
  12767. }
  12768. goto _29
  12769. _29:
  12770. ;
  12771. goto _30
  12772. goto _28
  12773. _28:
  12774. ;
  12775. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12776. return int32(m_XML_TOK_PROLOG_S)
  12777. _7:
  12778. ;
  12779. return _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12780. _8:
  12781. ;
  12782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12783. return int32(m_XML_TOK_COMMA)
  12784. _9:
  12785. ;
  12786. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12787. return int32(m_XML_TOK_OPEN_BRACKET)
  12788. _10:
  12789. ;
  12790. ptr += uintptr(1)
  12791. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12792. return -int32(m_XML_TOK_CLOSE_BRACKET)
  12793. }
  12794. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  12795. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))) {
  12796. return -int32(1)
  12797. }
  12798. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_GT1) {
  12799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(1))
  12800. return int32(m_XML_TOK_COND_SECT_CLOSE)
  12801. }
  12802. }
  12803. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12804. return int32(m_XML_TOK_CLOSE_BRACKET)
  12805. _11:
  12806. ;
  12807. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12808. return int32(m_XML_TOK_OPEN_PAREN)
  12809. _12:
  12810. ;
  12811. ptr += uintptr(1)
  12812. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  12813. return -int32(m_XML_TOK_CLOSE_PAREN)
  12814. }
  12815. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12816. case int32(_BT_AST):
  12817. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12818. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  12819. case int32(_BT_QUEST):
  12820. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12821. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  12822. case int32(_BT_PLUS):
  12823. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12824. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  12825. case int32(_BT_CR):
  12826. fallthrough
  12827. case int32(_BT_LF):
  12828. fallthrough
  12829. case int32(_BT_S):
  12830. fallthrough
  12831. case int32(_BT_GT):
  12832. fallthrough
  12833. case int32(_BT_COMMA):
  12834. fallthrough
  12835. case int32(_BT_VERBAR):
  12836. fallthrough
  12837. case int32(_BT_RPAR):
  12838. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12839. return int32(m_XML_TOK_CLOSE_PAREN)
  12840. }
  12841. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12842. return m_XML_TOK_INVALID
  12843. _13:
  12844. ;
  12845. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12846. return int32(m_XML_TOK_OR)
  12847. _14:
  12848. ;
  12849. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  12850. return int32(m_XML_TOK_DECL_CLOSE)
  12851. _15:
  12852. ;
  12853. return _normal_scanPoundName(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  12854. _16:
  12855. ;
  12856. if int64(end)-int64(ptr) < int64(2) {
  12857. return -int32(2)
  12858. }
  12859. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt2})))(tls, enc, ptr) != 0 {
  12860. ptr += uintptr(2)
  12861. tok = int32(m_XML_TOK_NAME)
  12862. goto _27
  12863. }
  12864. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0 {
  12865. ptr += uintptr(2)
  12866. tok = int32(m_XML_TOK_NMTOKEN)
  12867. goto _27
  12868. }
  12869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12870. return m_XML_TOK_INVALID
  12871. _17:
  12872. ;
  12873. if int64(end)-int64(ptr) < int64(3) {
  12874. return -int32(2)
  12875. }
  12876. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt3})))(tls, enc, ptr) != 0 {
  12877. ptr += uintptr(3)
  12878. tok = int32(m_XML_TOK_NAME)
  12879. goto _27
  12880. }
  12881. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0 {
  12882. ptr += uintptr(3)
  12883. tok = int32(m_XML_TOK_NMTOKEN)
  12884. goto _27
  12885. }
  12886. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12887. return m_XML_TOK_INVALID
  12888. _18:
  12889. ;
  12890. if int64(end)-int64(ptr) < int64(4) {
  12891. return -int32(2)
  12892. }
  12893. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisNmstrt4})))(tls, enc, ptr) != 0 {
  12894. ptr += uintptr(4)
  12895. tok = int32(m_XML_TOK_NAME)
  12896. goto _27
  12897. }
  12898. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0 {
  12899. ptr += uintptr(4)
  12900. tok = int32(m_XML_TOK_NMTOKEN)
  12901. goto _27
  12902. }
  12903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12904. return m_XML_TOK_INVALID
  12905. _20:
  12906. ;
  12907. _19:
  12908. ;
  12909. tok = int32(m_XML_TOK_NAME)
  12910. ptr += uintptr(1)
  12911. goto _27
  12912. _24:
  12913. ;
  12914. _23:
  12915. ;
  12916. _22:
  12917. ;
  12918. _21:
  12919. ;
  12920. tok = int32(m_XML_TOK_NMTOKEN)
  12921. ptr += uintptr(1)
  12922. goto _27
  12923. _25:
  12924. ;
  12925. if 0 != 0 {
  12926. ptr += uintptr(1)
  12927. tok = int32(m_XML_TOK_NAME)
  12928. goto _27
  12929. }
  12930. if 0 != 0 {
  12931. ptr += uintptr(1)
  12932. tok = int32(m_XML_TOK_NMTOKEN)
  12933. goto _27
  12934. }
  12935. /* fall through */
  12936. _26:
  12937. ;
  12938. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12939. return m_XML_TOK_INVALID
  12940. _27:
  12941. ;
  12942. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  12943. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  12944. case int32(_BT_NONASCII):
  12945. if !(libc.Int32FromInt32(0) != 0) {
  12946. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12947. return m_XML_TOK_INVALID
  12948. } /* fall through */
  12949. fallthrough
  12950. case int32(_BT_NMSTRT):
  12951. fallthrough
  12952. case int32(_BT_HEX):
  12953. fallthrough
  12954. case int32(_BT_DIGIT):
  12955. fallthrough
  12956. case int32(_BT_NAME):
  12957. fallthrough
  12958. case int32(_BT_MINUS):
  12959. ptr += uintptr(1)
  12960. case int32(_BT_LEAD2):
  12961. if int64(end)-int64(ptr) < int64(2) {
  12962. return -int32(2)
  12963. }
  12964. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  12965. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12966. return m_XML_TOK_INVALID
  12967. }
  12968. ptr += uintptr(2)
  12969. case int32(_BT_LEAD3):
  12970. if int64(end)-int64(ptr) < int64(3) {
  12971. return -int32(2)
  12972. }
  12973. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  12974. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12975. return m_XML_TOK_INVALID
  12976. }
  12977. ptr += uintptr(3)
  12978. case int32(_BT_LEAD4):
  12979. if int64(end)-int64(ptr) < int64(4) {
  12980. return -int32(2)
  12981. }
  12982. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  12983. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  12984. return m_XML_TOK_INVALID
  12985. }
  12986. ptr += uintptr(4)
  12987. case int32(_BT_GT):
  12988. fallthrough
  12989. case int32(_BT_RPAR):
  12990. fallthrough
  12991. case int32(_BT_COMMA):
  12992. fallthrough
  12993. case int32(_BT_VERBAR):
  12994. fallthrough
  12995. case int32(_BT_LSQB):
  12996. fallthrough
  12997. case int32(_BT_PERCNT):
  12998. fallthrough
  12999. case int32(_BT_S):
  13000. fallthrough
  13001. case int32(_BT_CR):
  13002. fallthrough
  13003. case int32(_BT_LF):
  13004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13005. return tok
  13006. case int32(_BT_COLON):
  13007. ptr += uintptr(1)
  13008. switch tok {
  13009. case int32(m_XML_TOK_NAME):
  13010. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13011. return -int32(1)
  13012. }
  13013. tok = int32(m_XML_TOK_PREFIXED_NAME)
  13014. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13015. case int32(_BT_NONASCII):
  13016. if !(libc.Int32FromInt32(0) != 0) {
  13017. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13018. return m_XML_TOK_INVALID
  13019. } /* fall through */
  13020. fallthrough
  13021. case int32(_BT_NMSTRT):
  13022. fallthrough
  13023. case int32(_BT_HEX):
  13024. fallthrough
  13025. case int32(_BT_DIGIT):
  13026. fallthrough
  13027. case int32(_BT_NAME):
  13028. fallthrough
  13029. case int32(_BT_MINUS):
  13030. ptr += uintptr(1)
  13031. case int32(_BT_LEAD2):
  13032. if int64(end)-int64(ptr) < int64(2) {
  13033. return -int32(2)
  13034. }
  13035. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName2})))(tls, enc, ptr) != 0) {
  13036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13037. return m_XML_TOK_INVALID
  13038. }
  13039. ptr += uintptr(2)
  13040. case int32(_BT_LEAD3):
  13041. if int64(end)-int64(ptr) < int64(3) {
  13042. return -int32(2)
  13043. }
  13044. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName3})))(tls, enc, ptr) != 0) {
  13045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13046. return m_XML_TOK_INVALID
  13047. }
  13048. ptr += uintptr(3)
  13049. case int32(_BT_LEAD4):
  13050. if int64(end)-int64(ptr) < int64(4) {
  13051. return -int32(2)
  13052. }
  13053. if !((*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisName4})))(tls, enc, ptr) != 0) {
  13054. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13055. return m_XML_TOK_INVALID
  13056. }
  13057. ptr += uintptr(4)
  13058. default:
  13059. tok = int32(m_XML_TOK_NMTOKEN)
  13060. break
  13061. }
  13062. case int32(m_XML_TOK_PREFIXED_NAME):
  13063. tok = int32(m_XML_TOK_NMTOKEN)
  13064. break
  13065. }
  13066. case int32(_BT_PLUS):
  13067. if tok == int32(m_XML_TOK_NMTOKEN) {
  13068. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13069. return m_XML_TOK_INVALID
  13070. }
  13071. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13072. return int32(m_XML_TOK_NAME_PLUS)
  13073. case int32(_BT_AST):
  13074. if tok == int32(m_XML_TOK_NMTOKEN) {
  13075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13076. return m_XML_TOK_INVALID
  13077. }
  13078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13079. return int32(m_XML_TOK_NAME_ASTERISK)
  13080. case int32(_BT_QUEST):
  13081. if tok == int32(m_XML_TOK_NMTOKEN) {
  13082. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13083. return m_XML_TOK_INVALID
  13084. }
  13085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13086. return int32(m_XML_TOK_NAME_QUESTION)
  13087. default:
  13088. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13089. return m_XML_TOK_INVALID
  13090. }
  13091. }
  13092. return -tok
  13093. }
  13094. func _normal_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13095. var start uintptr
  13096. _ = start
  13097. if ptr >= end {
  13098. return -int32(4)
  13099. } else {
  13100. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13101. /* This line cannot be executed. The incoming data has already
  13102. * been tokenized once, so incomplete characters like this have
  13103. * already been eliminated from the input. Retaining the paranoia
  13104. * check is still valuable, however.
  13105. */
  13106. return -int32(1) /* LCOV_EXCL_LINE */
  13107. }
  13108. }
  13109. start = ptr
  13110. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13111. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13112. case int32(_BT_LEAD2):
  13113. ptr += uintptr(2)
  13114. case int32(_BT_LEAD3):
  13115. ptr += uintptr(3)
  13116. case int32(_BT_LEAD4):
  13117. ptr += uintptr(4)
  13118. case int32(_BT_AMP):
  13119. if ptr == start {
  13120. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13121. }
  13122. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13123. return int32(m_XML_TOK_DATA_CHARS)
  13124. case int32(_BT_LT):
  13125. /* this is for inside entity references */
  13126. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13127. return m_XML_TOK_INVALID
  13128. case int32(_BT_LF):
  13129. if ptr == start {
  13130. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13131. return int32(m_XML_TOK_DATA_NEWLINE)
  13132. }
  13133. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13134. return int32(m_XML_TOK_DATA_CHARS)
  13135. case int32(_BT_CR):
  13136. if ptr == start {
  13137. ptr += uintptr(1)
  13138. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13139. return -int32(3)
  13140. }
  13141. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13142. ptr += uintptr(1)
  13143. }
  13144. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13145. return int32(m_XML_TOK_DATA_NEWLINE)
  13146. }
  13147. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13148. return int32(m_XML_TOK_DATA_CHARS)
  13149. case int32(_BT_S):
  13150. if ptr == start {
  13151. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13152. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  13153. }
  13154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13155. return int32(m_XML_TOK_DATA_CHARS)
  13156. default:
  13157. ptr += uintptr(1)
  13158. break
  13159. }
  13160. }
  13161. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13162. return int32(m_XML_TOK_DATA_CHARS)
  13163. }
  13164. func _normal_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13165. var start uintptr
  13166. var tok, v1 int32
  13167. _, _, _ = start, tok, v1
  13168. if ptr >= end {
  13169. return -int32(4)
  13170. } else {
  13171. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13172. /* This line cannot be executed. The incoming data has already
  13173. * been tokenized once, so incomplete characters like this have
  13174. * already been eliminated from the input. Retaining the paranoia
  13175. * check is still valuable, however.
  13176. */
  13177. return -int32(1) /* LCOV_EXCL_LINE */
  13178. }
  13179. }
  13180. start = ptr
  13181. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13182. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13183. case int32(_BT_LEAD2):
  13184. ptr += uintptr(2)
  13185. case int32(_BT_LEAD3):
  13186. ptr += uintptr(3)
  13187. case int32(_BT_LEAD4):
  13188. ptr += uintptr(4)
  13189. case int32(_BT_AMP):
  13190. if ptr == start {
  13191. return _normal_scanRef(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13192. }
  13193. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13194. return int32(m_XML_TOK_DATA_CHARS)
  13195. case int32(_BT_PERCNT):
  13196. if ptr == start {
  13197. tok = _normal_scanPercent(tls, enc, ptr+uintptr(1), end, nextTokPtr)
  13198. if tok == int32(m_XML_TOK_PERCENT) {
  13199. v1 = m_XML_TOK_INVALID
  13200. } else {
  13201. v1 = tok
  13202. }
  13203. return v1
  13204. }
  13205. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13206. return int32(m_XML_TOK_DATA_CHARS)
  13207. case int32(_BT_LF):
  13208. if ptr == start {
  13209. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(1)
  13210. return int32(m_XML_TOK_DATA_NEWLINE)
  13211. }
  13212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13213. return int32(m_XML_TOK_DATA_CHARS)
  13214. case int32(_BT_CR):
  13215. if ptr == start {
  13216. ptr += uintptr(1)
  13217. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13218. return -int32(3)
  13219. }
  13220. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13221. ptr += uintptr(1)
  13222. }
  13223. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13224. return int32(m_XML_TOK_DATA_NEWLINE)
  13225. }
  13226. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13227. return int32(m_XML_TOK_DATA_CHARS)
  13228. default:
  13229. ptr += uintptr(1)
  13230. break
  13231. }
  13232. }
  13233. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13234. return int32(m_XML_TOK_DATA_CHARS)
  13235. }
  13236. func _normal_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  13237. var level int32
  13238. var n Tsize_t
  13239. _, _ = level, n
  13240. level = 0
  13241. if int32(1) > int32(1) {
  13242. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  13243. if n&libc.Uint64FromInt32(libc.Int32FromInt32(1)-libc.Int32FromInt32(1)) != 0 {
  13244. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(1) - libc.Int32FromInt32(1)))
  13245. end = ptr + uintptr(n)
  13246. }
  13247. }
  13248. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13249. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13250. case int32(_BT_LEAD2):
  13251. if int64(end)-int64(ptr) < int64(2) {
  13252. return -int32(2)
  13253. }
  13254. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid2})))(tls, enc, ptr) != 0 {
  13255. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13256. return m_XML_TOK_INVALID
  13257. }
  13258. ptr += uintptr(2)
  13259. case int32(_BT_LEAD3):
  13260. if int64(end)-int64(ptr) < int64(3) {
  13261. return -int32(2)
  13262. }
  13263. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid3})))(tls, enc, ptr) != 0 {
  13264. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13265. return m_XML_TOK_INVALID
  13266. }
  13267. ptr += uintptr(3)
  13268. case int32(_BT_LEAD4):
  13269. if int64(end)-int64(ptr) < int64(4) {
  13270. return -int32(2)
  13271. }
  13272. if (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*Tnormal_encoding)(unsafe.Pointer(enc)).FisInvalid4})))(tls, enc, ptr) != 0 {
  13273. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13274. return m_XML_TOK_INVALID
  13275. }
  13276. ptr += uintptr(4)
  13277. case int32(_BT_NONXML):
  13278. fallthrough
  13279. case int32(_BT_MALFORM):
  13280. fallthrough
  13281. case int32(_BT_TRAIL):
  13282. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13283. return m_XML_TOK_INVALID
  13284. case int32(_BT_LT):
  13285. ptr += uintptr(1)
  13286. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13287. return -int32(1)
  13288. }
  13289. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL) {
  13290. ptr += uintptr(1)
  13291. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13292. return -int32(1)
  13293. }
  13294. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  13295. level++
  13296. ptr += uintptr(1)
  13297. }
  13298. }
  13299. case int32(_BT_RSQB):
  13300. ptr += uintptr(1)
  13301. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13302. return -int32(1)
  13303. }
  13304. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  13305. ptr += uintptr(1)
  13306. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13307. return -int32(1)
  13308. }
  13309. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  13310. ptr += uintptr(1)
  13311. if level == 0 {
  13312. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  13313. return int32(m_XML_TOK_IGNORE_SECT)
  13314. }
  13315. level--
  13316. }
  13317. }
  13318. default:
  13319. ptr += uintptr(1)
  13320. break
  13321. }
  13322. }
  13323. return -int32(1)
  13324. }
  13325. func _normal_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  13326. ptr += uintptr(1)
  13327. end -= uintptr(1)
  13328. for {
  13329. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1))) {
  13330. break
  13331. }
  13332. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13333. case int32(_BT_DIGIT):
  13334. fallthrough
  13335. case int32(_BT_HEX):
  13336. fallthrough
  13337. case int32(_BT_MINUS):
  13338. fallthrough
  13339. case int32(_BT_APOS):
  13340. fallthrough
  13341. case int32(_BT_LPAR):
  13342. fallthrough
  13343. case int32(_BT_RPAR):
  13344. fallthrough
  13345. case int32(_BT_PLUS):
  13346. fallthrough
  13347. case int32(_BT_COMMA):
  13348. fallthrough
  13349. case int32(_BT_SOL):
  13350. fallthrough
  13351. case int32(_BT_EQUALS):
  13352. fallthrough
  13353. case int32(_BT_QUEST):
  13354. fallthrough
  13355. case int32(_BT_CR):
  13356. fallthrough
  13357. case int32(_BT_LF):
  13358. fallthrough
  13359. case int32(_BT_SEMI):
  13360. fallthrough
  13361. case int32(_BT_EXCL):
  13362. fallthrough
  13363. case int32(_BT_AST):
  13364. fallthrough
  13365. case int32(_BT_PERCNT):
  13366. fallthrough
  13367. case int32(_BT_NUM):
  13368. fallthrough
  13369. case int32(_BT_COLON):
  13370. case int32(_BT_S):
  13371. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  13372. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  13373. return 0
  13374. }
  13375. case int32(_BT_NAME):
  13376. fallthrough
  13377. case int32(_BT_NMSTRT):
  13378. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) & ^libc.Int32FromInt32(0x7f) != 0) {
  13379. break
  13380. }
  13381. /* fall through */
  13382. fallthrough
  13383. default:
  13384. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13385. case int32(0x24): /* $ */
  13386. fallthrough
  13387. case int32(0x40): /* @ */
  13388. default:
  13389. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  13390. return 0
  13391. }
  13392. break
  13393. }
  13394. goto _1
  13395. _1:
  13396. ;
  13397. ptr += uintptr(1)
  13398. }
  13399. return int32(1)
  13400. }
  13401. /* This must only be called for a well-formed start-tag or empty
  13402. element tag. Returns the number of attributes. Pointers to the
  13403. first attsMax attributes are stored in atts.
  13404. */
  13405. func _normal_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  13406. var nAtts, open, state int32
  13407. _, _, _ = nAtts, open, state
  13408. state = 1
  13409. nAtts = 0
  13410. open = 0 /* defined when state == inValue;
  13411. initialization just to shut up compilers */
  13412. ptr += uintptr(1)
  13413. for {
  13414. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13415. case int32(_BT_LEAD2):
  13416. if state == 0 {
  13417. if nAtts < attsMax {
  13418. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13419. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13420. }
  13421. state = 1
  13422. }
  13423. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  13424. case int32(_BT_LEAD3):
  13425. if state == 0 {
  13426. if nAtts < attsMax {
  13427. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13428. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13429. }
  13430. state = 1
  13431. }
  13432. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  13433. case int32(_BT_LEAD4):
  13434. if state == 0 {
  13435. if nAtts < attsMax {
  13436. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13437. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13438. }
  13439. state = 1
  13440. }
  13441. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  13442. case int32(_BT_NONASCII):
  13443. fallthrough
  13444. case int32(_BT_NMSTRT):
  13445. fallthrough
  13446. case int32(_BT_HEX):
  13447. if state == 0 {
  13448. if nAtts < attsMax {
  13449. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  13450. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  13451. }
  13452. state = 1
  13453. }
  13454. case int32(_BT_QUOT):
  13455. if state != 2 {
  13456. if nAtts < attsMax {
  13457. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  13458. }
  13459. state = 2
  13460. open = int32(_BT_QUOT)
  13461. } else {
  13462. if open == int32(_BT_QUOT) {
  13463. state = 0
  13464. if nAtts < attsMax {
  13465. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  13466. }
  13467. nAtts++
  13468. }
  13469. }
  13470. case int32(_BT_APOS):
  13471. if state != 2 {
  13472. if nAtts < attsMax {
  13473. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(1)
  13474. }
  13475. state = 2
  13476. open = int32(_BT_APOS)
  13477. } else {
  13478. if open == int32(_BT_APOS) {
  13479. state = 0
  13480. if nAtts < attsMax {
  13481. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  13482. }
  13483. nAtts++
  13484. }
  13485. }
  13486. case int32(_BT_AMP):
  13487. if nAtts < attsMax {
  13488. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  13489. }
  13490. case int32(_BT_S):
  13491. if state == 1 {
  13492. state = 0
  13493. } else {
  13494. if state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0 && (ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) != int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_SPACE1) || libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1))))))) == open) {
  13495. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  13496. }
  13497. }
  13498. case int32(_BT_CR):
  13499. fallthrough
  13500. case int32(_BT_LF):
  13501. /* This case ensures that the first attribute name is counted
  13502. Apart from that we could just change state on the quote. */
  13503. if state == 1 {
  13504. state = 0
  13505. } else {
  13506. if state == 2 && nAtts < attsMax {
  13507. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  13508. }
  13509. }
  13510. case int32(_BT_GT):
  13511. fallthrough
  13512. case int32(_BT_SOL):
  13513. if state != 2 {
  13514. return nAtts
  13515. }
  13516. default:
  13517. break
  13518. }
  13519. goto _1
  13520. _1:
  13521. ;
  13522. ptr += uintptr(1)
  13523. }
  13524. /* not reached */
  13525. return r
  13526. }
  13527. func _normal_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  13528. var c, c1, result int32
  13529. _, _, _ = c, c1, result
  13530. result = 0
  13531. /* skip &# */
  13532. _ = enc
  13533. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(1))
  13534. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  13535. ptr += uintptr(1)
  13536. for {
  13537. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  13538. break
  13539. }
  13540. c = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  13541. switch c {
  13542. case int32(m_ASCII_0):
  13543. fallthrough
  13544. case int32(m_ASCII_1):
  13545. fallthrough
  13546. case int32(m_ASCII_2):
  13547. fallthrough
  13548. case int32(m_ASCII_3):
  13549. fallthrough
  13550. case int32(m_ASCII_41):
  13551. fallthrough
  13552. case int32(m_ASCII_51):
  13553. fallthrough
  13554. case int32(m_ASCII_61):
  13555. fallthrough
  13556. case int32(m_ASCII_71):
  13557. fallthrough
  13558. case int32(m_ASCII_8):
  13559. fallthrough
  13560. case int32(m_ASCII_9):
  13561. result <<= int32(4)
  13562. result |= c - int32(m_ASCII_0)
  13563. case int32(m_ASCII_A):
  13564. fallthrough
  13565. case int32(m_ASCII_B1):
  13566. fallthrough
  13567. case int32(m_ASCII_C):
  13568. fallthrough
  13569. case int32(m_ASCII_D):
  13570. fallthrough
  13571. case int32(m_ASCII_E):
  13572. fallthrough
  13573. case int32(m_ASCII_F):
  13574. result <<= int32(4)
  13575. result += int32(10) + (c - int32(m_ASCII_A))
  13576. case int32(m_ASCII_a):
  13577. fallthrough
  13578. case int32(m_ASCII_b1):
  13579. fallthrough
  13580. case int32(m_ASCII_c):
  13581. fallthrough
  13582. case int32(m_ASCII_d1):
  13583. fallthrough
  13584. case int32(m_ASCII_e):
  13585. fallthrough
  13586. case int32(m_ASCII_f1):
  13587. result <<= int32(4)
  13588. result += int32(10) + (c - int32(m_ASCII_a))
  13589. break
  13590. }
  13591. if result >= int32(0x110000) {
  13592. return -int32(1)
  13593. }
  13594. goto _1
  13595. _1:
  13596. ;
  13597. ptr += uintptr(1)
  13598. }
  13599. } else {
  13600. for {
  13601. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromInt32(m_ASCII_SEMI1)) {
  13602. break
  13603. }
  13604. c1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  13605. result *= int32(10)
  13606. result += c1 - int32(m_ASCII_0)
  13607. if result >= int32(0x110000) {
  13608. return -int32(1)
  13609. }
  13610. goto _2
  13611. _2:
  13612. ;
  13613. ptr += uintptr(1)
  13614. }
  13615. }
  13616. return _checkCharRefNumber(tls, result)
  13617. }
  13618. func _normal_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  13619. _ = enc
  13620. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(1) {
  13621. case int64(2):
  13622. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(1)))) == int32(m_ASCII_t) {
  13623. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13624. case int32(m_ASCII_l):
  13625. return int32(m_ASCII_LT1)
  13626. case int32(m_ASCII_g):
  13627. return int32(m_ASCII_GT1)
  13628. }
  13629. }
  13630. case int64(3):
  13631. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a) {
  13632. ptr += uintptr(1)
  13633. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m) {
  13634. ptr += uintptr(1)
  13635. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  13636. return int32(m_ASCII_AMP1)
  13637. }
  13638. }
  13639. }
  13640. case int64(4):
  13641. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  13642. case int32(m_ASCII_q1):
  13643. ptr += uintptr(1)
  13644. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  13645. ptr += uintptr(1)
  13646. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  13647. ptr += uintptr(1)
  13648. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t) {
  13649. return int32(m_ASCII_QUOT1)
  13650. }
  13651. }
  13652. }
  13653. case int32(m_ASCII_a):
  13654. ptr += uintptr(1)
  13655. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  13656. ptr += uintptr(1)
  13657. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  13658. ptr += uintptr(1)
  13659. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s) {
  13660. return int32(m_ASCII_APOS1)
  13661. }
  13662. }
  13663. }
  13664. break
  13665. }
  13666. }
  13667. return 0
  13668. }
  13669. func _normal_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  13670. _ = enc
  13671. for {
  13672. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  13673. break
  13674. }
  13675. if int64(end1)-int64(ptr1) < int64(1) {
  13676. /* This line cannot be executed. The incoming data has already
  13677. * been tokenized once, so incomplete characters like this have
  13678. * already been eliminated from the input. Retaining the
  13679. * paranoia check is still valuable, however.
  13680. */
  13681. return 0 /* LCOV_EXCL_LINE */
  13682. }
  13683. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  13684. return 0
  13685. }
  13686. goto _1
  13687. _1:
  13688. ;
  13689. ptr1 += uintptr(1)
  13690. ptr2++
  13691. }
  13692. return libc.BoolInt32(ptr1 == end1)
  13693. }
  13694. func _normal_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  13695. var start uintptr
  13696. _ = start
  13697. start = ptr
  13698. for {
  13699. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13700. case int32(_BT_LEAD2):
  13701. ptr += uintptr(2)
  13702. case int32(_BT_LEAD3):
  13703. ptr += uintptr(3)
  13704. case int32(_BT_LEAD4):
  13705. ptr += uintptr(4)
  13706. case int32(_BT_NONASCII):
  13707. fallthrough
  13708. case int32(_BT_NMSTRT):
  13709. fallthrough
  13710. case int32(_BT_COLON):
  13711. fallthrough
  13712. case int32(_BT_HEX):
  13713. fallthrough
  13714. case int32(_BT_DIGIT):
  13715. fallthrough
  13716. case int32(_BT_NAME):
  13717. fallthrough
  13718. case int32(_BT_MINUS):
  13719. ptr += uintptr(1)
  13720. default:
  13721. return int32(int64(ptr) - int64(start))
  13722. }
  13723. goto _1
  13724. _1:
  13725. }
  13726. return r
  13727. }
  13728. func _normal_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  13729. for {
  13730. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13731. case int32(_BT_LF):
  13732. fallthrough
  13733. case int32(_BT_CR):
  13734. fallthrough
  13735. case int32(_BT_S):
  13736. ptr += uintptr(1)
  13737. default:
  13738. return ptr
  13739. }
  13740. goto _1
  13741. _1:
  13742. }
  13743. return r
  13744. }
  13745. func _normal_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  13746. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) {
  13747. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) {
  13748. case int32(_BT_LEAD2):
  13749. ptr += uintptr(2)
  13750. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13751. case int32(_BT_LEAD3):
  13752. ptr += uintptr(3)
  13753. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13754. case int32(_BT_LEAD4):
  13755. ptr += uintptr(4)
  13756. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13757. case int32(_BT_LF):
  13758. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  13759. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  13760. ptr += uintptr(1)
  13761. case int32(_BT_CR):
  13762. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  13763. ptr += uintptr(1)
  13764. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(1)) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr)))))) == int32(_BT_LF) {
  13765. ptr += uintptr(1)
  13766. }
  13767. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  13768. default:
  13769. ptr += uintptr(1)
  13770. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  13771. break
  13772. }
  13773. }
  13774. }
  13775. const /* UTF8_cvalN is value of masked first byte of N byte sequence */
  13776. _UTF8_cval1 = 0
  13777. const _UTF8_cval2 = 192
  13778. const _UTF8_cval3 = 224
  13779. const _UTF8_cval4 = 240
  13780. func X_INTERNAL_trim_to_complete_utf8_characters(tls *libc.TLS, from uintptr, fromLimRef uintptr) {
  13781. var fromLim uintptr
  13782. var prev uint8
  13783. var walked Tsize_t
  13784. _, _, _ = fromLim, prev, walked
  13785. fromLim = *(*uintptr)(unsafe.Pointer(fromLimRef))
  13786. walked = uint64(0)
  13787. for {
  13788. if !(fromLim > from) {
  13789. break
  13790. }
  13791. prev = *(*uint8)(unsafe.Pointer(fromLim + uintptr(-libc.Int32FromInt32(1))))
  13792. if uint32(prev)&uint32(0xf8) == uint32(0xf0) { /* 4-byte character, lead by 0b11110xxx byte */
  13793. if walked+uint64(1) >= uint64(4) {
  13794. fromLim += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(1))
  13795. break
  13796. } else {
  13797. walked = uint64(0)
  13798. }
  13799. } else {
  13800. if uint32(prev)&uint32(0xf0) == uint32(0xe0) { /* 3-byte character, lead by 0b1110xxxx byte */
  13801. if walked+uint64(1) >= uint64(3) {
  13802. fromLim += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(1))
  13803. break
  13804. } else {
  13805. walked = uint64(0)
  13806. }
  13807. } else {
  13808. if uint32(prev)&uint32(0xe0) == uint32(0xc0) { /* 2-byte character, lead by 0b110xxxxx byte */
  13809. if walked+uint64(1) >= uint64(2) {
  13810. fromLim += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(1))
  13811. break
  13812. } else {
  13813. walked = uint64(0)
  13814. }
  13815. } else {
  13816. if uint32(prev)&uint32(0x80) == 0x00 { /* 1-byte character, matching 0b0xxxxxxx */
  13817. break
  13818. }
  13819. }
  13820. }
  13821. }
  13822. goto _1
  13823. _1:
  13824. ;
  13825. fromLim--
  13826. walked++
  13827. }
  13828. *(*uintptr)(unsafe.Pointer(fromLimRef)) = fromLim
  13829. }
  13830. func _utf8_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, _fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  13831. bp := tls.Alloc(16)
  13832. defer tls.Free(16)
  13833. *(*uintptr)(unsafe.Pointer(bp)) = _fromLim
  13834. var bytesAvailable, bytesStorable, bytesToCopy Tptrdiff_t
  13835. var fromLimBefore uintptr
  13836. var input_incomplete, output_exhausted uint8
  13837. _, _, _, _, _, _ = bytesAvailable, bytesStorable, bytesToCopy, fromLimBefore, input_incomplete, output_exhausted
  13838. input_incomplete = uint8(m_false)
  13839. output_exhausted = uint8(m_false)
  13840. /* Avoid copying partial characters (due to limited space). */
  13841. bytesAvailable = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  13842. bytesStorable = int64(toLim) - int64(*(*uintptr)(unsafe.Pointer(toP)))
  13843. _ = enc
  13844. if bytesAvailable > bytesStorable {
  13845. *(*uintptr)(unsafe.Pointer(bp)) = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr(bytesStorable)
  13846. output_exhausted = uint8(m_true)
  13847. }
  13848. /* Avoid copying partial characters (from incomplete input). */
  13849. fromLimBefore = *(*uintptr)(unsafe.Pointer(bp))
  13850. X_INTERNAL_trim_to_complete_utf8_characters(tls, *(*uintptr)(unsafe.Pointer(fromP)), bp)
  13851. if *(*uintptr)(unsafe.Pointer(bp)) < fromLimBefore {
  13852. input_incomplete = uint8(m_true)
  13853. }
  13854. bytesToCopy = int64(*(*uintptr)(unsafe.Pointer(bp))) - int64(*(*uintptr)(unsafe.Pointer(fromP)))
  13855. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), *(*uintptr)(unsafe.Pointer(fromP)), libc.Uint64FromInt64(bytesToCopy))
  13856. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(bytesToCopy)
  13857. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(bytesToCopy)
  13858. if output_exhausted != 0 { /* needs to go first */
  13859. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  13860. } else {
  13861. if input_incomplete != 0 {
  13862. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13863. } else {
  13864. return int32(_XML_CONVERT_COMPLETED)
  13865. }
  13866. }
  13867. return r
  13868. }
  13869. func _utf8_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  13870. var from, to, v1, v2, v3, v4 uintptr
  13871. var n uint64
  13872. var res _XML_Convert_Result
  13873. _, _, _, _, _, _, _, _ = from, n, res, to, v1, v2, v3, v4
  13874. res = int32(_XML_CONVERT_COMPLETED)
  13875. to = *(*uintptr)(unsafe.Pointer(toP))
  13876. from = *(*uintptr)(unsafe.Pointer(fromP))
  13877. for from < fromLim && to < toLim {
  13878. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(from)))))) {
  13879. case int32(_BT_LEAD2):
  13880. if int64(fromLim)-int64(from) < int64(2) {
  13881. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13882. goto after
  13883. }
  13884. v1 = to
  13885. to += 2
  13886. *(*uint16)(unsafe.Pointer(v1)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x1f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f))
  13887. from += uintptr(2)
  13888. case int32(_BT_LEAD3):
  13889. if int64(fromLim)-int64(from) < int64(3) {
  13890. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13891. goto after
  13892. }
  13893. v2 = to
  13894. to += 2
  13895. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3f)<<libc.Int32FromInt32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&libc.Int32FromInt32(0x3f))
  13896. from += uintptr(3)
  13897. case int32(_BT_LEAD4):
  13898. if (int64(toLim)-int64(to))/2 < int64(2) {
  13899. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  13900. goto after
  13901. }
  13902. if int64(fromLim)-int64(from) < int64(4) {
  13903. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  13904. goto after
  13905. }
  13906. n = libc.Uint64FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&int32(0x7)<<int32(18) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&int32(0x3f)<<int32(12) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 2)))&int32(0x3f)<<int32(6) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 3)))&int32(0x3f))
  13907. n -= uint64(0x10000)
  13908. *(*uint16)(unsafe.Pointer(to)) = uint16(n>>libc.Int32FromInt32(10) | libc.Uint64FromInt32(0xD800))
  13909. *(*uint16)(unsafe.Pointer(to + 1*2)) = uint16(n&libc.Uint64FromInt32(0x3FF) | libc.Uint64FromInt32(0xDC00))
  13910. to += uintptr(2) * 2
  13911. from += uintptr(4)
  13912. default:
  13913. v3 = to
  13914. to += 2
  13915. v4 = from
  13916. from++
  13917. *(*uint16)(unsafe.Pointer(v3)) = uint16(*(*uint8)(unsafe.Pointer(v4)))
  13918. break
  13919. }
  13920. }
  13921. if from < fromLim {
  13922. res = int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  13923. }
  13924. goto after
  13925. after:
  13926. ;
  13927. *(*uintptr)(unsafe.Pointer(fromP)) = from
  13928. *(*uintptr)(unsafe.Pointer(toP)) = to
  13929. return res
  13930. }
  13931. var _utf8_encoding_ns = Tnormal_encoding{
  13932. Fenc: TENCODING{
  13933. Fscanners: [4]TSCANNER{},
  13934. FliteralScanners: [2]TSCANNER{},
  13935. FminBytesPerChar: int32(1),
  13936. FisUtf8: uint8(1),
  13937. },
  13938. Ftype1: [256]uint8{
  13939. 9: uint8(_BT_S),
  13940. 10: uint8(_BT_LF),
  13941. 13: uint8(_BT_CR),
  13942. 32: uint8(_BT_S),
  13943. 33: uint8(_BT_EXCL),
  13944. 34: uint8(_BT_QUOT),
  13945. 35: uint8(_BT_NUM),
  13946. 36: uint8(_BT_OTHER),
  13947. 37: uint8(_BT_PERCNT),
  13948. 38: uint8(_BT_AMP),
  13949. 39: uint8(_BT_APOS),
  13950. 40: uint8(_BT_LPAR),
  13951. 41: uint8(_BT_RPAR),
  13952. 42: uint8(_BT_AST),
  13953. 43: uint8(_BT_PLUS),
  13954. 44: uint8(_BT_COMMA),
  13955. 45: uint8(_BT_MINUS),
  13956. 46: uint8(_BT_NAME),
  13957. 47: uint8(_BT_SOL),
  13958. 48: uint8(_BT_DIGIT),
  13959. 49: uint8(_BT_DIGIT),
  13960. 50: uint8(_BT_DIGIT),
  13961. 51: uint8(_BT_DIGIT),
  13962. 52: uint8(_BT_DIGIT),
  13963. 53: uint8(_BT_DIGIT),
  13964. 54: uint8(_BT_DIGIT),
  13965. 55: uint8(_BT_DIGIT),
  13966. 56: uint8(_BT_DIGIT),
  13967. 57: uint8(_BT_DIGIT),
  13968. 58: uint8(_BT_COLON),
  13969. 59: uint8(_BT_SEMI),
  13970. 60: uint8(_BT_LT),
  13971. 61: uint8(_BT_EQUALS),
  13972. 62: uint8(_BT_GT),
  13973. 63: uint8(_BT_QUEST),
  13974. 64: uint8(_BT_OTHER),
  13975. 65: uint8(_BT_HEX),
  13976. 66: uint8(_BT_HEX),
  13977. 67: uint8(_BT_HEX),
  13978. 68: uint8(_BT_HEX),
  13979. 69: uint8(_BT_HEX),
  13980. 70: uint8(_BT_HEX),
  13981. 71: uint8(_BT_NMSTRT),
  13982. 72: uint8(_BT_NMSTRT),
  13983. 73: uint8(_BT_NMSTRT),
  13984. 74: uint8(_BT_NMSTRT),
  13985. 75: uint8(_BT_NMSTRT),
  13986. 76: uint8(_BT_NMSTRT),
  13987. 77: uint8(_BT_NMSTRT),
  13988. 78: uint8(_BT_NMSTRT),
  13989. 79: uint8(_BT_NMSTRT),
  13990. 80: uint8(_BT_NMSTRT),
  13991. 81: uint8(_BT_NMSTRT),
  13992. 82: uint8(_BT_NMSTRT),
  13993. 83: uint8(_BT_NMSTRT),
  13994. 84: uint8(_BT_NMSTRT),
  13995. 85: uint8(_BT_NMSTRT),
  13996. 86: uint8(_BT_NMSTRT),
  13997. 87: uint8(_BT_NMSTRT),
  13998. 88: uint8(_BT_NMSTRT),
  13999. 89: uint8(_BT_NMSTRT),
  14000. 90: uint8(_BT_NMSTRT),
  14001. 91: uint8(_BT_LSQB),
  14002. 92: uint8(_BT_OTHER),
  14003. 93: uint8(_BT_RSQB),
  14004. 94: uint8(_BT_OTHER),
  14005. 95: uint8(_BT_NMSTRT),
  14006. 96: uint8(_BT_OTHER),
  14007. 97: uint8(_BT_HEX),
  14008. 98: uint8(_BT_HEX),
  14009. 99: uint8(_BT_HEX),
  14010. 100: uint8(_BT_HEX),
  14011. 101: uint8(_BT_HEX),
  14012. 102: uint8(_BT_HEX),
  14013. 103: uint8(_BT_NMSTRT),
  14014. 104: uint8(_BT_NMSTRT),
  14015. 105: uint8(_BT_NMSTRT),
  14016. 106: uint8(_BT_NMSTRT),
  14017. 107: uint8(_BT_NMSTRT),
  14018. 108: uint8(_BT_NMSTRT),
  14019. 109: uint8(_BT_NMSTRT),
  14020. 110: uint8(_BT_NMSTRT),
  14021. 111: uint8(_BT_NMSTRT),
  14022. 112: uint8(_BT_NMSTRT),
  14023. 113: uint8(_BT_NMSTRT),
  14024. 114: uint8(_BT_NMSTRT),
  14025. 115: uint8(_BT_NMSTRT),
  14026. 116: uint8(_BT_NMSTRT),
  14027. 117: uint8(_BT_NMSTRT),
  14028. 118: uint8(_BT_NMSTRT),
  14029. 119: uint8(_BT_NMSTRT),
  14030. 120: uint8(_BT_NMSTRT),
  14031. 121: uint8(_BT_NMSTRT),
  14032. 122: uint8(_BT_NMSTRT),
  14033. 123: uint8(_BT_OTHER),
  14034. 124: uint8(_BT_VERBAR),
  14035. 125: uint8(_BT_OTHER),
  14036. 126: uint8(_BT_OTHER),
  14037. 127: uint8(_BT_OTHER),
  14038. 128: uint8(_BT_TRAIL),
  14039. 129: uint8(_BT_TRAIL),
  14040. 130: uint8(_BT_TRAIL),
  14041. 131: uint8(_BT_TRAIL),
  14042. 132: uint8(_BT_TRAIL),
  14043. 133: uint8(_BT_TRAIL),
  14044. 134: uint8(_BT_TRAIL),
  14045. 135: uint8(_BT_TRAIL),
  14046. 136: uint8(_BT_TRAIL),
  14047. 137: uint8(_BT_TRAIL),
  14048. 138: uint8(_BT_TRAIL),
  14049. 139: uint8(_BT_TRAIL),
  14050. 140: uint8(_BT_TRAIL),
  14051. 141: uint8(_BT_TRAIL),
  14052. 142: uint8(_BT_TRAIL),
  14053. 143: uint8(_BT_TRAIL),
  14054. 144: uint8(_BT_TRAIL),
  14055. 145: uint8(_BT_TRAIL),
  14056. 146: uint8(_BT_TRAIL),
  14057. 147: uint8(_BT_TRAIL),
  14058. 148: uint8(_BT_TRAIL),
  14059. 149: uint8(_BT_TRAIL),
  14060. 150: uint8(_BT_TRAIL),
  14061. 151: uint8(_BT_TRAIL),
  14062. 152: uint8(_BT_TRAIL),
  14063. 153: uint8(_BT_TRAIL),
  14064. 154: uint8(_BT_TRAIL),
  14065. 155: uint8(_BT_TRAIL),
  14066. 156: uint8(_BT_TRAIL),
  14067. 157: uint8(_BT_TRAIL),
  14068. 158: uint8(_BT_TRAIL),
  14069. 159: uint8(_BT_TRAIL),
  14070. 160: uint8(_BT_TRAIL),
  14071. 161: uint8(_BT_TRAIL),
  14072. 162: uint8(_BT_TRAIL),
  14073. 163: uint8(_BT_TRAIL),
  14074. 164: uint8(_BT_TRAIL),
  14075. 165: uint8(_BT_TRAIL),
  14076. 166: uint8(_BT_TRAIL),
  14077. 167: uint8(_BT_TRAIL),
  14078. 168: uint8(_BT_TRAIL),
  14079. 169: uint8(_BT_TRAIL),
  14080. 170: uint8(_BT_TRAIL),
  14081. 171: uint8(_BT_TRAIL),
  14082. 172: uint8(_BT_TRAIL),
  14083. 173: uint8(_BT_TRAIL),
  14084. 174: uint8(_BT_TRAIL),
  14085. 175: uint8(_BT_TRAIL),
  14086. 176: uint8(_BT_TRAIL),
  14087. 177: uint8(_BT_TRAIL),
  14088. 178: uint8(_BT_TRAIL),
  14089. 179: uint8(_BT_TRAIL),
  14090. 180: uint8(_BT_TRAIL),
  14091. 181: uint8(_BT_TRAIL),
  14092. 182: uint8(_BT_TRAIL),
  14093. 183: uint8(_BT_TRAIL),
  14094. 184: uint8(_BT_TRAIL),
  14095. 185: uint8(_BT_TRAIL),
  14096. 186: uint8(_BT_TRAIL),
  14097. 187: uint8(_BT_TRAIL),
  14098. 188: uint8(_BT_TRAIL),
  14099. 189: uint8(_BT_TRAIL),
  14100. 190: uint8(_BT_TRAIL),
  14101. 191: uint8(_BT_TRAIL),
  14102. 192: uint8(_BT_LEAD2),
  14103. 193: uint8(_BT_LEAD2),
  14104. 194: uint8(_BT_LEAD2),
  14105. 195: uint8(_BT_LEAD2),
  14106. 196: uint8(_BT_LEAD2),
  14107. 197: uint8(_BT_LEAD2),
  14108. 198: uint8(_BT_LEAD2),
  14109. 199: uint8(_BT_LEAD2),
  14110. 200: uint8(_BT_LEAD2),
  14111. 201: uint8(_BT_LEAD2),
  14112. 202: uint8(_BT_LEAD2),
  14113. 203: uint8(_BT_LEAD2),
  14114. 204: uint8(_BT_LEAD2),
  14115. 205: uint8(_BT_LEAD2),
  14116. 206: uint8(_BT_LEAD2),
  14117. 207: uint8(_BT_LEAD2),
  14118. 208: uint8(_BT_LEAD2),
  14119. 209: uint8(_BT_LEAD2),
  14120. 210: uint8(_BT_LEAD2),
  14121. 211: uint8(_BT_LEAD2),
  14122. 212: uint8(_BT_LEAD2),
  14123. 213: uint8(_BT_LEAD2),
  14124. 214: uint8(_BT_LEAD2),
  14125. 215: uint8(_BT_LEAD2),
  14126. 216: uint8(_BT_LEAD2),
  14127. 217: uint8(_BT_LEAD2),
  14128. 218: uint8(_BT_LEAD2),
  14129. 219: uint8(_BT_LEAD2),
  14130. 220: uint8(_BT_LEAD2),
  14131. 221: uint8(_BT_LEAD2),
  14132. 222: uint8(_BT_LEAD2),
  14133. 223: uint8(_BT_LEAD2),
  14134. 224: uint8(_BT_LEAD3),
  14135. 225: uint8(_BT_LEAD3),
  14136. 226: uint8(_BT_LEAD3),
  14137. 227: uint8(_BT_LEAD3),
  14138. 228: uint8(_BT_LEAD3),
  14139. 229: uint8(_BT_LEAD3),
  14140. 230: uint8(_BT_LEAD3),
  14141. 231: uint8(_BT_LEAD3),
  14142. 232: uint8(_BT_LEAD3),
  14143. 233: uint8(_BT_LEAD3),
  14144. 234: uint8(_BT_LEAD3),
  14145. 235: uint8(_BT_LEAD3),
  14146. 236: uint8(_BT_LEAD3),
  14147. 237: uint8(_BT_LEAD3),
  14148. 238: uint8(_BT_LEAD3),
  14149. 239: uint8(_BT_LEAD3),
  14150. 240: uint8(_BT_LEAD4),
  14151. 241: uint8(_BT_LEAD4),
  14152. 242: uint8(_BT_LEAD4),
  14153. 243: uint8(_BT_LEAD4),
  14154. 244: uint8(_BT_LEAD4),
  14155. 254: uint8(_BT_MALFORM),
  14156. 255: uint8(_BT_MALFORM),
  14157. },
  14158. }
  14159. func init() {
  14160. p := unsafe.Pointer(&_utf8_encoding_ns)
  14161. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14162. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14163. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14164. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14165. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14166. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14167. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14168. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14169. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14170. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14171. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14172. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14173. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14174. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14175. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14176. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14177. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14178. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14179. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14180. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14181. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14182. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14183. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14184. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14185. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14186. }
  14187. var _utf8_encoding = Tnormal_encoding{
  14188. Fenc: TENCODING{
  14189. Fscanners: [4]TSCANNER{},
  14190. FliteralScanners: [2]TSCANNER{},
  14191. FminBytesPerChar: int32(1),
  14192. FisUtf8: uint8(1),
  14193. },
  14194. Ftype1: [256]uint8{
  14195. 9: uint8(_BT_S),
  14196. 10: uint8(_BT_LF),
  14197. 13: uint8(_BT_CR),
  14198. 32: uint8(_BT_S),
  14199. 33: uint8(_BT_EXCL),
  14200. 34: uint8(_BT_QUOT),
  14201. 35: uint8(_BT_NUM),
  14202. 36: uint8(_BT_OTHER),
  14203. 37: uint8(_BT_PERCNT),
  14204. 38: uint8(_BT_AMP),
  14205. 39: uint8(_BT_APOS),
  14206. 40: uint8(_BT_LPAR),
  14207. 41: uint8(_BT_RPAR),
  14208. 42: uint8(_BT_AST),
  14209. 43: uint8(_BT_PLUS),
  14210. 44: uint8(_BT_COMMA),
  14211. 45: uint8(_BT_MINUS),
  14212. 46: uint8(_BT_NAME),
  14213. 47: uint8(_BT_SOL),
  14214. 48: uint8(_BT_DIGIT),
  14215. 49: uint8(_BT_DIGIT),
  14216. 50: uint8(_BT_DIGIT),
  14217. 51: uint8(_BT_DIGIT),
  14218. 52: uint8(_BT_DIGIT),
  14219. 53: uint8(_BT_DIGIT),
  14220. 54: uint8(_BT_DIGIT),
  14221. 55: uint8(_BT_DIGIT),
  14222. 56: uint8(_BT_DIGIT),
  14223. 57: uint8(_BT_DIGIT),
  14224. 58: uint8(_BT_NMSTRT),
  14225. 59: uint8(_BT_SEMI),
  14226. 60: uint8(_BT_LT),
  14227. 61: uint8(_BT_EQUALS),
  14228. 62: uint8(_BT_GT),
  14229. 63: uint8(_BT_QUEST),
  14230. 64: uint8(_BT_OTHER),
  14231. 65: uint8(_BT_HEX),
  14232. 66: uint8(_BT_HEX),
  14233. 67: uint8(_BT_HEX),
  14234. 68: uint8(_BT_HEX),
  14235. 69: uint8(_BT_HEX),
  14236. 70: uint8(_BT_HEX),
  14237. 71: uint8(_BT_NMSTRT),
  14238. 72: uint8(_BT_NMSTRT),
  14239. 73: uint8(_BT_NMSTRT),
  14240. 74: uint8(_BT_NMSTRT),
  14241. 75: uint8(_BT_NMSTRT),
  14242. 76: uint8(_BT_NMSTRT),
  14243. 77: uint8(_BT_NMSTRT),
  14244. 78: uint8(_BT_NMSTRT),
  14245. 79: uint8(_BT_NMSTRT),
  14246. 80: uint8(_BT_NMSTRT),
  14247. 81: uint8(_BT_NMSTRT),
  14248. 82: uint8(_BT_NMSTRT),
  14249. 83: uint8(_BT_NMSTRT),
  14250. 84: uint8(_BT_NMSTRT),
  14251. 85: uint8(_BT_NMSTRT),
  14252. 86: uint8(_BT_NMSTRT),
  14253. 87: uint8(_BT_NMSTRT),
  14254. 88: uint8(_BT_NMSTRT),
  14255. 89: uint8(_BT_NMSTRT),
  14256. 90: uint8(_BT_NMSTRT),
  14257. 91: uint8(_BT_LSQB),
  14258. 92: uint8(_BT_OTHER),
  14259. 93: uint8(_BT_RSQB),
  14260. 94: uint8(_BT_OTHER),
  14261. 95: uint8(_BT_NMSTRT),
  14262. 96: uint8(_BT_OTHER),
  14263. 97: uint8(_BT_HEX),
  14264. 98: uint8(_BT_HEX),
  14265. 99: uint8(_BT_HEX),
  14266. 100: uint8(_BT_HEX),
  14267. 101: uint8(_BT_HEX),
  14268. 102: uint8(_BT_HEX),
  14269. 103: uint8(_BT_NMSTRT),
  14270. 104: uint8(_BT_NMSTRT),
  14271. 105: uint8(_BT_NMSTRT),
  14272. 106: uint8(_BT_NMSTRT),
  14273. 107: uint8(_BT_NMSTRT),
  14274. 108: uint8(_BT_NMSTRT),
  14275. 109: uint8(_BT_NMSTRT),
  14276. 110: uint8(_BT_NMSTRT),
  14277. 111: uint8(_BT_NMSTRT),
  14278. 112: uint8(_BT_NMSTRT),
  14279. 113: uint8(_BT_NMSTRT),
  14280. 114: uint8(_BT_NMSTRT),
  14281. 115: uint8(_BT_NMSTRT),
  14282. 116: uint8(_BT_NMSTRT),
  14283. 117: uint8(_BT_NMSTRT),
  14284. 118: uint8(_BT_NMSTRT),
  14285. 119: uint8(_BT_NMSTRT),
  14286. 120: uint8(_BT_NMSTRT),
  14287. 121: uint8(_BT_NMSTRT),
  14288. 122: uint8(_BT_NMSTRT),
  14289. 123: uint8(_BT_OTHER),
  14290. 124: uint8(_BT_VERBAR),
  14291. 125: uint8(_BT_OTHER),
  14292. 126: uint8(_BT_OTHER),
  14293. 127: uint8(_BT_OTHER),
  14294. 128: uint8(_BT_TRAIL),
  14295. 129: uint8(_BT_TRAIL),
  14296. 130: uint8(_BT_TRAIL),
  14297. 131: uint8(_BT_TRAIL),
  14298. 132: uint8(_BT_TRAIL),
  14299. 133: uint8(_BT_TRAIL),
  14300. 134: uint8(_BT_TRAIL),
  14301. 135: uint8(_BT_TRAIL),
  14302. 136: uint8(_BT_TRAIL),
  14303. 137: uint8(_BT_TRAIL),
  14304. 138: uint8(_BT_TRAIL),
  14305. 139: uint8(_BT_TRAIL),
  14306. 140: uint8(_BT_TRAIL),
  14307. 141: uint8(_BT_TRAIL),
  14308. 142: uint8(_BT_TRAIL),
  14309. 143: uint8(_BT_TRAIL),
  14310. 144: uint8(_BT_TRAIL),
  14311. 145: uint8(_BT_TRAIL),
  14312. 146: uint8(_BT_TRAIL),
  14313. 147: uint8(_BT_TRAIL),
  14314. 148: uint8(_BT_TRAIL),
  14315. 149: uint8(_BT_TRAIL),
  14316. 150: uint8(_BT_TRAIL),
  14317. 151: uint8(_BT_TRAIL),
  14318. 152: uint8(_BT_TRAIL),
  14319. 153: uint8(_BT_TRAIL),
  14320. 154: uint8(_BT_TRAIL),
  14321. 155: uint8(_BT_TRAIL),
  14322. 156: uint8(_BT_TRAIL),
  14323. 157: uint8(_BT_TRAIL),
  14324. 158: uint8(_BT_TRAIL),
  14325. 159: uint8(_BT_TRAIL),
  14326. 160: uint8(_BT_TRAIL),
  14327. 161: uint8(_BT_TRAIL),
  14328. 162: uint8(_BT_TRAIL),
  14329. 163: uint8(_BT_TRAIL),
  14330. 164: uint8(_BT_TRAIL),
  14331. 165: uint8(_BT_TRAIL),
  14332. 166: uint8(_BT_TRAIL),
  14333. 167: uint8(_BT_TRAIL),
  14334. 168: uint8(_BT_TRAIL),
  14335. 169: uint8(_BT_TRAIL),
  14336. 170: uint8(_BT_TRAIL),
  14337. 171: uint8(_BT_TRAIL),
  14338. 172: uint8(_BT_TRAIL),
  14339. 173: uint8(_BT_TRAIL),
  14340. 174: uint8(_BT_TRAIL),
  14341. 175: uint8(_BT_TRAIL),
  14342. 176: uint8(_BT_TRAIL),
  14343. 177: uint8(_BT_TRAIL),
  14344. 178: uint8(_BT_TRAIL),
  14345. 179: uint8(_BT_TRAIL),
  14346. 180: uint8(_BT_TRAIL),
  14347. 181: uint8(_BT_TRAIL),
  14348. 182: uint8(_BT_TRAIL),
  14349. 183: uint8(_BT_TRAIL),
  14350. 184: uint8(_BT_TRAIL),
  14351. 185: uint8(_BT_TRAIL),
  14352. 186: uint8(_BT_TRAIL),
  14353. 187: uint8(_BT_TRAIL),
  14354. 188: uint8(_BT_TRAIL),
  14355. 189: uint8(_BT_TRAIL),
  14356. 190: uint8(_BT_TRAIL),
  14357. 191: uint8(_BT_TRAIL),
  14358. 192: uint8(_BT_LEAD2),
  14359. 193: uint8(_BT_LEAD2),
  14360. 194: uint8(_BT_LEAD2),
  14361. 195: uint8(_BT_LEAD2),
  14362. 196: uint8(_BT_LEAD2),
  14363. 197: uint8(_BT_LEAD2),
  14364. 198: uint8(_BT_LEAD2),
  14365. 199: uint8(_BT_LEAD2),
  14366. 200: uint8(_BT_LEAD2),
  14367. 201: uint8(_BT_LEAD2),
  14368. 202: uint8(_BT_LEAD2),
  14369. 203: uint8(_BT_LEAD2),
  14370. 204: uint8(_BT_LEAD2),
  14371. 205: uint8(_BT_LEAD2),
  14372. 206: uint8(_BT_LEAD2),
  14373. 207: uint8(_BT_LEAD2),
  14374. 208: uint8(_BT_LEAD2),
  14375. 209: uint8(_BT_LEAD2),
  14376. 210: uint8(_BT_LEAD2),
  14377. 211: uint8(_BT_LEAD2),
  14378. 212: uint8(_BT_LEAD2),
  14379. 213: uint8(_BT_LEAD2),
  14380. 214: uint8(_BT_LEAD2),
  14381. 215: uint8(_BT_LEAD2),
  14382. 216: uint8(_BT_LEAD2),
  14383. 217: uint8(_BT_LEAD2),
  14384. 218: uint8(_BT_LEAD2),
  14385. 219: uint8(_BT_LEAD2),
  14386. 220: uint8(_BT_LEAD2),
  14387. 221: uint8(_BT_LEAD2),
  14388. 222: uint8(_BT_LEAD2),
  14389. 223: uint8(_BT_LEAD2),
  14390. 224: uint8(_BT_LEAD3),
  14391. 225: uint8(_BT_LEAD3),
  14392. 226: uint8(_BT_LEAD3),
  14393. 227: uint8(_BT_LEAD3),
  14394. 228: uint8(_BT_LEAD3),
  14395. 229: uint8(_BT_LEAD3),
  14396. 230: uint8(_BT_LEAD3),
  14397. 231: uint8(_BT_LEAD3),
  14398. 232: uint8(_BT_LEAD3),
  14399. 233: uint8(_BT_LEAD3),
  14400. 234: uint8(_BT_LEAD3),
  14401. 235: uint8(_BT_LEAD3),
  14402. 236: uint8(_BT_LEAD3),
  14403. 237: uint8(_BT_LEAD3),
  14404. 238: uint8(_BT_LEAD3),
  14405. 239: uint8(_BT_LEAD3),
  14406. 240: uint8(_BT_LEAD4),
  14407. 241: uint8(_BT_LEAD4),
  14408. 242: uint8(_BT_LEAD4),
  14409. 243: uint8(_BT_LEAD4),
  14410. 244: uint8(_BT_LEAD4),
  14411. 254: uint8(_BT_MALFORM),
  14412. 255: uint8(_BT_MALFORM),
  14413. },
  14414. }
  14415. func init() {
  14416. p := unsafe.Pointer(&_utf8_encoding)
  14417. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14418. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14419. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14420. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14421. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14422. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14423. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14424. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14425. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14426. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14427. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14428. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14429. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14430. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14431. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14432. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14433. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14434. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14435. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14436. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14437. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14438. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14439. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14440. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14441. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14442. }
  14443. var _internal_utf8_encoding_ns = Tnormal_encoding{
  14444. Fenc: TENCODING{
  14445. Fscanners: [4]TSCANNER{},
  14446. FliteralScanners: [2]TSCANNER{},
  14447. FminBytesPerChar: int32(1),
  14448. FisUtf8: uint8(1),
  14449. },
  14450. Ftype1: [256]uint8{
  14451. 9: uint8(_BT_S),
  14452. 10: uint8(_BT_LF),
  14453. 13: uint8(_BT_S),
  14454. 32: uint8(_BT_S),
  14455. 33: uint8(_BT_EXCL),
  14456. 34: uint8(_BT_QUOT),
  14457. 35: uint8(_BT_NUM),
  14458. 36: uint8(_BT_OTHER),
  14459. 37: uint8(_BT_PERCNT),
  14460. 38: uint8(_BT_AMP),
  14461. 39: uint8(_BT_APOS),
  14462. 40: uint8(_BT_LPAR),
  14463. 41: uint8(_BT_RPAR),
  14464. 42: uint8(_BT_AST),
  14465. 43: uint8(_BT_PLUS),
  14466. 44: uint8(_BT_COMMA),
  14467. 45: uint8(_BT_MINUS),
  14468. 46: uint8(_BT_NAME),
  14469. 47: uint8(_BT_SOL),
  14470. 48: uint8(_BT_DIGIT),
  14471. 49: uint8(_BT_DIGIT),
  14472. 50: uint8(_BT_DIGIT),
  14473. 51: uint8(_BT_DIGIT),
  14474. 52: uint8(_BT_DIGIT),
  14475. 53: uint8(_BT_DIGIT),
  14476. 54: uint8(_BT_DIGIT),
  14477. 55: uint8(_BT_DIGIT),
  14478. 56: uint8(_BT_DIGIT),
  14479. 57: uint8(_BT_DIGIT),
  14480. 58: uint8(_BT_COLON),
  14481. 59: uint8(_BT_SEMI),
  14482. 60: uint8(_BT_LT),
  14483. 61: uint8(_BT_EQUALS),
  14484. 62: uint8(_BT_GT),
  14485. 63: uint8(_BT_QUEST),
  14486. 64: uint8(_BT_OTHER),
  14487. 65: uint8(_BT_HEX),
  14488. 66: uint8(_BT_HEX),
  14489. 67: uint8(_BT_HEX),
  14490. 68: uint8(_BT_HEX),
  14491. 69: uint8(_BT_HEX),
  14492. 70: uint8(_BT_HEX),
  14493. 71: uint8(_BT_NMSTRT),
  14494. 72: uint8(_BT_NMSTRT),
  14495. 73: uint8(_BT_NMSTRT),
  14496. 74: uint8(_BT_NMSTRT),
  14497. 75: uint8(_BT_NMSTRT),
  14498. 76: uint8(_BT_NMSTRT),
  14499. 77: uint8(_BT_NMSTRT),
  14500. 78: uint8(_BT_NMSTRT),
  14501. 79: uint8(_BT_NMSTRT),
  14502. 80: uint8(_BT_NMSTRT),
  14503. 81: uint8(_BT_NMSTRT),
  14504. 82: uint8(_BT_NMSTRT),
  14505. 83: uint8(_BT_NMSTRT),
  14506. 84: uint8(_BT_NMSTRT),
  14507. 85: uint8(_BT_NMSTRT),
  14508. 86: uint8(_BT_NMSTRT),
  14509. 87: uint8(_BT_NMSTRT),
  14510. 88: uint8(_BT_NMSTRT),
  14511. 89: uint8(_BT_NMSTRT),
  14512. 90: uint8(_BT_NMSTRT),
  14513. 91: uint8(_BT_LSQB),
  14514. 92: uint8(_BT_OTHER),
  14515. 93: uint8(_BT_RSQB),
  14516. 94: uint8(_BT_OTHER),
  14517. 95: uint8(_BT_NMSTRT),
  14518. 96: uint8(_BT_OTHER),
  14519. 97: uint8(_BT_HEX),
  14520. 98: uint8(_BT_HEX),
  14521. 99: uint8(_BT_HEX),
  14522. 100: uint8(_BT_HEX),
  14523. 101: uint8(_BT_HEX),
  14524. 102: uint8(_BT_HEX),
  14525. 103: uint8(_BT_NMSTRT),
  14526. 104: uint8(_BT_NMSTRT),
  14527. 105: uint8(_BT_NMSTRT),
  14528. 106: uint8(_BT_NMSTRT),
  14529. 107: uint8(_BT_NMSTRT),
  14530. 108: uint8(_BT_NMSTRT),
  14531. 109: uint8(_BT_NMSTRT),
  14532. 110: uint8(_BT_NMSTRT),
  14533. 111: uint8(_BT_NMSTRT),
  14534. 112: uint8(_BT_NMSTRT),
  14535. 113: uint8(_BT_NMSTRT),
  14536. 114: uint8(_BT_NMSTRT),
  14537. 115: uint8(_BT_NMSTRT),
  14538. 116: uint8(_BT_NMSTRT),
  14539. 117: uint8(_BT_NMSTRT),
  14540. 118: uint8(_BT_NMSTRT),
  14541. 119: uint8(_BT_NMSTRT),
  14542. 120: uint8(_BT_NMSTRT),
  14543. 121: uint8(_BT_NMSTRT),
  14544. 122: uint8(_BT_NMSTRT),
  14545. 123: uint8(_BT_OTHER),
  14546. 124: uint8(_BT_VERBAR),
  14547. 125: uint8(_BT_OTHER),
  14548. 126: uint8(_BT_OTHER),
  14549. 127: uint8(_BT_OTHER),
  14550. 128: uint8(_BT_TRAIL),
  14551. 129: uint8(_BT_TRAIL),
  14552. 130: uint8(_BT_TRAIL),
  14553. 131: uint8(_BT_TRAIL),
  14554. 132: uint8(_BT_TRAIL),
  14555. 133: uint8(_BT_TRAIL),
  14556. 134: uint8(_BT_TRAIL),
  14557. 135: uint8(_BT_TRAIL),
  14558. 136: uint8(_BT_TRAIL),
  14559. 137: uint8(_BT_TRAIL),
  14560. 138: uint8(_BT_TRAIL),
  14561. 139: uint8(_BT_TRAIL),
  14562. 140: uint8(_BT_TRAIL),
  14563. 141: uint8(_BT_TRAIL),
  14564. 142: uint8(_BT_TRAIL),
  14565. 143: uint8(_BT_TRAIL),
  14566. 144: uint8(_BT_TRAIL),
  14567. 145: uint8(_BT_TRAIL),
  14568. 146: uint8(_BT_TRAIL),
  14569. 147: uint8(_BT_TRAIL),
  14570. 148: uint8(_BT_TRAIL),
  14571. 149: uint8(_BT_TRAIL),
  14572. 150: uint8(_BT_TRAIL),
  14573. 151: uint8(_BT_TRAIL),
  14574. 152: uint8(_BT_TRAIL),
  14575. 153: uint8(_BT_TRAIL),
  14576. 154: uint8(_BT_TRAIL),
  14577. 155: uint8(_BT_TRAIL),
  14578. 156: uint8(_BT_TRAIL),
  14579. 157: uint8(_BT_TRAIL),
  14580. 158: uint8(_BT_TRAIL),
  14581. 159: uint8(_BT_TRAIL),
  14582. 160: uint8(_BT_TRAIL),
  14583. 161: uint8(_BT_TRAIL),
  14584. 162: uint8(_BT_TRAIL),
  14585. 163: uint8(_BT_TRAIL),
  14586. 164: uint8(_BT_TRAIL),
  14587. 165: uint8(_BT_TRAIL),
  14588. 166: uint8(_BT_TRAIL),
  14589. 167: uint8(_BT_TRAIL),
  14590. 168: uint8(_BT_TRAIL),
  14591. 169: uint8(_BT_TRAIL),
  14592. 170: uint8(_BT_TRAIL),
  14593. 171: uint8(_BT_TRAIL),
  14594. 172: uint8(_BT_TRAIL),
  14595. 173: uint8(_BT_TRAIL),
  14596. 174: uint8(_BT_TRAIL),
  14597. 175: uint8(_BT_TRAIL),
  14598. 176: uint8(_BT_TRAIL),
  14599. 177: uint8(_BT_TRAIL),
  14600. 178: uint8(_BT_TRAIL),
  14601. 179: uint8(_BT_TRAIL),
  14602. 180: uint8(_BT_TRAIL),
  14603. 181: uint8(_BT_TRAIL),
  14604. 182: uint8(_BT_TRAIL),
  14605. 183: uint8(_BT_TRAIL),
  14606. 184: uint8(_BT_TRAIL),
  14607. 185: uint8(_BT_TRAIL),
  14608. 186: uint8(_BT_TRAIL),
  14609. 187: uint8(_BT_TRAIL),
  14610. 188: uint8(_BT_TRAIL),
  14611. 189: uint8(_BT_TRAIL),
  14612. 190: uint8(_BT_TRAIL),
  14613. 191: uint8(_BT_TRAIL),
  14614. 192: uint8(_BT_LEAD2),
  14615. 193: uint8(_BT_LEAD2),
  14616. 194: uint8(_BT_LEAD2),
  14617. 195: uint8(_BT_LEAD2),
  14618. 196: uint8(_BT_LEAD2),
  14619. 197: uint8(_BT_LEAD2),
  14620. 198: uint8(_BT_LEAD2),
  14621. 199: uint8(_BT_LEAD2),
  14622. 200: uint8(_BT_LEAD2),
  14623. 201: uint8(_BT_LEAD2),
  14624. 202: uint8(_BT_LEAD2),
  14625. 203: uint8(_BT_LEAD2),
  14626. 204: uint8(_BT_LEAD2),
  14627. 205: uint8(_BT_LEAD2),
  14628. 206: uint8(_BT_LEAD2),
  14629. 207: uint8(_BT_LEAD2),
  14630. 208: uint8(_BT_LEAD2),
  14631. 209: uint8(_BT_LEAD2),
  14632. 210: uint8(_BT_LEAD2),
  14633. 211: uint8(_BT_LEAD2),
  14634. 212: uint8(_BT_LEAD2),
  14635. 213: uint8(_BT_LEAD2),
  14636. 214: uint8(_BT_LEAD2),
  14637. 215: uint8(_BT_LEAD2),
  14638. 216: uint8(_BT_LEAD2),
  14639. 217: uint8(_BT_LEAD2),
  14640. 218: uint8(_BT_LEAD2),
  14641. 219: uint8(_BT_LEAD2),
  14642. 220: uint8(_BT_LEAD2),
  14643. 221: uint8(_BT_LEAD2),
  14644. 222: uint8(_BT_LEAD2),
  14645. 223: uint8(_BT_LEAD2),
  14646. 224: uint8(_BT_LEAD3),
  14647. 225: uint8(_BT_LEAD3),
  14648. 226: uint8(_BT_LEAD3),
  14649. 227: uint8(_BT_LEAD3),
  14650. 228: uint8(_BT_LEAD3),
  14651. 229: uint8(_BT_LEAD3),
  14652. 230: uint8(_BT_LEAD3),
  14653. 231: uint8(_BT_LEAD3),
  14654. 232: uint8(_BT_LEAD3),
  14655. 233: uint8(_BT_LEAD3),
  14656. 234: uint8(_BT_LEAD3),
  14657. 235: uint8(_BT_LEAD3),
  14658. 236: uint8(_BT_LEAD3),
  14659. 237: uint8(_BT_LEAD3),
  14660. 238: uint8(_BT_LEAD3),
  14661. 239: uint8(_BT_LEAD3),
  14662. 240: uint8(_BT_LEAD4),
  14663. 241: uint8(_BT_LEAD4),
  14664. 242: uint8(_BT_LEAD4),
  14665. 243: uint8(_BT_LEAD4),
  14666. 244: uint8(_BT_LEAD4),
  14667. 254: uint8(_BT_MALFORM),
  14668. 255: uint8(_BT_MALFORM),
  14669. },
  14670. }
  14671. func init() {
  14672. p := unsafe.Pointer(&_internal_utf8_encoding_ns)
  14673. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14674. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14675. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14676. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14677. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14678. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14679. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14680. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14681. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14682. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14683. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14684. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14685. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14686. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14687. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14688. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14689. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14690. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14691. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14692. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14693. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14694. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14695. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14696. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14697. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14698. }
  14699. var _internal_utf8_encoding = Tnormal_encoding{
  14700. Fenc: TENCODING{
  14701. Fscanners: [4]TSCANNER{},
  14702. FliteralScanners: [2]TSCANNER{},
  14703. FminBytesPerChar: int32(1),
  14704. FisUtf8: uint8(1),
  14705. },
  14706. Ftype1: [256]uint8{
  14707. 9: uint8(_BT_S),
  14708. 10: uint8(_BT_LF),
  14709. 13: uint8(_BT_S),
  14710. 32: uint8(_BT_S),
  14711. 33: uint8(_BT_EXCL),
  14712. 34: uint8(_BT_QUOT),
  14713. 35: uint8(_BT_NUM),
  14714. 36: uint8(_BT_OTHER),
  14715. 37: uint8(_BT_PERCNT),
  14716. 38: uint8(_BT_AMP),
  14717. 39: uint8(_BT_APOS),
  14718. 40: uint8(_BT_LPAR),
  14719. 41: uint8(_BT_RPAR),
  14720. 42: uint8(_BT_AST),
  14721. 43: uint8(_BT_PLUS),
  14722. 44: uint8(_BT_COMMA),
  14723. 45: uint8(_BT_MINUS),
  14724. 46: uint8(_BT_NAME),
  14725. 47: uint8(_BT_SOL),
  14726. 48: uint8(_BT_DIGIT),
  14727. 49: uint8(_BT_DIGIT),
  14728. 50: uint8(_BT_DIGIT),
  14729. 51: uint8(_BT_DIGIT),
  14730. 52: uint8(_BT_DIGIT),
  14731. 53: uint8(_BT_DIGIT),
  14732. 54: uint8(_BT_DIGIT),
  14733. 55: uint8(_BT_DIGIT),
  14734. 56: uint8(_BT_DIGIT),
  14735. 57: uint8(_BT_DIGIT),
  14736. 58: uint8(_BT_NMSTRT),
  14737. 59: uint8(_BT_SEMI),
  14738. 60: uint8(_BT_LT),
  14739. 61: uint8(_BT_EQUALS),
  14740. 62: uint8(_BT_GT),
  14741. 63: uint8(_BT_QUEST),
  14742. 64: uint8(_BT_OTHER),
  14743. 65: uint8(_BT_HEX),
  14744. 66: uint8(_BT_HEX),
  14745. 67: uint8(_BT_HEX),
  14746. 68: uint8(_BT_HEX),
  14747. 69: uint8(_BT_HEX),
  14748. 70: uint8(_BT_HEX),
  14749. 71: uint8(_BT_NMSTRT),
  14750. 72: uint8(_BT_NMSTRT),
  14751. 73: uint8(_BT_NMSTRT),
  14752. 74: uint8(_BT_NMSTRT),
  14753. 75: uint8(_BT_NMSTRT),
  14754. 76: uint8(_BT_NMSTRT),
  14755. 77: uint8(_BT_NMSTRT),
  14756. 78: uint8(_BT_NMSTRT),
  14757. 79: uint8(_BT_NMSTRT),
  14758. 80: uint8(_BT_NMSTRT),
  14759. 81: uint8(_BT_NMSTRT),
  14760. 82: uint8(_BT_NMSTRT),
  14761. 83: uint8(_BT_NMSTRT),
  14762. 84: uint8(_BT_NMSTRT),
  14763. 85: uint8(_BT_NMSTRT),
  14764. 86: uint8(_BT_NMSTRT),
  14765. 87: uint8(_BT_NMSTRT),
  14766. 88: uint8(_BT_NMSTRT),
  14767. 89: uint8(_BT_NMSTRT),
  14768. 90: uint8(_BT_NMSTRT),
  14769. 91: uint8(_BT_LSQB),
  14770. 92: uint8(_BT_OTHER),
  14771. 93: uint8(_BT_RSQB),
  14772. 94: uint8(_BT_OTHER),
  14773. 95: uint8(_BT_NMSTRT),
  14774. 96: uint8(_BT_OTHER),
  14775. 97: uint8(_BT_HEX),
  14776. 98: uint8(_BT_HEX),
  14777. 99: uint8(_BT_HEX),
  14778. 100: uint8(_BT_HEX),
  14779. 101: uint8(_BT_HEX),
  14780. 102: uint8(_BT_HEX),
  14781. 103: uint8(_BT_NMSTRT),
  14782. 104: uint8(_BT_NMSTRT),
  14783. 105: uint8(_BT_NMSTRT),
  14784. 106: uint8(_BT_NMSTRT),
  14785. 107: uint8(_BT_NMSTRT),
  14786. 108: uint8(_BT_NMSTRT),
  14787. 109: uint8(_BT_NMSTRT),
  14788. 110: uint8(_BT_NMSTRT),
  14789. 111: uint8(_BT_NMSTRT),
  14790. 112: uint8(_BT_NMSTRT),
  14791. 113: uint8(_BT_NMSTRT),
  14792. 114: uint8(_BT_NMSTRT),
  14793. 115: uint8(_BT_NMSTRT),
  14794. 116: uint8(_BT_NMSTRT),
  14795. 117: uint8(_BT_NMSTRT),
  14796. 118: uint8(_BT_NMSTRT),
  14797. 119: uint8(_BT_NMSTRT),
  14798. 120: uint8(_BT_NMSTRT),
  14799. 121: uint8(_BT_NMSTRT),
  14800. 122: uint8(_BT_NMSTRT),
  14801. 123: uint8(_BT_OTHER),
  14802. 124: uint8(_BT_VERBAR),
  14803. 125: uint8(_BT_OTHER),
  14804. 126: uint8(_BT_OTHER),
  14805. 127: uint8(_BT_OTHER),
  14806. 128: uint8(_BT_TRAIL),
  14807. 129: uint8(_BT_TRAIL),
  14808. 130: uint8(_BT_TRAIL),
  14809. 131: uint8(_BT_TRAIL),
  14810. 132: uint8(_BT_TRAIL),
  14811. 133: uint8(_BT_TRAIL),
  14812. 134: uint8(_BT_TRAIL),
  14813. 135: uint8(_BT_TRAIL),
  14814. 136: uint8(_BT_TRAIL),
  14815. 137: uint8(_BT_TRAIL),
  14816. 138: uint8(_BT_TRAIL),
  14817. 139: uint8(_BT_TRAIL),
  14818. 140: uint8(_BT_TRAIL),
  14819. 141: uint8(_BT_TRAIL),
  14820. 142: uint8(_BT_TRAIL),
  14821. 143: uint8(_BT_TRAIL),
  14822. 144: uint8(_BT_TRAIL),
  14823. 145: uint8(_BT_TRAIL),
  14824. 146: uint8(_BT_TRAIL),
  14825. 147: uint8(_BT_TRAIL),
  14826. 148: uint8(_BT_TRAIL),
  14827. 149: uint8(_BT_TRAIL),
  14828. 150: uint8(_BT_TRAIL),
  14829. 151: uint8(_BT_TRAIL),
  14830. 152: uint8(_BT_TRAIL),
  14831. 153: uint8(_BT_TRAIL),
  14832. 154: uint8(_BT_TRAIL),
  14833. 155: uint8(_BT_TRAIL),
  14834. 156: uint8(_BT_TRAIL),
  14835. 157: uint8(_BT_TRAIL),
  14836. 158: uint8(_BT_TRAIL),
  14837. 159: uint8(_BT_TRAIL),
  14838. 160: uint8(_BT_TRAIL),
  14839. 161: uint8(_BT_TRAIL),
  14840. 162: uint8(_BT_TRAIL),
  14841. 163: uint8(_BT_TRAIL),
  14842. 164: uint8(_BT_TRAIL),
  14843. 165: uint8(_BT_TRAIL),
  14844. 166: uint8(_BT_TRAIL),
  14845. 167: uint8(_BT_TRAIL),
  14846. 168: uint8(_BT_TRAIL),
  14847. 169: uint8(_BT_TRAIL),
  14848. 170: uint8(_BT_TRAIL),
  14849. 171: uint8(_BT_TRAIL),
  14850. 172: uint8(_BT_TRAIL),
  14851. 173: uint8(_BT_TRAIL),
  14852. 174: uint8(_BT_TRAIL),
  14853. 175: uint8(_BT_TRAIL),
  14854. 176: uint8(_BT_TRAIL),
  14855. 177: uint8(_BT_TRAIL),
  14856. 178: uint8(_BT_TRAIL),
  14857. 179: uint8(_BT_TRAIL),
  14858. 180: uint8(_BT_TRAIL),
  14859. 181: uint8(_BT_TRAIL),
  14860. 182: uint8(_BT_TRAIL),
  14861. 183: uint8(_BT_TRAIL),
  14862. 184: uint8(_BT_TRAIL),
  14863. 185: uint8(_BT_TRAIL),
  14864. 186: uint8(_BT_TRAIL),
  14865. 187: uint8(_BT_TRAIL),
  14866. 188: uint8(_BT_TRAIL),
  14867. 189: uint8(_BT_TRAIL),
  14868. 190: uint8(_BT_TRAIL),
  14869. 191: uint8(_BT_TRAIL),
  14870. 192: uint8(_BT_LEAD2),
  14871. 193: uint8(_BT_LEAD2),
  14872. 194: uint8(_BT_LEAD2),
  14873. 195: uint8(_BT_LEAD2),
  14874. 196: uint8(_BT_LEAD2),
  14875. 197: uint8(_BT_LEAD2),
  14876. 198: uint8(_BT_LEAD2),
  14877. 199: uint8(_BT_LEAD2),
  14878. 200: uint8(_BT_LEAD2),
  14879. 201: uint8(_BT_LEAD2),
  14880. 202: uint8(_BT_LEAD2),
  14881. 203: uint8(_BT_LEAD2),
  14882. 204: uint8(_BT_LEAD2),
  14883. 205: uint8(_BT_LEAD2),
  14884. 206: uint8(_BT_LEAD2),
  14885. 207: uint8(_BT_LEAD2),
  14886. 208: uint8(_BT_LEAD2),
  14887. 209: uint8(_BT_LEAD2),
  14888. 210: uint8(_BT_LEAD2),
  14889. 211: uint8(_BT_LEAD2),
  14890. 212: uint8(_BT_LEAD2),
  14891. 213: uint8(_BT_LEAD2),
  14892. 214: uint8(_BT_LEAD2),
  14893. 215: uint8(_BT_LEAD2),
  14894. 216: uint8(_BT_LEAD2),
  14895. 217: uint8(_BT_LEAD2),
  14896. 218: uint8(_BT_LEAD2),
  14897. 219: uint8(_BT_LEAD2),
  14898. 220: uint8(_BT_LEAD2),
  14899. 221: uint8(_BT_LEAD2),
  14900. 222: uint8(_BT_LEAD2),
  14901. 223: uint8(_BT_LEAD2),
  14902. 224: uint8(_BT_LEAD3),
  14903. 225: uint8(_BT_LEAD3),
  14904. 226: uint8(_BT_LEAD3),
  14905. 227: uint8(_BT_LEAD3),
  14906. 228: uint8(_BT_LEAD3),
  14907. 229: uint8(_BT_LEAD3),
  14908. 230: uint8(_BT_LEAD3),
  14909. 231: uint8(_BT_LEAD3),
  14910. 232: uint8(_BT_LEAD3),
  14911. 233: uint8(_BT_LEAD3),
  14912. 234: uint8(_BT_LEAD3),
  14913. 235: uint8(_BT_LEAD3),
  14914. 236: uint8(_BT_LEAD3),
  14915. 237: uint8(_BT_LEAD3),
  14916. 238: uint8(_BT_LEAD3),
  14917. 239: uint8(_BT_LEAD3),
  14918. 240: uint8(_BT_LEAD4),
  14919. 241: uint8(_BT_LEAD4),
  14920. 242: uint8(_BT_LEAD4),
  14921. 243: uint8(_BT_LEAD4),
  14922. 244: uint8(_BT_LEAD4),
  14923. 254: uint8(_BT_MALFORM),
  14924. 255: uint8(_BT_MALFORM),
  14925. },
  14926. }
  14927. func init() {
  14928. p := unsafe.Pointer(&_internal_utf8_encoding)
  14929. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  14930. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  14931. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  14932. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  14933. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  14934. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  14935. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  14936. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  14937. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  14938. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  14939. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  14940. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  14941. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  14942. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  14943. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_utf8_toUtf8)
  14944. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_utf8_toUtf16)
  14945. *(*uintptr)(unsafe.Add(p, 392)) = __ccgo_fp(_utf8_isName2)
  14946. *(*uintptr)(unsafe.Add(p, 400)) = __ccgo_fp(_utf8_isName3)
  14947. *(*uintptr)(unsafe.Add(p, 408)) = __ccgo_fp(_isNever)
  14948. *(*uintptr)(unsafe.Add(p, 416)) = __ccgo_fp(_utf8_isNmstrt2)
  14949. *(*uintptr)(unsafe.Add(p, 424)) = __ccgo_fp(_utf8_isNmstrt3)
  14950. *(*uintptr)(unsafe.Add(p, 432)) = __ccgo_fp(_isNever)
  14951. *(*uintptr)(unsafe.Add(p, 440)) = __ccgo_fp(_utf8_isInvalid2)
  14952. *(*uintptr)(unsafe.Add(p, 448)) = __ccgo_fp(_utf8_isInvalid3)
  14953. *(*uintptr)(unsafe.Add(p, 456)) = __ccgo_fp(_utf8_isInvalid4)
  14954. }
  14955. func _latin1_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  14956. var c uint8
  14957. var v2, v3, v4, v5, v6, v7, v8, v9 uintptr
  14958. _, _, _, _, _, _, _, _, _ = c, v2, v3, v4, v5, v6, v7, v8, v9
  14959. _ = enc
  14960. for {
  14961. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  14962. return int32(_XML_CONVERT_COMPLETED)
  14963. }
  14964. c = *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))
  14965. if libc.Int32FromUint8(c)&int32(0x80) != 0 {
  14966. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  14967. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  14968. }
  14969. v3 = toP
  14970. v2 = *(*uintptr)(unsafe.Pointer(v3))
  14971. *(*uintptr)(unsafe.Pointer(v3))++
  14972. *(*uint8)(unsafe.Pointer(v2)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  14973. v5 = toP
  14974. v4 = *(*uintptr)(unsafe.Pointer(v5))
  14975. *(*uintptr)(unsafe.Pointer(v5))++
  14976. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(c)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  14977. *(*uintptr)(unsafe.Pointer(fromP))++
  14978. } else {
  14979. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  14980. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  14981. }
  14982. v7 = toP
  14983. v6 = *(*uintptr)(unsafe.Pointer(v7))
  14984. *(*uintptr)(unsafe.Pointer(v7))++
  14985. v9 = fromP
  14986. v8 = *(*uintptr)(unsafe.Pointer(v9))
  14987. *(*uintptr)(unsafe.Pointer(v9))++
  14988. *(*uint8)(unsafe.Pointer(v6)) = *(*uint8)(unsafe.Pointer(v8))
  14989. }
  14990. goto _1
  14991. _1:
  14992. }
  14993. return r
  14994. }
  14995. func _latin1_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  14996. var v1, v2, v3, v4 uintptr
  14997. _, _, _, _ = v1, v2, v3, v4
  14998. _ = enc
  14999. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  15000. v2 = toP
  15001. v1 = *(*uintptr)(unsafe.Pointer(v2))
  15002. *(*uintptr)(unsafe.Pointer(v2)) += 2
  15003. v4 = fromP
  15004. v3 = *(*uintptr)(unsafe.Pointer(v4))
  15005. *(*uintptr)(unsafe.Pointer(v4))++
  15006. *(*uint16)(unsafe.Pointer(v1)) = uint16(*(*uint8)(unsafe.Pointer(v3)))
  15007. }
  15008. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  15009. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15010. } else {
  15011. return int32(_XML_CONVERT_COMPLETED)
  15012. }
  15013. return r
  15014. }
  15015. var _latin1_encoding_ns = Tnormal_encoding{
  15016. Fenc: TENCODING{
  15017. Fscanners: [4]TSCANNER{},
  15018. FliteralScanners: [2]TSCANNER{},
  15019. FminBytesPerChar: int32(1),
  15020. },
  15021. Ftype1: [256]uint8{
  15022. 9: uint8(_BT_S),
  15023. 10: uint8(_BT_LF),
  15024. 13: uint8(_BT_CR),
  15025. 32: uint8(_BT_S),
  15026. 33: uint8(_BT_EXCL),
  15027. 34: uint8(_BT_QUOT),
  15028. 35: uint8(_BT_NUM),
  15029. 36: uint8(_BT_OTHER),
  15030. 37: uint8(_BT_PERCNT),
  15031. 38: uint8(_BT_AMP),
  15032. 39: uint8(_BT_APOS),
  15033. 40: uint8(_BT_LPAR),
  15034. 41: uint8(_BT_RPAR),
  15035. 42: uint8(_BT_AST),
  15036. 43: uint8(_BT_PLUS),
  15037. 44: uint8(_BT_COMMA),
  15038. 45: uint8(_BT_MINUS),
  15039. 46: uint8(_BT_NAME),
  15040. 47: uint8(_BT_SOL),
  15041. 48: uint8(_BT_DIGIT),
  15042. 49: uint8(_BT_DIGIT),
  15043. 50: uint8(_BT_DIGIT),
  15044. 51: uint8(_BT_DIGIT),
  15045. 52: uint8(_BT_DIGIT),
  15046. 53: uint8(_BT_DIGIT),
  15047. 54: uint8(_BT_DIGIT),
  15048. 55: uint8(_BT_DIGIT),
  15049. 56: uint8(_BT_DIGIT),
  15050. 57: uint8(_BT_DIGIT),
  15051. 58: uint8(_BT_COLON),
  15052. 59: uint8(_BT_SEMI),
  15053. 60: uint8(_BT_LT),
  15054. 61: uint8(_BT_EQUALS),
  15055. 62: uint8(_BT_GT),
  15056. 63: uint8(_BT_QUEST),
  15057. 64: uint8(_BT_OTHER),
  15058. 65: uint8(_BT_HEX),
  15059. 66: uint8(_BT_HEX),
  15060. 67: uint8(_BT_HEX),
  15061. 68: uint8(_BT_HEX),
  15062. 69: uint8(_BT_HEX),
  15063. 70: uint8(_BT_HEX),
  15064. 71: uint8(_BT_NMSTRT),
  15065. 72: uint8(_BT_NMSTRT),
  15066. 73: uint8(_BT_NMSTRT),
  15067. 74: uint8(_BT_NMSTRT),
  15068. 75: uint8(_BT_NMSTRT),
  15069. 76: uint8(_BT_NMSTRT),
  15070. 77: uint8(_BT_NMSTRT),
  15071. 78: uint8(_BT_NMSTRT),
  15072. 79: uint8(_BT_NMSTRT),
  15073. 80: uint8(_BT_NMSTRT),
  15074. 81: uint8(_BT_NMSTRT),
  15075. 82: uint8(_BT_NMSTRT),
  15076. 83: uint8(_BT_NMSTRT),
  15077. 84: uint8(_BT_NMSTRT),
  15078. 85: uint8(_BT_NMSTRT),
  15079. 86: uint8(_BT_NMSTRT),
  15080. 87: uint8(_BT_NMSTRT),
  15081. 88: uint8(_BT_NMSTRT),
  15082. 89: uint8(_BT_NMSTRT),
  15083. 90: uint8(_BT_NMSTRT),
  15084. 91: uint8(_BT_LSQB),
  15085. 92: uint8(_BT_OTHER),
  15086. 93: uint8(_BT_RSQB),
  15087. 94: uint8(_BT_OTHER),
  15088. 95: uint8(_BT_NMSTRT),
  15089. 96: uint8(_BT_OTHER),
  15090. 97: uint8(_BT_HEX),
  15091. 98: uint8(_BT_HEX),
  15092. 99: uint8(_BT_HEX),
  15093. 100: uint8(_BT_HEX),
  15094. 101: uint8(_BT_HEX),
  15095. 102: uint8(_BT_HEX),
  15096. 103: uint8(_BT_NMSTRT),
  15097. 104: uint8(_BT_NMSTRT),
  15098. 105: uint8(_BT_NMSTRT),
  15099. 106: uint8(_BT_NMSTRT),
  15100. 107: uint8(_BT_NMSTRT),
  15101. 108: uint8(_BT_NMSTRT),
  15102. 109: uint8(_BT_NMSTRT),
  15103. 110: uint8(_BT_NMSTRT),
  15104. 111: uint8(_BT_NMSTRT),
  15105. 112: uint8(_BT_NMSTRT),
  15106. 113: uint8(_BT_NMSTRT),
  15107. 114: uint8(_BT_NMSTRT),
  15108. 115: uint8(_BT_NMSTRT),
  15109. 116: uint8(_BT_NMSTRT),
  15110. 117: uint8(_BT_NMSTRT),
  15111. 118: uint8(_BT_NMSTRT),
  15112. 119: uint8(_BT_NMSTRT),
  15113. 120: uint8(_BT_NMSTRT),
  15114. 121: uint8(_BT_NMSTRT),
  15115. 122: uint8(_BT_NMSTRT),
  15116. 123: uint8(_BT_OTHER),
  15117. 124: uint8(_BT_VERBAR),
  15118. 125: uint8(_BT_OTHER),
  15119. 126: uint8(_BT_OTHER),
  15120. 127: uint8(_BT_OTHER),
  15121. 128: uint8(_BT_OTHER),
  15122. 129: uint8(_BT_OTHER),
  15123. 130: uint8(_BT_OTHER),
  15124. 131: uint8(_BT_OTHER),
  15125. 132: uint8(_BT_OTHER),
  15126. 133: uint8(_BT_OTHER),
  15127. 134: uint8(_BT_OTHER),
  15128. 135: uint8(_BT_OTHER),
  15129. 136: uint8(_BT_OTHER),
  15130. 137: uint8(_BT_OTHER),
  15131. 138: uint8(_BT_OTHER),
  15132. 139: uint8(_BT_OTHER),
  15133. 140: uint8(_BT_OTHER),
  15134. 141: uint8(_BT_OTHER),
  15135. 142: uint8(_BT_OTHER),
  15136. 143: uint8(_BT_OTHER),
  15137. 144: uint8(_BT_OTHER),
  15138. 145: uint8(_BT_OTHER),
  15139. 146: uint8(_BT_OTHER),
  15140. 147: uint8(_BT_OTHER),
  15141. 148: uint8(_BT_OTHER),
  15142. 149: uint8(_BT_OTHER),
  15143. 150: uint8(_BT_OTHER),
  15144. 151: uint8(_BT_OTHER),
  15145. 152: uint8(_BT_OTHER),
  15146. 153: uint8(_BT_OTHER),
  15147. 154: uint8(_BT_OTHER),
  15148. 155: uint8(_BT_OTHER),
  15149. 156: uint8(_BT_OTHER),
  15150. 157: uint8(_BT_OTHER),
  15151. 158: uint8(_BT_OTHER),
  15152. 159: uint8(_BT_OTHER),
  15153. 160: uint8(_BT_OTHER),
  15154. 161: uint8(_BT_OTHER),
  15155. 162: uint8(_BT_OTHER),
  15156. 163: uint8(_BT_OTHER),
  15157. 164: uint8(_BT_OTHER),
  15158. 165: uint8(_BT_OTHER),
  15159. 166: uint8(_BT_OTHER),
  15160. 167: uint8(_BT_OTHER),
  15161. 168: uint8(_BT_OTHER),
  15162. 169: uint8(_BT_OTHER),
  15163. 170: uint8(_BT_NMSTRT),
  15164. 171: uint8(_BT_OTHER),
  15165. 172: uint8(_BT_OTHER),
  15166. 173: uint8(_BT_OTHER),
  15167. 174: uint8(_BT_OTHER),
  15168. 175: uint8(_BT_OTHER),
  15169. 176: uint8(_BT_OTHER),
  15170. 177: uint8(_BT_OTHER),
  15171. 178: uint8(_BT_OTHER),
  15172. 179: uint8(_BT_OTHER),
  15173. 180: uint8(_BT_OTHER),
  15174. 181: uint8(_BT_NMSTRT),
  15175. 182: uint8(_BT_OTHER),
  15176. 183: uint8(_BT_NAME),
  15177. 184: uint8(_BT_OTHER),
  15178. 185: uint8(_BT_OTHER),
  15179. 186: uint8(_BT_NMSTRT),
  15180. 187: uint8(_BT_OTHER),
  15181. 188: uint8(_BT_OTHER),
  15182. 189: uint8(_BT_OTHER),
  15183. 190: uint8(_BT_OTHER),
  15184. 191: uint8(_BT_OTHER),
  15185. 192: uint8(_BT_NMSTRT),
  15186. 193: uint8(_BT_NMSTRT),
  15187. 194: uint8(_BT_NMSTRT),
  15188. 195: uint8(_BT_NMSTRT),
  15189. 196: uint8(_BT_NMSTRT),
  15190. 197: uint8(_BT_NMSTRT),
  15191. 198: uint8(_BT_NMSTRT),
  15192. 199: uint8(_BT_NMSTRT),
  15193. 200: uint8(_BT_NMSTRT),
  15194. 201: uint8(_BT_NMSTRT),
  15195. 202: uint8(_BT_NMSTRT),
  15196. 203: uint8(_BT_NMSTRT),
  15197. 204: uint8(_BT_NMSTRT),
  15198. 205: uint8(_BT_NMSTRT),
  15199. 206: uint8(_BT_NMSTRT),
  15200. 207: uint8(_BT_NMSTRT),
  15201. 208: uint8(_BT_NMSTRT),
  15202. 209: uint8(_BT_NMSTRT),
  15203. 210: uint8(_BT_NMSTRT),
  15204. 211: uint8(_BT_NMSTRT),
  15205. 212: uint8(_BT_NMSTRT),
  15206. 213: uint8(_BT_NMSTRT),
  15207. 214: uint8(_BT_NMSTRT),
  15208. 215: uint8(_BT_OTHER),
  15209. 216: uint8(_BT_NMSTRT),
  15210. 217: uint8(_BT_NMSTRT),
  15211. 218: uint8(_BT_NMSTRT),
  15212. 219: uint8(_BT_NMSTRT),
  15213. 220: uint8(_BT_NMSTRT),
  15214. 221: uint8(_BT_NMSTRT),
  15215. 222: uint8(_BT_NMSTRT),
  15216. 223: uint8(_BT_NMSTRT),
  15217. 224: uint8(_BT_NMSTRT),
  15218. 225: uint8(_BT_NMSTRT),
  15219. 226: uint8(_BT_NMSTRT),
  15220. 227: uint8(_BT_NMSTRT),
  15221. 228: uint8(_BT_NMSTRT),
  15222. 229: uint8(_BT_NMSTRT),
  15223. 230: uint8(_BT_NMSTRT),
  15224. 231: uint8(_BT_NMSTRT),
  15225. 232: uint8(_BT_NMSTRT),
  15226. 233: uint8(_BT_NMSTRT),
  15227. 234: uint8(_BT_NMSTRT),
  15228. 235: uint8(_BT_NMSTRT),
  15229. 236: uint8(_BT_NMSTRT),
  15230. 237: uint8(_BT_NMSTRT),
  15231. 238: uint8(_BT_NMSTRT),
  15232. 239: uint8(_BT_NMSTRT),
  15233. 240: uint8(_BT_NMSTRT),
  15234. 241: uint8(_BT_NMSTRT),
  15235. 242: uint8(_BT_NMSTRT),
  15236. 243: uint8(_BT_NMSTRT),
  15237. 244: uint8(_BT_NMSTRT),
  15238. 245: uint8(_BT_NMSTRT),
  15239. 246: uint8(_BT_NMSTRT),
  15240. 247: uint8(_BT_OTHER),
  15241. 248: uint8(_BT_NMSTRT),
  15242. 249: uint8(_BT_NMSTRT),
  15243. 250: uint8(_BT_NMSTRT),
  15244. 251: uint8(_BT_NMSTRT),
  15245. 252: uint8(_BT_NMSTRT),
  15246. 253: uint8(_BT_NMSTRT),
  15247. 254: uint8(_BT_NMSTRT),
  15248. 255: uint8(_BT_NMSTRT),
  15249. },
  15250. }
  15251. func init() {
  15252. p := unsafe.Pointer(&_latin1_encoding_ns)
  15253. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15254. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15255. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15256. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15257. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15258. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15259. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15260. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15261. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15262. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15263. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15264. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15265. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15266. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15267. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  15268. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15269. }
  15270. var _latin1_encoding = Tnormal_encoding{
  15271. Fenc: TENCODING{
  15272. Fscanners: [4]TSCANNER{},
  15273. FliteralScanners: [2]TSCANNER{},
  15274. FminBytesPerChar: int32(1),
  15275. },
  15276. Ftype1: [256]uint8{
  15277. 9: uint8(_BT_S),
  15278. 10: uint8(_BT_LF),
  15279. 13: uint8(_BT_CR),
  15280. 32: uint8(_BT_S),
  15281. 33: uint8(_BT_EXCL),
  15282. 34: uint8(_BT_QUOT),
  15283. 35: uint8(_BT_NUM),
  15284. 36: uint8(_BT_OTHER),
  15285. 37: uint8(_BT_PERCNT),
  15286. 38: uint8(_BT_AMP),
  15287. 39: uint8(_BT_APOS),
  15288. 40: uint8(_BT_LPAR),
  15289. 41: uint8(_BT_RPAR),
  15290. 42: uint8(_BT_AST),
  15291. 43: uint8(_BT_PLUS),
  15292. 44: uint8(_BT_COMMA),
  15293. 45: uint8(_BT_MINUS),
  15294. 46: uint8(_BT_NAME),
  15295. 47: uint8(_BT_SOL),
  15296. 48: uint8(_BT_DIGIT),
  15297. 49: uint8(_BT_DIGIT),
  15298. 50: uint8(_BT_DIGIT),
  15299. 51: uint8(_BT_DIGIT),
  15300. 52: uint8(_BT_DIGIT),
  15301. 53: uint8(_BT_DIGIT),
  15302. 54: uint8(_BT_DIGIT),
  15303. 55: uint8(_BT_DIGIT),
  15304. 56: uint8(_BT_DIGIT),
  15305. 57: uint8(_BT_DIGIT),
  15306. 58: uint8(_BT_NMSTRT),
  15307. 59: uint8(_BT_SEMI),
  15308. 60: uint8(_BT_LT),
  15309. 61: uint8(_BT_EQUALS),
  15310. 62: uint8(_BT_GT),
  15311. 63: uint8(_BT_QUEST),
  15312. 64: uint8(_BT_OTHER),
  15313. 65: uint8(_BT_HEX),
  15314. 66: uint8(_BT_HEX),
  15315. 67: uint8(_BT_HEX),
  15316. 68: uint8(_BT_HEX),
  15317. 69: uint8(_BT_HEX),
  15318. 70: uint8(_BT_HEX),
  15319. 71: uint8(_BT_NMSTRT),
  15320. 72: uint8(_BT_NMSTRT),
  15321. 73: uint8(_BT_NMSTRT),
  15322. 74: uint8(_BT_NMSTRT),
  15323. 75: uint8(_BT_NMSTRT),
  15324. 76: uint8(_BT_NMSTRT),
  15325. 77: uint8(_BT_NMSTRT),
  15326. 78: uint8(_BT_NMSTRT),
  15327. 79: uint8(_BT_NMSTRT),
  15328. 80: uint8(_BT_NMSTRT),
  15329. 81: uint8(_BT_NMSTRT),
  15330. 82: uint8(_BT_NMSTRT),
  15331. 83: uint8(_BT_NMSTRT),
  15332. 84: uint8(_BT_NMSTRT),
  15333. 85: uint8(_BT_NMSTRT),
  15334. 86: uint8(_BT_NMSTRT),
  15335. 87: uint8(_BT_NMSTRT),
  15336. 88: uint8(_BT_NMSTRT),
  15337. 89: uint8(_BT_NMSTRT),
  15338. 90: uint8(_BT_NMSTRT),
  15339. 91: uint8(_BT_LSQB),
  15340. 92: uint8(_BT_OTHER),
  15341. 93: uint8(_BT_RSQB),
  15342. 94: uint8(_BT_OTHER),
  15343. 95: uint8(_BT_NMSTRT),
  15344. 96: uint8(_BT_OTHER),
  15345. 97: uint8(_BT_HEX),
  15346. 98: uint8(_BT_HEX),
  15347. 99: uint8(_BT_HEX),
  15348. 100: uint8(_BT_HEX),
  15349. 101: uint8(_BT_HEX),
  15350. 102: uint8(_BT_HEX),
  15351. 103: uint8(_BT_NMSTRT),
  15352. 104: uint8(_BT_NMSTRT),
  15353. 105: uint8(_BT_NMSTRT),
  15354. 106: uint8(_BT_NMSTRT),
  15355. 107: uint8(_BT_NMSTRT),
  15356. 108: uint8(_BT_NMSTRT),
  15357. 109: uint8(_BT_NMSTRT),
  15358. 110: uint8(_BT_NMSTRT),
  15359. 111: uint8(_BT_NMSTRT),
  15360. 112: uint8(_BT_NMSTRT),
  15361. 113: uint8(_BT_NMSTRT),
  15362. 114: uint8(_BT_NMSTRT),
  15363. 115: uint8(_BT_NMSTRT),
  15364. 116: uint8(_BT_NMSTRT),
  15365. 117: uint8(_BT_NMSTRT),
  15366. 118: uint8(_BT_NMSTRT),
  15367. 119: uint8(_BT_NMSTRT),
  15368. 120: uint8(_BT_NMSTRT),
  15369. 121: uint8(_BT_NMSTRT),
  15370. 122: uint8(_BT_NMSTRT),
  15371. 123: uint8(_BT_OTHER),
  15372. 124: uint8(_BT_VERBAR),
  15373. 125: uint8(_BT_OTHER),
  15374. 126: uint8(_BT_OTHER),
  15375. 127: uint8(_BT_OTHER),
  15376. 128: uint8(_BT_OTHER),
  15377. 129: uint8(_BT_OTHER),
  15378. 130: uint8(_BT_OTHER),
  15379. 131: uint8(_BT_OTHER),
  15380. 132: uint8(_BT_OTHER),
  15381. 133: uint8(_BT_OTHER),
  15382. 134: uint8(_BT_OTHER),
  15383. 135: uint8(_BT_OTHER),
  15384. 136: uint8(_BT_OTHER),
  15385. 137: uint8(_BT_OTHER),
  15386. 138: uint8(_BT_OTHER),
  15387. 139: uint8(_BT_OTHER),
  15388. 140: uint8(_BT_OTHER),
  15389. 141: uint8(_BT_OTHER),
  15390. 142: uint8(_BT_OTHER),
  15391. 143: uint8(_BT_OTHER),
  15392. 144: uint8(_BT_OTHER),
  15393. 145: uint8(_BT_OTHER),
  15394. 146: uint8(_BT_OTHER),
  15395. 147: uint8(_BT_OTHER),
  15396. 148: uint8(_BT_OTHER),
  15397. 149: uint8(_BT_OTHER),
  15398. 150: uint8(_BT_OTHER),
  15399. 151: uint8(_BT_OTHER),
  15400. 152: uint8(_BT_OTHER),
  15401. 153: uint8(_BT_OTHER),
  15402. 154: uint8(_BT_OTHER),
  15403. 155: uint8(_BT_OTHER),
  15404. 156: uint8(_BT_OTHER),
  15405. 157: uint8(_BT_OTHER),
  15406. 158: uint8(_BT_OTHER),
  15407. 159: uint8(_BT_OTHER),
  15408. 160: uint8(_BT_OTHER),
  15409. 161: uint8(_BT_OTHER),
  15410. 162: uint8(_BT_OTHER),
  15411. 163: uint8(_BT_OTHER),
  15412. 164: uint8(_BT_OTHER),
  15413. 165: uint8(_BT_OTHER),
  15414. 166: uint8(_BT_OTHER),
  15415. 167: uint8(_BT_OTHER),
  15416. 168: uint8(_BT_OTHER),
  15417. 169: uint8(_BT_OTHER),
  15418. 170: uint8(_BT_NMSTRT),
  15419. 171: uint8(_BT_OTHER),
  15420. 172: uint8(_BT_OTHER),
  15421. 173: uint8(_BT_OTHER),
  15422. 174: uint8(_BT_OTHER),
  15423. 175: uint8(_BT_OTHER),
  15424. 176: uint8(_BT_OTHER),
  15425. 177: uint8(_BT_OTHER),
  15426. 178: uint8(_BT_OTHER),
  15427. 179: uint8(_BT_OTHER),
  15428. 180: uint8(_BT_OTHER),
  15429. 181: uint8(_BT_NMSTRT),
  15430. 182: uint8(_BT_OTHER),
  15431. 183: uint8(_BT_NAME),
  15432. 184: uint8(_BT_OTHER),
  15433. 185: uint8(_BT_OTHER),
  15434. 186: uint8(_BT_NMSTRT),
  15435. 187: uint8(_BT_OTHER),
  15436. 188: uint8(_BT_OTHER),
  15437. 189: uint8(_BT_OTHER),
  15438. 190: uint8(_BT_OTHER),
  15439. 191: uint8(_BT_OTHER),
  15440. 192: uint8(_BT_NMSTRT),
  15441. 193: uint8(_BT_NMSTRT),
  15442. 194: uint8(_BT_NMSTRT),
  15443. 195: uint8(_BT_NMSTRT),
  15444. 196: uint8(_BT_NMSTRT),
  15445. 197: uint8(_BT_NMSTRT),
  15446. 198: uint8(_BT_NMSTRT),
  15447. 199: uint8(_BT_NMSTRT),
  15448. 200: uint8(_BT_NMSTRT),
  15449. 201: uint8(_BT_NMSTRT),
  15450. 202: uint8(_BT_NMSTRT),
  15451. 203: uint8(_BT_NMSTRT),
  15452. 204: uint8(_BT_NMSTRT),
  15453. 205: uint8(_BT_NMSTRT),
  15454. 206: uint8(_BT_NMSTRT),
  15455. 207: uint8(_BT_NMSTRT),
  15456. 208: uint8(_BT_NMSTRT),
  15457. 209: uint8(_BT_NMSTRT),
  15458. 210: uint8(_BT_NMSTRT),
  15459. 211: uint8(_BT_NMSTRT),
  15460. 212: uint8(_BT_NMSTRT),
  15461. 213: uint8(_BT_NMSTRT),
  15462. 214: uint8(_BT_NMSTRT),
  15463. 215: uint8(_BT_OTHER),
  15464. 216: uint8(_BT_NMSTRT),
  15465. 217: uint8(_BT_NMSTRT),
  15466. 218: uint8(_BT_NMSTRT),
  15467. 219: uint8(_BT_NMSTRT),
  15468. 220: uint8(_BT_NMSTRT),
  15469. 221: uint8(_BT_NMSTRT),
  15470. 222: uint8(_BT_NMSTRT),
  15471. 223: uint8(_BT_NMSTRT),
  15472. 224: uint8(_BT_NMSTRT),
  15473. 225: uint8(_BT_NMSTRT),
  15474. 226: uint8(_BT_NMSTRT),
  15475. 227: uint8(_BT_NMSTRT),
  15476. 228: uint8(_BT_NMSTRT),
  15477. 229: uint8(_BT_NMSTRT),
  15478. 230: uint8(_BT_NMSTRT),
  15479. 231: uint8(_BT_NMSTRT),
  15480. 232: uint8(_BT_NMSTRT),
  15481. 233: uint8(_BT_NMSTRT),
  15482. 234: uint8(_BT_NMSTRT),
  15483. 235: uint8(_BT_NMSTRT),
  15484. 236: uint8(_BT_NMSTRT),
  15485. 237: uint8(_BT_NMSTRT),
  15486. 238: uint8(_BT_NMSTRT),
  15487. 239: uint8(_BT_NMSTRT),
  15488. 240: uint8(_BT_NMSTRT),
  15489. 241: uint8(_BT_NMSTRT),
  15490. 242: uint8(_BT_NMSTRT),
  15491. 243: uint8(_BT_NMSTRT),
  15492. 244: uint8(_BT_NMSTRT),
  15493. 245: uint8(_BT_NMSTRT),
  15494. 246: uint8(_BT_NMSTRT),
  15495. 247: uint8(_BT_OTHER),
  15496. 248: uint8(_BT_NMSTRT),
  15497. 249: uint8(_BT_NMSTRT),
  15498. 250: uint8(_BT_NMSTRT),
  15499. 251: uint8(_BT_NMSTRT),
  15500. 252: uint8(_BT_NMSTRT),
  15501. 253: uint8(_BT_NMSTRT),
  15502. 254: uint8(_BT_NMSTRT),
  15503. 255: uint8(_BT_NMSTRT),
  15504. },
  15505. }
  15506. func init() {
  15507. p := unsafe.Pointer(&_latin1_encoding)
  15508. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15509. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15510. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15511. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15512. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15513. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15514. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15515. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15516. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15517. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15518. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15519. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15520. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15521. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15522. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_latin1_toUtf8)
  15523. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15524. }
  15525. func _ascii_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15526. var v1, v2, v3, v4 uintptr
  15527. _, _, _, _ = v1, v2, v3, v4
  15528. _ = enc
  15529. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  15530. v2 = toP
  15531. v1 = *(*uintptr)(unsafe.Pointer(v2))
  15532. *(*uintptr)(unsafe.Pointer(v2))++
  15533. v4 = fromP
  15534. v3 = *(*uintptr)(unsafe.Pointer(v4))
  15535. *(*uintptr)(unsafe.Pointer(v4))++
  15536. *(*uint8)(unsafe.Pointer(v1)) = *(*uint8)(unsafe.Pointer(v3))
  15537. }
  15538. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  15539. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15540. } else {
  15541. return int32(_XML_CONVERT_COMPLETED)
  15542. }
  15543. return r
  15544. }
  15545. var _ascii_encoding_ns = Tnormal_encoding{
  15546. Fenc: TENCODING{
  15547. Fscanners: [4]TSCANNER{},
  15548. FliteralScanners: [2]TSCANNER{},
  15549. FminBytesPerChar: int32(1),
  15550. FisUtf8: uint8(1),
  15551. },
  15552. Ftype1: [256]uint8{
  15553. 9: uint8(_BT_S),
  15554. 10: uint8(_BT_LF),
  15555. 13: uint8(_BT_CR),
  15556. 32: uint8(_BT_S),
  15557. 33: uint8(_BT_EXCL),
  15558. 34: uint8(_BT_QUOT),
  15559. 35: uint8(_BT_NUM),
  15560. 36: uint8(_BT_OTHER),
  15561. 37: uint8(_BT_PERCNT),
  15562. 38: uint8(_BT_AMP),
  15563. 39: uint8(_BT_APOS),
  15564. 40: uint8(_BT_LPAR),
  15565. 41: uint8(_BT_RPAR),
  15566. 42: uint8(_BT_AST),
  15567. 43: uint8(_BT_PLUS),
  15568. 44: uint8(_BT_COMMA),
  15569. 45: uint8(_BT_MINUS),
  15570. 46: uint8(_BT_NAME),
  15571. 47: uint8(_BT_SOL),
  15572. 48: uint8(_BT_DIGIT),
  15573. 49: uint8(_BT_DIGIT),
  15574. 50: uint8(_BT_DIGIT),
  15575. 51: uint8(_BT_DIGIT),
  15576. 52: uint8(_BT_DIGIT),
  15577. 53: uint8(_BT_DIGIT),
  15578. 54: uint8(_BT_DIGIT),
  15579. 55: uint8(_BT_DIGIT),
  15580. 56: uint8(_BT_DIGIT),
  15581. 57: uint8(_BT_DIGIT),
  15582. 58: uint8(_BT_COLON),
  15583. 59: uint8(_BT_SEMI),
  15584. 60: uint8(_BT_LT),
  15585. 61: uint8(_BT_EQUALS),
  15586. 62: uint8(_BT_GT),
  15587. 63: uint8(_BT_QUEST),
  15588. 64: uint8(_BT_OTHER),
  15589. 65: uint8(_BT_HEX),
  15590. 66: uint8(_BT_HEX),
  15591. 67: uint8(_BT_HEX),
  15592. 68: uint8(_BT_HEX),
  15593. 69: uint8(_BT_HEX),
  15594. 70: uint8(_BT_HEX),
  15595. 71: uint8(_BT_NMSTRT),
  15596. 72: uint8(_BT_NMSTRT),
  15597. 73: uint8(_BT_NMSTRT),
  15598. 74: uint8(_BT_NMSTRT),
  15599. 75: uint8(_BT_NMSTRT),
  15600. 76: uint8(_BT_NMSTRT),
  15601. 77: uint8(_BT_NMSTRT),
  15602. 78: uint8(_BT_NMSTRT),
  15603. 79: uint8(_BT_NMSTRT),
  15604. 80: uint8(_BT_NMSTRT),
  15605. 81: uint8(_BT_NMSTRT),
  15606. 82: uint8(_BT_NMSTRT),
  15607. 83: uint8(_BT_NMSTRT),
  15608. 84: uint8(_BT_NMSTRT),
  15609. 85: uint8(_BT_NMSTRT),
  15610. 86: uint8(_BT_NMSTRT),
  15611. 87: uint8(_BT_NMSTRT),
  15612. 88: uint8(_BT_NMSTRT),
  15613. 89: uint8(_BT_NMSTRT),
  15614. 90: uint8(_BT_NMSTRT),
  15615. 91: uint8(_BT_LSQB),
  15616. 92: uint8(_BT_OTHER),
  15617. 93: uint8(_BT_RSQB),
  15618. 94: uint8(_BT_OTHER),
  15619. 95: uint8(_BT_NMSTRT),
  15620. 96: uint8(_BT_OTHER),
  15621. 97: uint8(_BT_HEX),
  15622. 98: uint8(_BT_HEX),
  15623. 99: uint8(_BT_HEX),
  15624. 100: uint8(_BT_HEX),
  15625. 101: uint8(_BT_HEX),
  15626. 102: uint8(_BT_HEX),
  15627. 103: uint8(_BT_NMSTRT),
  15628. 104: uint8(_BT_NMSTRT),
  15629. 105: uint8(_BT_NMSTRT),
  15630. 106: uint8(_BT_NMSTRT),
  15631. 107: uint8(_BT_NMSTRT),
  15632. 108: uint8(_BT_NMSTRT),
  15633. 109: uint8(_BT_NMSTRT),
  15634. 110: uint8(_BT_NMSTRT),
  15635. 111: uint8(_BT_NMSTRT),
  15636. 112: uint8(_BT_NMSTRT),
  15637. 113: uint8(_BT_NMSTRT),
  15638. 114: uint8(_BT_NMSTRT),
  15639. 115: uint8(_BT_NMSTRT),
  15640. 116: uint8(_BT_NMSTRT),
  15641. 117: uint8(_BT_NMSTRT),
  15642. 118: uint8(_BT_NMSTRT),
  15643. 119: uint8(_BT_NMSTRT),
  15644. 120: uint8(_BT_NMSTRT),
  15645. 121: uint8(_BT_NMSTRT),
  15646. 122: uint8(_BT_NMSTRT),
  15647. 123: uint8(_BT_OTHER),
  15648. 124: uint8(_BT_VERBAR),
  15649. 125: uint8(_BT_OTHER),
  15650. 126: uint8(_BT_OTHER),
  15651. 127: uint8(_BT_OTHER),
  15652. },
  15653. }
  15654. func init() {
  15655. p := unsafe.Pointer(&_ascii_encoding_ns)
  15656. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15657. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15658. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15659. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15660. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15661. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15662. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15663. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15664. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15665. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15666. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15667. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15668. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15669. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15670. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  15671. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15672. }
  15673. var _ascii_encoding = Tnormal_encoding{
  15674. Fenc: TENCODING{
  15675. Fscanners: [4]TSCANNER{},
  15676. FliteralScanners: [2]TSCANNER{},
  15677. FminBytesPerChar: int32(1),
  15678. FisUtf8: uint8(1),
  15679. },
  15680. Ftype1: [256]uint8{
  15681. 9: uint8(_BT_S),
  15682. 10: uint8(_BT_LF),
  15683. 13: uint8(_BT_CR),
  15684. 32: uint8(_BT_S),
  15685. 33: uint8(_BT_EXCL),
  15686. 34: uint8(_BT_QUOT),
  15687. 35: uint8(_BT_NUM),
  15688. 36: uint8(_BT_OTHER),
  15689. 37: uint8(_BT_PERCNT),
  15690. 38: uint8(_BT_AMP),
  15691. 39: uint8(_BT_APOS),
  15692. 40: uint8(_BT_LPAR),
  15693. 41: uint8(_BT_RPAR),
  15694. 42: uint8(_BT_AST),
  15695. 43: uint8(_BT_PLUS),
  15696. 44: uint8(_BT_COMMA),
  15697. 45: uint8(_BT_MINUS),
  15698. 46: uint8(_BT_NAME),
  15699. 47: uint8(_BT_SOL),
  15700. 48: uint8(_BT_DIGIT),
  15701. 49: uint8(_BT_DIGIT),
  15702. 50: uint8(_BT_DIGIT),
  15703. 51: uint8(_BT_DIGIT),
  15704. 52: uint8(_BT_DIGIT),
  15705. 53: uint8(_BT_DIGIT),
  15706. 54: uint8(_BT_DIGIT),
  15707. 55: uint8(_BT_DIGIT),
  15708. 56: uint8(_BT_DIGIT),
  15709. 57: uint8(_BT_DIGIT),
  15710. 58: uint8(_BT_NMSTRT),
  15711. 59: uint8(_BT_SEMI),
  15712. 60: uint8(_BT_LT),
  15713. 61: uint8(_BT_EQUALS),
  15714. 62: uint8(_BT_GT),
  15715. 63: uint8(_BT_QUEST),
  15716. 64: uint8(_BT_OTHER),
  15717. 65: uint8(_BT_HEX),
  15718. 66: uint8(_BT_HEX),
  15719. 67: uint8(_BT_HEX),
  15720. 68: uint8(_BT_HEX),
  15721. 69: uint8(_BT_HEX),
  15722. 70: uint8(_BT_HEX),
  15723. 71: uint8(_BT_NMSTRT),
  15724. 72: uint8(_BT_NMSTRT),
  15725. 73: uint8(_BT_NMSTRT),
  15726. 74: uint8(_BT_NMSTRT),
  15727. 75: uint8(_BT_NMSTRT),
  15728. 76: uint8(_BT_NMSTRT),
  15729. 77: uint8(_BT_NMSTRT),
  15730. 78: uint8(_BT_NMSTRT),
  15731. 79: uint8(_BT_NMSTRT),
  15732. 80: uint8(_BT_NMSTRT),
  15733. 81: uint8(_BT_NMSTRT),
  15734. 82: uint8(_BT_NMSTRT),
  15735. 83: uint8(_BT_NMSTRT),
  15736. 84: uint8(_BT_NMSTRT),
  15737. 85: uint8(_BT_NMSTRT),
  15738. 86: uint8(_BT_NMSTRT),
  15739. 87: uint8(_BT_NMSTRT),
  15740. 88: uint8(_BT_NMSTRT),
  15741. 89: uint8(_BT_NMSTRT),
  15742. 90: uint8(_BT_NMSTRT),
  15743. 91: uint8(_BT_LSQB),
  15744. 92: uint8(_BT_OTHER),
  15745. 93: uint8(_BT_RSQB),
  15746. 94: uint8(_BT_OTHER),
  15747. 95: uint8(_BT_NMSTRT),
  15748. 96: uint8(_BT_OTHER),
  15749. 97: uint8(_BT_HEX),
  15750. 98: uint8(_BT_HEX),
  15751. 99: uint8(_BT_HEX),
  15752. 100: uint8(_BT_HEX),
  15753. 101: uint8(_BT_HEX),
  15754. 102: uint8(_BT_HEX),
  15755. 103: uint8(_BT_NMSTRT),
  15756. 104: uint8(_BT_NMSTRT),
  15757. 105: uint8(_BT_NMSTRT),
  15758. 106: uint8(_BT_NMSTRT),
  15759. 107: uint8(_BT_NMSTRT),
  15760. 108: uint8(_BT_NMSTRT),
  15761. 109: uint8(_BT_NMSTRT),
  15762. 110: uint8(_BT_NMSTRT),
  15763. 111: uint8(_BT_NMSTRT),
  15764. 112: uint8(_BT_NMSTRT),
  15765. 113: uint8(_BT_NMSTRT),
  15766. 114: uint8(_BT_NMSTRT),
  15767. 115: uint8(_BT_NMSTRT),
  15768. 116: uint8(_BT_NMSTRT),
  15769. 117: uint8(_BT_NMSTRT),
  15770. 118: uint8(_BT_NMSTRT),
  15771. 119: uint8(_BT_NMSTRT),
  15772. 120: uint8(_BT_NMSTRT),
  15773. 121: uint8(_BT_NMSTRT),
  15774. 122: uint8(_BT_NMSTRT),
  15775. 123: uint8(_BT_OTHER),
  15776. 124: uint8(_BT_VERBAR),
  15777. 125: uint8(_BT_OTHER),
  15778. 126: uint8(_BT_OTHER),
  15779. 127: uint8(_BT_OTHER),
  15780. },
  15781. }
  15782. func init() {
  15783. p := unsafe.Pointer(&_ascii_encoding)
  15784. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_normal_prologTok)
  15785. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_normal_contentTok)
  15786. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_normal_cdataSectionTok)
  15787. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_normal_ignoreSectionTok)
  15788. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_normal_attributeValueTok)
  15789. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_normal_entityValueTok)
  15790. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_normal_nameMatchesAscii)
  15791. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_normal_nameLength)
  15792. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_normal_skipS)
  15793. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_normal_getAtts)
  15794. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_normal_charRefNumber)
  15795. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_normal_predefinedEntityName)
  15796. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_normal_updatePosition)
  15797. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_normal_isPublicId)
  15798. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_ascii_toUtf8)
  15799. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_latin1_toUtf16)
  15800. }
  15801. func _unicode_byte_type(tls *libc.TLS, hi uint8, lo uint8) (r int32) {
  15802. switch libc.Int32FromUint8(hi) {
  15803. /* 0xD800-0xDBFF first 16-bit code unit or high surrogate (W1) */
  15804. case int32(0xD8):
  15805. fallthrough
  15806. case int32(0xD9):
  15807. fallthrough
  15808. case int32(0xDA):
  15809. fallthrough
  15810. case int32(0xDB):
  15811. return int32(_BT_LEAD4)
  15812. /* 0xDC00-0xDFFF second 16-bit code unit or low surrogate (W2) */
  15813. fallthrough
  15814. case int32(0xDC):
  15815. fallthrough
  15816. case int32(0xDD):
  15817. fallthrough
  15818. case int32(0xDE):
  15819. fallthrough
  15820. case int32(0xDF):
  15821. return int32(_BT_TRAIL)
  15822. case int32(0xFF):
  15823. switch libc.Int32FromUint8(lo) {
  15824. case int32(0xFF): /* noncharacter-FFFF */
  15825. fallthrough
  15826. case int32(0xFE): /* noncharacter-FFFE */
  15827. return int32(_BT_NONXML)
  15828. }
  15829. break
  15830. }
  15831. return int32(_BT_NONASCII)
  15832. }
  15833. func _little2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15834. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  15835. var hi, lo, lo2 uint8
  15836. var plane int32
  15837. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  15838. from = *(*uintptr)(unsafe.Pointer(fromP))
  15839. _ = enc
  15840. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  15841. for {
  15842. if !(from < fromLim) {
  15843. break
  15844. }
  15845. lo = *(*uint8)(unsafe.Pointer(from))
  15846. hi = *(*uint8)(unsafe.Pointer(from + 1))
  15847. switch libc.Int32FromUint8(hi) {
  15848. case 0:
  15849. if libc.Int32FromUint8(lo) < int32(0x80) {
  15850. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  15851. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15852. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15853. }
  15854. v3 = toP
  15855. v2 = *(*uintptr)(unsafe.Pointer(v3))
  15856. *(*uintptr)(unsafe.Pointer(v3))++
  15857. *(*uint8)(unsafe.Pointer(v2)) = lo
  15858. break
  15859. } /* fall through */
  15860. fallthrough
  15861. case int32(0x1):
  15862. fallthrough
  15863. case int32(0x2):
  15864. fallthrough
  15865. case int32(0x3):
  15866. fallthrough
  15867. case int32(0x4):
  15868. fallthrough
  15869. case int32(0x5):
  15870. fallthrough
  15871. case int32(0x6):
  15872. fallthrough
  15873. case int32(0x7):
  15874. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  15875. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15876. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15877. }
  15878. v5 = toP
  15879. v4 = *(*uintptr)(unsafe.Pointer(v5))
  15880. *(*uintptr)(unsafe.Pointer(v5))++
  15881. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  15882. v7 = toP
  15883. v6 = *(*uintptr)(unsafe.Pointer(v7))
  15884. *(*uintptr)(unsafe.Pointer(v7))++
  15885. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15886. default:
  15887. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  15888. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15889. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15890. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  15891. v9 = toP
  15892. v8 = *(*uintptr)(unsafe.Pointer(v9))
  15893. *(*uintptr)(unsafe.Pointer(v9))++
  15894. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  15895. v11 = toP
  15896. v10 = *(*uintptr)(unsafe.Pointer(v11))
  15897. *(*uintptr)(unsafe.Pointer(v11))++
  15898. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  15899. v13 = toP
  15900. v12 = *(*uintptr)(unsafe.Pointer(v13))
  15901. *(*uintptr)(unsafe.Pointer(v13))++
  15902. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15903. case int32(0xD8):
  15904. fallthrough
  15905. case int32(0xD9):
  15906. fallthrough
  15907. case int32(0xDA):
  15908. fallthrough
  15909. case int32(0xDB):
  15910. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  15911. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15912. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15913. }
  15914. if int64(fromLim)-int64(from) < int64(4) {
  15915. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15916. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  15917. }
  15918. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  15919. v15 = toP
  15920. v14 = *(*uintptr)(unsafe.Pointer(v15))
  15921. *(*uintptr)(unsafe.Pointer(v15))++
  15922. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  15923. v17 = toP
  15924. v16 = *(*uintptr)(unsafe.Pointer(v17))
  15925. *(*uintptr)(unsafe.Pointer(v17))++
  15926. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  15927. from += uintptr(2)
  15928. lo2 = *(*uint8)(unsafe.Pointer(from))
  15929. v19 = toP
  15930. v18 = *(*uintptr)(unsafe.Pointer(v19))
  15931. *(*uintptr)(unsafe.Pointer(v19))++
  15932. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from + 1)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  15933. v21 = toP
  15934. v20 = *(*uintptr)(unsafe.Pointer(v21))
  15935. *(*uintptr)(unsafe.Pointer(v21))++
  15936. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  15937. break
  15938. }
  15939. goto _1
  15940. _1:
  15941. ;
  15942. from += uintptr(2)
  15943. }
  15944. *(*uintptr)(unsafe.Pointer(fromP)) = from
  15945. if from < fromLim {
  15946. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  15947. } else {
  15948. return int32(_XML_CONVERT_COMPLETED)
  15949. }
  15950. return r
  15951. }
  15952. func _little2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15953. var res _XML_Convert_Result
  15954. var v2, v3 uintptr
  15955. _, _, _ = res, v2, v3
  15956. res = int32(_XML_CONVERT_COMPLETED)
  15957. _ = enc
  15958. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  15959. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2) + 1)))&int32(0xF8) == int32(0xD8) {
  15960. fromLim -= uintptr(2)
  15961. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  15962. }
  15963. for {
  15964. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  15965. break
  15966. }
  15967. v3 = toP
  15968. v2 = *(*uintptr)(unsafe.Pointer(v3))
  15969. *(*uintptr)(unsafe.Pointer(v3)) += 2
  15970. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1)))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP))))))
  15971. goto _1
  15972. _1:
  15973. ;
  15974. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  15975. }
  15976. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  15977. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  15978. } else {
  15979. return res
  15980. }
  15981. return r
  15982. }
  15983. func _big2_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  15984. var from, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v2, v20, v21, v3, v4, v5, v6, v7, v8, v9 uintptr
  15985. var hi, lo, lo2 uint8
  15986. var plane int32
  15987. _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = 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
  15988. from = *(*uintptr)(unsafe.Pointer(fromP))
  15989. _ = enc
  15990. fromLim = from + uintptr((int64(fromLim)-int64(from))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */
  15991. for {
  15992. if !(from < fromLim) {
  15993. break
  15994. }
  15995. lo = *(*uint8)(unsafe.Pointer(from + 1))
  15996. hi = *(*uint8)(unsafe.Pointer(from))
  15997. switch libc.Int32FromUint8(hi) {
  15998. case 0:
  15999. if libc.Int32FromUint8(lo) < int32(0x80) {
  16000. if *(*uintptr)(unsafe.Pointer(toP)) == toLim {
  16001. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16002. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16003. }
  16004. v3 = toP
  16005. v2 = *(*uintptr)(unsafe.Pointer(v3))
  16006. *(*uintptr)(unsafe.Pointer(v3))++
  16007. *(*uint8)(unsafe.Pointer(v2)) = lo
  16008. break
  16009. } /* fall through */
  16010. fallthrough
  16011. case int32(0x1):
  16012. fallthrough
  16013. case int32(0x2):
  16014. fallthrough
  16015. case int32(0x3):
  16016. fallthrough
  16017. case int32(0x4):
  16018. fallthrough
  16019. case int32(0x5):
  16020. fallthrough
  16021. case int32(0x6):
  16022. fallthrough
  16023. case int32(0x7):
  16024. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(2) {
  16025. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16026. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16027. }
  16028. v5 = toP
  16029. v4 = *(*uintptr)(unsafe.Pointer(v5))
  16030. *(*uintptr)(unsafe.Pointer(v5))++
  16031. *(*uint8)(unsafe.Pointer(v4)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromUint8(hi)<<libc.Int32FromInt32(2) | int32(_UTF8_cval2))
  16032. v7 = toP
  16033. v6 = *(*uintptr)(unsafe.Pointer(v7))
  16034. *(*uintptr)(unsafe.Pointer(v7))++
  16035. *(*uint8)(unsafe.Pointer(v6)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  16036. default:
  16037. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(3) {
  16038. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16039. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16040. } /* 16 bits divided 4, 6, 6 amongst 3 bytes */
  16041. v9 = toP
  16042. v8 = *(*uintptr)(unsafe.Pointer(v9))
  16043. *(*uintptr)(unsafe.Pointer(v9))++
  16044. *(*uint8)(unsafe.Pointer(v8)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)>>libc.Int32FromInt32(4) | int32(_UTF8_cval3))
  16045. v11 = toP
  16046. v10 = *(*uintptr)(unsafe.Pointer(v11))
  16047. *(*uintptr)(unsafe.Pointer(v11))++
  16048. *(*uint8)(unsafe.Pointer(v10)) = libc.Uint8FromInt32(libc.Int32FromUint8(hi)&libc.Int32FromInt32(0xf)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  16049. v13 = toP
  16050. v12 = *(*uintptr)(unsafe.Pointer(v13))
  16051. *(*uintptr)(unsafe.Pointer(v13))++
  16052. *(*uint8)(unsafe.Pointer(v12)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  16053. case int32(0xD8):
  16054. fallthrough
  16055. case int32(0xD9):
  16056. fallthrough
  16057. case int32(0xDA):
  16058. fallthrough
  16059. case int32(0xDB):
  16060. if int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) < int64(4) {
  16061. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16062. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16063. }
  16064. if int64(fromLim)-int64(from) < int64(4) {
  16065. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16066. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16067. }
  16068. plane = libc.Int32FromUint8(hi)&int32(0x3)<<int32(2) | libc.Int32FromUint8(lo)>>int32(6)&int32(0x3) + int32(1)
  16069. v15 = toP
  16070. v14 = *(*uintptr)(unsafe.Pointer(v15))
  16071. *(*uintptr)(unsafe.Pointer(v15))++
  16072. *(*uint8)(unsafe.Pointer(v14)) = libc.Uint8FromInt32(plane>>libc.Int32FromInt32(2) | int32(_UTF8_cval4))
  16073. v17 = toP
  16074. v16 = *(*uintptr)(unsafe.Pointer(v17))
  16075. *(*uintptr)(unsafe.Pointer(v17))++
  16076. *(*uint8)(unsafe.Pointer(v16)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)>>libc.Int32FromInt32(2)&libc.Int32FromInt32(0xF) | plane&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromInt32(0x80))
  16077. from += uintptr(2)
  16078. lo2 = *(*uint8)(unsafe.Pointer(from + 1))
  16079. v19 = toP
  16080. v18 = *(*uintptr)(unsafe.Pointer(v19))
  16081. *(*uintptr)(unsafe.Pointer(v19))++
  16082. *(*uint8)(unsafe.Pointer(v18)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo)&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(4) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(from)))&libc.Int32FromInt32(0x3)<<libc.Int32FromInt32(2) | libc.Int32FromUint8(lo2)>>libc.Int32FromInt32(6) | libc.Int32FromInt32(0x80))
  16083. v21 = toP
  16084. v20 = *(*uintptr)(unsafe.Pointer(v21))
  16085. *(*uintptr)(unsafe.Pointer(v21))++
  16086. *(*uint8)(unsafe.Pointer(v20)) = libc.Uint8FromInt32(libc.Int32FromUint8(lo2)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  16087. break
  16088. }
  16089. goto _1
  16090. _1:
  16091. ;
  16092. from += uintptr(2)
  16093. }
  16094. *(*uintptr)(unsafe.Pointer(fromP)) = from
  16095. if from < fromLim {
  16096. return int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16097. } else {
  16098. return int32(_XML_CONVERT_COMPLETED)
  16099. }
  16100. return r
  16101. }
  16102. func _big2_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  16103. var res _XML_Convert_Result
  16104. var v2, v3 uintptr
  16105. _, _, _ = res, v2, v3
  16106. res = int32(_XML_CONVERT_COMPLETED)
  16107. _ = enc
  16108. fromLim = *(*uintptr)(unsafe.Pointer(fromP)) + uintptr((int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))))>>libc.Int32FromInt32(1)<<libc.Int32FromInt32(1)) /* shrink to even */ /* Avoid copying first half only of surrogate */
  16109. if int64(fromLim)-int64(*(*uintptr)(unsafe.Pointer(fromP))) > (int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))))/2<<libc.Int32FromInt32(1) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(fromLim - libc.UintptrFromInt32(2))))&int32(0xF8) == int32(0xD8) {
  16110. fromLim -= uintptr(2)
  16111. res = int32(_XML_CONVERT_INPUT_INCOMPLETE)
  16112. }
  16113. for {
  16114. if !(*(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim) {
  16115. break
  16116. }
  16117. v3 = toP
  16118. v2 = *(*uintptr)(unsafe.Pointer(v3))
  16119. *(*uintptr)(unsafe.Pointer(v3)) += 2
  16120. *(*uint16)(unsafe.Pointer(v2)) = libc.Uint16FromInt32(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))<<int32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)) + 1))))
  16121. goto _1
  16122. _1:
  16123. ;
  16124. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(2)
  16125. }
  16126. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  16127. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  16128. } else {
  16129. return res
  16130. }
  16131. return r
  16132. }
  16133. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  16134. /* This file is included!
  16135. __ __ _
  16136. ___\ \/ /_ __ __ _| |_
  16137. / _ \\ /| '_ \ / _` | __|
  16138. | __// \| |_) | (_| | |_
  16139. \___/_/\_\ .__/ \__,_|\__|
  16140. |_| XML parser
  16141. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  16142. Copyright (c) 2000-2017 Expat development team
  16143. Licensed under the MIT license:
  16144. Permission is hereby granted, free of charge, to any person obtaining
  16145. a copy of this software and associated documentation files (the
  16146. "Software"), to deal in the Software without restriction, including
  16147. without limitation the rights to use, copy, modify, merge, publish,
  16148. distribute, sublicense, and/or sell copies of the Software, and to permit
  16149. persons to whom the Software is furnished to do so, subject to the
  16150. following conditions:
  16151. The above copyright notice and this permission notice shall be included
  16152. in all copies or substantial portions of the Software.
  16153. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16154. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16155. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  16156. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  16157. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16158. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  16159. USE OR OTHER DEALINGS IN THE SOFTWARE.
  16160. */
  16161. /* ptr points to character following "<!-" */
  16162. func _little2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16163. var v1 int32
  16164. _ = v1
  16165. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16166. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1)) {
  16167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16168. return m_XML_TOK_INVALID
  16169. }
  16170. ptr += uintptr(2)
  16171. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16172. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16173. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16174. } else {
  16175. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16176. }
  16177. switch v1 {
  16178. case int32(_BT_LEAD2):
  16179. if int64(end)-int64(ptr) < int64(2) {
  16180. return -int32(2)
  16181. }
  16182. if 0 != 0 {
  16183. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16184. return m_XML_TOK_INVALID
  16185. }
  16186. ptr += uintptr(2)
  16187. case int32(_BT_LEAD3):
  16188. if int64(end)-int64(ptr) < int64(3) {
  16189. return -int32(2)
  16190. }
  16191. if 0 != 0 {
  16192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16193. return m_XML_TOK_INVALID
  16194. }
  16195. ptr += uintptr(3)
  16196. case int32(_BT_LEAD4):
  16197. if int64(end)-int64(ptr) < int64(4) {
  16198. return -int32(2)
  16199. }
  16200. if 0 != 0 {
  16201. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16202. return m_XML_TOK_INVALID
  16203. }
  16204. ptr += uintptr(4)
  16205. case int32(_BT_NONXML):
  16206. fallthrough
  16207. case int32(_BT_MALFORM):
  16208. fallthrough
  16209. case int32(_BT_TRAIL):
  16210. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16211. return m_XML_TOK_INVALID
  16212. case int32(_BT_MINUS):
  16213. ptr += uintptr(2)
  16214. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16215. return -int32(1)
  16216. }
  16217. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_MINUS1) {
  16218. ptr += uintptr(2)
  16219. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16220. return -int32(1)
  16221. }
  16222. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  16223. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16224. return m_XML_TOK_INVALID
  16225. }
  16226. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16227. return int32(m_XML_TOK_COMMENT)
  16228. }
  16229. default:
  16230. ptr += uintptr(2)
  16231. break
  16232. }
  16233. }
  16234. }
  16235. return -int32(1)
  16236. }
  16237. /* ptr points to character following "<!" */
  16238. func _little2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16239. var v1, v2, v3 int32
  16240. _, _, _ = v1, v2, v3
  16241. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16242. return -int32(1)
  16243. }
  16244. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16245. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16246. } else {
  16247. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16248. }
  16249. switch v1 {
  16250. case int32(_BT_MINUS):
  16251. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  16252. case int32(_BT_LSQB):
  16253. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16254. return int32(m_XML_TOK_COND_SECT_OPEN)
  16255. case int32(_BT_NMSTRT):
  16256. fallthrough
  16257. case int32(_BT_HEX):
  16258. ptr += uintptr(2)
  16259. default:
  16260. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16261. return m_XML_TOK_INVALID
  16262. }
  16263. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16264. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16265. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16266. } else {
  16267. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16268. }
  16269. switch v2 {
  16270. case int32(_BT_PERCNT):
  16271. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  16272. return -int32(1)
  16273. }
  16274. /* don't allow <!ENTITY% foo "whatever"> */
  16275. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  16276. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  16277. } else {
  16278. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  16279. }
  16280. switch v3 {
  16281. case int32(_BT_S):
  16282. fallthrough
  16283. case int32(_BT_CR):
  16284. fallthrough
  16285. case int32(_BT_LF):
  16286. fallthrough
  16287. case int32(_BT_PERCNT):
  16288. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16289. return m_XML_TOK_INVALID
  16290. }
  16291. /* fall through */
  16292. fallthrough
  16293. case int32(_BT_S):
  16294. fallthrough
  16295. case int32(_BT_CR):
  16296. fallthrough
  16297. case int32(_BT_LF):
  16298. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16299. return int32(m_XML_TOK_DECL_OPEN)
  16300. case int32(_BT_NMSTRT):
  16301. fallthrough
  16302. case int32(_BT_HEX):
  16303. ptr += uintptr(2)
  16304. default:
  16305. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16306. return m_XML_TOK_INVALID
  16307. }
  16308. }
  16309. return -int32(1)
  16310. }
  16311. func _little2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  16312. var upper, v1, v2, v3 int32
  16313. _, _, _, _ = upper, v1, v2, v3
  16314. upper = 0
  16315. _ = enc
  16316. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  16317. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  16318. return int32(1)
  16319. }
  16320. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16321. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16322. } else {
  16323. v1 = -int32(1)
  16324. }
  16325. switch v1 {
  16326. case int32(m_ASCII_x):
  16327. case int32(m_ASCII_X):
  16328. upper = int32(1)
  16329. default:
  16330. return int32(1)
  16331. }
  16332. ptr += uintptr(2)
  16333. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16334. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16335. } else {
  16336. v2 = -int32(1)
  16337. }
  16338. switch v2 {
  16339. case int32(m_ASCII_m):
  16340. case int32(m_ASCII_M):
  16341. upper = int32(1)
  16342. default:
  16343. return int32(1)
  16344. }
  16345. ptr += uintptr(2)
  16346. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16347. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  16348. } else {
  16349. v3 = -int32(1)
  16350. }
  16351. switch v3 {
  16352. case int32(m_ASCII_l):
  16353. case int32(m_ASCII_L):
  16354. upper = int32(1)
  16355. default:
  16356. return int32(1)
  16357. }
  16358. if upper != 0 {
  16359. return 0
  16360. }
  16361. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  16362. return int32(1)
  16363. }
  16364. /* ptr points to character following "<?" */
  16365. func _little2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16366. bp := tls.Alloc(16)
  16367. defer tls.Free(16)
  16368. var target uintptr
  16369. var v1, v2, v3 int32
  16370. var _ /* tok at bp+0 */ int32
  16371. _, _, _, _ = target, v1, v2, v3
  16372. target = ptr
  16373. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16374. return -int32(1)
  16375. }
  16376. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16377. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16378. } else {
  16379. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16380. }
  16381. switch v1 {
  16382. case int32(_BT_NONASCII):
  16383. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16384. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16385. return m_XML_TOK_INVALID
  16386. } /* fall through */
  16387. fallthrough
  16388. case int32(_BT_NMSTRT):
  16389. fallthrough
  16390. case int32(_BT_HEX):
  16391. ptr += uintptr(2)
  16392. case int32(_BT_LEAD2):
  16393. if int64(end)-int64(ptr) < int64(2) {
  16394. return -int32(2)
  16395. }
  16396. if !(libc.Int32FromInt32(0) != 0) {
  16397. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16398. return m_XML_TOK_INVALID
  16399. }
  16400. ptr += uintptr(2)
  16401. case int32(_BT_LEAD3):
  16402. if int64(end)-int64(ptr) < int64(3) {
  16403. return -int32(2)
  16404. }
  16405. if !(libc.Int32FromInt32(0) != 0) {
  16406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16407. return m_XML_TOK_INVALID
  16408. }
  16409. ptr += uintptr(3)
  16410. case int32(_BT_LEAD4):
  16411. if int64(end)-int64(ptr) < int64(4) {
  16412. return -int32(2)
  16413. }
  16414. if !(libc.Int32FromInt32(0) != 0) {
  16415. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16416. return m_XML_TOK_INVALID
  16417. }
  16418. ptr += uintptr(4)
  16419. default:
  16420. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16421. return m_XML_TOK_INVALID
  16422. }
  16423. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16424. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16425. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16426. } else {
  16427. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16428. }
  16429. switch v2 {
  16430. case int32(_BT_NONASCII):
  16431. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16432. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16433. return m_XML_TOK_INVALID
  16434. } /* fall through */
  16435. fallthrough
  16436. case int32(_BT_NMSTRT):
  16437. fallthrough
  16438. case int32(_BT_HEX):
  16439. fallthrough
  16440. case int32(_BT_DIGIT):
  16441. fallthrough
  16442. case int32(_BT_NAME):
  16443. fallthrough
  16444. case int32(_BT_MINUS):
  16445. ptr += uintptr(2)
  16446. case int32(_BT_LEAD2):
  16447. if int64(end)-int64(ptr) < int64(2) {
  16448. return -int32(2)
  16449. }
  16450. if !(libc.Int32FromInt32(0) != 0) {
  16451. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16452. return m_XML_TOK_INVALID
  16453. }
  16454. ptr += uintptr(2)
  16455. case int32(_BT_LEAD3):
  16456. if int64(end)-int64(ptr) < int64(3) {
  16457. return -int32(2)
  16458. }
  16459. if !(libc.Int32FromInt32(0) != 0) {
  16460. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16461. return m_XML_TOK_INVALID
  16462. }
  16463. ptr += uintptr(3)
  16464. case int32(_BT_LEAD4):
  16465. if int64(end)-int64(ptr) < int64(4) {
  16466. return -int32(2)
  16467. }
  16468. if !(libc.Int32FromInt32(0) != 0) {
  16469. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16470. return m_XML_TOK_INVALID
  16471. }
  16472. ptr += uintptr(4)
  16473. case int32(_BT_S):
  16474. fallthrough
  16475. case int32(_BT_CR):
  16476. fallthrough
  16477. case int32(_BT_LF):
  16478. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  16479. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16480. return m_XML_TOK_INVALID
  16481. }
  16482. ptr += uintptr(2)
  16483. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16484. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16485. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16486. } else {
  16487. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16488. }
  16489. switch v3 {
  16490. case int32(_BT_LEAD2):
  16491. if int64(end)-int64(ptr) < int64(2) {
  16492. return -int32(2)
  16493. }
  16494. if 0 != 0 {
  16495. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16496. return m_XML_TOK_INVALID
  16497. }
  16498. ptr += uintptr(2)
  16499. case int32(_BT_LEAD3):
  16500. if int64(end)-int64(ptr) < int64(3) {
  16501. return -int32(2)
  16502. }
  16503. if 0 != 0 {
  16504. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16505. return m_XML_TOK_INVALID
  16506. }
  16507. ptr += uintptr(3)
  16508. case int32(_BT_LEAD4):
  16509. if int64(end)-int64(ptr) < int64(4) {
  16510. return -int32(2)
  16511. }
  16512. if 0 != 0 {
  16513. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16514. return m_XML_TOK_INVALID
  16515. }
  16516. ptr += uintptr(4)
  16517. case int32(_BT_NONXML):
  16518. fallthrough
  16519. case int32(_BT_MALFORM):
  16520. fallthrough
  16521. case int32(_BT_TRAIL):
  16522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16523. return m_XML_TOK_INVALID
  16524. case int32(_BT_QUEST):
  16525. ptr += uintptr(2)
  16526. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16527. return -int32(1)
  16528. }
  16529. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  16530. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16531. return *(*int32)(unsafe.Pointer(bp))
  16532. }
  16533. default:
  16534. ptr += uintptr(2)
  16535. break
  16536. }
  16537. }
  16538. return -int32(1)
  16539. case int32(_BT_QUEST):
  16540. if !(_little2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  16541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16542. return m_XML_TOK_INVALID
  16543. }
  16544. ptr += uintptr(2)
  16545. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16546. return -int32(1)
  16547. }
  16548. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  16549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16550. return *(*int32)(unsafe.Pointer(bp))
  16551. }
  16552. /* fall through */
  16553. fallthrough
  16554. default:
  16555. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16556. return m_XML_TOK_INVALID
  16557. }
  16558. }
  16559. return -int32(1)
  16560. }
  16561. func _little2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16562. var i int32
  16563. _ = i
  16564. _ = enc
  16565. /* CDATA[ */
  16566. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  16567. return -int32(1)
  16568. }
  16569. i = 0
  16570. for {
  16571. if !(i < int32(6)) {
  16572. break
  16573. }
  16574. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == libc.Int32FromUint8(_CDATA_LSQB1[i])) {
  16575. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16576. return m_XML_TOK_INVALID
  16577. }
  16578. goto _1
  16579. _1:
  16580. ;
  16581. i++
  16582. ptr += uintptr(2)
  16583. }
  16584. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16585. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  16586. }
  16587. var _CDATA_LSQB1 = [6]uint8{
  16588. 0: uint8(m_ASCII_C),
  16589. 1: uint8(m_ASCII_D),
  16590. 2: uint8(m_ASCII_A),
  16591. 3: uint8(m_ASCII_T),
  16592. 4: uint8(m_ASCII_A),
  16593. 5: uint8(m_ASCII_LSQB1),
  16594. }
  16595. func _little2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16596. var n Tsize_t
  16597. var v1, v2, v3 int32
  16598. _, _, _, _ = n, v1, v2, v3
  16599. if ptr >= end {
  16600. return -int32(4)
  16601. }
  16602. if int32(2) > int32(1) {
  16603. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  16604. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  16605. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  16606. if n == uint64(0) {
  16607. return -int32(1)
  16608. }
  16609. end = ptr + uintptr(n)
  16610. }
  16611. }
  16612. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16613. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16614. } else {
  16615. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16616. }
  16617. switch v1 {
  16618. case int32(_BT_RSQB):
  16619. ptr += uintptr(2)
  16620. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16621. return -int32(1)
  16622. }
  16623. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  16624. break
  16625. }
  16626. ptr += uintptr(2)
  16627. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16628. return -int32(1)
  16629. }
  16630. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  16631. ptr -= uintptr(2)
  16632. break
  16633. }
  16634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16635. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  16636. case int32(_BT_CR):
  16637. ptr += uintptr(2)
  16638. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16639. return -int32(1)
  16640. }
  16641. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16642. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16643. } else {
  16644. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16645. }
  16646. if v2 == int32(_BT_LF) {
  16647. ptr += uintptr(2)
  16648. }
  16649. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16650. return int32(m_XML_TOK_DATA_NEWLINE)
  16651. case int32(_BT_LF):
  16652. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16653. return int32(m_XML_TOK_DATA_NEWLINE)
  16654. case int32(_BT_LEAD2):
  16655. if int64(end)-int64(ptr) < int64(2) {
  16656. return -int32(2)
  16657. }
  16658. if 0 != 0 {
  16659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16660. return m_XML_TOK_INVALID
  16661. }
  16662. ptr += uintptr(2)
  16663. case int32(_BT_LEAD3):
  16664. if int64(end)-int64(ptr) < int64(3) {
  16665. return -int32(2)
  16666. }
  16667. if 0 != 0 {
  16668. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16669. return m_XML_TOK_INVALID
  16670. }
  16671. ptr += uintptr(3)
  16672. case int32(_BT_LEAD4):
  16673. if int64(end)-int64(ptr) < int64(4) {
  16674. return -int32(2)
  16675. }
  16676. if 0 != 0 {
  16677. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16678. return m_XML_TOK_INVALID
  16679. }
  16680. ptr += uintptr(4)
  16681. case int32(_BT_NONXML):
  16682. fallthrough
  16683. case int32(_BT_MALFORM):
  16684. fallthrough
  16685. case int32(_BT_TRAIL):
  16686. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16687. return m_XML_TOK_INVALID
  16688. default:
  16689. ptr += uintptr(2)
  16690. break
  16691. }
  16692. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16693. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16694. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16695. } else {
  16696. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16697. }
  16698. switch v3 {
  16699. case int32(_BT_LEAD2):
  16700. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  16701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16702. return int32(m_XML_TOK_DATA_CHARS)
  16703. }
  16704. ptr += uintptr(2)
  16705. case int32(_BT_LEAD3):
  16706. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  16707. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16708. return int32(m_XML_TOK_DATA_CHARS)
  16709. }
  16710. ptr += uintptr(3)
  16711. case int32(_BT_LEAD4):
  16712. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  16713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16714. return int32(m_XML_TOK_DATA_CHARS)
  16715. }
  16716. ptr += uintptr(4)
  16717. case int32(_BT_NONXML):
  16718. fallthrough
  16719. case int32(_BT_MALFORM):
  16720. fallthrough
  16721. case int32(_BT_TRAIL):
  16722. fallthrough
  16723. case int32(_BT_CR):
  16724. fallthrough
  16725. case int32(_BT_LF):
  16726. fallthrough
  16727. case int32(_BT_RSQB):
  16728. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16729. return int32(m_XML_TOK_DATA_CHARS)
  16730. default:
  16731. ptr += uintptr(2)
  16732. break
  16733. }
  16734. }
  16735. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16736. return int32(m_XML_TOK_DATA_CHARS)
  16737. }
  16738. /* ptr points to character following "</" */
  16739. func _little2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16740. var v1, v2, v22 int32
  16741. _, _, _ = v1, v2, v22
  16742. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16743. return -int32(1)
  16744. }
  16745. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16746. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16747. } else {
  16748. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16749. }
  16750. switch v1 {
  16751. case int32(_BT_NONASCII):
  16752. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16753. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16754. return m_XML_TOK_INVALID
  16755. } /* fall through */
  16756. fallthrough
  16757. case int32(_BT_NMSTRT):
  16758. fallthrough
  16759. case int32(_BT_HEX):
  16760. ptr += uintptr(2)
  16761. case int32(_BT_LEAD2):
  16762. if int64(end)-int64(ptr) < int64(2) {
  16763. return -int32(2)
  16764. }
  16765. if !(libc.Int32FromInt32(0) != 0) {
  16766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16767. return m_XML_TOK_INVALID
  16768. }
  16769. ptr += uintptr(2)
  16770. case int32(_BT_LEAD3):
  16771. if int64(end)-int64(ptr) < int64(3) {
  16772. return -int32(2)
  16773. }
  16774. if !(libc.Int32FromInt32(0) != 0) {
  16775. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16776. return m_XML_TOK_INVALID
  16777. }
  16778. ptr += uintptr(3)
  16779. case int32(_BT_LEAD4):
  16780. if int64(end)-int64(ptr) < int64(4) {
  16781. return -int32(2)
  16782. }
  16783. if !(libc.Int32FromInt32(0) != 0) {
  16784. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16785. return m_XML_TOK_INVALID
  16786. }
  16787. ptr += uintptr(4)
  16788. default:
  16789. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16790. return m_XML_TOK_INVALID
  16791. }
  16792. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16793. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16794. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16795. } else {
  16796. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16797. }
  16798. switch v2 {
  16799. case int32(_BT_NONASCII):
  16800. goto _3
  16801. case int32(_BT_MINUS):
  16802. goto _4
  16803. case int32(_BT_NAME):
  16804. goto _5
  16805. case int32(_BT_DIGIT):
  16806. goto _6
  16807. case int32(_BT_HEX):
  16808. goto _7
  16809. case int32(_BT_NMSTRT):
  16810. goto _8
  16811. case int32(_BT_LEAD2):
  16812. goto _9
  16813. case int32(_BT_LEAD3):
  16814. goto _10
  16815. case int32(_BT_LEAD4):
  16816. goto _11
  16817. case int32(_BT_LF):
  16818. goto _12
  16819. case int32(_BT_CR):
  16820. goto _13
  16821. case int32(_BT_S):
  16822. goto _14
  16823. case int32(_BT_COLON):
  16824. goto _15
  16825. case int32(_BT_GT):
  16826. goto _16
  16827. default:
  16828. goto _17
  16829. }
  16830. goto _18
  16831. _3:
  16832. ;
  16833. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  16834. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16835. return m_XML_TOK_INVALID
  16836. } /* fall through */
  16837. _8:
  16838. ;
  16839. _7:
  16840. ;
  16841. _6:
  16842. ;
  16843. _5:
  16844. ;
  16845. _4:
  16846. ;
  16847. ptr += uintptr(2)
  16848. goto _18
  16849. _9:
  16850. ;
  16851. if int64(end)-int64(ptr) < int64(2) {
  16852. return -int32(2)
  16853. }
  16854. if !(libc.Int32FromInt32(0) != 0) {
  16855. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16856. return m_XML_TOK_INVALID
  16857. }
  16858. ptr += uintptr(2)
  16859. goto _18
  16860. _10:
  16861. ;
  16862. if int64(end)-int64(ptr) < int64(3) {
  16863. return -int32(2)
  16864. }
  16865. if !(libc.Int32FromInt32(0) != 0) {
  16866. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16867. return m_XML_TOK_INVALID
  16868. }
  16869. ptr += uintptr(3)
  16870. goto _18
  16871. _11:
  16872. ;
  16873. if int64(end)-int64(ptr) < int64(4) {
  16874. return -int32(2)
  16875. }
  16876. if !(libc.Int32FromInt32(0) != 0) {
  16877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16878. return m_XML_TOK_INVALID
  16879. }
  16880. ptr += uintptr(4)
  16881. goto _18
  16882. _14:
  16883. ;
  16884. _13:
  16885. ;
  16886. _12:
  16887. ;
  16888. ptr += uintptr(2)
  16889. _21:
  16890. ;
  16891. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16892. goto _19
  16893. }
  16894. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16895. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16896. } else {
  16897. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16898. }
  16899. switch v22 {
  16900. case int32(_BT_S):
  16901. fallthrough
  16902. case int32(_BT_CR):
  16903. fallthrough
  16904. case int32(_BT_LF):
  16905. case int32(_BT_GT):
  16906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16907. return int32(m_XML_TOK_END_TAG)
  16908. default:
  16909. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16910. return m_XML_TOK_INVALID
  16911. }
  16912. goto _20
  16913. _20:
  16914. ;
  16915. ptr += uintptr(2)
  16916. goto _21
  16917. goto _19
  16918. _19:
  16919. ;
  16920. return -int32(1)
  16921. _15:
  16922. ;
  16923. /* no need to check qname syntax here,
  16924. since end-tag must match exactly */
  16925. ptr += uintptr(2)
  16926. goto _18
  16927. _16:
  16928. ;
  16929. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16930. return int32(m_XML_TOK_END_TAG)
  16931. _17:
  16932. ;
  16933. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16934. return m_XML_TOK_INVALID
  16935. _18:
  16936. }
  16937. return -int32(1)
  16938. }
  16939. /* ptr points to character following "&#X" */
  16940. func _little2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16941. var v1, v3 int32
  16942. _, _ = v1, v3
  16943. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16944. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16945. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16946. } else {
  16947. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16948. }
  16949. switch v1 {
  16950. case int32(_BT_DIGIT):
  16951. fallthrough
  16952. case int32(_BT_HEX):
  16953. default:
  16954. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16955. return m_XML_TOK_INVALID
  16956. }
  16957. ptr += uintptr(2)
  16958. for {
  16959. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  16960. break
  16961. }
  16962. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16963. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16964. } else {
  16965. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16966. }
  16967. switch v3 {
  16968. case int32(_BT_DIGIT):
  16969. fallthrough
  16970. case int32(_BT_HEX):
  16971. case int32(_BT_SEMI):
  16972. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  16973. return int32(m_XML_TOK_CHAR_REF)
  16974. default:
  16975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  16976. return m_XML_TOK_INVALID
  16977. }
  16978. goto _2
  16979. _2:
  16980. ;
  16981. ptr += uintptr(2)
  16982. }
  16983. }
  16984. return -int32(1)
  16985. }
  16986. /* ptr points to character following "&#" */
  16987. func _little2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  16988. var v1, v3 int32
  16989. _, _ = v1, v3
  16990. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  16991. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  16992. return _little2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  16993. }
  16994. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  16995. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  16996. } else {
  16997. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  16998. }
  16999. switch v1 {
  17000. case int32(_BT_DIGIT):
  17001. default:
  17002. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17003. return m_XML_TOK_INVALID
  17004. }
  17005. ptr += uintptr(2)
  17006. for {
  17007. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17008. break
  17009. }
  17010. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17011. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17012. } else {
  17013. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17014. }
  17015. switch v3 {
  17016. case int32(_BT_DIGIT):
  17017. case int32(_BT_SEMI):
  17018. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17019. return int32(m_XML_TOK_CHAR_REF)
  17020. default:
  17021. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17022. return m_XML_TOK_INVALID
  17023. }
  17024. goto _2
  17025. _2:
  17026. ;
  17027. ptr += uintptr(2)
  17028. }
  17029. }
  17030. return -int32(1)
  17031. }
  17032. /* ptr points to character following "&" */
  17033. func _little2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17034. var v1, v2 int32
  17035. _, _ = v1, v2
  17036. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17037. return -int32(1)
  17038. }
  17039. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17040. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17041. } else {
  17042. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17043. }
  17044. switch v1 {
  17045. case int32(_BT_NONASCII):
  17046. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17047. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17048. return m_XML_TOK_INVALID
  17049. } /* fall through */
  17050. fallthrough
  17051. case int32(_BT_NMSTRT):
  17052. fallthrough
  17053. case int32(_BT_HEX):
  17054. ptr += uintptr(2)
  17055. case int32(_BT_LEAD2):
  17056. if int64(end)-int64(ptr) < int64(2) {
  17057. return -int32(2)
  17058. }
  17059. if !(libc.Int32FromInt32(0) != 0) {
  17060. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17061. return m_XML_TOK_INVALID
  17062. }
  17063. ptr += uintptr(2)
  17064. case int32(_BT_LEAD3):
  17065. if int64(end)-int64(ptr) < int64(3) {
  17066. return -int32(2)
  17067. }
  17068. if !(libc.Int32FromInt32(0) != 0) {
  17069. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17070. return m_XML_TOK_INVALID
  17071. }
  17072. ptr += uintptr(3)
  17073. case int32(_BT_LEAD4):
  17074. if int64(end)-int64(ptr) < int64(4) {
  17075. return -int32(2)
  17076. }
  17077. if !(libc.Int32FromInt32(0) != 0) {
  17078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17079. return m_XML_TOK_INVALID
  17080. }
  17081. ptr += uintptr(4)
  17082. case int32(_BT_NUM):
  17083. return _little2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17084. default:
  17085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17086. return m_XML_TOK_INVALID
  17087. }
  17088. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17089. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17090. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17091. } else {
  17092. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17093. }
  17094. switch v2 {
  17095. case int32(_BT_NONASCII):
  17096. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17097. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17098. return m_XML_TOK_INVALID
  17099. } /* fall through */
  17100. fallthrough
  17101. case int32(_BT_NMSTRT):
  17102. fallthrough
  17103. case int32(_BT_HEX):
  17104. fallthrough
  17105. case int32(_BT_DIGIT):
  17106. fallthrough
  17107. case int32(_BT_NAME):
  17108. fallthrough
  17109. case int32(_BT_MINUS):
  17110. ptr += uintptr(2)
  17111. case int32(_BT_LEAD2):
  17112. if int64(end)-int64(ptr) < int64(2) {
  17113. return -int32(2)
  17114. }
  17115. if !(libc.Int32FromInt32(0) != 0) {
  17116. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17117. return m_XML_TOK_INVALID
  17118. }
  17119. ptr += uintptr(2)
  17120. case int32(_BT_LEAD3):
  17121. if int64(end)-int64(ptr) < int64(3) {
  17122. return -int32(2)
  17123. }
  17124. if !(libc.Int32FromInt32(0) != 0) {
  17125. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17126. return m_XML_TOK_INVALID
  17127. }
  17128. ptr += uintptr(3)
  17129. case int32(_BT_LEAD4):
  17130. if int64(end)-int64(ptr) < int64(4) {
  17131. return -int32(2)
  17132. }
  17133. if !(libc.Int32FromInt32(0) != 0) {
  17134. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17135. return m_XML_TOK_INVALID
  17136. }
  17137. ptr += uintptr(4)
  17138. case int32(_BT_SEMI):
  17139. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17140. return int32(m_XML_TOK_ENTITY_REF)
  17141. default:
  17142. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17143. return m_XML_TOK_INVALID
  17144. }
  17145. }
  17146. return -int32(1)
  17147. }
  17148. /* ptr points to character following first character of attribute name */
  17149. func _little2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17150. bp := tls.Alloc(16)
  17151. defer tls.Free(16)
  17152. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  17153. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  17154. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  17155. hadColon = 0
  17156. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17157. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17158. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17159. } else {
  17160. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17161. }
  17162. switch v1 {
  17163. case int32(_BT_NONASCII):
  17164. goto _2
  17165. case int32(_BT_MINUS):
  17166. goto _3
  17167. case int32(_BT_NAME):
  17168. goto _4
  17169. case int32(_BT_DIGIT):
  17170. goto _5
  17171. case int32(_BT_HEX):
  17172. goto _6
  17173. case int32(_BT_NMSTRT):
  17174. goto _7
  17175. case int32(_BT_LEAD2):
  17176. goto _8
  17177. case int32(_BT_LEAD3):
  17178. goto _9
  17179. case int32(_BT_LEAD4):
  17180. goto _10
  17181. case int32(_BT_COLON):
  17182. goto _11
  17183. case int32(_BT_LF):
  17184. goto _12
  17185. case int32(_BT_CR):
  17186. goto _13
  17187. case int32(_BT_S):
  17188. goto _14
  17189. case int32(_BT_EQUALS):
  17190. goto _15
  17191. default:
  17192. goto _16
  17193. }
  17194. goto _17
  17195. _2:
  17196. ;
  17197. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  17198. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17199. return m_XML_TOK_INVALID
  17200. } /* fall through */
  17201. _7:
  17202. ;
  17203. _6:
  17204. ;
  17205. _5:
  17206. ;
  17207. _4:
  17208. ;
  17209. _3:
  17210. ;
  17211. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17212. goto _17
  17213. _8:
  17214. ;
  17215. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17216. return -int32(2)
  17217. }
  17218. if !(libc.Int32FromInt32(0) != 0) {
  17219. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17220. return m_XML_TOK_INVALID
  17221. }
  17222. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17223. goto _17
  17224. _9:
  17225. ;
  17226. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17227. return -int32(2)
  17228. }
  17229. if !(libc.Int32FromInt32(0) != 0) {
  17230. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17231. return m_XML_TOK_INVALID
  17232. }
  17233. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17234. goto _17
  17235. _10:
  17236. ;
  17237. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17238. return -int32(2)
  17239. }
  17240. if !(libc.Int32FromInt32(0) != 0) {
  17241. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17242. return m_XML_TOK_INVALID
  17243. }
  17244. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17245. goto _17
  17246. _11:
  17247. ;
  17248. if hadColon != 0 {
  17249. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17250. return m_XML_TOK_INVALID
  17251. }
  17252. hadColon = int32(1)
  17253. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17254. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17255. return -int32(1)
  17256. }
  17257. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17258. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17259. } else {
  17260. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17261. }
  17262. switch v18 {
  17263. case int32(_BT_NONASCII):
  17264. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  17265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17266. return m_XML_TOK_INVALID
  17267. } /* fall through */
  17268. fallthrough
  17269. case int32(_BT_NMSTRT):
  17270. fallthrough
  17271. case int32(_BT_HEX):
  17272. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17273. case int32(_BT_LEAD2):
  17274. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17275. return -int32(2)
  17276. }
  17277. if !(libc.Int32FromInt32(0) != 0) {
  17278. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17279. return m_XML_TOK_INVALID
  17280. }
  17281. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17282. case int32(_BT_LEAD3):
  17283. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17284. return -int32(2)
  17285. }
  17286. if !(libc.Int32FromInt32(0) != 0) {
  17287. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17288. return m_XML_TOK_INVALID
  17289. }
  17290. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17291. case int32(_BT_LEAD4):
  17292. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17293. return -int32(2)
  17294. }
  17295. if !(libc.Int32FromInt32(0) != 0) {
  17296. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17297. return m_XML_TOK_INVALID
  17298. }
  17299. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17300. default:
  17301. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17302. return m_XML_TOK_INVALID
  17303. }
  17304. goto _17
  17305. _14:
  17306. ;
  17307. _13:
  17308. ;
  17309. _12:
  17310. ;
  17311. _21:
  17312. ;
  17313. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17314. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17315. return -int32(1)
  17316. }
  17317. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17318. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17319. } else {
  17320. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17321. }
  17322. t = v22
  17323. if t == int32(_BT_EQUALS) {
  17324. goto _19
  17325. }
  17326. switch t {
  17327. case int32(_BT_S):
  17328. fallthrough
  17329. case int32(_BT_LF):
  17330. fallthrough
  17331. case int32(_BT_CR):
  17332. default:
  17333. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17334. return m_XML_TOK_INVALID
  17335. }
  17336. goto _20
  17337. _20:
  17338. ;
  17339. goto _21
  17340. goto _19
  17341. _19:
  17342. ;
  17343. /* fall through */
  17344. _15:
  17345. ;
  17346. hadColon = 0
  17347. for {
  17348. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17349. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17350. return -int32(1)
  17351. }
  17352. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17353. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17354. } else {
  17355. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17356. }
  17357. open = v24
  17358. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  17359. break
  17360. }
  17361. switch open {
  17362. case int32(_BT_S):
  17363. fallthrough
  17364. case int32(_BT_LF):
  17365. fallthrough
  17366. case int32(_BT_CR):
  17367. default:
  17368. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17369. return m_XML_TOK_INVALID
  17370. }
  17371. goto _23
  17372. _23:
  17373. }
  17374. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17375. /* in attribute value */
  17376. for {
  17377. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17378. return -int32(1)
  17379. }
  17380. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17381. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17382. } else {
  17383. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17384. }
  17385. t1 = v26
  17386. if t1 == open {
  17387. break
  17388. }
  17389. switch t1 {
  17390. case int32(_BT_LEAD2):
  17391. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17392. return -int32(2)
  17393. }
  17394. if 0 != 0 {
  17395. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17396. return m_XML_TOK_INVALID
  17397. }
  17398. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17399. case int32(_BT_LEAD3):
  17400. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17401. return -int32(2)
  17402. }
  17403. if 0 != 0 {
  17404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17405. return m_XML_TOK_INVALID
  17406. }
  17407. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17408. case int32(_BT_LEAD4):
  17409. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17410. return -int32(2)
  17411. }
  17412. if 0 != 0 {
  17413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17414. return m_XML_TOK_INVALID
  17415. }
  17416. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17417. case int32(_BT_NONXML):
  17418. fallthrough
  17419. case int32(_BT_MALFORM):
  17420. fallthrough
  17421. case int32(_BT_TRAIL):
  17422. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17423. return m_XML_TOK_INVALID
  17424. case int32(_BT_AMP):
  17425. tok = _little2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  17426. if tok <= 0 {
  17427. if tok == m_XML_TOK_INVALID {
  17428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17429. }
  17430. return tok
  17431. }
  17432. case int32(_BT_LT):
  17433. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17434. return m_XML_TOK_INVALID
  17435. default:
  17436. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17437. break
  17438. }
  17439. goto _25
  17440. _25:
  17441. }
  17442. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17443. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17444. return -int32(1)
  17445. }
  17446. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17447. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17448. } else {
  17449. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17450. }
  17451. switch v27 {
  17452. case int32(_BT_S):
  17453. fallthrough
  17454. case int32(_BT_CR):
  17455. fallthrough
  17456. case int32(_BT_LF):
  17457. case int32(_BT_SOL):
  17458. goto sol
  17459. case int32(_BT_GT):
  17460. goto gt
  17461. default:
  17462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17463. return m_XML_TOK_INVALID
  17464. }
  17465. /* ptr points to closing quote */
  17466. _30:
  17467. ;
  17468. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17469. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17470. return -int32(1)
  17471. }
  17472. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 {
  17473. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))))))
  17474. } else {
  17475. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))
  17476. }
  17477. switch v31 {
  17478. case int32(_BT_NONASCII):
  17479. goto _32
  17480. case int32(_BT_HEX):
  17481. goto _33
  17482. case int32(_BT_NMSTRT):
  17483. goto _34
  17484. case int32(_BT_LEAD2):
  17485. goto _35
  17486. case int32(_BT_LEAD3):
  17487. goto _36
  17488. case int32(_BT_LEAD4):
  17489. goto _37
  17490. case int32(_BT_LF):
  17491. goto _38
  17492. case int32(_BT_CR):
  17493. goto _39
  17494. case int32(_BT_S):
  17495. goto _40
  17496. case int32(_BT_GT):
  17497. goto _41
  17498. case int32(_BT_SOL):
  17499. goto _42
  17500. default:
  17501. goto _43
  17502. }
  17503. goto _44
  17504. _32:
  17505. ;
  17506. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))))&libc.Int32FromInt32(0x1F))) != 0) {
  17507. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17508. return m_XML_TOK_INVALID
  17509. } /* fall through */
  17510. _34:
  17511. ;
  17512. _33:
  17513. ;
  17514. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17515. goto _44
  17516. _35:
  17517. ;
  17518. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  17519. return -int32(2)
  17520. }
  17521. if !(libc.Int32FromInt32(0) != 0) {
  17522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17523. return m_XML_TOK_INVALID
  17524. }
  17525. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17526. goto _44
  17527. _36:
  17528. ;
  17529. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  17530. return -int32(2)
  17531. }
  17532. if !(libc.Int32FromInt32(0) != 0) {
  17533. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17534. return m_XML_TOK_INVALID
  17535. }
  17536. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  17537. goto _44
  17538. _37:
  17539. ;
  17540. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  17541. return -int32(2)
  17542. }
  17543. if !(libc.Int32FromInt32(0) != 0) {
  17544. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17545. return m_XML_TOK_INVALID
  17546. }
  17547. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  17548. goto _44
  17549. _40:
  17550. ;
  17551. _39:
  17552. ;
  17553. _38:
  17554. ;
  17555. goto _29
  17556. _41:
  17557. ;
  17558. goto gt
  17559. gt:
  17560. ;
  17561. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  17562. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  17563. _42:
  17564. ;
  17565. goto sol
  17566. sol:
  17567. ;
  17568. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  17569. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17570. return -int32(1)
  17571. }
  17572. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == int32(m_ASCII_GT1)) {
  17573. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17574. return m_XML_TOK_INVALID
  17575. }
  17576. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  17577. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  17578. _43:
  17579. ;
  17580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17581. return m_XML_TOK_INVALID
  17582. _44:
  17583. ;
  17584. goto _28
  17585. goto _29
  17586. _29:
  17587. ;
  17588. goto _30
  17589. goto _28
  17590. _28:
  17591. ;
  17592. goto _17
  17593. _16:
  17594. ;
  17595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  17596. return m_XML_TOK_INVALID
  17597. _17:
  17598. }
  17599. return -int32(1)
  17600. }
  17601. /* ptr points to character following "<" */
  17602. func _little2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17603. var hadColon, v1, v2, v21, v22, v3 int32
  17604. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  17605. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17606. return -int32(1)
  17607. }
  17608. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17609. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17610. } else {
  17611. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17612. }
  17613. switch v1 {
  17614. case int32(_BT_NONASCII):
  17615. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17617. return m_XML_TOK_INVALID
  17618. } /* fall through */
  17619. fallthrough
  17620. case int32(_BT_NMSTRT):
  17621. fallthrough
  17622. case int32(_BT_HEX):
  17623. ptr += uintptr(2)
  17624. case int32(_BT_LEAD2):
  17625. if int64(end)-int64(ptr) < int64(2) {
  17626. return -int32(2)
  17627. }
  17628. if !(libc.Int32FromInt32(0) != 0) {
  17629. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17630. return m_XML_TOK_INVALID
  17631. }
  17632. ptr += uintptr(2)
  17633. case int32(_BT_LEAD3):
  17634. if int64(end)-int64(ptr) < int64(3) {
  17635. return -int32(2)
  17636. }
  17637. if !(libc.Int32FromInt32(0) != 0) {
  17638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17639. return m_XML_TOK_INVALID
  17640. }
  17641. ptr += uintptr(3)
  17642. case int32(_BT_LEAD4):
  17643. if int64(end)-int64(ptr) < int64(4) {
  17644. return -int32(2)
  17645. }
  17646. if !(libc.Int32FromInt32(0) != 0) {
  17647. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17648. return m_XML_TOK_INVALID
  17649. }
  17650. ptr += uintptr(4)
  17651. case int32(_BT_EXCL):
  17652. ptr += uintptr(2)
  17653. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17654. return -int32(1)
  17655. }
  17656. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17657. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17658. } else {
  17659. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17660. }
  17661. switch v2 {
  17662. case int32(_BT_MINUS):
  17663. return _little2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17664. case int32(_BT_LSQB):
  17665. return _little2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17666. }
  17667. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17668. return m_XML_TOK_INVALID
  17669. case int32(_BT_QUEST):
  17670. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17671. case int32(_BT_SOL):
  17672. return _little2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17673. default:
  17674. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17675. return m_XML_TOK_INVALID
  17676. }
  17677. hadColon = 0
  17678. /* we have a start-tag */
  17679. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17680. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17681. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17682. } else {
  17683. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17684. }
  17685. switch v3 {
  17686. case int32(_BT_NONASCII):
  17687. goto _4
  17688. case int32(_BT_MINUS):
  17689. goto _5
  17690. case int32(_BT_NAME):
  17691. goto _6
  17692. case int32(_BT_DIGIT):
  17693. goto _7
  17694. case int32(_BT_HEX):
  17695. goto _8
  17696. case int32(_BT_NMSTRT):
  17697. goto _9
  17698. case int32(_BT_LEAD2):
  17699. goto _10
  17700. case int32(_BT_LEAD3):
  17701. goto _11
  17702. case int32(_BT_LEAD4):
  17703. goto _12
  17704. case int32(_BT_COLON):
  17705. goto _13
  17706. case int32(_BT_LF):
  17707. goto _14
  17708. case int32(_BT_CR):
  17709. goto _15
  17710. case int32(_BT_S):
  17711. goto _16
  17712. case int32(_BT_GT):
  17713. goto _17
  17714. case int32(_BT_SOL):
  17715. goto _18
  17716. default:
  17717. goto _19
  17718. }
  17719. goto _20
  17720. _4:
  17721. ;
  17722. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17723. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17724. return m_XML_TOK_INVALID
  17725. } /* fall through */
  17726. _9:
  17727. ;
  17728. _8:
  17729. ;
  17730. _7:
  17731. ;
  17732. _6:
  17733. ;
  17734. _5:
  17735. ;
  17736. ptr += uintptr(2)
  17737. goto _20
  17738. _10:
  17739. ;
  17740. if int64(end)-int64(ptr) < int64(2) {
  17741. return -int32(2)
  17742. }
  17743. if !(libc.Int32FromInt32(0) != 0) {
  17744. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17745. return m_XML_TOK_INVALID
  17746. }
  17747. ptr += uintptr(2)
  17748. goto _20
  17749. _11:
  17750. ;
  17751. if int64(end)-int64(ptr) < int64(3) {
  17752. return -int32(2)
  17753. }
  17754. if !(libc.Int32FromInt32(0) != 0) {
  17755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17756. return m_XML_TOK_INVALID
  17757. }
  17758. ptr += uintptr(3)
  17759. goto _20
  17760. _12:
  17761. ;
  17762. if int64(end)-int64(ptr) < int64(4) {
  17763. return -int32(2)
  17764. }
  17765. if !(libc.Int32FromInt32(0) != 0) {
  17766. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17767. return m_XML_TOK_INVALID
  17768. }
  17769. ptr += uintptr(4)
  17770. goto _20
  17771. _13:
  17772. ;
  17773. if hadColon != 0 {
  17774. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17775. return m_XML_TOK_INVALID
  17776. }
  17777. hadColon = int32(1)
  17778. ptr += uintptr(2)
  17779. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17780. return -int32(1)
  17781. }
  17782. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17783. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17784. } else {
  17785. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17786. }
  17787. switch v21 {
  17788. case int32(_BT_NONASCII):
  17789. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17790. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17791. return m_XML_TOK_INVALID
  17792. } /* fall through */
  17793. fallthrough
  17794. case int32(_BT_NMSTRT):
  17795. fallthrough
  17796. case int32(_BT_HEX):
  17797. ptr += uintptr(2)
  17798. case int32(_BT_LEAD2):
  17799. if int64(end)-int64(ptr) < int64(2) {
  17800. return -int32(2)
  17801. }
  17802. if !(libc.Int32FromInt32(0) != 0) {
  17803. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17804. return m_XML_TOK_INVALID
  17805. }
  17806. ptr += uintptr(2)
  17807. case int32(_BT_LEAD3):
  17808. if int64(end)-int64(ptr) < int64(3) {
  17809. return -int32(2)
  17810. }
  17811. if !(libc.Int32FromInt32(0) != 0) {
  17812. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17813. return m_XML_TOK_INVALID
  17814. }
  17815. ptr += uintptr(3)
  17816. case int32(_BT_LEAD4):
  17817. if int64(end)-int64(ptr) < int64(4) {
  17818. return -int32(2)
  17819. }
  17820. if !(libc.Int32FromInt32(0) != 0) {
  17821. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17822. return m_XML_TOK_INVALID
  17823. }
  17824. ptr += uintptr(4)
  17825. default:
  17826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17827. return m_XML_TOK_INVALID
  17828. }
  17829. goto _20
  17830. _16:
  17831. ;
  17832. _15:
  17833. ;
  17834. _14:
  17835. ;
  17836. ptr += uintptr(2)
  17837. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  17838. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17839. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17840. } else {
  17841. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17842. }
  17843. switch v22 {
  17844. case int32(_BT_NONASCII):
  17845. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  17846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17847. return m_XML_TOK_INVALID
  17848. } /* fall through */
  17849. fallthrough
  17850. case int32(_BT_NMSTRT):
  17851. fallthrough
  17852. case int32(_BT_HEX):
  17853. ptr += uintptr(2)
  17854. case int32(_BT_LEAD2):
  17855. if int64(end)-int64(ptr) < int64(2) {
  17856. return -int32(2)
  17857. }
  17858. if !(libc.Int32FromInt32(0) != 0) {
  17859. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17860. return m_XML_TOK_INVALID
  17861. }
  17862. ptr += uintptr(2)
  17863. case int32(_BT_LEAD3):
  17864. if int64(end)-int64(ptr) < int64(3) {
  17865. return -int32(2)
  17866. }
  17867. if !(libc.Int32FromInt32(0) != 0) {
  17868. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17869. return m_XML_TOK_INVALID
  17870. }
  17871. ptr += uintptr(3)
  17872. case int32(_BT_LEAD4):
  17873. if int64(end)-int64(ptr) < int64(4) {
  17874. return -int32(2)
  17875. }
  17876. if !(libc.Int32FromInt32(0) != 0) {
  17877. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17878. return m_XML_TOK_INVALID
  17879. }
  17880. ptr += uintptr(4)
  17881. case int32(_BT_GT):
  17882. goto gt
  17883. case int32(_BT_SOL):
  17884. goto sol
  17885. case int32(_BT_S):
  17886. fallthrough
  17887. case int32(_BT_CR):
  17888. fallthrough
  17889. case int32(_BT_LF):
  17890. ptr += uintptr(2)
  17891. continue
  17892. default:
  17893. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17894. return m_XML_TOK_INVALID
  17895. }
  17896. return _little2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  17897. }
  17898. return -int32(1)
  17899. _17:
  17900. ;
  17901. goto gt
  17902. gt:
  17903. ;
  17904. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17905. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  17906. _18:
  17907. ;
  17908. goto sol
  17909. sol:
  17910. ;
  17911. ptr += uintptr(2)
  17912. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17913. return -int32(1)
  17914. }
  17915. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  17916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17917. return m_XML_TOK_INVALID
  17918. }
  17919. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17920. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  17921. _19:
  17922. ;
  17923. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17924. return m_XML_TOK_INVALID
  17925. _20:
  17926. }
  17927. return -int32(1)
  17928. }
  17929. func _little2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  17930. var n Tsize_t
  17931. var v1, v2, v3 int32
  17932. _, _, _, _ = n, v1, v2, v3
  17933. if ptr >= end {
  17934. return -int32(4)
  17935. }
  17936. if int32(2) > int32(1) {
  17937. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  17938. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  17939. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  17940. if n == uint64(0) {
  17941. return -int32(1)
  17942. }
  17943. end = ptr + uintptr(n)
  17944. }
  17945. }
  17946. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17947. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17948. } else {
  17949. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17950. }
  17951. switch v1 {
  17952. case int32(_BT_LT):
  17953. return _little2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17954. case int32(_BT_AMP):
  17955. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  17956. case int32(_BT_CR):
  17957. ptr += uintptr(2)
  17958. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17959. return -int32(3)
  17960. }
  17961. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  17962. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  17963. } else {
  17964. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  17965. }
  17966. if v2 == int32(_BT_LF) {
  17967. ptr += uintptr(2)
  17968. }
  17969. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17970. return int32(m_XML_TOK_DATA_NEWLINE)
  17971. case int32(_BT_LF):
  17972. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  17973. return int32(m_XML_TOK_DATA_NEWLINE)
  17974. case int32(_BT_RSQB):
  17975. ptr += uintptr(2)
  17976. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17977. return -int32(5)
  17978. }
  17979. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1)) {
  17980. break
  17981. }
  17982. ptr += uintptr(2)
  17983. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  17984. return -int32(5)
  17985. }
  17986. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1)) {
  17987. ptr -= uintptr(2)
  17988. break
  17989. }
  17990. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17991. return m_XML_TOK_INVALID
  17992. case int32(_BT_LEAD2):
  17993. if int64(end)-int64(ptr) < int64(2) {
  17994. return -int32(2)
  17995. }
  17996. if 0 != 0 {
  17997. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  17998. return m_XML_TOK_INVALID
  17999. }
  18000. ptr += uintptr(2)
  18001. case int32(_BT_LEAD3):
  18002. if int64(end)-int64(ptr) < int64(3) {
  18003. return -int32(2)
  18004. }
  18005. if 0 != 0 {
  18006. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18007. return m_XML_TOK_INVALID
  18008. }
  18009. ptr += uintptr(3)
  18010. case int32(_BT_LEAD4):
  18011. if int64(end)-int64(ptr) < int64(4) {
  18012. return -int32(2)
  18013. }
  18014. if 0 != 0 {
  18015. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18016. return m_XML_TOK_INVALID
  18017. }
  18018. ptr += uintptr(4)
  18019. case int32(_BT_NONXML):
  18020. fallthrough
  18021. case int32(_BT_MALFORM):
  18022. fallthrough
  18023. case int32(_BT_TRAIL):
  18024. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18025. return m_XML_TOK_INVALID
  18026. default:
  18027. ptr += uintptr(2)
  18028. break
  18029. }
  18030. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18031. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18032. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18033. } else {
  18034. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18035. }
  18036. switch v3 {
  18037. case int32(_BT_LEAD2):
  18038. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  18039. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18040. return int32(m_XML_TOK_DATA_CHARS)
  18041. }
  18042. ptr += uintptr(2)
  18043. case int32(_BT_LEAD3):
  18044. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  18045. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18046. return int32(m_XML_TOK_DATA_CHARS)
  18047. }
  18048. ptr += uintptr(3)
  18049. case int32(_BT_LEAD4):
  18050. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  18051. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18052. return int32(m_XML_TOK_DATA_CHARS)
  18053. }
  18054. ptr += uintptr(4)
  18055. case int32(_BT_RSQB):
  18056. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  18057. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_RSQB1)) {
  18058. ptr += uintptr(2)
  18059. break
  18060. }
  18061. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  18062. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == int32(m_ASCII_GT1)) {
  18063. ptr += uintptr(2)
  18064. break
  18065. }
  18066. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  18067. return m_XML_TOK_INVALID
  18068. }
  18069. }
  18070. /* fall through */
  18071. fallthrough
  18072. case int32(_BT_AMP):
  18073. fallthrough
  18074. case int32(_BT_LT):
  18075. fallthrough
  18076. case int32(_BT_NONXML):
  18077. fallthrough
  18078. case int32(_BT_MALFORM):
  18079. fallthrough
  18080. case int32(_BT_TRAIL):
  18081. fallthrough
  18082. case int32(_BT_CR):
  18083. fallthrough
  18084. case int32(_BT_LF):
  18085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18086. return int32(m_XML_TOK_DATA_CHARS)
  18087. default:
  18088. ptr += uintptr(2)
  18089. break
  18090. }
  18091. }
  18092. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18093. return int32(m_XML_TOK_DATA_CHARS)
  18094. }
  18095. /* ptr points to character following "%" */
  18096. func _little2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18097. var v1, v2 int32
  18098. _, _ = v1, v2
  18099. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18100. return -int32(1)
  18101. }
  18102. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18103. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18104. } else {
  18105. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18106. }
  18107. switch v1 {
  18108. case int32(_BT_NONASCII):
  18109. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18110. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18111. return m_XML_TOK_INVALID
  18112. } /* fall through */
  18113. fallthrough
  18114. case int32(_BT_NMSTRT):
  18115. fallthrough
  18116. case int32(_BT_HEX):
  18117. ptr += uintptr(2)
  18118. case int32(_BT_LEAD2):
  18119. if int64(end)-int64(ptr) < int64(2) {
  18120. return -int32(2)
  18121. }
  18122. if !(libc.Int32FromInt32(0) != 0) {
  18123. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18124. return m_XML_TOK_INVALID
  18125. }
  18126. ptr += uintptr(2)
  18127. case int32(_BT_LEAD3):
  18128. if int64(end)-int64(ptr) < int64(3) {
  18129. return -int32(2)
  18130. }
  18131. if !(libc.Int32FromInt32(0) != 0) {
  18132. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18133. return m_XML_TOK_INVALID
  18134. }
  18135. ptr += uintptr(3)
  18136. case int32(_BT_LEAD4):
  18137. if int64(end)-int64(ptr) < int64(4) {
  18138. return -int32(2)
  18139. }
  18140. if !(libc.Int32FromInt32(0) != 0) {
  18141. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18142. return m_XML_TOK_INVALID
  18143. }
  18144. ptr += uintptr(4)
  18145. case int32(_BT_S):
  18146. fallthrough
  18147. case int32(_BT_LF):
  18148. fallthrough
  18149. case int32(_BT_CR):
  18150. fallthrough
  18151. case int32(_BT_PERCNT):
  18152. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18153. return int32(m_XML_TOK_PERCENT)
  18154. default:
  18155. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18156. return m_XML_TOK_INVALID
  18157. }
  18158. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18159. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18160. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18161. } else {
  18162. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18163. }
  18164. switch v2 {
  18165. case int32(_BT_NONASCII):
  18166. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18167. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18168. return m_XML_TOK_INVALID
  18169. } /* fall through */
  18170. fallthrough
  18171. case int32(_BT_NMSTRT):
  18172. fallthrough
  18173. case int32(_BT_HEX):
  18174. fallthrough
  18175. case int32(_BT_DIGIT):
  18176. fallthrough
  18177. case int32(_BT_NAME):
  18178. fallthrough
  18179. case int32(_BT_MINUS):
  18180. ptr += uintptr(2)
  18181. case int32(_BT_LEAD2):
  18182. if int64(end)-int64(ptr) < int64(2) {
  18183. return -int32(2)
  18184. }
  18185. if !(libc.Int32FromInt32(0) != 0) {
  18186. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18187. return m_XML_TOK_INVALID
  18188. }
  18189. ptr += uintptr(2)
  18190. case int32(_BT_LEAD3):
  18191. if int64(end)-int64(ptr) < int64(3) {
  18192. return -int32(2)
  18193. }
  18194. if !(libc.Int32FromInt32(0) != 0) {
  18195. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18196. return m_XML_TOK_INVALID
  18197. }
  18198. ptr += uintptr(3)
  18199. case int32(_BT_LEAD4):
  18200. if int64(end)-int64(ptr) < int64(4) {
  18201. return -int32(2)
  18202. }
  18203. if !(libc.Int32FromInt32(0) != 0) {
  18204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18205. return m_XML_TOK_INVALID
  18206. }
  18207. ptr += uintptr(4)
  18208. case int32(_BT_SEMI):
  18209. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18210. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  18211. default:
  18212. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18213. return m_XML_TOK_INVALID
  18214. }
  18215. }
  18216. return -int32(1)
  18217. }
  18218. func _little2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18219. var v1, v2 int32
  18220. _, _ = v1, v2
  18221. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18222. return -int32(1)
  18223. }
  18224. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18225. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18226. } else {
  18227. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18228. }
  18229. switch v1 {
  18230. case int32(_BT_NONASCII):
  18231. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18232. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18233. return m_XML_TOK_INVALID
  18234. } /* fall through */
  18235. fallthrough
  18236. case int32(_BT_NMSTRT):
  18237. fallthrough
  18238. case int32(_BT_HEX):
  18239. ptr += uintptr(2)
  18240. case int32(_BT_LEAD2):
  18241. if int64(end)-int64(ptr) < int64(2) {
  18242. return -int32(2)
  18243. }
  18244. if !(libc.Int32FromInt32(0) != 0) {
  18245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18246. return m_XML_TOK_INVALID
  18247. }
  18248. ptr += uintptr(2)
  18249. case int32(_BT_LEAD3):
  18250. if int64(end)-int64(ptr) < int64(3) {
  18251. return -int32(2)
  18252. }
  18253. if !(libc.Int32FromInt32(0) != 0) {
  18254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18255. return m_XML_TOK_INVALID
  18256. }
  18257. ptr += uintptr(3)
  18258. case int32(_BT_LEAD4):
  18259. if int64(end)-int64(ptr) < int64(4) {
  18260. return -int32(2)
  18261. }
  18262. if !(libc.Int32FromInt32(0) != 0) {
  18263. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18264. return m_XML_TOK_INVALID
  18265. }
  18266. ptr += uintptr(4)
  18267. default:
  18268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18269. return m_XML_TOK_INVALID
  18270. }
  18271. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18272. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18273. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18274. } else {
  18275. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18276. }
  18277. switch v2 {
  18278. case int32(_BT_NONASCII):
  18279. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18280. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18281. return m_XML_TOK_INVALID
  18282. } /* fall through */
  18283. fallthrough
  18284. case int32(_BT_NMSTRT):
  18285. fallthrough
  18286. case int32(_BT_HEX):
  18287. fallthrough
  18288. case int32(_BT_DIGIT):
  18289. fallthrough
  18290. case int32(_BT_NAME):
  18291. fallthrough
  18292. case int32(_BT_MINUS):
  18293. ptr += uintptr(2)
  18294. case int32(_BT_LEAD2):
  18295. if int64(end)-int64(ptr) < int64(2) {
  18296. return -int32(2)
  18297. }
  18298. if !(libc.Int32FromInt32(0) != 0) {
  18299. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18300. return m_XML_TOK_INVALID
  18301. }
  18302. ptr += uintptr(2)
  18303. case int32(_BT_LEAD3):
  18304. if int64(end)-int64(ptr) < int64(3) {
  18305. return -int32(2)
  18306. }
  18307. if !(libc.Int32FromInt32(0) != 0) {
  18308. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18309. return m_XML_TOK_INVALID
  18310. }
  18311. ptr += uintptr(3)
  18312. case int32(_BT_LEAD4):
  18313. if int64(end)-int64(ptr) < int64(4) {
  18314. return -int32(2)
  18315. }
  18316. if !(libc.Int32FromInt32(0) != 0) {
  18317. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18318. return m_XML_TOK_INVALID
  18319. }
  18320. ptr += uintptr(4)
  18321. case int32(_BT_CR):
  18322. fallthrough
  18323. case int32(_BT_LF):
  18324. fallthrough
  18325. case int32(_BT_S):
  18326. fallthrough
  18327. case int32(_BT_RPAR):
  18328. fallthrough
  18329. case int32(_BT_GT):
  18330. fallthrough
  18331. case int32(_BT_PERCNT):
  18332. fallthrough
  18333. case int32(_BT_VERBAR):
  18334. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18335. return int32(m_XML_TOK_POUND_NAME)
  18336. default:
  18337. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18338. return m_XML_TOK_INVALID
  18339. }
  18340. }
  18341. return -int32(m_XML_TOK_POUND_NAME)
  18342. }
  18343. func _little2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18344. var t, v1, v2 int32
  18345. _, _, _ = t, v1, v2
  18346. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18347. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18348. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18349. } else {
  18350. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18351. }
  18352. t = v1
  18353. switch t {
  18354. case int32(_BT_LEAD2):
  18355. if int64(end)-int64(ptr) < int64(2) {
  18356. return -int32(2)
  18357. }
  18358. if 0 != 0 {
  18359. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18360. return m_XML_TOK_INVALID
  18361. }
  18362. ptr += uintptr(2)
  18363. case int32(_BT_LEAD3):
  18364. if int64(end)-int64(ptr) < int64(3) {
  18365. return -int32(2)
  18366. }
  18367. if 0 != 0 {
  18368. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18369. return m_XML_TOK_INVALID
  18370. }
  18371. ptr += uintptr(3)
  18372. case int32(_BT_LEAD4):
  18373. if int64(end)-int64(ptr) < int64(4) {
  18374. return -int32(2)
  18375. }
  18376. if 0 != 0 {
  18377. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18378. return m_XML_TOK_INVALID
  18379. }
  18380. ptr += uintptr(4)
  18381. case int32(_BT_NONXML):
  18382. fallthrough
  18383. case int32(_BT_MALFORM):
  18384. fallthrough
  18385. case int32(_BT_TRAIL):
  18386. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18387. return m_XML_TOK_INVALID
  18388. case int32(_BT_QUOT):
  18389. fallthrough
  18390. case int32(_BT_APOS):
  18391. ptr += uintptr(2)
  18392. if t != open {
  18393. break
  18394. }
  18395. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18396. return -int32(m_XML_TOK_LITERAL)
  18397. }
  18398. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18399. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18400. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18401. } else {
  18402. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18403. }
  18404. switch v2 {
  18405. case int32(_BT_S):
  18406. fallthrough
  18407. case int32(_BT_CR):
  18408. fallthrough
  18409. case int32(_BT_LF):
  18410. fallthrough
  18411. case int32(_BT_GT):
  18412. fallthrough
  18413. case int32(_BT_PERCNT):
  18414. fallthrough
  18415. case int32(_BT_LSQB):
  18416. return int32(m_XML_TOK_LITERAL)
  18417. default:
  18418. return m_XML_TOK_INVALID
  18419. }
  18420. fallthrough
  18421. default:
  18422. ptr += uintptr(2)
  18423. break
  18424. }
  18425. }
  18426. return -int32(1)
  18427. }
  18428. func _little2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18429. var n Tsize_t
  18430. var tok, v1, v29, v33, v34, v35, v36 int32
  18431. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  18432. if ptr >= end {
  18433. return -int32(4)
  18434. }
  18435. if int32(2) > int32(1) {
  18436. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  18437. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  18438. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  18439. if n == uint64(0) {
  18440. return -int32(1)
  18441. }
  18442. end = ptr + uintptr(n)
  18443. }
  18444. }
  18445. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18446. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18447. } else {
  18448. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18449. }
  18450. switch v1 {
  18451. case int32(_BT_QUOT):
  18452. goto _2
  18453. case int32(_BT_APOS):
  18454. goto _3
  18455. case int32(_BT_LT):
  18456. goto _4
  18457. case int32(_BT_CR):
  18458. goto _5
  18459. case int32(_BT_LF):
  18460. goto _6
  18461. case int32(_BT_S):
  18462. goto _7
  18463. case int32(_BT_PERCNT):
  18464. goto _8
  18465. case int32(_BT_COMMA):
  18466. goto _9
  18467. case int32(_BT_LSQB):
  18468. goto _10
  18469. case int32(_BT_RSQB):
  18470. goto _11
  18471. case int32(_BT_LPAR):
  18472. goto _12
  18473. case int32(_BT_RPAR):
  18474. goto _13
  18475. case int32(_BT_VERBAR):
  18476. goto _14
  18477. case int32(_BT_GT):
  18478. goto _15
  18479. case int32(_BT_NUM):
  18480. goto _16
  18481. case int32(_BT_LEAD2):
  18482. goto _17
  18483. case int32(_BT_LEAD3):
  18484. goto _18
  18485. case int32(_BT_LEAD4):
  18486. goto _19
  18487. case int32(_BT_HEX):
  18488. goto _20
  18489. case int32(_BT_NMSTRT):
  18490. goto _21
  18491. case int32(_BT_COLON):
  18492. goto _22
  18493. case int32(_BT_MINUS):
  18494. goto _23
  18495. case int32(_BT_NAME):
  18496. goto _24
  18497. case int32(_BT_DIGIT):
  18498. goto _25
  18499. case int32(_BT_NONASCII):
  18500. goto _26
  18501. default:
  18502. goto _27
  18503. }
  18504. goto _28
  18505. _2:
  18506. ;
  18507. return _little2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  18508. _3:
  18509. ;
  18510. return _little2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  18511. _4:
  18512. ;
  18513. ptr += uintptr(2)
  18514. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18515. return -int32(1)
  18516. }
  18517. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18518. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18519. } else {
  18520. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18521. }
  18522. switch v29 {
  18523. case int32(_BT_EXCL):
  18524. return _little2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18525. case int32(_BT_QUEST):
  18526. return _little2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18527. case int32(_BT_NMSTRT):
  18528. fallthrough
  18529. case int32(_BT_HEX):
  18530. fallthrough
  18531. case int32(_BT_NONASCII):
  18532. fallthrough
  18533. case int32(_BT_LEAD2):
  18534. fallthrough
  18535. case int32(_BT_LEAD3):
  18536. fallthrough
  18537. case int32(_BT_LEAD4):
  18538. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  18539. return int32(m_XML_TOK_INSTANCE_START)
  18540. }
  18541. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18542. return m_XML_TOK_INVALID
  18543. _5:
  18544. ;
  18545. if ptr+uintptr(2) == end {
  18546. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  18547. /* indicate that this might be part of a CR/LF pair */
  18548. return -int32(m_XML_TOK_PROLOG_S)
  18549. }
  18550. /* fall through */
  18551. _7:
  18552. ;
  18553. _6:
  18554. ;
  18555. _32:
  18556. ;
  18557. ptr += uintptr(2)
  18558. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18559. goto _30
  18560. }
  18561. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18562. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18563. } else {
  18564. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18565. }
  18566. switch v33 {
  18567. case int32(_BT_S):
  18568. fallthrough
  18569. case int32(_BT_LF):
  18570. case int32(_BT_CR):
  18571. /* don't split CR/LF pair */
  18572. if ptr+uintptr(2) != end {
  18573. break
  18574. }
  18575. /* fall through */
  18576. fallthrough
  18577. default:
  18578. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18579. return int32(m_XML_TOK_PROLOG_S)
  18580. }
  18581. goto _31
  18582. _31:
  18583. ;
  18584. goto _32
  18585. goto _30
  18586. _30:
  18587. ;
  18588. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18589. return int32(m_XML_TOK_PROLOG_S)
  18590. _8:
  18591. ;
  18592. return _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18593. _9:
  18594. ;
  18595. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18596. return int32(m_XML_TOK_COMMA)
  18597. _10:
  18598. ;
  18599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18600. return int32(m_XML_TOK_OPEN_BRACKET)
  18601. _11:
  18602. ;
  18603. ptr += uintptr(2)
  18604. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18605. return -int32(m_XML_TOK_CLOSE_BRACKET)
  18606. }
  18607. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  18608. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  18609. return -int32(1)
  18610. }
  18611. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_GT1) {
  18612. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  18613. return int32(m_XML_TOK_COND_SECT_CLOSE)
  18614. }
  18615. }
  18616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18617. return int32(m_XML_TOK_CLOSE_BRACKET)
  18618. _12:
  18619. ;
  18620. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18621. return int32(m_XML_TOK_OPEN_PAREN)
  18622. _13:
  18623. ;
  18624. ptr += uintptr(2)
  18625. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18626. return -int32(m_XML_TOK_CLOSE_PAREN)
  18627. }
  18628. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18629. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18630. } else {
  18631. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18632. }
  18633. switch v34 {
  18634. case int32(_BT_AST):
  18635. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18636. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  18637. case int32(_BT_QUEST):
  18638. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18639. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  18640. case int32(_BT_PLUS):
  18641. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18642. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  18643. case int32(_BT_CR):
  18644. fallthrough
  18645. case int32(_BT_LF):
  18646. fallthrough
  18647. case int32(_BT_S):
  18648. fallthrough
  18649. case int32(_BT_GT):
  18650. fallthrough
  18651. case int32(_BT_COMMA):
  18652. fallthrough
  18653. case int32(_BT_VERBAR):
  18654. fallthrough
  18655. case int32(_BT_RPAR):
  18656. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18657. return int32(m_XML_TOK_CLOSE_PAREN)
  18658. }
  18659. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18660. return m_XML_TOK_INVALID
  18661. _14:
  18662. ;
  18663. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18664. return int32(m_XML_TOK_OR)
  18665. _15:
  18666. ;
  18667. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18668. return int32(m_XML_TOK_DECL_CLOSE)
  18669. _16:
  18670. ;
  18671. return _little2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18672. _17:
  18673. ;
  18674. if int64(end)-int64(ptr) < int64(2) {
  18675. return -int32(2)
  18676. }
  18677. if 0 != 0 {
  18678. ptr += uintptr(2)
  18679. tok = int32(m_XML_TOK_NAME)
  18680. goto _28
  18681. }
  18682. if 0 != 0 {
  18683. ptr += uintptr(2)
  18684. tok = int32(m_XML_TOK_NMTOKEN)
  18685. goto _28
  18686. }
  18687. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18688. return m_XML_TOK_INVALID
  18689. _18:
  18690. ;
  18691. if int64(end)-int64(ptr) < int64(3) {
  18692. return -int32(2)
  18693. }
  18694. if 0 != 0 {
  18695. ptr += uintptr(3)
  18696. tok = int32(m_XML_TOK_NAME)
  18697. goto _28
  18698. }
  18699. if 0 != 0 {
  18700. ptr += uintptr(3)
  18701. tok = int32(m_XML_TOK_NMTOKEN)
  18702. goto _28
  18703. }
  18704. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18705. return m_XML_TOK_INVALID
  18706. _19:
  18707. ;
  18708. if int64(end)-int64(ptr) < int64(4) {
  18709. return -int32(2)
  18710. }
  18711. if 0 != 0 {
  18712. ptr += uintptr(4)
  18713. tok = int32(m_XML_TOK_NAME)
  18714. goto _28
  18715. }
  18716. if 0 != 0 {
  18717. ptr += uintptr(4)
  18718. tok = int32(m_XML_TOK_NMTOKEN)
  18719. goto _28
  18720. }
  18721. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18722. return m_XML_TOK_INVALID
  18723. _21:
  18724. ;
  18725. _20:
  18726. ;
  18727. tok = int32(m_XML_TOK_NAME)
  18728. ptr += uintptr(2)
  18729. goto _28
  18730. _25:
  18731. ;
  18732. _24:
  18733. ;
  18734. _23:
  18735. ;
  18736. _22:
  18737. ;
  18738. tok = int32(m_XML_TOK_NMTOKEN)
  18739. ptr += uintptr(2)
  18740. goto _28
  18741. _26:
  18742. ;
  18743. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  18744. ptr += uintptr(2)
  18745. tok = int32(m_XML_TOK_NAME)
  18746. goto _28
  18747. }
  18748. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&int32(0x1F))) != 0 {
  18749. ptr += uintptr(2)
  18750. tok = int32(m_XML_TOK_NMTOKEN)
  18751. goto _28
  18752. }
  18753. /* fall through */
  18754. _27:
  18755. ;
  18756. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18757. return m_XML_TOK_INVALID
  18758. _28:
  18759. ;
  18760. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18761. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18762. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18763. } else {
  18764. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18765. }
  18766. switch v35 {
  18767. case int32(_BT_NONASCII):
  18768. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18769. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18770. return m_XML_TOK_INVALID
  18771. } /* fall through */
  18772. fallthrough
  18773. case int32(_BT_NMSTRT):
  18774. fallthrough
  18775. case int32(_BT_HEX):
  18776. fallthrough
  18777. case int32(_BT_DIGIT):
  18778. fallthrough
  18779. case int32(_BT_NAME):
  18780. fallthrough
  18781. case int32(_BT_MINUS):
  18782. ptr += uintptr(2)
  18783. case int32(_BT_LEAD2):
  18784. if int64(end)-int64(ptr) < int64(2) {
  18785. return -int32(2)
  18786. }
  18787. if !(libc.Int32FromInt32(0) != 0) {
  18788. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18789. return m_XML_TOK_INVALID
  18790. }
  18791. ptr += uintptr(2)
  18792. case int32(_BT_LEAD3):
  18793. if int64(end)-int64(ptr) < int64(3) {
  18794. return -int32(2)
  18795. }
  18796. if !(libc.Int32FromInt32(0) != 0) {
  18797. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18798. return m_XML_TOK_INVALID
  18799. }
  18800. ptr += uintptr(3)
  18801. case int32(_BT_LEAD4):
  18802. if int64(end)-int64(ptr) < int64(4) {
  18803. return -int32(2)
  18804. }
  18805. if !(libc.Int32FromInt32(0) != 0) {
  18806. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18807. return m_XML_TOK_INVALID
  18808. }
  18809. ptr += uintptr(4)
  18810. case int32(_BT_GT):
  18811. fallthrough
  18812. case int32(_BT_RPAR):
  18813. fallthrough
  18814. case int32(_BT_COMMA):
  18815. fallthrough
  18816. case int32(_BT_VERBAR):
  18817. fallthrough
  18818. case int32(_BT_LSQB):
  18819. fallthrough
  18820. case int32(_BT_PERCNT):
  18821. fallthrough
  18822. case int32(_BT_S):
  18823. fallthrough
  18824. case int32(_BT_CR):
  18825. fallthrough
  18826. case int32(_BT_LF):
  18827. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18828. return tok
  18829. case int32(_BT_COLON):
  18830. ptr += uintptr(2)
  18831. switch tok {
  18832. case int32(m_XML_TOK_NAME):
  18833. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18834. return -int32(1)
  18835. }
  18836. tok = int32(m_XML_TOK_PREFIXED_NAME)
  18837. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18838. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18839. } else {
  18840. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18841. }
  18842. switch v36 {
  18843. case int32(_BT_NONASCII):
  18844. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr + 1))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))&libc.Int32FromInt32(0x1F))) != 0) {
  18845. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18846. return m_XML_TOK_INVALID
  18847. } /* fall through */
  18848. fallthrough
  18849. case int32(_BT_NMSTRT):
  18850. fallthrough
  18851. case int32(_BT_HEX):
  18852. fallthrough
  18853. case int32(_BT_DIGIT):
  18854. fallthrough
  18855. case int32(_BT_NAME):
  18856. fallthrough
  18857. case int32(_BT_MINUS):
  18858. ptr += uintptr(2)
  18859. case int32(_BT_LEAD2):
  18860. if int64(end)-int64(ptr) < int64(2) {
  18861. return -int32(2)
  18862. }
  18863. if !(libc.Int32FromInt32(0) != 0) {
  18864. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18865. return m_XML_TOK_INVALID
  18866. }
  18867. ptr += uintptr(2)
  18868. case int32(_BT_LEAD3):
  18869. if int64(end)-int64(ptr) < int64(3) {
  18870. return -int32(2)
  18871. }
  18872. if !(libc.Int32FromInt32(0) != 0) {
  18873. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18874. return m_XML_TOK_INVALID
  18875. }
  18876. ptr += uintptr(3)
  18877. case int32(_BT_LEAD4):
  18878. if int64(end)-int64(ptr) < int64(4) {
  18879. return -int32(2)
  18880. }
  18881. if !(libc.Int32FromInt32(0) != 0) {
  18882. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18883. return m_XML_TOK_INVALID
  18884. }
  18885. ptr += uintptr(4)
  18886. default:
  18887. tok = int32(m_XML_TOK_NMTOKEN)
  18888. break
  18889. }
  18890. case int32(m_XML_TOK_PREFIXED_NAME):
  18891. tok = int32(m_XML_TOK_NMTOKEN)
  18892. break
  18893. }
  18894. case int32(_BT_PLUS):
  18895. if tok == int32(m_XML_TOK_NMTOKEN) {
  18896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18897. return m_XML_TOK_INVALID
  18898. }
  18899. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18900. return int32(m_XML_TOK_NAME_PLUS)
  18901. case int32(_BT_AST):
  18902. if tok == int32(m_XML_TOK_NMTOKEN) {
  18903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18904. return m_XML_TOK_INVALID
  18905. }
  18906. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18907. return int32(m_XML_TOK_NAME_ASTERISK)
  18908. case int32(_BT_QUEST):
  18909. if tok == int32(m_XML_TOK_NMTOKEN) {
  18910. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18911. return m_XML_TOK_INVALID
  18912. }
  18913. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18914. return int32(m_XML_TOK_NAME_QUESTION)
  18915. default:
  18916. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18917. return m_XML_TOK_INVALID
  18918. }
  18919. }
  18920. return -tok
  18921. }
  18922. func _little2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  18923. var start uintptr
  18924. var v1, v2 int32
  18925. _, _, _ = start, v1, v2
  18926. if ptr >= end {
  18927. return -int32(4)
  18928. } else {
  18929. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18930. /* This line cannot be executed. The incoming data has already
  18931. * been tokenized once, so incomplete characters like this have
  18932. * already been eliminated from the input. Retaining the paranoia
  18933. * check is still valuable, however.
  18934. */
  18935. return -int32(1) /* LCOV_EXCL_LINE */
  18936. }
  18937. }
  18938. start = ptr
  18939. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  18940. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18941. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18942. } else {
  18943. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18944. }
  18945. switch v1 {
  18946. case int32(_BT_LEAD2):
  18947. ptr += uintptr(2)
  18948. case int32(_BT_LEAD3):
  18949. ptr += uintptr(3)
  18950. case int32(_BT_LEAD4):
  18951. ptr += uintptr(4)
  18952. case int32(_BT_AMP):
  18953. if ptr == start {
  18954. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  18955. }
  18956. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18957. return int32(m_XML_TOK_DATA_CHARS)
  18958. case int32(_BT_LT):
  18959. /* this is for inside entity references */
  18960. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18961. return m_XML_TOK_INVALID
  18962. case int32(_BT_LF):
  18963. if ptr == start {
  18964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18965. return int32(m_XML_TOK_DATA_NEWLINE)
  18966. }
  18967. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18968. return int32(m_XML_TOK_DATA_CHARS)
  18969. case int32(_BT_CR):
  18970. if ptr == start {
  18971. ptr += uintptr(2)
  18972. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  18973. return -int32(3)
  18974. }
  18975. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  18976. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  18977. } else {
  18978. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  18979. }
  18980. if v2 == int32(_BT_LF) {
  18981. ptr += uintptr(2)
  18982. }
  18983. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18984. return int32(m_XML_TOK_DATA_NEWLINE)
  18985. }
  18986. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18987. return int32(m_XML_TOK_DATA_CHARS)
  18988. case int32(_BT_S):
  18989. if ptr == start {
  18990. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  18991. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  18992. }
  18993. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  18994. return int32(m_XML_TOK_DATA_CHARS)
  18995. default:
  18996. ptr += uintptr(2)
  18997. break
  18998. }
  18999. }
  19000. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19001. return int32(m_XML_TOK_DATA_CHARS)
  19002. }
  19003. func _little2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19004. var start uintptr
  19005. var tok, v1, v2, v3 int32
  19006. _, _, _, _, _ = start, tok, v1, v2, v3
  19007. if ptr >= end {
  19008. return -int32(4)
  19009. } else {
  19010. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19011. /* This line cannot be executed. The incoming data has already
  19012. * been tokenized once, so incomplete characters like this have
  19013. * already been eliminated from the input. Retaining the paranoia
  19014. * check is still valuable, however.
  19015. */
  19016. return -int32(1) /* LCOV_EXCL_LINE */
  19017. }
  19018. }
  19019. start = ptr
  19020. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19021. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19022. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19023. } else {
  19024. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19025. }
  19026. switch v1 {
  19027. case int32(_BT_LEAD2):
  19028. ptr += uintptr(2)
  19029. case int32(_BT_LEAD3):
  19030. ptr += uintptr(3)
  19031. case int32(_BT_LEAD4):
  19032. ptr += uintptr(4)
  19033. case int32(_BT_AMP):
  19034. if ptr == start {
  19035. return _little2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19036. }
  19037. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19038. return int32(m_XML_TOK_DATA_CHARS)
  19039. case int32(_BT_PERCNT):
  19040. if ptr == start {
  19041. tok = _little2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  19042. if tok == int32(m_XML_TOK_PERCENT) {
  19043. v2 = m_XML_TOK_INVALID
  19044. } else {
  19045. v2 = tok
  19046. }
  19047. return v2
  19048. }
  19049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19050. return int32(m_XML_TOK_DATA_CHARS)
  19051. case int32(_BT_LF):
  19052. if ptr == start {
  19053. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  19054. return int32(m_XML_TOK_DATA_NEWLINE)
  19055. }
  19056. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19057. return int32(m_XML_TOK_DATA_CHARS)
  19058. case int32(_BT_CR):
  19059. if ptr == start {
  19060. ptr += uintptr(2)
  19061. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19062. return -int32(3)
  19063. }
  19064. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19065. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19066. } else {
  19067. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19068. }
  19069. if v3 == int32(_BT_LF) {
  19070. ptr += uintptr(2)
  19071. }
  19072. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19073. return int32(m_XML_TOK_DATA_NEWLINE)
  19074. }
  19075. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19076. return int32(m_XML_TOK_DATA_CHARS)
  19077. default:
  19078. ptr += uintptr(2)
  19079. break
  19080. }
  19081. }
  19082. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19083. return int32(m_XML_TOK_DATA_CHARS)
  19084. }
  19085. func _little2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  19086. var level, v1 int32
  19087. var n Tsize_t
  19088. _, _, _ = level, n, v1
  19089. level = 0
  19090. if int32(2) > int32(1) {
  19091. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  19092. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  19093. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  19094. end = ptr + uintptr(n)
  19095. }
  19096. }
  19097. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19098. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19099. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19100. } else {
  19101. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19102. }
  19103. switch v1 {
  19104. case int32(_BT_LEAD2):
  19105. if int64(end)-int64(ptr) < int64(2) {
  19106. return -int32(2)
  19107. }
  19108. if 0 != 0 {
  19109. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19110. return m_XML_TOK_INVALID
  19111. }
  19112. ptr += uintptr(2)
  19113. case int32(_BT_LEAD3):
  19114. if int64(end)-int64(ptr) < int64(3) {
  19115. return -int32(2)
  19116. }
  19117. if 0 != 0 {
  19118. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19119. return m_XML_TOK_INVALID
  19120. }
  19121. ptr += uintptr(3)
  19122. case int32(_BT_LEAD4):
  19123. if int64(end)-int64(ptr) < int64(4) {
  19124. return -int32(2)
  19125. }
  19126. if 0 != 0 {
  19127. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19128. return m_XML_TOK_INVALID
  19129. }
  19130. ptr += uintptr(4)
  19131. case int32(_BT_NONXML):
  19132. fallthrough
  19133. case int32(_BT_MALFORM):
  19134. fallthrough
  19135. case int32(_BT_TRAIL):
  19136. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19137. return m_XML_TOK_INVALID
  19138. case int32(_BT_LT):
  19139. ptr += uintptr(2)
  19140. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19141. return -int32(1)
  19142. }
  19143. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_EXCL) {
  19144. ptr += uintptr(2)
  19145. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19146. return -int32(1)
  19147. }
  19148. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_LSQB1) {
  19149. level++
  19150. ptr += uintptr(2)
  19151. }
  19152. }
  19153. case int32(_BT_RSQB):
  19154. ptr += uintptr(2)
  19155. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19156. return -int32(1)
  19157. }
  19158. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_RSQB1) {
  19159. ptr += uintptr(2)
  19160. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19161. return -int32(1)
  19162. }
  19163. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_GT1) {
  19164. ptr += uintptr(2)
  19165. if level == 0 {
  19166. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  19167. return int32(m_XML_TOK_IGNORE_SECT)
  19168. }
  19169. level--
  19170. }
  19171. }
  19172. default:
  19173. ptr += uintptr(2)
  19174. break
  19175. }
  19176. }
  19177. return -int32(1)
  19178. }
  19179. func _little2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  19180. var v2, v3, v4 int32
  19181. _, _, _ = v2, v3, v4
  19182. ptr += uintptr(2)
  19183. end -= uintptr(2)
  19184. for {
  19185. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  19186. break
  19187. }
  19188. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19189. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19190. } else {
  19191. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19192. }
  19193. switch v2 {
  19194. case int32(_BT_DIGIT):
  19195. fallthrough
  19196. case int32(_BT_HEX):
  19197. fallthrough
  19198. case int32(_BT_MINUS):
  19199. fallthrough
  19200. case int32(_BT_APOS):
  19201. fallthrough
  19202. case int32(_BT_LPAR):
  19203. fallthrough
  19204. case int32(_BT_RPAR):
  19205. fallthrough
  19206. case int32(_BT_PLUS):
  19207. fallthrough
  19208. case int32(_BT_COMMA):
  19209. fallthrough
  19210. case int32(_BT_SOL):
  19211. fallthrough
  19212. case int32(_BT_EQUALS):
  19213. fallthrough
  19214. case int32(_BT_QUEST):
  19215. fallthrough
  19216. case int32(_BT_CR):
  19217. fallthrough
  19218. case int32(_BT_LF):
  19219. fallthrough
  19220. case int32(_BT_SEMI):
  19221. fallthrough
  19222. case int32(_BT_EXCL):
  19223. fallthrough
  19224. case int32(_BT_AST):
  19225. fallthrough
  19226. case int32(_BT_PERCNT):
  19227. fallthrough
  19228. case int32(_BT_NUM):
  19229. fallthrough
  19230. case int32(_BT_COLON):
  19231. case int32(_BT_S):
  19232. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_TAB1) {
  19233. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  19234. return 0
  19235. }
  19236. case int32(_BT_NAME):
  19237. fallthrough
  19238. case int32(_BT_NMSTRT):
  19239. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19240. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19241. } else {
  19242. v3 = -int32(1)
  19243. }
  19244. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  19245. break
  19246. }
  19247. /* fall through */
  19248. fallthrough
  19249. default:
  19250. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19251. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19252. } else {
  19253. v4 = -int32(1)
  19254. }
  19255. switch v4 {
  19256. case int32(0x24): /* $ */
  19257. fallthrough
  19258. case int32(0x40): /* @ */
  19259. default:
  19260. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  19261. return 0
  19262. }
  19263. break
  19264. }
  19265. goto _1
  19266. _1:
  19267. ;
  19268. ptr += uintptr(2)
  19269. }
  19270. return int32(1)
  19271. }
  19272. /* This must only be called for a well-formed start-tag or empty
  19273. element tag. Returns the number of attributes. Pointers to the
  19274. first attsMax attributes are stored in atts.
  19275. */
  19276. func _little2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  19277. var nAtts, open, state, v2, v3, v5, v7 int32
  19278. var v4, v6, v8, v9 bool
  19279. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  19280. state = 1
  19281. nAtts = 0
  19282. open = 0 /* defined when state == inValue;
  19283. initialization just to shut up compilers */
  19284. ptr += uintptr(2)
  19285. for {
  19286. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19287. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19288. } else {
  19289. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19290. }
  19291. switch v2 {
  19292. case int32(_BT_LEAD2):
  19293. if state == 0 {
  19294. if nAtts < attsMax {
  19295. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19296. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19297. }
  19298. state = 1
  19299. }
  19300. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  19301. case int32(_BT_LEAD3):
  19302. if state == 0 {
  19303. if nAtts < attsMax {
  19304. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19305. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19306. }
  19307. state = 1
  19308. }
  19309. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  19310. case int32(_BT_LEAD4):
  19311. if state == 0 {
  19312. if nAtts < attsMax {
  19313. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19314. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19315. }
  19316. state = 1
  19317. }
  19318. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  19319. case int32(_BT_NONASCII):
  19320. fallthrough
  19321. case int32(_BT_NMSTRT):
  19322. fallthrough
  19323. case int32(_BT_HEX):
  19324. if state == 0 {
  19325. if nAtts < attsMax {
  19326. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  19327. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  19328. }
  19329. state = 1
  19330. }
  19331. case int32(_BT_QUOT):
  19332. if state != 2 {
  19333. if nAtts < attsMax {
  19334. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  19335. }
  19336. state = 2
  19337. open = int32(_BT_QUOT)
  19338. } else {
  19339. if open == int32(_BT_QUOT) {
  19340. state = 0
  19341. if nAtts < attsMax {
  19342. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  19343. }
  19344. nAtts++
  19345. }
  19346. }
  19347. case int32(_BT_APOS):
  19348. if state != 2 {
  19349. if nAtts < attsMax {
  19350. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  19351. }
  19352. state = 2
  19353. open = int32(_BT_APOS)
  19354. } else {
  19355. if open == int32(_BT_APOS) {
  19356. state = 0
  19357. if nAtts < attsMax {
  19358. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  19359. }
  19360. nAtts++
  19361. }
  19362. }
  19363. case int32(_BT_AMP):
  19364. if nAtts < attsMax {
  19365. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  19366. }
  19367. case int32(_BT_S):
  19368. if state == 1 {
  19369. state = 0
  19370. } else {
  19371. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  19372. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  19373. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19374. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19375. } else {
  19376. v3 = -int32(1)
  19377. }
  19378. }
  19379. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  19380. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  19381. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  19382. } else {
  19383. v5 = -int32(1)
  19384. }
  19385. }
  19386. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  19387. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 {
  19388. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))))))
  19389. } else {
  19390. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))))
  19391. }
  19392. }
  19393. }
  19394. if v9 && (v8 || v7 == open) {
  19395. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  19396. }
  19397. }
  19398. case int32(_BT_CR):
  19399. fallthrough
  19400. case int32(_BT_LF):
  19401. /* This case ensures that the first attribute name is counted
  19402. Apart from that we could just change state on the quote. */
  19403. if state == 1 {
  19404. state = 0
  19405. } else {
  19406. if state == 2 && nAtts < attsMax {
  19407. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  19408. }
  19409. }
  19410. case int32(_BT_GT):
  19411. fallthrough
  19412. case int32(_BT_SOL):
  19413. if state != 2 {
  19414. return nAtts
  19415. }
  19416. default:
  19417. break
  19418. }
  19419. goto _1
  19420. _1:
  19421. ;
  19422. ptr += uintptr(2)
  19423. }
  19424. /* not reached */
  19425. return r
  19426. }
  19427. func _little2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  19428. var c, c1, result, v2, v4 int32
  19429. _, _, _, _, _ = c, c1, result, v2, v4
  19430. result = 0
  19431. /* skip &# */
  19432. _ = enc
  19433. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  19434. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_x) {
  19435. ptr += uintptr(2)
  19436. for {
  19437. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  19438. break
  19439. }
  19440. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19441. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19442. } else {
  19443. v2 = -int32(1)
  19444. }
  19445. c = v2
  19446. switch c {
  19447. case int32(m_ASCII_0):
  19448. fallthrough
  19449. case int32(m_ASCII_1):
  19450. fallthrough
  19451. case int32(m_ASCII_2):
  19452. fallthrough
  19453. case int32(m_ASCII_3):
  19454. fallthrough
  19455. case int32(m_ASCII_41):
  19456. fallthrough
  19457. case int32(m_ASCII_51):
  19458. fallthrough
  19459. case int32(m_ASCII_61):
  19460. fallthrough
  19461. case int32(m_ASCII_71):
  19462. fallthrough
  19463. case int32(m_ASCII_8):
  19464. fallthrough
  19465. case int32(m_ASCII_9):
  19466. result <<= int32(4)
  19467. result |= c - int32(m_ASCII_0)
  19468. case int32(m_ASCII_A):
  19469. fallthrough
  19470. case int32(m_ASCII_B1):
  19471. fallthrough
  19472. case int32(m_ASCII_C):
  19473. fallthrough
  19474. case int32(m_ASCII_D):
  19475. fallthrough
  19476. case int32(m_ASCII_E):
  19477. fallthrough
  19478. case int32(m_ASCII_F):
  19479. result <<= int32(4)
  19480. result += int32(10) + (c - int32(m_ASCII_A))
  19481. case int32(m_ASCII_a):
  19482. fallthrough
  19483. case int32(m_ASCII_b1):
  19484. fallthrough
  19485. case int32(m_ASCII_c):
  19486. fallthrough
  19487. case int32(m_ASCII_d1):
  19488. fallthrough
  19489. case int32(m_ASCII_e):
  19490. fallthrough
  19491. case int32(m_ASCII_f1):
  19492. result <<= int32(4)
  19493. result += int32(10) + (c - int32(m_ASCII_a))
  19494. break
  19495. }
  19496. if result >= int32(0x110000) {
  19497. return -int32(1)
  19498. }
  19499. goto _1
  19500. _1:
  19501. ;
  19502. ptr += uintptr(2)
  19503. }
  19504. } else {
  19505. for {
  19506. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_SEMI1)) {
  19507. break
  19508. }
  19509. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19510. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19511. } else {
  19512. v4 = -int32(1)
  19513. }
  19514. c1 = v4
  19515. result *= int32(10)
  19516. result += c1 - int32(m_ASCII_0)
  19517. if result >= int32(0x110000) {
  19518. return -int32(1)
  19519. }
  19520. goto _3
  19521. _3:
  19522. ;
  19523. ptr += uintptr(2)
  19524. }
  19525. }
  19526. return _checkCharRefNumber(tls, result)
  19527. }
  19528. func _little2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  19529. var v1, v2 int32
  19530. _, _ = v1, v2
  19531. _ = enc
  19532. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  19533. case int64(2):
  19534. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == int32(m_ASCII_t) {
  19535. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19536. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19537. } else {
  19538. v1 = -int32(1)
  19539. }
  19540. switch v1 {
  19541. case int32(m_ASCII_l):
  19542. return int32(m_ASCII_LT1)
  19543. case int32(m_ASCII_g):
  19544. return int32(m_ASCII_GT1)
  19545. }
  19546. }
  19547. case int64(3):
  19548. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_a) {
  19549. ptr += uintptr(2)
  19550. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_m) {
  19551. ptr += uintptr(2)
  19552. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  19553. return int32(m_ASCII_AMP1)
  19554. }
  19555. }
  19556. }
  19557. case int64(4):
  19558. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19559. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))
  19560. } else {
  19561. v2 = -int32(1)
  19562. }
  19563. switch v2 {
  19564. case int32(m_ASCII_q1):
  19565. ptr += uintptr(2)
  19566. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_u1) {
  19567. ptr += uintptr(2)
  19568. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  19569. ptr += uintptr(2)
  19570. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_t) {
  19571. return int32(m_ASCII_QUOT1)
  19572. }
  19573. }
  19574. }
  19575. case int32(m_ASCII_a):
  19576. ptr += uintptr(2)
  19577. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_p) {
  19578. ptr += uintptr(2)
  19579. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_o) {
  19580. ptr += uintptr(2)
  19581. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32(m_ASCII_s) {
  19582. return int32(m_ASCII_APOS1)
  19583. }
  19584. }
  19585. }
  19586. break
  19587. }
  19588. }
  19589. return 0
  19590. }
  19591. func _little2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  19592. _ = enc
  19593. for {
  19594. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  19595. break
  19596. }
  19597. if int64(end1)-int64(ptr1) < int64(2) {
  19598. /* This line cannot be executed. The incoming data has already
  19599. * been tokenized once, so incomplete characters like this have
  19600. * already been eliminated from the input. Retaining the
  19601. * paranoia check is still valuable, however.
  19602. */
  19603. return 0 /* LCOV_EXCL_LINE */
  19604. }
  19605. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  19606. return 0
  19607. }
  19608. goto _1
  19609. _1:
  19610. ;
  19611. ptr1 += uintptr(2)
  19612. ptr2++
  19613. }
  19614. return libc.BoolInt32(ptr1 == end1)
  19615. }
  19616. func _little2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  19617. var start uintptr
  19618. var v2 int32
  19619. _, _ = start, v2
  19620. start = ptr
  19621. for {
  19622. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19623. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19624. } else {
  19625. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19626. }
  19627. switch v2 {
  19628. case int32(_BT_LEAD2):
  19629. ptr += uintptr(2)
  19630. case int32(_BT_LEAD3):
  19631. ptr += uintptr(3)
  19632. case int32(_BT_LEAD4):
  19633. ptr += uintptr(4)
  19634. case int32(_BT_NONASCII):
  19635. fallthrough
  19636. case int32(_BT_NMSTRT):
  19637. fallthrough
  19638. case int32(_BT_COLON):
  19639. fallthrough
  19640. case int32(_BT_HEX):
  19641. fallthrough
  19642. case int32(_BT_DIGIT):
  19643. fallthrough
  19644. case int32(_BT_NAME):
  19645. fallthrough
  19646. case int32(_BT_MINUS):
  19647. ptr += uintptr(2)
  19648. default:
  19649. return int32(int64(ptr) - int64(start))
  19650. }
  19651. goto _1
  19652. _1:
  19653. }
  19654. return r
  19655. }
  19656. func _little2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  19657. var v2 int32
  19658. _ = v2
  19659. for {
  19660. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19661. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19662. } else {
  19663. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19664. }
  19665. switch v2 {
  19666. case int32(_BT_LF):
  19667. fallthrough
  19668. case int32(_BT_CR):
  19669. fallthrough
  19670. case int32(_BT_S):
  19671. ptr += uintptr(2)
  19672. default:
  19673. return ptr
  19674. }
  19675. goto _1
  19676. _1:
  19677. }
  19678. return r
  19679. }
  19680. func _little2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  19681. var v1, v2 int32
  19682. var v3 bool
  19683. _, _, _ = v1, v2, v3
  19684. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  19685. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19686. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19687. } else {
  19688. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19689. }
  19690. switch v1 {
  19691. case int32(_BT_LEAD2):
  19692. ptr += uintptr(2)
  19693. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19694. case int32(_BT_LEAD3):
  19695. ptr += uintptr(3)
  19696. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19697. case int32(_BT_LEAD4):
  19698. ptr += uintptr(4)
  19699. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19700. case int32(_BT_LF):
  19701. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  19702. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  19703. ptr += uintptr(2)
  19704. case int32(_BT_CR):
  19705. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  19706. ptr += uintptr(2)
  19707. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  19708. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == 0 {
  19709. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr))))))
  19710. } else {
  19711. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + 1)), *(*uint8)(unsafe.Pointer(ptr)))
  19712. }
  19713. }
  19714. if v3 && v2 == int32(_BT_LF) {
  19715. ptr += uintptr(2)
  19716. }
  19717. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  19718. default:
  19719. ptr += uintptr(2)
  19720. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  19721. break
  19722. }
  19723. }
  19724. }
  19725. var _little2_encoding_ns = Tnormal_encoding{
  19726. Fenc: TENCODING{
  19727. Fscanners: [4]TSCANNER{},
  19728. FliteralScanners: [2]TSCANNER{},
  19729. FminBytesPerChar: int32(2),
  19730. FisUtf16: uint8(1),
  19731. },
  19732. Ftype1: [256]uint8{
  19733. 9: uint8(_BT_S),
  19734. 10: uint8(_BT_LF),
  19735. 13: uint8(_BT_CR),
  19736. 32: uint8(_BT_S),
  19737. 33: uint8(_BT_EXCL),
  19738. 34: uint8(_BT_QUOT),
  19739. 35: uint8(_BT_NUM),
  19740. 36: uint8(_BT_OTHER),
  19741. 37: uint8(_BT_PERCNT),
  19742. 38: uint8(_BT_AMP),
  19743. 39: uint8(_BT_APOS),
  19744. 40: uint8(_BT_LPAR),
  19745. 41: uint8(_BT_RPAR),
  19746. 42: uint8(_BT_AST),
  19747. 43: uint8(_BT_PLUS),
  19748. 44: uint8(_BT_COMMA),
  19749. 45: uint8(_BT_MINUS),
  19750. 46: uint8(_BT_NAME),
  19751. 47: uint8(_BT_SOL),
  19752. 48: uint8(_BT_DIGIT),
  19753. 49: uint8(_BT_DIGIT),
  19754. 50: uint8(_BT_DIGIT),
  19755. 51: uint8(_BT_DIGIT),
  19756. 52: uint8(_BT_DIGIT),
  19757. 53: uint8(_BT_DIGIT),
  19758. 54: uint8(_BT_DIGIT),
  19759. 55: uint8(_BT_DIGIT),
  19760. 56: uint8(_BT_DIGIT),
  19761. 57: uint8(_BT_DIGIT),
  19762. 58: uint8(_BT_COLON),
  19763. 59: uint8(_BT_SEMI),
  19764. 60: uint8(_BT_LT),
  19765. 61: uint8(_BT_EQUALS),
  19766. 62: uint8(_BT_GT),
  19767. 63: uint8(_BT_QUEST),
  19768. 64: uint8(_BT_OTHER),
  19769. 65: uint8(_BT_HEX),
  19770. 66: uint8(_BT_HEX),
  19771. 67: uint8(_BT_HEX),
  19772. 68: uint8(_BT_HEX),
  19773. 69: uint8(_BT_HEX),
  19774. 70: uint8(_BT_HEX),
  19775. 71: uint8(_BT_NMSTRT),
  19776. 72: uint8(_BT_NMSTRT),
  19777. 73: uint8(_BT_NMSTRT),
  19778. 74: uint8(_BT_NMSTRT),
  19779. 75: uint8(_BT_NMSTRT),
  19780. 76: uint8(_BT_NMSTRT),
  19781. 77: uint8(_BT_NMSTRT),
  19782. 78: uint8(_BT_NMSTRT),
  19783. 79: uint8(_BT_NMSTRT),
  19784. 80: uint8(_BT_NMSTRT),
  19785. 81: uint8(_BT_NMSTRT),
  19786. 82: uint8(_BT_NMSTRT),
  19787. 83: uint8(_BT_NMSTRT),
  19788. 84: uint8(_BT_NMSTRT),
  19789. 85: uint8(_BT_NMSTRT),
  19790. 86: uint8(_BT_NMSTRT),
  19791. 87: uint8(_BT_NMSTRT),
  19792. 88: uint8(_BT_NMSTRT),
  19793. 89: uint8(_BT_NMSTRT),
  19794. 90: uint8(_BT_NMSTRT),
  19795. 91: uint8(_BT_LSQB),
  19796. 92: uint8(_BT_OTHER),
  19797. 93: uint8(_BT_RSQB),
  19798. 94: uint8(_BT_OTHER),
  19799. 95: uint8(_BT_NMSTRT),
  19800. 96: uint8(_BT_OTHER),
  19801. 97: uint8(_BT_HEX),
  19802. 98: uint8(_BT_HEX),
  19803. 99: uint8(_BT_HEX),
  19804. 100: uint8(_BT_HEX),
  19805. 101: uint8(_BT_HEX),
  19806. 102: uint8(_BT_HEX),
  19807. 103: uint8(_BT_NMSTRT),
  19808. 104: uint8(_BT_NMSTRT),
  19809. 105: uint8(_BT_NMSTRT),
  19810. 106: uint8(_BT_NMSTRT),
  19811. 107: uint8(_BT_NMSTRT),
  19812. 108: uint8(_BT_NMSTRT),
  19813. 109: uint8(_BT_NMSTRT),
  19814. 110: uint8(_BT_NMSTRT),
  19815. 111: uint8(_BT_NMSTRT),
  19816. 112: uint8(_BT_NMSTRT),
  19817. 113: uint8(_BT_NMSTRT),
  19818. 114: uint8(_BT_NMSTRT),
  19819. 115: uint8(_BT_NMSTRT),
  19820. 116: uint8(_BT_NMSTRT),
  19821. 117: uint8(_BT_NMSTRT),
  19822. 118: uint8(_BT_NMSTRT),
  19823. 119: uint8(_BT_NMSTRT),
  19824. 120: uint8(_BT_NMSTRT),
  19825. 121: uint8(_BT_NMSTRT),
  19826. 122: uint8(_BT_NMSTRT),
  19827. 123: uint8(_BT_OTHER),
  19828. 124: uint8(_BT_VERBAR),
  19829. 125: uint8(_BT_OTHER),
  19830. 126: uint8(_BT_OTHER),
  19831. 127: uint8(_BT_OTHER),
  19832. 128: uint8(_BT_OTHER),
  19833. 129: uint8(_BT_OTHER),
  19834. 130: uint8(_BT_OTHER),
  19835. 131: uint8(_BT_OTHER),
  19836. 132: uint8(_BT_OTHER),
  19837. 133: uint8(_BT_OTHER),
  19838. 134: uint8(_BT_OTHER),
  19839. 135: uint8(_BT_OTHER),
  19840. 136: uint8(_BT_OTHER),
  19841. 137: uint8(_BT_OTHER),
  19842. 138: uint8(_BT_OTHER),
  19843. 139: uint8(_BT_OTHER),
  19844. 140: uint8(_BT_OTHER),
  19845. 141: uint8(_BT_OTHER),
  19846. 142: uint8(_BT_OTHER),
  19847. 143: uint8(_BT_OTHER),
  19848. 144: uint8(_BT_OTHER),
  19849. 145: uint8(_BT_OTHER),
  19850. 146: uint8(_BT_OTHER),
  19851. 147: uint8(_BT_OTHER),
  19852. 148: uint8(_BT_OTHER),
  19853. 149: uint8(_BT_OTHER),
  19854. 150: uint8(_BT_OTHER),
  19855. 151: uint8(_BT_OTHER),
  19856. 152: uint8(_BT_OTHER),
  19857. 153: uint8(_BT_OTHER),
  19858. 154: uint8(_BT_OTHER),
  19859. 155: uint8(_BT_OTHER),
  19860. 156: uint8(_BT_OTHER),
  19861. 157: uint8(_BT_OTHER),
  19862. 158: uint8(_BT_OTHER),
  19863. 159: uint8(_BT_OTHER),
  19864. 160: uint8(_BT_OTHER),
  19865. 161: uint8(_BT_OTHER),
  19866. 162: uint8(_BT_OTHER),
  19867. 163: uint8(_BT_OTHER),
  19868. 164: uint8(_BT_OTHER),
  19869. 165: uint8(_BT_OTHER),
  19870. 166: uint8(_BT_OTHER),
  19871. 167: uint8(_BT_OTHER),
  19872. 168: uint8(_BT_OTHER),
  19873. 169: uint8(_BT_OTHER),
  19874. 170: uint8(_BT_NMSTRT),
  19875. 171: uint8(_BT_OTHER),
  19876. 172: uint8(_BT_OTHER),
  19877. 173: uint8(_BT_OTHER),
  19878. 174: uint8(_BT_OTHER),
  19879. 175: uint8(_BT_OTHER),
  19880. 176: uint8(_BT_OTHER),
  19881. 177: uint8(_BT_OTHER),
  19882. 178: uint8(_BT_OTHER),
  19883. 179: uint8(_BT_OTHER),
  19884. 180: uint8(_BT_OTHER),
  19885. 181: uint8(_BT_NMSTRT),
  19886. 182: uint8(_BT_OTHER),
  19887. 183: uint8(_BT_NAME),
  19888. 184: uint8(_BT_OTHER),
  19889. 185: uint8(_BT_OTHER),
  19890. 186: uint8(_BT_NMSTRT),
  19891. 187: uint8(_BT_OTHER),
  19892. 188: uint8(_BT_OTHER),
  19893. 189: uint8(_BT_OTHER),
  19894. 190: uint8(_BT_OTHER),
  19895. 191: uint8(_BT_OTHER),
  19896. 192: uint8(_BT_NMSTRT),
  19897. 193: uint8(_BT_NMSTRT),
  19898. 194: uint8(_BT_NMSTRT),
  19899. 195: uint8(_BT_NMSTRT),
  19900. 196: uint8(_BT_NMSTRT),
  19901. 197: uint8(_BT_NMSTRT),
  19902. 198: uint8(_BT_NMSTRT),
  19903. 199: uint8(_BT_NMSTRT),
  19904. 200: uint8(_BT_NMSTRT),
  19905. 201: uint8(_BT_NMSTRT),
  19906. 202: uint8(_BT_NMSTRT),
  19907. 203: uint8(_BT_NMSTRT),
  19908. 204: uint8(_BT_NMSTRT),
  19909. 205: uint8(_BT_NMSTRT),
  19910. 206: uint8(_BT_NMSTRT),
  19911. 207: uint8(_BT_NMSTRT),
  19912. 208: uint8(_BT_NMSTRT),
  19913. 209: uint8(_BT_NMSTRT),
  19914. 210: uint8(_BT_NMSTRT),
  19915. 211: uint8(_BT_NMSTRT),
  19916. 212: uint8(_BT_NMSTRT),
  19917. 213: uint8(_BT_NMSTRT),
  19918. 214: uint8(_BT_NMSTRT),
  19919. 215: uint8(_BT_OTHER),
  19920. 216: uint8(_BT_NMSTRT),
  19921. 217: uint8(_BT_NMSTRT),
  19922. 218: uint8(_BT_NMSTRT),
  19923. 219: uint8(_BT_NMSTRT),
  19924. 220: uint8(_BT_NMSTRT),
  19925. 221: uint8(_BT_NMSTRT),
  19926. 222: uint8(_BT_NMSTRT),
  19927. 223: uint8(_BT_NMSTRT),
  19928. 224: uint8(_BT_NMSTRT),
  19929. 225: uint8(_BT_NMSTRT),
  19930. 226: uint8(_BT_NMSTRT),
  19931. 227: uint8(_BT_NMSTRT),
  19932. 228: uint8(_BT_NMSTRT),
  19933. 229: uint8(_BT_NMSTRT),
  19934. 230: uint8(_BT_NMSTRT),
  19935. 231: uint8(_BT_NMSTRT),
  19936. 232: uint8(_BT_NMSTRT),
  19937. 233: uint8(_BT_NMSTRT),
  19938. 234: uint8(_BT_NMSTRT),
  19939. 235: uint8(_BT_NMSTRT),
  19940. 236: uint8(_BT_NMSTRT),
  19941. 237: uint8(_BT_NMSTRT),
  19942. 238: uint8(_BT_NMSTRT),
  19943. 239: uint8(_BT_NMSTRT),
  19944. 240: uint8(_BT_NMSTRT),
  19945. 241: uint8(_BT_NMSTRT),
  19946. 242: uint8(_BT_NMSTRT),
  19947. 243: uint8(_BT_NMSTRT),
  19948. 244: uint8(_BT_NMSTRT),
  19949. 245: uint8(_BT_NMSTRT),
  19950. 246: uint8(_BT_NMSTRT),
  19951. 247: uint8(_BT_OTHER),
  19952. 248: uint8(_BT_NMSTRT),
  19953. 249: uint8(_BT_NMSTRT),
  19954. 250: uint8(_BT_NMSTRT),
  19955. 251: uint8(_BT_NMSTRT),
  19956. 252: uint8(_BT_NMSTRT),
  19957. 253: uint8(_BT_NMSTRT),
  19958. 254: uint8(_BT_NMSTRT),
  19959. 255: uint8(_BT_NMSTRT),
  19960. },
  19961. }
  19962. func init() {
  19963. p := unsafe.Pointer(&_little2_encoding_ns)
  19964. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  19965. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  19966. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  19967. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  19968. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  19969. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  19970. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  19971. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  19972. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  19973. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  19974. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  19975. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  19976. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  19977. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  19978. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  19979. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  19980. }
  19981. var _little2_encoding = Tnormal_encoding{
  19982. Fenc: TENCODING{
  19983. Fscanners: [4]TSCANNER{},
  19984. FliteralScanners: [2]TSCANNER{},
  19985. FminBytesPerChar: int32(2),
  19986. FisUtf16: uint8(1),
  19987. },
  19988. Ftype1: [256]uint8{
  19989. 9: uint8(_BT_S),
  19990. 10: uint8(_BT_LF),
  19991. 13: uint8(_BT_CR),
  19992. 32: uint8(_BT_S),
  19993. 33: uint8(_BT_EXCL),
  19994. 34: uint8(_BT_QUOT),
  19995. 35: uint8(_BT_NUM),
  19996. 36: uint8(_BT_OTHER),
  19997. 37: uint8(_BT_PERCNT),
  19998. 38: uint8(_BT_AMP),
  19999. 39: uint8(_BT_APOS),
  20000. 40: uint8(_BT_LPAR),
  20001. 41: uint8(_BT_RPAR),
  20002. 42: uint8(_BT_AST),
  20003. 43: uint8(_BT_PLUS),
  20004. 44: uint8(_BT_COMMA),
  20005. 45: uint8(_BT_MINUS),
  20006. 46: uint8(_BT_NAME),
  20007. 47: uint8(_BT_SOL),
  20008. 48: uint8(_BT_DIGIT),
  20009. 49: uint8(_BT_DIGIT),
  20010. 50: uint8(_BT_DIGIT),
  20011. 51: uint8(_BT_DIGIT),
  20012. 52: uint8(_BT_DIGIT),
  20013. 53: uint8(_BT_DIGIT),
  20014. 54: uint8(_BT_DIGIT),
  20015. 55: uint8(_BT_DIGIT),
  20016. 56: uint8(_BT_DIGIT),
  20017. 57: uint8(_BT_DIGIT),
  20018. 58: uint8(_BT_NMSTRT),
  20019. 59: uint8(_BT_SEMI),
  20020. 60: uint8(_BT_LT),
  20021. 61: uint8(_BT_EQUALS),
  20022. 62: uint8(_BT_GT),
  20023. 63: uint8(_BT_QUEST),
  20024. 64: uint8(_BT_OTHER),
  20025. 65: uint8(_BT_HEX),
  20026. 66: uint8(_BT_HEX),
  20027. 67: uint8(_BT_HEX),
  20028. 68: uint8(_BT_HEX),
  20029. 69: uint8(_BT_HEX),
  20030. 70: uint8(_BT_HEX),
  20031. 71: uint8(_BT_NMSTRT),
  20032. 72: uint8(_BT_NMSTRT),
  20033. 73: uint8(_BT_NMSTRT),
  20034. 74: uint8(_BT_NMSTRT),
  20035. 75: uint8(_BT_NMSTRT),
  20036. 76: uint8(_BT_NMSTRT),
  20037. 77: uint8(_BT_NMSTRT),
  20038. 78: uint8(_BT_NMSTRT),
  20039. 79: uint8(_BT_NMSTRT),
  20040. 80: uint8(_BT_NMSTRT),
  20041. 81: uint8(_BT_NMSTRT),
  20042. 82: uint8(_BT_NMSTRT),
  20043. 83: uint8(_BT_NMSTRT),
  20044. 84: uint8(_BT_NMSTRT),
  20045. 85: uint8(_BT_NMSTRT),
  20046. 86: uint8(_BT_NMSTRT),
  20047. 87: uint8(_BT_NMSTRT),
  20048. 88: uint8(_BT_NMSTRT),
  20049. 89: uint8(_BT_NMSTRT),
  20050. 90: uint8(_BT_NMSTRT),
  20051. 91: uint8(_BT_LSQB),
  20052. 92: uint8(_BT_OTHER),
  20053. 93: uint8(_BT_RSQB),
  20054. 94: uint8(_BT_OTHER),
  20055. 95: uint8(_BT_NMSTRT),
  20056. 96: uint8(_BT_OTHER),
  20057. 97: uint8(_BT_HEX),
  20058. 98: uint8(_BT_HEX),
  20059. 99: uint8(_BT_HEX),
  20060. 100: uint8(_BT_HEX),
  20061. 101: uint8(_BT_HEX),
  20062. 102: uint8(_BT_HEX),
  20063. 103: uint8(_BT_NMSTRT),
  20064. 104: uint8(_BT_NMSTRT),
  20065. 105: uint8(_BT_NMSTRT),
  20066. 106: uint8(_BT_NMSTRT),
  20067. 107: uint8(_BT_NMSTRT),
  20068. 108: uint8(_BT_NMSTRT),
  20069. 109: uint8(_BT_NMSTRT),
  20070. 110: uint8(_BT_NMSTRT),
  20071. 111: uint8(_BT_NMSTRT),
  20072. 112: uint8(_BT_NMSTRT),
  20073. 113: uint8(_BT_NMSTRT),
  20074. 114: uint8(_BT_NMSTRT),
  20075. 115: uint8(_BT_NMSTRT),
  20076. 116: uint8(_BT_NMSTRT),
  20077. 117: uint8(_BT_NMSTRT),
  20078. 118: uint8(_BT_NMSTRT),
  20079. 119: uint8(_BT_NMSTRT),
  20080. 120: uint8(_BT_NMSTRT),
  20081. 121: uint8(_BT_NMSTRT),
  20082. 122: uint8(_BT_NMSTRT),
  20083. 123: uint8(_BT_OTHER),
  20084. 124: uint8(_BT_VERBAR),
  20085. 125: uint8(_BT_OTHER),
  20086. 126: uint8(_BT_OTHER),
  20087. 127: uint8(_BT_OTHER),
  20088. 128: uint8(_BT_OTHER),
  20089. 129: uint8(_BT_OTHER),
  20090. 130: uint8(_BT_OTHER),
  20091. 131: uint8(_BT_OTHER),
  20092. 132: uint8(_BT_OTHER),
  20093. 133: uint8(_BT_OTHER),
  20094. 134: uint8(_BT_OTHER),
  20095. 135: uint8(_BT_OTHER),
  20096. 136: uint8(_BT_OTHER),
  20097. 137: uint8(_BT_OTHER),
  20098. 138: uint8(_BT_OTHER),
  20099. 139: uint8(_BT_OTHER),
  20100. 140: uint8(_BT_OTHER),
  20101. 141: uint8(_BT_OTHER),
  20102. 142: uint8(_BT_OTHER),
  20103. 143: uint8(_BT_OTHER),
  20104. 144: uint8(_BT_OTHER),
  20105. 145: uint8(_BT_OTHER),
  20106. 146: uint8(_BT_OTHER),
  20107. 147: uint8(_BT_OTHER),
  20108. 148: uint8(_BT_OTHER),
  20109. 149: uint8(_BT_OTHER),
  20110. 150: uint8(_BT_OTHER),
  20111. 151: uint8(_BT_OTHER),
  20112. 152: uint8(_BT_OTHER),
  20113. 153: uint8(_BT_OTHER),
  20114. 154: uint8(_BT_OTHER),
  20115. 155: uint8(_BT_OTHER),
  20116. 156: uint8(_BT_OTHER),
  20117. 157: uint8(_BT_OTHER),
  20118. 158: uint8(_BT_OTHER),
  20119. 159: uint8(_BT_OTHER),
  20120. 160: uint8(_BT_OTHER),
  20121. 161: uint8(_BT_OTHER),
  20122. 162: uint8(_BT_OTHER),
  20123. 163: uint8(_BT_OTHER),
  20124. 164: uint8(_BT_OTHER),
  20125. 165: uint8(_BT_OTHER),
  20126. 166: uint8(_BT_OTHER),
  20127. 167: uint8(_BT_OTHER),
  20128. 168: uint8(_BT_OTHER),
  20129. 169: uint8(_BT_OTHER),
  20130. 170: uint8(_BT_NMSTRT),
  20131. 171: uint8(_BT_OTHER),
  20132. 172: uint8(_BT_OTHER),
  20133. 173: uint8(_BT_OTHER),
  20134. 174: uint8(_BT_OTHER),
  20135. 175: uint8(_BT_OTHER),
  20136. 176: uint8(_BT_OTHER),
  20137. 177: uint8(_BT_OTHER),
  20138. 178: uint8(_BT_OTHER),
  20139. 179: uint8(_BT_OTHER),
  20140. 180: uint8(_BT_OTHER),
  20141. 181: uint8(_BT_NMSTRT),
  20142. 182: uint8(_BT_OTHER),
  20143. 183: uint8(_BT_NAME),
  20144. 184: uint8(_BT_OTHER),
  20145. 185: uint8(_BT_OTHER),
  20146. 186: uint8(_BT_NMSTRT),
  20147. 187: uint8(_BT_OTHER),
  20148. 188: uint8(_BT_OTHER),
  20149. 189: uint8(_BT_OTHER),
  20150. 190: uint8(_BT_OTHER),
  20151. 191: uint8(_BT_OTHER),
  20152. 192: uint8(_BT_NMSTRT),
  20153. 193: uint8(_BT_NMSTRT),
  20154. 194: uint8(_BT_NMSTRT),
  20155. 195: uint8(_BT_NMSTRT),
  20156. 196: uint8(_BT_NMSTRT),
  20157. 197: uint8(_BT_NMSTRT),
  20158. 198: uint8(_BT_NMSTRT),
  20159. 199: uint8(_BT_NMSTRT),
  20160. 200: uint8(_BT_NMSTRT),
  20161. 201: uint8(_BT_NMSTRT),
  20162. 202: uint8(_BT_NMSTRT),
  20163. 203: uint8(_BT_NMSTRT),
  20164. 204: uint8(_BT_NMSTRT),
  20165. 205: uint8(_BT_NMSTRT),
  20166. 206: uint8(_BT_NMSTRT),
  20167. 207: uint8(_BT_NMSTRT),
  20168. 208: uint8(_BT_NMSTRT),
  20169. 209: uint8(_BT_NMSTRT),
  20170. 210: uint8(_BT_NMSTRT),
  20171. 211: uint8(_BT_NMSTRT),
  20172. 212: uint8(_BT_NMSTRT),
  20173. 213: uint8(_BT_NMSTRT),
  20174. 214: uint8(_BT_NMSTRT),
  20175. 215: uint8(_BT_OTHER),
  20176. 216: uint8(_BT_NMSTRT),
  20177. 217: uint8(_BT_NMSTRT),
  20178. 218: uint8(_BT_NMSTRT),
  20179. 219: uint8(_BT_NMSTRT),
  20180. 220: uint8(_BT_NMSTRT),
  20181. 221: uint8(_BT_NMSTRT),
  20182. 222: uint8(_BT_NMSTRT),
  20183. 223: uint8(_BT_NMSTRT),
  20184. 224: uint8(_BT_NMSTRT),
  20185. 225: uint8(_BT_NMSTRT),
  20186. 226: uint8(_BT_NMSTRT),
  20187. 227: uint8(_BT_NMSTRT),
  20188. 228: uint8(_BT_NMSTRT),
  20189. 229: uint8(_BT_NMSTRT),
  20190. 230: uint8(_BT_NMSTRT),
  20191. 231: uint8(_BT_NMSTRT),
  20192. 232: uint8(_BT_NMSTRT),
  20193. 233: uint8(_BT_NMSTRT),
  20194. 234: uint8(_BT_NMSTRT),
  20195. 235: uint8(_BT_NMSTRT),
  20196. 236: uint8(_BT_NMSTRT),
  20197. 237: uint8(_BT_NMSTRT),
  20198. 238: uint8(_BT_NMSTRT),
  20199. 239: uint8(_BT_NMSTRT),
  20200. 240: uint8(_BT_NMSTRT),
  20201. 241: uint8(_BT_NMSTRT),
  20202. 242: uint8(_BT_NMSTRT),
  20203. 243: uint8(_BT_NMSTRT),
  20204. 244: uint8(_BT_NMSTRT),
  20205. 245: uint8(_BT_NMSTRT),
  20206. 246: uint8(_BT_NMSTRT),
  20207. 247: uint8(_BT_OTHER),
  20208. 248: uint8(_BT_NMSTRT),
  20209. 249: uint8(_BT_NMSTRT),
  20210. 250: uint8(_BT_NMSTRT),
  20211. 251: uint8(_BT_NMSTRT),
  20212. 252: uint8(_BT_NMSTRT),
  20213. 253: uint8(_BT_NMSTRT),
  20214. 254: uint8(_BT_NMSTRT),
  20215. 255: uint8(_BT_NMSTRT),
  20216. },
  20217. }
  20218. func init() {
  20219. p := unsafe.Pointer(&_little2_encoding)
  20220. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  20221. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  20222. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  20223. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  20224. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  20225. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  20226. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  20227. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  20228. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  20229. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  20230. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  20231. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  20232. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  20233. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  20234. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  20235. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  20236. }
  20237. var _internal_little2_encoding_ns = Tnormal_encoding{
  20238. Fenc: TENCODING{
  20239. Fscanners: [4]TSCANNER{},
  20240. FliteralScanners: [2]TSCANNER{},
  20241. FminBytesPerChar: int32(2),
  20242. FisUtf16: uint8(1),
  20243. },
  20244. Ftype1: [256]uint8{
  20245. 9: uint8(_BT_S),
  20246. 10: uint8(_BT_LF),
  20247. 13: uint8(_BT_S),
  20248. 32: uint8(_BT_S),
  20249. 33: uint8(_BT_EXCL),
  20250. 34: uint8(_BT_QUOT),
  20251. 35: uint8(_BT_NUM),
  20252. 36: uint8(_BT_OTHER),
  20253. 37: uint8(_BT_PERCNT),
  20254. 38: uint8(_BT_AMP),
  20255. 39: uint8(_BT_APOS),
  20256. 40: uint8(_BT_LPAR),
  20257. 41: uint8(_BT_RPAR),
  20258. 42: uint8(_BT_AST),
  20259. 43: uint8(_BT_PLUS),
  20260. 44: uint8(_BT_COMMA),
  20261. 45: uint8(_BT_MINUS),
  20262. 46: uint8(_BT_NAME),
  20263. 47: uint8(_BT_SOL),
  20264. 48: uint8(_BT_DIGIT),
  20265. 49: uint8(_BT_DIGIT),
  20266. 50: uint8(_BT_DIGIT),
  20267. 51: uint8(_BT_DIGIT),
  20268. 52: uint8(_BT_DIGIT),
  20269. 53: uint8(_BT_DIGIT),
  20270. 54: uint8(_BT_DIGIT),
  20271. 55: uint8(_BT_DIGIT),
  20272. 56: uint8(_BT_DIGIT),
  20273. 57: uint8(_BT_DIGIT),
  20274. 58: uint8(_BT_COLON),
  20275. 59: uint8(_BT_SEMI),
  20276. 60: uint8(_BT_LT),
  20277. 61: uint8(_BT_EQUALS),
  20278. 62: uint8(_BT_GT),
  20279. 63: uint8(_BT_QUEST),
  20280. 64: uint8(_BT_OTHER),
  20281. 65: uint8(_BT_HEX),
  20282. 66: uint8(_BT_HEX),
  20283. 67: uint8(_BT_HEX),
  20284. 68: uint8(_BT_HEX),
  20285. 69: uint8(_BT_HEX),
  20286. 70: uint8(_BT_HEX),
  20287. 71: uint8(_BT_NMSTRT),
  20288. 72: uint8(_BT_NMSTRT),
  20289. 73: uint8(_BT_NMSTRT),
  20290. 74: uint8(_BT_NMSTRT),
  20291. 75: uint8(_BT_NMSTRT),
  20292. 76: uint8(_BT_NMSTRT),
  20293. 77: uint8(_BT_NMSTRT),
  20294. 78: uint8(_BT_NMSTRT),
  20295. 79: uint8(_BT_NMSTRT),
  20296. 80: uint8(_BT_NMSTRT),
  20297. 81: uint8(_BT_NMSTRT),
  20298. 82: uint8(_BT_NMSTRT),
  20299. 83: uint8(_BT_NMSTRT),
  20300. 84: uint8(_BT_NMSTRT),
  20301. 85: uint8(_BT_NMSTRT),
  20302. 86: uint8(_BT_NMSTRT),
  20303. 87: uint8(_BT_NMSTRT),
  20304. 88: uint8(_BT_NMSTRT),
  20305. 89: uint8(_BT_NMSTRT),
  20306. 90: uint8(_BT_NMSTRT),
  20307. 91: uint8(_BT_LSQB),
  20308. 92: uint8(_BT_OTHER),
  20309. 93: uint8(_BT_RSQB),
  20310. 94: uint8(_BT_OTHER),
  20311. 95: uint8(_BT_NMSTRT),
  20312. 96: uint8(_BT_OTHER),
  20313. 97: uint8(_BT_HEX),
  20314. 98: uint8(_BT_HEX),
  20315. 99: uint8(_BT_HEX),
  20316. 100: uint8(_BT_HEX),
  20317. 101: uint8(_BT_HEX),
  20318. 102: uint8(_BT_HEX),
  20319. 103: uint8(_BT_NMSTRT),
  20320. 104: uint8(_BT_NMSTRT),
  20321. 105: uint8(_BT_NMSTRT),
  20322. 106: uint8(_BT_NMSTRT),
  20323. 107: uint8(_BT_NMSTRT),
  20324. 108: uint8(_BT_NMSTRT),
  20325. 109: uint8(_BT_NMSTRT),
  20326. 110: uint8(_BT_NMSTRT),
  20327. 111: uint8(_BT_NMSTRT),
  20328. 112: uint8(_BT_NMSTRT),
  20329. 113: uint8(_BT_NMSTRT),
  20330. 114: uint8(_BT_NMSTRT),
  20331. 115: uint8(_BT_NMSTRT),
  20332. 116: uint8(_BT_NMSTRT),
  20333. 117: uint8(_BT_NMSTRT),
  20334. 118: uint8(_BT_NMSTRT),
  20335. 119: uint8(_BT_NMSTRT),
  20336. 120: uint8(_BT_NMSTRT),
  20337. 121: uint8(_BT_NMSTRT),
  20338. 122: uint8(_BT_NMSTRT),
  20339. 123: uint8(_BT_OTHER),
  20340. 124: uint8(_BT_VERBAR),
  20341. 125: uint8(_BT_OTHER),
  20342. 126: uint8(_BT_OTHER),
  20343. 127: uint8(_BT_OTHER),
  20344. 128: uint8(_BT_OTHER),
  20345. 129: uint8(_BT_OTHER),
  20346. 130: uint8(_BT_OTHER),
  20347. 131: uint8(_BT_OTHER),
  20348. 132: uint8(_BT_OTHER),
  20349. 133: uint8(_BT_OTHER),
  20350. 134: uint8(_BT_OTHER),
  20351. 135: uint8(_BT_OTHER),
  20352. 136: uint8(_BT_OTHER),
  20353. 137: uint8(_BT_OTHER),
  20354. 138: uint8(_BT_OTHER),
  20355. 139: uint8(_BT_OTHER),
  20356. 140: uint8(_BT_OTHER),
  20357. 141: uint8(_BT_OTHER),
  20358. 142: uint8(_BT_OTHER),
  20359. 143: uint8(_BT_OTHER),
  20360. 144: uint8(_BT_OTHER),
  20361. 145: uint8(_BT_OTHER),
  20362. 146: uint8(_BT_OTHER),
  20363. 147: uint8(_BT_OTHER),
  20364. 148: uint8(_BT_OTHER),
  20365. 149: uint8(_BT_OTHER),
  20366. 150: uint8(_BT_OTHER),
  20367. 151: uint8(_BT_OTHER),
  20368. 152: uint8(_BT_OTHER),
  20369. 153: uint8(_BT_OTHER),
  20370. 154: uint8(_BT_OTHER),
  20371. 155: uint8(_BT_OTHER),
  20372. 156: uint8(_BT_OTHER),
  20373. 157: uint8(_BT_OTHER),
  20374. 158: uint8(_BT_OTHER),
  20375. 159: uint8(_BT_OTHER),
  20376. 160: uint8(_BT_OTHER),
  20377. 161: uint8(_BT_OTHER),
  20378. 162: uint8(_BT_OTHER),
  20379. 163: uint8(_BT_OTHER),
  20380. 164: uint8(_BT_OTHER),
  20381. 165: uint8(_BT_OTHER),
  20382. 166: uint8(_BT_OTHER),
  20383. 167: uint8(_BT_OTHER),
  20384. 168: uint8(_BT_OTHER),
  20385. 169: uint8(_BT_OTHER),
  20386. 170: uint8(_BT_NMSTRT),
  20387. 171: uint8(_BT_OTHER),
  20388. 172: uint8(_BT_OTHER),
  20389. 173: uint8(_BT_OTHER),
  20390. 174: uint8(_BT_OTHER),
  20391. 175: uint8(_BT_OTHER),
  20392. 176: uint8(_BT_OTHER),
  20393. 177: uint8(_BT_OTHER),
  20394. 178: uint8(_BT_OTHER),
  20395. 179: uint8(_BT_OTHER),
  20396. 180: uint8(_BT_OTHER),
  20397. 181: uint8(_BT_NMSTRT),
  20398. 182: uint8(_BT_OTHER),
  20399. 183: uint8(_BT_NAME),
  20400. 184: uint8(_BT_OTHER),
  20401. 185: uint8(_BT_OTHER),
  20402. 186: uint8(_BT_NMSTRT),
  20403. 187: uint8(_BT_OTHER),
  20404. 188: uint8(_BT_OTHER),
  20405. 189: uint8(_BT_OTHER),
  20406. 190: uint8(_BT_OTHER),
  20407. 191: uint8(_BT_OTHER),
  20408. 192: uint8(_BT_NMSTRT),
  20409. 193: uint8(_BT_NMSTRT),
  20410. 194: uint8(_BT_NMSTRT),
  20411. 195: uint8(_BT_NMSTRT),
  20412. 196: uint8(_BT_NMSTRT),
  20413. 197: uint8(_BT_NMSTRT),
  20414. 198: uint8(_BT_NMSTRT),
  20415. 199: uint8(_BT_NMSTRT),
  20416. 200: uint8(_BT_NMSTRT),
  20417. 201: uint8(_BT_NMSTRT),
  20418. 202: uint8(_BT_NMSTRT),
  20419. 203: uint8(_BT_NMSTRT),
  20420. 204: uint8(_BT_NMSTRT),
  20421. 205: uint8(_BT_NMSTRT),
  20422. 206: uint8(_BT_NMSTRT),
  20423. 207: uint8(_BT_NMSTRT),
  20424. 208: uint8(_BT_NMSTRT),
  20425. 209: uint8(_BT_NMSTRT),
  20426. 210: uint8(_BT_NMSTRT),
  20427. 211: uint8(_BT_NMSTRT),
  20428. 212: uint8(_BT_NMSTRT),
  20429. 213: uint8(_BT_NMSTRT),
  20430. 214: uint8(_BT_NMSTRT),
  20431. 215: uint8(_BT_OTHER),
  20432. 216: uint8(_BT_NMSTRT),
  20433. 217: uint8(_BT_NMSTRT),
  20434. 218: uint8(_BT_NMSTRT),
  20435. 219: uint8(_BT_NMSTRT),
  20436. 220: uint8(_BT_NMSTRT),
  20437. 221: uint8(_BT_NMSTRT),
  20438. 222: uint8(_BT_NMSTRT),
  20439. 223: uint8(_BT_NMSTRT),
  20440. 224: uint8(_BT_NMSTRT),
  20441. 225: uint8(_BT_NMSTRT),
  20442. 226: uint8(_BT_NMSTRT),
  20443. 227: uint8(_BT_NMSTRT),
  20444. 228: uint8(_BT_NMSTRT),
  20445. 229: uint8(_BT_NMSTRT),
  20446. 230: uint8(_BT_NMSTRT),
  20447. 231: uint8(_BT_NMSTRT),
  20448. 232: uint8(_BT_NMSTRT),
  20449. 233: uint8(_BT_NMSTRT),
  20450. 234: uint8(_BT_NMSTRT),
  20451. 235: uint8(_BT_NMSTRT),
  20452. 236: uint8(_BT_NMSTRT),
  20453. 237: uint8(_BT_NMSTRT),
  20454. 238: uint8(_BT_NMSTRT),
  20455. 239: uint8(_BT_NMSTRT),
  20456. 240: uint8(_BT_NMSTRT),
  20457. 241: uint8(_BT_NMSTRT),
  20458. 242: uint8(_BT_NMSTRT),
  20459. 243: uint8(_BT_NMSTRT),
  20460. 244: uint8(_BT_NMSTRT),
  20461. 245: uint8(_BT_NMSTRT),
  20462. 246: uint8(_BT_NMSTRT),
  20463. 247: uint8(_BT_OTHER),
  20464. 248: uint8(_BT_NMSTRT),
  20465. 249: uint8(_BT_NMSTRT),
  20466. 250: uint8(_BT_NMSTRT),
  20467. 251: uint8(_BT_NMSTRT),
  20468. 252: uint8(_BT_NMSTRT),
  20469. 253: uint8(_BT_NMSTRT),
  20470. 254: uint8(_BT_NMSTRT),
  20471. 255: uint8(_BT_NMSTRT),
  20472. },
  20473. }
  20474. func init() {
  20475. p := unsafe.Pointer(&_internal_little2_encoding_ns)
  20476. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  20477. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  20478. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  20479. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  20480. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  20481. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  20482. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  20483. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  20484. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  20485. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  20486. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  20487. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  20488. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  20489. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  20490. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  20491. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  20492. }
  20493. var _internal_little2_encoding = Tnormal_encoding{
  20494. Fenc: TENCODING{
  20495. Fscanners: [4]TSCANNER{},
  20496. FliteralScanners: [2]TSCANNER{},
  20497. FminBytesPerChar: int32(2),
  20498. FisUtf16: uint8(1),
  20499. },
  20500. Ftype1: [256]uint8{
  20501. 9: uint8(_BT_S),
  20502. 10: uint8(_BT_LF),
  20503. 13: uint8(_BT_S),
  20504. 32: uint8(_BT_S),
  20505. 33: uint8(_BT_EXCL),
  20506. 34: uint8(_BT_QUOT),
  20507. 35: uint8(_BT_NUM),
  20508. 36: uint8(_BT_OTHER),
  20509. 37: uint8(_BT_PERCNT),
  20510. 38: uint8(_BT_AMP),
  20511. 39: uint8(_BT_APOS),
  20512. 40: uint8(_BT_LPAR),
  20513. 41: uint8(_BT_RPAR),
  20514. 42: uint8(_BT_AST),
  20515. 43: uint8(_BT_PLUS),
  20516. 44: uint8(_BT_COMMA),
  20517. 45: uint8(_BT_MINUS),
  20518. 46: uint8(_BT_NAME),
  20519. 47: uint8(_BT_SOL),
  20520. 48: uint8(_BT_DIGIT),
  20521. 49: uint8(_BT_DIGIT),
  20522. 50: uint8(_BT_DIGIT),
  20523. 51: uint8(_BT_DIGIT),
  20524. 52: uint8(_BT_DIGIT),
  20525. 53: uint8(_BT_DIGIT),
  20526. 54: uint8(_BT_DIGIT),
  20527. 55: uint8(_BT_DIGIT),
  20528. 56: uint8(_BT_DIGIT),
  20529. 57: uint8(_BT_DIGIT),
  20530. 58: uint8(_BT_NMSTRT),
  20531. 59: uint8(_BT_SEMI),
  20532. 60: uint8(_BT_LT),
  20533. 61: uint8(_BT_EQUALS),
  20534. 62: uint8(_BT_GT),
  20535. 63: uint8(_BT_QUEST),
  20536. 64: uint8(_BT_OTHER),
  20537. 65: uint8(_BT_HEX),
  20538. 66: uint8(_BT_HEX),
  20539. 67: uint8(_BT_HEX),
  20540. 68: uint8(_BT_HEX),
  20541. 69: uint8(_BT_HEX),
  20542. 70: uint8(_BT_HEX),
  20543. 71: uint8(_BT_NMSTRT),
  20544. 72: uint8(_BT_NMSTRT),
  20545. 73: uint8(_BT_NMSTRT),
  20546. 74: uint8(_BT_NMSTRT),
  20547. 75: uint8(_BT_NMSTRT),
  20548. 76: uint8(_BT_NMSTRT),
  20549. 77: uint8(_BT_NMSTRT),
  20550. 78: uint8(_BT_NMSTRT),
  20551. 79: uint8(_BT_NMSTRT),
  20552. 80: uint8(_BT_NMSTRT),
  20553. 81: uint8(_BT_NMSTRT),
  20554. 82: uint8(_BT_NMSTRT),
  20555. 83: uint8(_BT_NMSTRT),
  20556. 84: uint8(_BT_NMSTRT),
  20557. 85: uint8(_BT_NMSTRT),
  20558. 86: uint8(_BT_NMSTRT),
  20559. 87: uint8(_BT_NMSTRT),
  20560. 88: uint8(_BT_NMSTRT),
  20561. 89: uint8(_BT_NMSTRT),
  20562. 90: uint8(_BT_NMSTRT),
  20563. 91: uint8(_BT_LSQB),
  20564. 92: uint8(_BT_OTHER),
  20565. 93: uint8(_BT_RSQB),
  20566. 94: uint8(_BT_OTHER),
  20567. 95: uint8(_BT_NMSTRT),
  20568. 96: uint8(_BT_OTHER),
  20569. 97: uint8(_BT_HEX),
  20570. 98: uint8(_BT_HEX),
  20571. 99: uint8(_BT_HEX),
  20572. 100: uint8(_BT_HEX),
  20573. 101: uint8(_BT_HEX),
  20574. 102: uint8(_BT_HEX),
  20575. 103: uint8(_BT_NMSTRT),
  20576. 104: uint8(_BT_NMSTRT),
  20577. 105: uint8(_BT_NMSTRT),
  20578. 106: uint8(_BT_NMSTRT),
  20579. 107: uint8(_BT_NMSTRT),
  20580. 108: uint8(_BT_NMSTRT),
  20581. 109: uint8(_BT_NMSTRT),
  20582. 110: uint8(_BT_NMSTRT),
  20583. 111: uint8(_BT_NMSTRT),
  20584. 112: uint8(_BT_NMSTRT),
  20585. 113: uint8(_BT_NMSTRT),
  20586. 114: uint8(_BT_NMSTRT),
  20587. 115: uint8(_BT_NMSTRT),
  20588. 116: uint8(_BT_NMSTRT),
  20589. 117: uint8(_BT_NMSTRT),
  20590. 118: uint8(_BT_NMSTRT),
  20591. 119: uint8(_BT_NMSTRT),
  20592. 120: uint8(_BT_NMSTRT),
  20593. 121: uint8(_BT_NMSTRT),
  20594. 122: uint8(_BT_NMSTRT),
  20595. 123: uint8(_BT_OTHER),
  20596. 124: uint8(_BT_VERBAR),
  20597. 125: uint8(_BT_OTHER),
  20598. 126: uint8(_BT_OTHER),
  20599. 127: uint8(_BT_OTHER),
  20600. 128: uint8(_BT_OTHER),
  20601. 129: uint8(_BT_OTHER),
  20602. 130: uint8(_BT_OTHER),
  20603. 131: uint8(_BT_OTHER),
  20604. 132: uint8(_BT_OTHER),
  20605. 133: uint8(_BT_OTHER),
  20606. 134: uint8(_BT_OTHER),
  20607. 135: uint8(_BT_OTHER),
  20608. 136: uint8(_BT_OTHER),
  20609. 137: uint8(_BT_OTHER),
  20610. 138: uint8(_BT_OTHER),
  20611. 139: uint8(_BT_OTHER),
  20612. 140: uint8(_BT_OTHER),
  20613. 141: uint8(_BT_OTHER),
  20614. 142: uint8(_BT_OTHER),
  20615. 143: uint8(_BT_OTHER),
  20616. 144: uint8(_BT_OTHER),
  20617. 145: uint8(_BT_OTHER),
  20618. 146: uint8(_BT_OTHER),
  20619. 147: uint8(_BT_OTHER),
  20620. 148: uint8(_BT_OTHER),
  20621. 149: uint8(_BT_OTHER),
  20622. 150: uint8(_BT_OTHER),
  20623. 151: uint8(_BT_OTHER),
  20624. 152: uint8(_BT_OTHER),
  20625. 153: uint8(_BT_OTHER),
  20626. 154: uint8(_BT_OTHER),
  20627. 155: uint8(_BT_OTHER),
  20628. 156: uint8(_BT_OTHER),
  20629. 157: uint8(_BT_OTHER),
  20630. 158: uint8(_BT_OTHER),
  20631. 159: uint8(_BT_OTHER),
  20632. 160: uint8(_BT_OTHER),
  20633. 161: uint8(_BT_OTHER),
  20634. 162: uint8(_BT_OTHER),
  20635. 163: uint8(_BT_OTHER),
  20636. 164: uint8(_BT_OTHER),
  20637. 165: uint8(_BT_OTHER),
  20638. 166: uint8(_BT_OTHER),
  20639. 167: uint8(_BT_OTHER),
  20640. 168: uint8(_BT_OTHER),
  20641. 169: uint8(_BT_OTHER),
  20642. 170: uint8(_BT_NMSTRT),
  20643. 171: uint8(_BT_OTHER),
  20644. 172: uint8(_BT_OTHER),
  20645. 173: uint8(_BT_OTHER),
  20646. 174: uint8(_BT_OTHER),
  20647. 175: uint8(_BT_OTHER),
  20648. 176: uint8(_BT_OTHER),
  20649. 177: uint8(_BT_OTHER),
  20650. 178: uint8(_BT_OTHER),
  20651. 179: uint8(_BT_OTHER),
  20652. 180: uint8(_BT_OTHER),
  20653. 181: uint8(_BT_NMSTRT),
  20654. 182: uint8(_BT_OTHER),
  20655. 183: uint8(_BT_NAME),
  20656. 184: uint8(_BT_OTHER),
  20657. 185: uint8(_BT_OTHER),
  20658. 186: uint8(_BT_NMSTRT),
  20659. 187: uint8(_BT_OTHER),
  20660. 188: uint8(_BT_OTHER),
  20661. 189: uint8(_BT_OTHER),
  20662. 190: uint8(_BT_OTHER),
  20663. 191: uint8(_BT_OTHER),
  20664. 192: uint8(_BT_NMSTRT),
  20665. 193: uint8(_BT_NMSTRT),
  20666. 194: uint8(_BT_NMSTRT),
  20667. 195: uint8(_BT_NMSTRT),
  20668. 196: uint8(_BT_NMSTRT),
  20669. 197: uint8(_BT_NMSTRT),
  20670. 198: uint8(_BT_NMSTRT),
  20671. 199: uint8(_BT_NMSTRT),
  20672. 200: uint8(_BT_NMSTRT),
  20673. 201: uint8(_BT_NMSTRT),
  20674. 202: uint8(_BT_NMSTRT),
  20675. 203: uint8(_BT_NMSTRT),
  20676. 204: uint8(_BT_NMSTRT),
  20677. 205: uint8(_BT_NMSTRT),
  20678. 206: uint8(_BT_NMSTRT),
  20679. 207: uint8(_BT_NMSTRT),
  20680. 208: uint8(_BT_NMSTRT),
  20681. 209: uint8(_BT_NMSTRT),
  20682. 210: uint8(_BT_NMSTRT),
  20683. 211: uint8(_BT_NMSTRT),
  20684. 212: uint8(_BT_NMSTRT),
  20685. 213: uint8(_BT_NMSTRT),
  20686. 214: uint8(_BT_NMSTRT),
  20687. 215: uint8(_BT_OTHER),
  20688. 216: uint8(_BT_NMSTRT),
  20689. 217: uint8(_BT_NMSTRT),
  20690. 218: uint8(_BT_NMSTRT),
  20691. 219: uint8(_BT_NMSTRT),
  20692. 220: uint8(_BT_NMSTRT),
  20693. 221: uint8(_BT_NMSTRT),
  20694. 222: uint8(_BT_NMSTRT),
  20695. 223: uint8(_BT_NMSTRT),
  20696. 224: uint8(_BT_NMSTRT),
  20697. 225: uint8(_BT_NMSTRT),
  20698. 226: uint8(_BT_NMSTRT),
  20699. 227: uint8(_BT_NMSTRT),
  20700. 228: uint8(_BT_NMSTRT),
  20701. 229: uint8(_BT_NMSTRT),
  20702. 230: uint8(_BT_NMSTRT),
  20703. 231: uint8(_BT_NMSTRT),
  20704. 232: uint8(_BT_NMSTRT),
  20705. 233: uint8(_BT_NMSTRT),
  20706. 234: uint8(_BT_NMSTRT),
  20707. 235: uint8(_BT_NMSTRT),
  20708. 236: uint8(_BT_NMSTRT),
  20709. 237: uint8(_BT_NMSTRT),
  20710. 238: uint8(_BT_NMSTRT),
  20711. 239: uint8(_BT_NMSTRT),
  20712. 240: uint8(_BT_NMSTRT),
  20713. 241: uint8(_BT_NMSTRT),
  20714. 242: uint8(_BT_NMSTRT),
  20715. 243: uint8(_BT_NMSTRT),
  20716. 244: uint8(_BT_NMSTRT),
  20717. 245: uint8(_BT_NMSTRT),
  20718. 246: uint8(_BT_NMSTRT),
  20719. 247: uint8(_BT_OTHER),
  20720. 248: uint8(_BT_NMSTRT),
  20721. 249: uint8(_BT_NMSTRT),
  20722. 250: uint8(_BT_NMSTRT),
  20723. 251: uint8(_BT_NMSTRT),
  20724. 252: uint8(_BT_NMSTRT),
  20725. 253: uint8(_BT_NMSTRT),
  20726. 254: uint8(_BT_NMSTRT),
  20727. 255: uint8(_BT_NMSTRT),
  20728. },
  20729. }
  20730. func init() {
  20731. p := unsafe.Pointer(&_internal_little2_encoding)
  20732. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_little2_prologTok)
  20733. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_little2_contentTok)
  20734. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_little2_cdataSectionTok)
  20735. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_little2_ignoreSectionTok)
  20736. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_little2_attributeValueTok)
  20737. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_little2_entityValueTok)
  20738. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_little2_nameMatchesAscii)
  20739. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_little2_nameLength)
  20740. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_little2_skipS)
  20741. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_little2_getAtts)
  20742. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_little2_charRefNumber)
  20743. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_little2_predefinedEntityName)
  20744. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_little2_updatePosition)
  20745. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_little2_isPublicId)
  20746. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_little2_toUtf8)
  20747. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_little2_toUtf16)
  20748. }
  20749. /* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */
  20750. /* This file is included!
  20751. __ __ _
  20752. ___\ \/ /_ __ __ _| |_
  20753. / _ \\ /| '_ \ / _` | __|
  20754. | __// \| |_) | (_| | |_
  20755. \___/_/\_\ .__/ \__,_|\__|
  20756. |_| XML parser
  20757. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  20758. Copyright (c) 2000-2017 Expat development team
  20759. Licensed under the MIT license:
  20760. Permission is hereby granted, free of charge, to any person obtaining
  20761. a copy of this software and associated documentation files (the
  20762. "Software"), to deal in the Software without restriction, including
  20763. without limitation the rights to use, copy, modify, merge, publish,
  20764. distribute, sublicense, and/or sell copies of the Software, and to permit
  20765. persons to whom the Software is furnished to do so, subject to the
  20766. following conditions:
  20767. The above copyright notice and this permission notice shall be included
  20768. in all copies or substantial portions of the Software.
  20769. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20770. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20771. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  20772. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  20773. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20774. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  20775. USE OR OTHER DEALINGS IN THE SOFTWARE.
  20776. */
  20777. /* ptr points to character following "<!-" */
  20778. func _big2_scanComment(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20779. var v1 int32
  20780. _ = v1
  20781. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20782. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1)) {
  20783. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20784. return m_XML_TOK_INVALID
  20785. }
  20786. ptr += uintptr(2)
  20787. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20788. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20789. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20790. } else {
  20791. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20792. }
  20793. switch v1 {
  20794. case int32(_BT_LEAD2):
  20795. if int64(end)-int64(ptr) < int64(2) {
  20796. return -int32(2)
  20797. }
  20798. if 0 != 0 {
  20799. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20800. return m_XML_TOK_INVALID
  20801. }
  20802. ptr += uintptr(2)
  20803. case int32(_BT_LEAD3):
  20804. if int64(end)-int64(ptr) < int64(3) {
  20805. return -int32(2)
  20806. }
  20807. if 0 != 0 {
  20808. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20809. return m_XML_TOK_INVALID
  20810. }
  20811. ptr += uintptr(3)
  20812. case int32(_BT_LEAD4):
  20813. if int64(end)-int64(ptr) < int64(4) {
  20814. return -int32(2)
  20815. }
  20816. if 0 != 0 {
  20817. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20818. return m_XML_TOK_INVALID
  20819. }
  20820. ptr += uintptr(4)
  20821. case int32(_BT_NONXML):
  20822. fallthrough
  20823. case int32(_BT_MALFORM):
  20824. fallthrough
  20825. case int32(_BT_TRAIL):
  20826. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20827. return m_XML_TOK_INVALID
  20828. case int32(_BT_MINUS):
  20829. ptr += uintptr(2)
  20830. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20831. return -int32(1)
  20832. }
  20833. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_MINUS1) {
  20834. ptr += uintptr(2)
  20835. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20836. return -int32(1)
  20837. }
  20838. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  20839. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20840. return m_XML_TOK_INVALID
  20841. }
  20842. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20843. return int32(m_XML_TOK_COMMENT)
  20844. }
  20845. default:
  20846. ptr += uintptr(2)
  20847. break
  20848. }
  20849. }
  20850. }
  20851. return -int32(1)
  20852. }
  20853. /* ptr points to character following "<!" */
  20854. func _big2_scanDecl(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20855. var v1, v2, v3 int32
  20856. _, _, _ = v1, v2, v3
  20857. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20858. return -int32(1)
  20859. }
  20860. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20861. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20862. } else {
  20863. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20864. }
  20865. switch v1 {
  20866. case int32(_BT_MINUS):
  20867. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  20868. case int32(_BT_LSQB):
  20869. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  20870. return int32(m_XML_TOK_COND_SECT_OPEN)
  20871. case int32(_BT_NMSTRT):
  20872. fallthrough
  20873. case int32(_BT_HEX):
  20874. ptr += uintptr(2)
  20875. default:
  20876. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20877. return m_XML_TOK_INVALID
  20878. }
  20879. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  20880. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20881. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20882. } else {
  20883. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20884. }
  20885. switch v2 {
  20886. case int32(_BT_PERCNT):
  20887. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  20888. return -int32(1)
  20889. }
  20890. /* don't allow <!ENTITY% foo "whatever"> */
  20891. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  20892. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  20893. } else {
  20894. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  20895. }
  20896. switch v3 {
  20897. case int32(_BT_S):
  20898. fallthrough
  20899. case int32(_BT_CR):
  20900. fallthrough
  20901. case int32(_BT_LF):
  20902. fallthrough
  20903. case int32(_BT_PERCNT):
  20904. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20905. return m_XML_TOK_INVALID
  20906. }
  20907. /* fall through */
  20908. fallthrough
  20909. case int32(_BT_S):
  20910. fallthrough
  20911. case int32(_BT_CR):
  20912. fallthrough
  20913. case int32(_BT_LF):
  20914. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20915. return int32(m_XML_TOK_DECL_OPEN)
  20916. case int32(_BT_NMSTRT):
  20917. fallthrough
  20918. case int32(_BT_HEX):
  20919. ptr += uintptr(2)
  20920. default:
  20921. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  20922. return m_XML_TOK_INVALID
  20923. }
  20924. }
  20925. return -int32(1)
  20926. }
  20927. func _big2_checkPiTarget(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, tokPtr uintptr) (r int32) {
  20928. var upper, v1, v2, v3 int32
  20929. _, _, _, _ = upper, v1, v2, v3
  20930. upper = 0
  20931. _ = enc
  20932. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_PI)
  20933. if int64(end)-int64(ptr) != int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(3)) {
  20934. return int32(1)
  20935. }
  20936. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20937. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  20938. } else {
  20939. v1 = -int32(1)
  20940. }
  20941. switch v1 {
  20942. case int32(m_ASCII_x):
  20943. case int32(m_ASCII_X):
  20944. upper = int32(1)
  20945. default:
  20946. return int32(1)
  20947. }
  20948. ptr += uintptr(2)
  20949. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20950. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  20951. } else {
  20952. v2 = -int32(1)
  20953. }
  20954. switch v2 {
  20955. case int32(m_ASCII_m):
  20956. case int32(m_ASCII_M):
  20957. upper = int32(1)
  20958. default:
  20959. return int32(1)
  20960. }
  20961. ptr += uintptr(2)
  20962. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20963. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  20964. } else {
  20965. v3 = -int32(1)
  20966. }
  20967. switch v3 {
  20968. case int32(m_ASCII_l):
  20969. case int32(m_ASCII_L):
  20970. upper = int32(1)
  20971. default:
  20972. return int32(1)
  20973. }
  20974. if upper != 0 {
  20975. return 0
  20976. }
  20977. *(*int32)(unsafe.Pointer(tokPtr)) = int32(m_XML_TOK_XML_DECL)
  20978. return int32(1)
  20979. }
  20980. /* ptr points to character following "<?" */
  20981. func _big2_scanPi(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  20982. bp := tls.Alloc(16)
  20983. defer tls.Free(16)
  20984. var target uintptr
  20985. var v1, v2, v3 int32
  20986. var _ /* tok at bp+0 */ int32
  20987. _, _, _, _ = target, v1, v2, v3
  20988. target = ptr
  20989. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  20990. return -int32(1)
  20991. }
  20992. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  20993. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  20994. } else {
  20995. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  20996. }
  20997. switch v1 {
  20998. case int32(_BT_NONASCII):
  20999. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21000. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21001. return m_XML_TOK_INVALID
  21002. } /* fall through */
  21003. fallthrough
  21004. case int32(_BT_NMSTRT):
  21005. fallthrough
  21006. case int32(_BT_HEX):
  21007. ptr += uintptr(2)
  21008. case int32(_BT_LEAD2):
  21009. if int64(end)-int64(ptr) < int64(2) {
  21010. return -int32(2)
  21011. }
  21012. if !(libc.Int32FromInt32(0) != 0) {
  21013. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21014. return m_XML_TOK_INVALID
  21015. }
  21016. ptr += uintptr(2)
  21017. case int32(_BT_LEAD3):
  21018. if int64(end)-int64(ptr) < int64(3) {
  21019. return -int32(2)
  21020. }
  21021. if !(libc.Int32FromInt32(0) != 0) {
  21022. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21023. return m_XML_TOK_INVALID
  21024. }
  21025. ptr += uintptr(3)
  21026. case int32(_BT_LEAD4):
  21027. if int64(end)-int64(ptr) < int64(4) {
  21028. return -int32(2)
  21029. }
  21030. if !(libc.Int32FromInt32(0) != 0) {
  21031. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21032. return m_XML_TOK_INVALID
  21033. }
  21034. ptr += uintptr(4)
  21035. default:
  21036. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21037. return m_XML_TOK_INVALID
  21038. }
  21039. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21040. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21041. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21042. } else {
  21043. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21044. }
  21045. switch v2 {
  21046. case int32(_BT_NONASCII):
  21047. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21048. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21049. return m_XML_TOK_INVALID
  21050. } /* fall through */
  21051. fallthrough
  21052. case int32(_BT_NMSTRT):
  21053. fallthrough
  21054. case int32(_BT_HEX):
  21055. fallthrough
  21056. case int32(_BT_DIGIT):
  21057. fallthrough
  21058. case int32(_BT_NAME):
  21059. fallthrough
  21060. case int32(_BT_MINUS):
  21061. ptr += uintptr(2)
  21062. case int32(_BT_LEAD2):
  21063. if int64(end)-int64(ptr) < int64(2) {
  21064. return -int32(2)
  21065. }
  21066. if !(libc.Int32FromInt32(0) != 0) {
  21067. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21068. return m_XML_TOK_INVALID
  21069. }
  21070. ptr += uintptr(2)
  21071. case int32(_BT_LEAD3):
  21072. if int64(end)-int64(ptr) < int64(3) {
  21073. return -int32(2)
  21074. }
  21075. if !(libc.Int32FromInt32(0) != 0) {
  21076. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21077. return m_XML_TOK_INVALID
  21078. }
  21079. ptr += uintptr(3)
  21080. case int32(_BT_LEAD4):
  21081. if int64(end)-int64(ptr) < int64(4) {
  21082. return -int32(2)
  21083. }
  21084. if !(libc.Int32FromInt32(0) != 0) {
  21085. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21086. return m_XML_TOK_INVALID
  21087. }
  21088. ptr += uintptr(4)
  21089. case int32(_BT_S):
  21090. fallthrough
  21091. case int32(_BT_CR):
  21092. fallthrough
  21093. case int32(_BT_LF):
  21094. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  21095. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21096. return m_XML_TOK_INVALID
  21097. }
  21098. ptr += uintptr(2)
  21099. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21100. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21101. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21102. } else {
  21103. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21104. }
  21105. switch v3 {
  21106. case int32(_BT_LEAD2):
  21107. if int64(end)-int64(ptr) < int64(2) {
  21108. return -int32(2)
  21109. }
  21110. if 0 != 0 {
  21111. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21112. return m_XML_TOK_INVALID
  21113. }
  21114. ptr += uintptr(2)
  21115. case int32(_BT_LEAD3):
  21116. if int64(end)-int64(ptr) < int64(3) {
  21117. return -int32(2)
  21118. }
  21119. if 0 != 0 {
  21120. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21121. return m_XML_TOK_INVALID
  21122. }
  21123. ptr += uintptr(3)
  21124. case int32(_BT_LEAD4):
  21125. if int64(end)-int64(ptr) < int64(4) {
  21126. return -int32(2)
  21127. }
  21128. if 0 != 0 {
  21129. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21130. return m_XML_TOK_INVALID
  21131. }
  21132. ptr += uintptr(4)
  21133. case int32(_BT_NONXML):
  21134. fallthrough
  21135. case int32(_BT_MALFORM):
  21136. fallthrough
  21137. case int32(_BT_TRAIL):
  21138. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21139. return m_XML_TOK_INVALID
  21140. case int32(_BT_QUEST):
  21141. ptr += uintptr(2)
  21142. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21143. return -int32(1)
  21144. }
  21145. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  21146. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21147. return *(*int32)(unsafe.Pointer(bp))
  21148. }
  21149. default:
  21150. ptr += uintptr(2)
  21151. break
  21152. }
  21153. }
  21154. return -int32(1)
  21155. case int32(_BT_QUEST):
  21156. if !(_big2_checkPiTarget(tls, enc, target, ptr, bp) != 0) {
  21157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21158. return m_XML_TOK_INVALID
  21159. }
  21160. ptr += uintptr(2)
  21161. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21162. return -int32(1)
  21163. }
  21164. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  21165. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21166. return *(*int32)(unsafe.Pointer(bp))
  21167. }
  21168. /* fall through */
  21169. fallthrough
  21170. default:
  21171. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21172. return m_XML_TOK_INVALID
  21173. }
  21174. }
  21175. return -int32(1)
  21176. }
  21177. func _big2_scanCdataSection(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21178. var i int32
  21179. _ = i
  21180. _ = enc
  21181. /* CDATA[ */
  21182. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(6)*libc.Int32FromInt32(2))) {
  21183. return -int32(1)
  21184. }
  21185. i = 0
  21186. for {
  21187. if !(i < int32(6)) {
  21188. break
  21189. }
  21190. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == libc.Int32FromUint8(_CDATA_LSQB2[i])) {
  21191. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21192. return m_XML_TOK_INVALID
  21193. }
  21194. goto _1
  21195. _1:
  21196. ;
  21197. i++
  21198. ptr += uintptr(2)
  21199. }
  21200. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21201. return int32(m_XML_TOK_CDATA_SECT_OPEN)
  21202. }
  21203. var _CDATA_LSQB2 = [6]uint8{
  21204. 0: uint8(m_ASCII_C),
  21205. 1: uint8(m_ASCII_D),
  21206. 2: uint8(m_ASCII_A),
  21207. 3: uint8(m_ASCII_T),
  21208. 4: uint8(m_ASCII_A),
  21209. 5: uint8(m_ASCII_LSQB1),
  21210. }
  21211. func _big2_cdataSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21212. var n Tsize_t
  21213. var v1, v2, v3 int32
  21214. _, _, _, _ = n, v1, v2, v3
  21215. if ptr >= end {
  21216. return -int32(4)
  21217. }
  21218. if int32(2) > int32(1) {
  21219. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  21220. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  21221. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  21222. if n == uint64(0) {
  21223. return -int32(1)
  21224. }
  21225. end = ptr + uintptr(n)
  21226. }
  21227. }
  21228. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21229. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21230. } else {
  21231. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21232. }
  21233. switch v1 {
  21234. case int32(_BT_RSQB):
  21235. ptr += uintptr(2)
  21236. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21237. return -int32(1)
  21238. }
  21239. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  21240. break
  21241. }
  21242. ptr += uintptr(2)
  21243. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21244. return -int32(1)
  21245. }
  21246. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  21247. ptr -= uintptr(2)
  21248. break
  21249. }
  21250. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21251. return int32(m_XML_TOK_CDATA_SECT_CLOSE)
  21252. case int32(_BT_CR):
  21253. ptr += uintptr(2)
  21254. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21255. return -int32(1)
  21256. }
  21257. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21258. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21259. } else {
  21260. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21261. }
  21262. if v2 == int32(_BT_LF) {
  21263. ptr += uintptr(2)
  21264. }
  21265. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21266. return int32(m_XML_TOK_DATA_NEWLINE)
  21267. case int32(_BT_LF):
  21268. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21269. return int32(m_XML_TOK_DATA_NEWLINE)
  21270. case int32(_BT_LEAD2):
  21271. if int64(end)-int64(ptr) < int64(2) {
  21272. return -int32(2)
  21273. }
  21274. if 0 != 0 {
  21275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21276. return m_XML_TOK_INVALID
  21277. }
  21278. ptr += uintptr(2)
  21279. case int32(_BT_LEAD3):
  21280. if int64(end)-int64(ptr) < int64(3) {
  21281. return -int32(2)
  21282. }
  21283. if 0 != 0 {
  21284. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21285. return m_XML_TOK_INVALID
  21286. }
  21287. ptr += uintptr(3)
  21288. case int32(_BT_LEAD4):
  21289. if int64(end)-int64(ptr) < int64(4) {
  21290. return -int32(2)
  21291. }
  21292. if 0 != 0 {
  21293. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21294. return m_XML_TOK_INVALID
  21295. }
  21296. ptr += uintptr(4)
  21297. case int32(_BT_NONXML):
  21298. fallthrough
  21299. case int32(_BT_MALFORM):
  21300. fallthrough
  21301. case int32(_BT_TRAIL):
  21302. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21303. return m_XML_TOK_INVALID
  21304. default:
  21305. ptr += uintptr(2)
  21306. break
  21307. }
  21308. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21309. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21310. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21311. } else {
  21312. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21313. }
  21314. switch v3 {
  21315. case int32(_BT_LEAD2):
  21316. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  21317. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21318. return int32(m_XML_TOK_DATA_CHARS)
  21319. }
  21320. ptr += uintptr(2)
  21321. case int32(_BT_LEAD3):
  21322. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  21323. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21324. return int32(m_XML_TOK_DATA_CHARS)
  21325. }
  21326. ptr += uintptr(3)
  21327. case int32(_BT_LEAD4):
  21328. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  21329. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21330. return int32(m_XML_TOK_DATA_CHARS)
  21331. }
  21332. ptr += uintptr(4)
  21333. case int32(_BT_NONXML):
  21334. fallthrough
  21335. case int32(_BT_MALFORM):
  21336. fallthrough
  21337. case int32(_BT_TRAIL):
  21338. fallthrough
  21339. case int32(_BT_CR):
  21340. fallthrough
  21341. case int32(_BT_LF):
  21342. fallthrough
  21343. case int32(_BT_RSQB):
  21344. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21345. return int32(m_XML_TOK_DATA_CHARS)
  21346. default:
  21347. ptr += uintptr(2)
  21348. break
  21349. }
  21350. }
  21351. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21352. return int32(m_XML_TOK_DATA_CHARS)
  21353. }
  21354. /* ptr points to character following "</" */
  21355. func _big2_scanEndTag(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21356. var v1, v2, v22 int32
  21357. _, _, _ = v1, v2, v22
  21358. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21359. return -int32(1)
  21360. }
  21361. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21362. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21363. } else {
  21364. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21365. }
  21366. switch v1 {
  21367. case int32(_BT_NONASCII):
  21368. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21369. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21370. return m_XML_TOK_INVALID
  21371. } /* fall through */
  21372. fallthrough
  21373. case int32(_BT_NMSTRT):
  21374. fallthrough
  21375. case int32(_BT_HEX):
  21376. ptr += uintptr(2)
  21377. case int32(_BT_LEAD2):
  21378. if int64(end)-int64(ptr) < int64(2) {
  21379. return -int32(2)
  21380. }
  21381. if !(libc.Int32FromInt32(0) != 0) {
  21382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21383. return m_XML_TOK_INVALID
  21384. }
  21385. ptr += uintptr(2)
  21386. case int32(_BT_LEAD3):
  21387. if int64(end)-int64(ptr) < int64(3) {
  21388. return -int32(2)
  21389. }
  21390. if !(libc.Int32FromInt32(0) != 0) {
  21391. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21392. return m_XML_TOK_INVALID
  21393. }
  21394. ptr += uintptr(3)
  21395. case int32(_BT_LEAD4):
  21396. if int64(end)-int64(ptr) < int64(4) {
  21397. return -int32(2)
  21398. }
  21399. if !(libc.Int32FromInt32(0) != 0) {
  21400. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21401. return m_XML_TOK_INVALID
  21402. }
  21403. ptr += uintptr(4)
  21404. default:
  21405. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21406. return m_XML_TOK_INVALID
  21407. }
  21408. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21409. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21410. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21411. } else {
  21412. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21413. }
  21414. switch v2 {
  21415. case int32(_BT_NONASCII):
  21416. goto _3
  21417. case int32(_BT_MINUS):
  21418. goto _4
  21419. case int32(_BT_NAME):
  21420. goto _5
  21421. case int32(_BT_DIGIT):
  21422. goto _6
  21423. case int32(_BT_HEX):
  21424. goto _7
  21425. case int32(_BT_NMSTRT):
  21426. goto _8
  21427. case int32(_BT_LEAD2):
  21428. goto _9
  21429. case int32(_BT_LEAD3):
  21430. goto _10
  21431. case int32(_BT_LEAD4):
  21432. goto _11
  21433. case int32(_BT_LF):
  21434. goto _12
  21435. case int32(_BT_CR):
  21436. goto _13
  21437. case int32(_BT_S):
  21438. goto _14
  21439. case int32(_BT_COLON):
  21440. goto _15
  21441. case int32(_BT_GT):
  21442. goto _16
  21443. default:
  21444. goto _17
  21445. }
  21446. goto _18
  21447. _3:
  21448. ;
  21449. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21450. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21451. return m_XML_TOK_INVALID
  21452. } /* fall through */
  21453. _8:
  21454. ;
  21455. _7:
  21456. ;
  21457. _6:
  21458. ;
  21459. _5:
  21460. ;
  21461. _4:
  21462. ;
  21463. ptr += uintptr(2)
  21464. goto _18
  21465. _9:
  21466. ;
  21467. if int64(end)-int64(ptr) < int64(2) {
  21468. return -int32(2)
  21469. }
  21470. if !(libc.Int32FromInt32(0) != 0) {
  21471. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21472. return m_XML_TOK_INVALID
  21473. }
  21474. ptr += uintptr(2)
  21475. goto _18
  21476. _10:
  21477. ;
  21478. if int64(end)-int64(ptr) < int64(3) {
  21479. return -int32(2)
  21480. }
  21481. if !(libc.Int32FromInt32(0) != 0) {
  21482. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21483. return m_XML_TOK_INVALID
  21484. }
  21485. ptr += uintptr(3)
  21486. goto _18
  21487. _11:
  21488. ;
  21489. if int64(end)-int64(ptr) < int64(4) {
  21490. return -int32(2)
  21491. }
  21492. if !(libc.Int32FromInt32(0) != 0) {
  21493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21494. return m_XML_TOK_INVALID
  21495. }
  21496. ptr += uintptr(4)
  21497. goto _18
  21498. _14:
  21499. ;
  21500. _13:
  21501. ;
  21502. _12:
  21503. ;
  21504. ptr += uintptr(2)
  21505. _21:
  21506. ;
  21507. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21508. goto _19
  21509. }
  21510. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21511. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21512. } else {
  21513. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21514. }
  21515. switch v22 {
  21516. case int32(_BT_S):
  21517. fallthrough
  21518. case int32(_BT_CR):
  21519. fallthrough
  21520. case int32(_BT_LF):
  21521. case int32(_BT_GT):
  21522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21523. return int32(m_XML_TOK_END_TAG)
  21524. default:
  21525. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21526. return m_XML_TOK_INVALID
  21527. }
  21528. goto _20
  21529. _20:
  21530. ;
  21531. ptr += uintptr(2)
  21532. goto _21
  21533. goto _19
  21534. _19:
  21535. ;
  21536. return -int32(1)
  21537. _15:
  21538. ;
  21539. /* no need to check qname syntax here,
  21540. since end-tag must match exactly */
  21541. ptr += uintptr(2)
  21542. goto _18
  21543. _16:
  21544. ;
  21545. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21546. return int32(m_XML_TOK_END_TAG)
  21547. _17:
  21548. ;
  21549. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21550. return m_XML_TOK_INVALID
  21551. _18:
  21552. }
  21553. return -int32(1)
  21554. }
  21555. /* ptr points to character following "&#X" */
  21556. func _big2_scanHexCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21557. var v1, v3 int32
  21558. _, _ = v1, v3
  21559. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21560. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21561. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21562. } else {
  21563. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21564. }
  21565. switch v1 {
  21566. case int32(_BT_DIGIT):
  21567. fallthrough
  21568. case int32(_BT_HEX):
  21569. default:
  21570. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21571. return m_XML_TOK_INVALID
  21572. }
  21573. ptr += uintptr(2)
  21574. for {
  21575. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21576. break
  21577. }
  21578. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21579. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21580. } else {
  21581. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21582. }
  21583. switch v3 {
  21584. case int32(_BT_DIGIT):
  21585. fallthrough
  21586. case int32(_BT_HEX):
  21587. case int32(_BT_SEMI):
  21588. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21589. return int32(m_XML_TOK_CHAR_REF)
  21590. default:
  21591. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21592. return m_XML_TOK_INVALID
  21593. }
  21594. goto _2
  21595. _2:
  21596. ;
  21597. ptr += uintptr(2)
  21598. }
  21599. }
  21600. return -int32(1)
  21601. }
  21602. /* ptr points to character following "&#" */
  21603. func _big2_scanCharRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21604. var v1, v3 int32
  21605. _, _ = v1, v3
  21606. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21607. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x) {
  21608. return _big2_scanHexCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21609. }
  21610. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21611. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21612. } else {
  21613. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21614. }
  21615. switch v1 {
  21616. case int32(_BT_DIGIT):
  21617. default:
  21618. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21619. return m_XML_TOK_INVALID
  21620. }
  21621. ptr += uintptr(2)
  21622. for {
  21623. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21624. break
  21625. }
  21626. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21627. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21628. } else {
  21629. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21630. }
  21631. switch v3 {
  21632. case int32(_BT_DIGIT):
  21633. case int32(_BT_SEMI):
  21634. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21635. return int32(m_XML_TOK_CHAR_REF)
  21636. default:
  21637. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21638. return m_XML_TOK_INVALID
  21639. }
  21640. goto _2
  21641. _2:
  21642. ;
  21643. ptr += uintptr(2)
  21644. }
  21645. }
  21646. return -int32(1)
  21647. }
  21648. /* ptr points to character following "&" */
  21649. func _big2_scanRef(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21650. var v1, v2 int32
  21651. _, _ = v1, v2
  21652. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21653. return -int32(1)
  21654. }
  21655. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21656. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21657. } else {
  21658. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21659. }
  21660. switch v1 {
  21661. case int32(_BT_NONASCII):
  21662. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21663. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21664. return m_XML_TOK_INVALID
  21665. } /* fall through */
  21666. fallthrough
  21667. case int32(_BT_NMSTRT):
  21668. fallthrough
  21669. case int32(_BT_HEX):
  21670. ptr += uintptr(2)
  21671. case int32(_BT_LEAD2):
  21672. if int64(end)-int64(ptr) < int64(2) {
  21673. return -int32(2)
  21674. }
  21675. if !(libc.Int32FromInt32(0) != 0) {
  21676. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21677. return m_XML_TOK_INVALID
  21678. }
  21679. ptr += uintptr(2)
  21680. case int32(_BT_LEAD3):
  21681. if int64(end)-int64(ptr) < int64(3) {
  21682. return -int32(2)
  21683. }
  21684. if !(libc.Int32FromInt32(0) != 0) {
  21685. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21686. return m_XML_TOK_INVALID
  21687. }
  21688. ptr += uintptr(3)
  21689. case int32(_BT_LEAD4):
  21690. if int64(end)-int64(ptr) < int64(4) {
  21691. return -int32(2)
  21692. }
  21693. if !(libc.Int32FromInt32(0) != 0) {
  21694. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21695. return m_XML_TOK_INVALID
  21696. }
  21697. ptr += uintptr(4)
  21698. case int32(_BT_NUM):
  21699. return _big2_scanCharRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  21700. default:
  21701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21702. return m_XML_TOK_INVALID
  21703. }
  21704. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21705. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  21706. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  21707. } else {
  21708. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  21709. }
  21710. switch v2 {
  21711. case int32(_BT_NONASCII):
  21712. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21713. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21714. return m_XML_TOK_INVALID
  21715. } /* fall through */
  21716. fallthrough
  21717. case int32(_BT_NMSTRT):
  21718. fallthrough
  21719. case int32(_BT_HEX):
  21720. fallthrough
  21721. case int32(_BT_DIGIT):
  21722. fallthrough
  21723. case int32(_BT_NAME):
  21724. fallthrough
  21725. case int32(_BT_MINUS):
  21726. ptr += uintptr(2)
  21727. case int32(_BT_LEAD2):
  21728. if int64(end)-int64(ptr) < int64(2) {
  21729. return -int32(2)
  21730. }
  21731. if !(libc.Int32FromInt32(0) != 0) {
  21732. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21733. return m_XML_TOK_INVALID
  21734. }
  21735. ptr += uintptr(2)
  21736. case int32(_BT_LEAD3):
  21737. if int64(end)-int64(ptr) < int64(3) {
  21738. return -int32(2)
  21739. }
  21740. if !(libc.Int32FromInt32(0) != 0) {
  21741. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21742. return m_XML_TOK_INVALID
  21743. }
  21744. ptr += uintptr(3)
  21745. case int32(_BT_LEAD4):
  21746. if int64(end)-int64(ptr) < int64(4) {
  21747. return -int32(2)
  21748. }
  21749. if !(libc.Int32FromInt32(0) != 0) {
  21750. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21751. return m_XML_TOK_INVALID
  21752. }
  21753. ptr += uintptr(4)
  21754. case int32(_BT_SEMI):
  21755. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  21756. return int32(m_XML_TOK_ENTITY_REF)
  21757. default:
  21758. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  21759. return m_XML_TOK_INVALID
  21760. }
  21761. }
  21762. return -int32(1)
  21763. }
  21764. /* ptr points to character following first character of attribute name */
  21765. func _big2_scanAtts(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  21766. bp := tls.Alloc(16)
  21767. defer tls.Free(16)
  21768. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  21769. var hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31 int32
  21770. _, _, _, _, _, _, _, _, _, _, _, _ = hadColon, open, t, t1, tok, v1, v18, v22, v24, v26, v27, v31
  21771. hadColon = 0
  21772. for int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  21773. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21774. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21775. } else {
  21776. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21777. }
  21778. switch v1 {
  21779. case int32(_BT_NONASCII):
  21780. goto _2
  21781. case int32(_BT_MINUS):
  21782. goto _3
  21783. case int32(_BT_NAME):
  21784. goto _4
  21785. case int32(_BT_DIGIT):
  21786. goto _5
  21787. case int32(_BT_HEX):
  21788. goto _6
  21789. case int32(_BT_NMSTRT):
  21790. goto _7
  21791. case int32(_BT_LEAD2):
  21792. goto _8
  21793. case int32(_BT_LEAD3):
  21794. goto _9
  21795. case int32(_BT_LEAD4):
  21796. goto _10
  21797. case int32(_BT_COLON):
  21798. goto _11
  21799. case int32(_BT_LF):
  21800. goto _12
  21801. case int32(_BT_CR):
  21802. goto _13
  21803. case int32(_BT_S):
  21804. goto _14
  21805. case int32(_BT_EQUALS):
  21806. goto _15
  21807. default:
  21808. goto _16
  21809. }
  21810. goto _17
  21811. _2:
  21812. ;
  21813. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21814. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21815. return m_XML_TOK_INVALID
  21816. } /* fall through */
  21817. _7:
  21818. ;
  21819. _6:
  21820. ;
  21821. _5:
  21822. ;
  21823. _4:
  21824. ;
  21825. _3:
  21826. ;
  21827. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21828. goto _17
  21829. _8:
  21830. ;
  21831. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21832. return -int32(2)
  21833. }
  21834. if !(libc.Int32FromInt32(0) != 0) {
  21835. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21836. return m_XML_TOK_INVALID
  21837. }
  21838. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21839. goto _17
  21840. _9:
  21841. ;
  21842. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21843. return -int32(2)
  21844. }
  21845. if !(libc.Int32FromInt32(0) != 0) {
  21846. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21847. return m_XML_TOK_INVALID
  21848. }
  21849. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21850. goto _17
  21851. _10:
  21852. ;
  21853. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21854. return -int32(2)
  21855. }
  21856. if !(libc.Int32FromInt32(0) != 0) {
  21857. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21858. return m_XML_TOK_INVALID
  21859. }
  21860. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21861. goto _17
  21862. _11:
  21863. ;
  21864. if hadColon != 0 {
  21865. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21866. return m_XML_TOK_INVALID
  21867. }
  21868. hadColon = int32(1)
  21869. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21870. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21871. return -int32(1)
  21872. }
  21873. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21874. v18 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21875. } else {
  21876. v18 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21877. }
  21878. switch v18 {
  21879. case int32(_BT_NONASCII):
  21880. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  21881. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21882. return m_XML_TOK_INVALID
  21883. } /* fall through */
  21884. fallthrough
  21885. case int32(_BT_NMSTRT):
  21886. fallthrough
  21887. case int32(_BT_HEX):
  21888. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21889. case int32(_BT_LEAD2):
  21890. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  21891. return -int32(2)
  21892. }
  21893. if !(libc.Int32FromInt32(0) != 0) {
  21894. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21895. return m_XML_TOK_INVALID
  21896. }
  21897. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21898. case int32(_BT_LEAD3):
  21899. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  21900. return -int32(2)
  21901. }
  21902. if !(libc.Int32FromInt32(0) != 0) {
  21903. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21904. return m_XML_TOK_INVALID
  21905. }
  21906. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  21907. case int32(_BT_LEAD4):
  21908. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  21909. return -int32(2)
  21910. }
  21911. if !(libc.Int32FromInt32(0) != 0) {
  21912. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21913. return m_XML_TOK_INVALID
  21914. }
  21915. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  21916. default:
  21917. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21918. return m_XML_TOK_INVALID
  21919. }
  21920. goto _17
  21921. _14:
  21922. ;
  21923. _13:
  21924. ;
  21925. _12:
  21926. ;
  21927. _21:
  21928. ;
  21929. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21930. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21931. return -int32(1)
  21932. }
  21933. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21934. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21935. } else {
  21936. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21937. }
  21938. t = v22
  21939. if t == int32(_BT_EQUALS) {
  21940. goto _19
  21941. }
  21942. switch t {
  21943. case int32(_BT_S):
  21944. fallthrough
  21945. case int32(_BT_LF):
  21946. fallthrough
  21947. case int32(_BT_CR):
  21948. default:
  21949. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21950. return m_XML_TOK_INVALID
  21951. }
  21952. goto _20
  21953. _20:
  21954. ;
  21955. goto _21
  21956. goto _19
  21957. _19:
  21958. ;
  21959. /* fall through */
  21960. _15:
  21961. ;
  21962. hadColon = 0
  21963. for {
  21964. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21965. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21966. return -int32(1)
  21967. }
  21968. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21969. v24 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21970. } else {
  21971. v24 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  21972. }
  21973. open = v24
  21974. if open == int32(_BT_QUOT) || open == int32(_BT_APOS) {
  21975. break
  21976. }
  21977. switch open {
  21978. case int32(_BT_S):
  21979. fallthrough
  21980. case int32(_BT_LF):
  21981. fallthrough
  21982. case int32(_BT_CR):
  21983. default:
  21984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  21985. return m_XML_TOK_INVALID
  21986. }
  21987. goto _23
  21988. _23:
  21989. }
  21990. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  21991. /* in attribute value */
  21992. for {
  21993. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  21994. return -int32(1)
  21995. }
  21996. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  21997. v26 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  21998. } else {
  21999. v26 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  22000. }
  22001. t1 = v26
  22002. if t1 == open {
  22003. break
  22004. }
  22005. switch t1 {
  22006. case int32(_BT_LEAD2):
  22007. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  22008. return -int32(2)
  22009. }
  22010. if 0 != 0 {
  22011. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22012. return m_XML_TOK_INVALID
  22013. }
  22014. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22015. case int32(_BT_LEAD3):
  22016. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  22017. return -int32(2)
  22018. }
  22019. if 0 != 0 {
  22020. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22021. return m_XML_TOK_INVALID
  22022. }
  22023. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  22024. case int32(_BT_LEAD4):
  22025. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  22026. return -int32(2)
  22027. }
  22028. if 0 != 0 {
  22029. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22030. return m_XML_TOK_INVALID
  22031. }
  22032. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  22033. case int32(_BT_NONXML):
  22034. fallthrough
  22035. case int32(_BT_MALFORM):
  22036. fallthrough
  22037. case int32(_BT_TRAIL):
  22038. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22039. return m_XML_TOK_INVALID
  22040. case int32(_BT_AMP):
  22041. tok = _big2_scanRef(tls, enc, *(*uintptr)(unsafe.Pointer(bp))+uintptr(2), end, bp)
  22042. if tok <= 0 {
  22043. if tok == m_XML_TOK_INVALID {
  22044. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22045. }
  22046. return tok
  22047. }
  22048. case int32(_BT_LT):
  22049. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22050. return m_XML_TOK_INVALID
  22051. default:
  22052. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22053. break
  22054. }
  22055. goto _25
  22056. _25:
  22057. }
  22058. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22059. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22060. return -int32(1)
  22061. }
  22062. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  22063. v27 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  22064. } else {
  22065. v27 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  22066. }
  22067. switch v27 {
  22068. case int32(_BT_S):
  22069. fallthrough
  22070. case int32(_BT_CR):
  22071. fallthrough
  22072. case int32(_BT_LF):
  22073. case int32(_BT_SOL):
  22074. goto sol
  22075. case int32(_BT_GT):
  22076. goto gt
  22077. default:
  22078. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22079. return m_XML_TOK_INVALID
  22080. }
  22081. /* ptr points to closing quote */
  22082. _30:
  22083. ;
  22084. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22085. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22086. return -int32(1)
  22087. }
  22088. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 {
  22089. v31 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))))))
  22090. } else {
  22091. v31 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)))), *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))
  22092. }
  22093. switch v31 {
  22094. case int32(_BT_NONASCII):
  22095. goto _32
  22096. case int32(_BT_HEX):
  22097. goto _33
  22098. case int32(_BT_NMSTRT):
  22099. goto _34
  22100. case int32(_BT_LEAD2):
  22101. goto _35
  22102. case int32(_BT_LEAD3):
  22103. goto _36
  22104. case int32(_BT_LEAD4):
  22105. goto _37
  22106. case int32(_BT_LF):
  22107. goto _38
  22108. case int32(_BT_CR):
  22109. goto _39
  22110. case int32(_BT_S):
  22111. goto _40
  22112. case int32(_BT_GT):
  22113. goto _41
  22114. case int32(_BT_SOL):
  22115. goto _42
  22116. default:
  22117. goto _43
  22118. }
  22119. goto _44
  22120. _32:
  22121. ;
  22122. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22123. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22124. return m_XML_TOK_INVALID
  22125. } /* fall through */
  22126. _34:
  22127. ;
  22128. _33:
  22129. ;
  22130. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22131. goto _44
  22132. _35:
  22133. ;
  22134. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(2) {
  22135. return -int32(2)
  22136. }
  22137. if !(libc.Int32FromInt32(0) != 0) {
  22138. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22139. return m_XML_TOK_INVALID
  22140. }
  22141. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22142. goto _44
  22143. _36:
  22144. ;
  22145. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(3) {
  22146. return -int32(2)
  22147. }
  22148. if !(libc.Int32FromInt32(0) != 0) {
  22149. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22150. return m_XML_TOK_INVALID
  22151. }
  22152. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(3)
  22153. goto _44
  22154. _37:
  22155. ;
  22156. if int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) < int64(4) {
  22157. return -int32(2)
  22158. }
  22159. if !(libc.Int32FromInt32(0) != 0) {
  22160. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22161. return m_XML_TOK_INVALID
  22162. }
  22163. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(4)
  22164. goto _44
  22165. _40:
  22166. ;
  22167. _39:
  22168. ;
  22169. _38:
  22170. ;
  22171. goto _29
  22172. _41:
  22173. ;
  22174. goto gt
  22175. gt:
  22176. ;
  22177. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  22178. return int32(m_XML_TOK_START_TAG_WITH_ATTS)
  22179. _42:
  22180. ;
  22181. goto sol
  22182. sol:
  22183. ;
  22184. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(2)
  22185. if !(int64(end)-int64(*(*uintptr)(unsafe.Pointer(bp))) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22186. return -int32(1)
  22187. }
  22188. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp)) + 1))) == int32(m_ASCII_GT1)) {
  22189. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22190. return m_XML_TOK_INVALID
  22191. }
  22192. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp)) + uintptr(2)
  22193. return int32(m_XML_TOK_EMPTY_ELEMENT_WITH_ATTS)
  22194. _43:
  22195. ;
  22196. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22197. return m_XML_TOK_INVALID
  22198. _44:
  22199. ;
  22200. goto _28
  22201. goto _29
  22202. _29:
  22203. ;
  22204. goto _30
  22205. goto _28
  22206. _28:
  22207. ;
  22208. goto _17
  22209. _16:
  22210. ;
  22211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  22212. return m_XML_TOK_INVALID
  22213. _17:
  22214. }
  22215. return -int32(1)
  22216. }
  22217. /* ptr points to character following "<" */
  22218. func _big2_scanLt(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22219. var hadColon, v1, v2, v21, v22, v3 int32
  22220. _, _, _, _, _, _ = hadColon, v1, v2, v21, v22, v3
  22221. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22222. return -int32(1)
  22223. }
  22224. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22225. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22226. } else {
  22227. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22228. }
  22229. switch v1 {
  22230. case int32(_BT_NONASCII):
  22231. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22232. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22233. return m_XML_TOK_INVALID
  22234. } /* fall through */
  22235. fallthrough
  22236. case int32(_BT_NMSTRT):
  22237. fallthrough
  22238. case int32(_BT_HEX):
  22239. ptr += uintptr(2)
  22240. case int32(_BT_LEAD2):
  22241. if int64(end)-int64(ptr) < int64(2) {
  22242. return -int32(2)
  22243. }
  22244. if !(libc.Int32FromInt32(0) != 0) {
  22245. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22246. return m_XML_TOK_INVALID
  22247. }
  22248. ptr += uintptr(2)
  22249. case int32(_BT_LEAD3):
  22250. if int64(end)-int64(ptr) < int64(3) {
  22251. return -int32(2)
  22252. }
  22253. if !(libc.Int32FromInt32(0) != 0) {
  22254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22255. return m_XML_TOK_INVALID
  22256. }
  22257. ptr += uintptr(3)
  22258. case int32(_BT_LEAD4):
  22259. if int64(end)-int64(ptr) < int64(4) {
  22260. return -int32(2)
  22261. }
  22262. if !(libc.Int32FromInt32(0) != 0) {
  22263. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22264. return m_XML_TOK_INVALID
  22265. }
  22266. ptr += uintptr(4)
  22267. case int32(_BT_EXCL):
  22268. ptr += uintptr(2)
  22269. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22270. return -int32(1)
  22271. }
  22272. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22273. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22274. } else {
  22275. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22276. }
  22277. switch v2 {
  22278. case int32(_BT_MINUS):
  22279. return _big2_scanComment(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22280. case int32(_BT_LSQB):
  22281. return _big2_scanCdataSection(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22282. }
  22283. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22284. return m_XML_TOK_INVALID
  22285. case int32(_BT_QUEST):
  22286. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22287. case int32(_BT_SOL):
  22288. return _big2_scanEndTag(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22289. default:
  22290. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22291. return m_XML_TOK_INVALID
  22292. }
  22293. hadColon = 0
  22294. /* we have a start-tag */
  22295. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22296. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22297. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22298. } else {
  22299. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22300. }
  22301. switch v3 {
  22302. case int32(_BT_NONASCII):
  22303. goto _4
  22304. case int32(_BT_MINUS):
  22305. goto _5
  22306. case int32(_BT_NAME):
  22307. goto _6
  22308. case int32(_BT_DIGIT):
  22309. goto _7
  22310. case int32(_BT_HEX):
  22311. goto _8
  22312. case int32(_BT_NMSTRT):
  22313. goto _9
  22314. case int32(_BT_LEAD2):
  22315. goto _10
  22316. case int32(_BT_LEAD3):
  22317. goto _11
  22318. case int32(_BT_LEAD4):
  22319. goto _12
  22320. case int32(_BT_COLON):
  22321. goto _13
  22322. case int32(_BT_LF):
  22323. goto _14
  22324. case int32(_BT_CR):
  22325. goto _15
  22326. case int32(_BT_S):
  22327. goto _16
  22328. case int32(_BT_GT):
  22329. goto _17
  22330. case int32(_BT_SOL):
  22331. goto _18
  22332. default:
  22333. goto _19
  22334. }
  22335. goto _20
  22336. _4:
  22337. ;
  22338. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22339. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22340. return m_XML_TOK_INVALID
  22341. } /* fall through */
  22342. _9:
  22343. ;
  22344. _8:
  22345. ;
  22346. _7:
  22347. ;
  22348. _6:
  22349. ;
  22350. _5:
  22351. ;
  22352. ptr += uintptr(2)
  22353. goto _20
  22354. _10:
  22355. ;
  22356. if int64(end)-int64(ptr) < int64(2) {
  22357. return -int32(2)
  22358. }
  22359. if !(libc.Int32FromInt32(0) != 0) {
  22360. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22361. return m_XML_TOK_INVALID
  22362. }
  22363. ptr += uintptr(2)
  22364. goto _20
  22365. _11:
  22366. ;
  22367. if int64(end)-int64(ptr) < int64(3) {
  22368. return -int32(2)
  22369. }
  22370. if !(libc.Int32FromInt32(0) != 0) {
  22371. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22372. return m_XML_TOK_INVALID
  22373. }
  22374. ptr += uintptr(3)
  22375. goto _20
  22376. _12:
  22377. ;
  22378. if int64(end)-int64(ptr) < int64(4) {
  22379. return -int32(2)
  22380. }
  22381. if !(libc.Int32FromInt32(0) != 0) {
  22382. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22383. return m_XML_TOK_INVALID
  22384. }
  22385. ptr += uintptr(4)
  22386. goto _20
  22387. _13:
  22388. ;
  22389. if hadColon != 0 {
  22390. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22391. return m_XML_TOK_INVALID
  22392. }
  22393. hadColon = int32(1)
  22394. ptr += uintptr(2)
  22395. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22396. return -int32(1)
  22397. }
  22398. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22399. v21 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22400. } else {
  22401. v21 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22402. }
  22403. switch v21 {
  22404. case int32(_BT_NONASCII):
  22405. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22406. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22407. return m_XML_TOK_INVALID
  22408. } /* fall through */
  22409. fallthrough
  22410. case int32(_BT_NMSTRT):
  22411. fallthrough
  22412. case int32(_BT_HEX):
  22413. ptr += uintptr(2)
  22414. case int32(_BT_LEAD2):
  22415. if int64(end)-int64(ptr) < int64(2) {
  22416. return -int32(2)
  22417. }
  22418. if !(libc.Int32FromInt32(0) != 0) {
  22419. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22420. return m_XML_TOK_INVALID
  22421. }
  22422. ptr += uintptr(2)
  22423. case int32(_BT_LEAD3):
  22424. if int64(end)-int64(ptr) < int64(3) {
  22425. return -int32(2)
  22426. }
  22427. if !(libc.Int32FromInt32(0) != 0) {
  22428. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22429. return m_XML_TOK_INVALID
  22430. }
  22431. ptr += uintptr(3)
  22432. case int32(_BT_LEAD4):
  22433. if int64(end)-int64(ptr) < int64(4) {
  22434. return -int32(2)
  22435. }
  22436. if !(libc.Int32FromInt32(0) != 0) {
  22437. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22438. return m_XML_TOK_INVALID
  22439. }
  22440. ptr += uintptr(4)
  22441. default:
  22442. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22443. return m_XML_TOK_INVALID
  22444. }
  22445. goto _20
  22446. _16:
  22447. ;
  22448. _15:
  22449. ;
  22450. _14:
  22451. ;
  22452. ptr += uintptr(2)
  22453. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22454. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22455. v22 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22456. } else {
  22457. v22 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22458. }
  22459. switch v22 {
  22460. case int32(_BT_NONASCII):
  22461. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22462. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22463. return m_XML_TOK_INVALID
  22464. } /* fall through */
  22465. fallthrough
  22466. case int32(_BT_NMSTRT):
  22467. fallthrough
  22468. case int32(_BT_HEX):
  22469. ptr += uintptr(2)
  22470. case int32(_BT_LEAD2):
  22471. if int64(end)-int64(ptr) < int64(2) {
  22472. return -int32(2)
  22473. }
  22474. if !(libc.Int32FromInt32(0) != 0) {
  22475. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22476. return m_XML_TOK_INVALID
  22477. }
  22478. ptr += uintptr(2)
  22479. case int32(_BT_LEAD3):
  22480. if int64(end)-int64(ptr) < int64(3) {
  22481. return -int32(2)
  22482. }
  22483. if !(libc.Int32FromInt32(0) != 0) {
  22484. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22485. return m_XML_TOK_INVALID
  22486. }
  22487. ptr += uintptr(3)
  22488. case int32(_BT_LEAD4):
  22489. if int64(end)-int64(ptr) < int64(4) {
  22490. return -int32(2)
  22491. }
  22492. if !(libc.Int32FromInt32(0) != 0) {
  22493. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22494. return m_XML_TOK_INVALID
  22495. }
  22496. ptr += uintptr(4)
  22497. case int32(_BT_GT):
  22498. goto gt
  22499. case int32(_BT_SOL):
  22500. goto sol
  22501. case int32(_BT_S):
  22502. fallthrough
  22503. case int32(_BT_CR):
  22504. fallthrough
  22505. case int32(_BT_LF):
  22506. ptr += uintptr(2)
  22507. continue
  22508. default:
  22509. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22510. return m_XML_TOK_INVALID
  22511. }
  22512. return _big2_scanAtts(tls, enc, ptr, end, nextTokPtr)
  22513. }
  22514. return -int32(1)
  22515. _17:
  22516. ;
  22517. goto gt
  22518. gt:
  22519. ;
  22520. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22521. return int32(m_XML_TOK_START_TAG_NO_ATTS)
  22522. _18:
  22523. ;
  22524. goto sol
  22525. sol:
  22526. ;
  22527. ptr += uintptr(2)
  22528. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22529. return -int32(1)
  22530. }
  22531. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  22532. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22533. return m_XML_TOK_INVALID
  22534. }
  22535. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22536. return int32(m_XML_TOK_EMPTY_ELEMENT_NO_ATTS)
  22537. _19:
  22538. ;
  22539. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22540. return m_XML_TOK_INVALID
  22541. _20:
  22542. }
  22543. return -int32(1)
  22544. }
  22545. func _big2_contentTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22546. var n Tsize_t
  22547. var v1, v2, v3 int32
  22548. _, _, _, _ = n, v1, v2, v3
  22549. if ptr >= end {
  22550. return -int32(4)
  22551. }
  22552. if int32(2) > int32(1) {
  22553. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  22554. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  22555. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  22556. if n == uint64(0) {
  22557. return -int32(1)
  22558. }
  22559. end = ptr + uintptr(n)
  22560. }
  22561. }
  22562. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22563. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22564. } else {
  22565. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22566. }
  22567. switch v1 {
  22568. case int32(_BT_LT):
  22569. return _big2_scanLt(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22570. case int32(_BT_AMP):
  22571. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  22572. case int32(_BT_CR):
  22573. ptr += uintptr(2)
  22574. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22575. return -int32(3)
  22576. }
  22577. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22578. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22579. } else {
  22580. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22581. }
  22582. if v2 == int32(_BT_LF) {
  22583. ptr += uintptr(2)
  22584. }
  22585. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22586. return int32(m_XML_TOK_DATA_NEWLINE)
  22587. case int32(_BT_LF):
  22588. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22589. return int32(m_XML_TOK_DATA_NEWLINE)
  22590. case int32(_BT_RSQB):
  22591. ptr += uintptr(2)
  22592. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22593. return -int32(5)
  22594. }
  22595. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1)) {
  22596. break
  22597. }
  22598. ptr += uintptr(2)
  22599. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22600. return -int32(5)
  22601. }
  22602. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1)) {
  22603. ptr -= uintptr(2)
  22604. break
  22605. }
  22606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22607. return m_XML_TOK_INVALID
  22608. case int32(_BT_LEAD2):
  22609. if int64(end)-int64(ptr) < int64(2) {
  22610. return -int32(2)
  22611. }
  22612. if 0 != 0 {
  22613. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22614. return m_XML_TOK_INVALID
  22615. }
  22616. ptr += uintptr(2)
  22617. case int32(_BT_LEAD3):
  22618. if int64(end)-int64(ptr) < int64(3) {
  22619. return -int32(2)
  22620. }
  22621. if 0 != 0 {
  22622. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22623. return m_XML_TOK_INVALID
  22624. }
  22625. ptr += uintptr(3)
  22626. case int32(_BT_LEAD4):
  22627. if int64(end)-int64(ptr) < int64(4) {
  22628. return -int32(2)
  22629. }
  22630. if 0 != 0 {
  22631. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22632. return m_XML_TOK_INVALID
  22633. }
  22634. ptr += uintptr(4)
  22635. case int32(_BT_NONXML):
  22636. fallthrough
  22637. case int32(_BT_MALFORM):
  22638. fallthrough
  22639. case int32(_BT_TRAIL):
  22640. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22641. return m_XML_TOK_INVALID
  22642. default:
  22643. ptr += uintptr(2)
  22644. break
  22645. }
  22646. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22647. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22648. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22649. } else {
  22650. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22651. }
  22652. switch v3 {
  22653. case int32(_BT_LEAD2):
  22654. if int64(end)-int64(ptr) < int64(2) || libc.Bool(0 != 0) {
  22655. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22656. return int32(m_XML_TOK_DATA_CHARS)
  22657. }
  22658. ptr += uintptr(2)
  22659. case int32(_BT_LEAD3):
  22660. if int64(end)-int64(ptr) < int64(3) || libc.Bool(0 != 0) {
  22661. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22662. return int32(m_XML_TOK_DATA_CHARS)
  22663. }
  22664. ptr += uintptr(3)
  22665. case int32(_BT_LEAD4):
  22666. if int64(end)-int64(ptr) < int64(4) || libc.Bool(0 != 0) {
  22667. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22668. return int32(m_XML_TOK_DATA_CHARS)
  22669. }
  22670. ptr += uintptr(4)
  22671. case int32(_BT_RSQB):
  22672. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) {
  22673. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_RSQB1)) {
  22674. ptr += uintptr(2)
  22675. break
  22676. }
  22677. if int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(3)*libc.Int32FromInt32(2)) {
  22678. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2)) + 1))) == int32(m_ASCII_GT1)) {
  22679. ptr += uintptr(2)
  22680. break
  22681. }
  22682. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  22683. return m_XML_TOK_INVALID
  22684. }
  22685. }
  22686. /* fall through */
  22687. fallthrough
  22688. case int32(_BT_AMP):
  22689. fallthrough
  22690. case int32(_BT_LT):
  22691. fallthrough
  22692. case int32(_BT_NONXML):
  22693. fallthrough
  22694. case int32(_BT_MALFORM):
  22695. fallthrough
  22696. case int32(_BT_TRAIL):
  22697. fallthrough
  22698. case int32(_BT_CR):
  22699. fallthrough
  22700. case int32(_BT_LF):
  22701. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22702. return int32(m_XML_TOK_DATA_CHARS)
  22703. default:
  22704. ptr += uintptr(2)
  22705. break
  22706. }
  22707. }
  22708. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22709. return int32(m_XML_TOK_DATA_CHARS)
  22710. }
  22711. /* ptr points to character following "%" */
  22712. func _big2_scanPercent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22713. var v1, v2 int32
  22714. _, _ = v1, v2
  22715. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22716. return -int32(1)
  22717. }
  22718. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22719. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22720. } else {
  22721. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22722. }
  22723. switch v1 {
  22724. case int32(_BT_NONASCII):
  22725. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22726. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22727. return m_XML_TOK_INVALID
  22728. } /* fall through */
  22729. fallthrough
  22730. case int32(_BT_NMSTRT):
  22731. fallthrough
  22732. case int32(_BT_HEX):
  22733. ptr += uintptr(2)
  22734. case int32(_BT_LEAD2):
  22735. if int64(end)-int64(ptr) < int64(2) {
  22736. return -int32(2)
  22737. }
  22738. if !(libc.Int32FromInt32(0) != 0) {
  22739. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22740. return m_XML_TOK_INVALID
  22741. }
  22742. ptr += uintptr(2)
  22743. case int32(_BT_LEAD3):
  22744. if int64(end)-int64(ptr) < int64(3) {
  22745. return -int32(2)
  22746. }
  22747. if !(libc.Int32FromInt32(0) != 0) {
  22748. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22749. return m_XML_TOK_INVALID
  22750. }
  22751. ptr += uintptr(3)
  22752. case int32(_BT_LEAD4):
  22753. if int64(end)-int64(ptr) < int64(4) {
  22754. return -int32(2)
  22755. }
  22756. if !(libc.Int32FromInt32(0) != 0) {
  22757. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22758. return m_XML_TOK_INVALID
  22759. }
  22760. ptr += uintptr(4)
  22761. case int32(_BT_S):
  22762. fallthrough
  22763. case int32(_BT_LF):
  22764. fallthrough
  22765. case int32(_BT_CR):
  22766. fallthrough
  22767. case int32(_BT_PERCNT):
  22768. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22769. return int32(m_XML_TOK_PERCENT)
  22770. default:
  22771. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22772. return m_XML_TOK_INVALID
  22773. }
  22774. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22775. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22776. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22777. } else {
  22778. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22779. }
  22780. switch v2 {
  22781. case int32(_BT_NONASCII):
  22782. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22783. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22784. return m_XML_TOK_INVALID
  22785. } /* fall through */
  22786. fallthrough
  22787. case int32(_BT_NMSTRT):
  22788. fallthrough
  22789. case int32(_BT_HEX):
  22790. fallthrough
  22791. case int32(_BT_DIGIT):
  22792. fallthrough
  22793. case int32(_BT_NAME):
  22794. fallthrough
  22795. case int32(_BT_MINUS):
  22796. ptr += uintptr(2)
  22797. case int32(_BT_LEAD2):
  22798. if int64(end)-int64(ptr) < int64(2) {
  22799. return -int32(2)
  22800. }
  22801. if !(libc.Int32FromInt32(0) != 0) {
  22802. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22803. return m_XML_TOK_INVALID
  22804. }
  22805. ptr += uintptr(2)
  22806. case int32(_BT_LEAD3):
  22807. if int64(end)-int64(ptr) < int64(3) {
  22808. return -int32(2)
  22809. }
  22810. if !(libc.Int32FromInt32(0) != 0) {
  22811. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22812. return m_XML_TOK_INVALID
  22813. }
  22814. ptr += uintptr(3)
  22815. case int32(_BT_LEAD4):
  22816. if int64(end)-int64(ptr) < int64(4) {
  22817. return -int32(2)
  22818. }
  22819. if !(libc.Int32FromInt32(0) != 0) {
  22820. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22821. return m_XML_TOK_INVALID
  22822. }
  22823. ptr += uintptr(4)
  22824. case int32(_BT_SEMI):
  22825. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  22826. return int32(m_XML_TOK_PARAM_ENTITY_REF)
  22827. default:
  22828. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22829. return m_XML_TOK_INVALID
  22830. }
  22831. }
  22832. return -int32(1)
  22833. }
  22834. func _big2_scanPoundName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22835. var v1, v2 int32
  22836. _, _ = v1, v2
  22837. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  22838. return -int32(1)
  22839. }
  22840. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22841. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22842. } else {
  22843. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22844. }
  22845. switch v1 {
  22846. case int32(_BT_NONASCII):
  22847. if !(_namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22848. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22849. return m_XML_TOK_INVALID
  22850. } /* fall through */
  22851. fallthrough
  22852. case int32(_BT_NMSTRT):
  22853. fallthrough
  22854. case int32(_BT_HEX):
  22855. ptr += uintptr(2)
  22856. case int32(_BT_LEAD2):
  22857. if int64(end)-int64(ptr) < int64(2) {
  22858. return -int32(2)
  22859. }
  22860. if !(libc.Int32FromInt32(0) != 0) {
  22861. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22862. return m_XML_TOK_INVALID
  22863. }
  22864. ptr += uintptr(2)
  22865. case int32(_BT_LEAD3):
  22866. if int64(end)-int64(ptr) < int64(3) {
  22867. return -int32(2)
  22868. }
  22869. if !(libc.Int32FromInt32(0) != 0) {
  22870. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22871. return m_XML_TOK_INVALID
  22872. }
  22873. ptr += uintptr(3)
  22874. case int32(_BT_LEAD4):
  22875. if int64(end)-int64(ptr) < int64(4) {
  22876. return -int32(2)
  22877. }
  22878. if !(libc.Int32FromInt32(0) != 0) {
  22879. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22880. return m_XML_TOK_INVALID
  22881. }
  22882. ptr += uintptr(4)
  22883. default:
  22884. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22885. return m_XML_TOK_INVALID
  22886. }
  22887. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22888. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22889. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22890. } else {
  22891. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22892. }
  22893. switch v2 {
  22894. case int32(_BT_NONASCII):
  22895. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  22896. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22897. return m_XML_TOK_INVALID
  22898. } /* fall through */
  22899. fallthrough
  22900. case int32(_BT_NMSTRT):
  22901. fallthrough
  22902. case int32(_BT_HEX):
  22903. fallthrough
  22904. case int32(_BT_DIGIT):
  22905. fallthrough
  22906. case int32(_BT_NAME):
  22907. fallthrough
  22908. case int32(_BT_MINUS):
  22909. ptr += uintptr(2)
  22910. case int32(_BT_LEAD2):
  22911. if int64(end)-int64(ptr) < int64(2) {
  22912. return -int32(2)
  22913. }
  22914. if !(libc.Int32FromInt32(0) != 0) {
  22915. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22916. return m_XML_TOK_INVALID
  22917. }
  22918. ptr += uintptr(2)
  22919. case int32(_BT_LEAD3):
  22920. if int64(end)-int64(ptr) < int64(3) {
  22921. return -int32(2)
  22922. }
  22923. if !(libc.Int32FromInt32(0) != 0) {
  22924. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22925. return m_XML_TOK_INVALID
  22926. }
  22927. ptr += uintptr(3)
  22928. case int32(_BT_LEAD4):
  22929. if int64(end)-int64(ptr) < int64(4) {
  22930. return -int32(2)
  22931. }
  22932. if !(libc.Int32FromInt32(0) != 0) {
  22933. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22934. return m_XML_TOK_INVALID
  22935. }
  22936. ptr += uintptr(4)
  22937. case int32(_BT_CR):
  22938. fallthrough
  22939. case int32(_BT_LF):
  22940. fallthrough
  22941. case int32(_BT_S):
  22942. fallthrough
  22943. case int32(_BT_RPAR):
  22944. fallthrough
  22945. case int32(_BT_GT):
  22946. fallthrough
  22947. case int32(_BT_PERCNT):
  22948. fallthrough
  22949. case int32(_BT_VERBAR):
  22950. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22951. return int32(m_XML_TOK_POUND_NAME)
  22952. default:
  22953. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22954. return m_XML_TOK_INVALID
  22955. }
  22956. }
  22957. return -int32(m_XML_TOK_POUND_NAME)
  22958. }
  22959. func _big2_scanLit(tls *libc.TLS, open int32, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  22960. var t, v1, v2 int32
  22961. _, _, _ = t, v1, v2
  22962. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  22963. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  22964. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  22965. } else {
  22966. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  22967. }
  22968. t = v1
  22969. switch t {
  22970. case int32(_BT_LEAD2):
  22971. if int64(end)-int64(ptr) < int64(2) {
  22972. return -int32(2)
  22973. }
  22974. if 0 != 0 {
  22975. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22976. return m_XML_TOK_INVALID
  22977. }
  22978. ptr += uintptr(2)
  22979. case int32(_BT_LEAD3):
  22980. if int64(end)-int64(ptr) < int64(3) {
  22981. return -int32(2)
  22982. }
  22983. if 0 != 0 {
  22984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22985. return m_XML_TOK_INVALID
  22986. }
  22987. ptr += uintptr(3)
  22988. case int32(_BT_LEAD4):
  22989. if int64(end)-int64(ptr) < int64(4) {
  22990. return -int32(2)
  22991. }
  22992. if 0 != 0 {
  22993. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  22994. return m_XML_TOK_INVALID
  22995. }
  22996. ptr += uintptr(4)
  22997. case int32(_BT_NONXML):
  22998. fallthrough
  22999. case int32(_BT_MALFORM):
  23000. fallthrough
  23001. case int32(_BT_TRAIL):
  23002. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23003. return m_XML_TOK_INVALID
  23004. case int32(_BT_QUOT):
  23005. fallthrough
  23006. case int32(_BT_APOS):
  23007. ptr += uintptr(2)
  23008. if t != open {
  23009. break
  23010. }
  23011. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23012. return -int32(m_XML_TOK_LITERAL)
  23013. }
  23014. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23015. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23016. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23017. } else {
  23018. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23019. }
  23020. switch v2 {
  23021. case int32(_BT_S):
  23022. fallthrough
  23023. case int32(_BT_CR):
  23024. fallthrough
  23025. case int32(_BT_LF):
  23026. fallthrough
  23027. case int32(_BT_GT):
  23028. fallthrough
  23029. case int32(_BT_PERCNT):
  23030. fallthrough
  23031. case int32(_BT_LSQB):
  23032. return int32(m_XML_TOK_LITERAL)
  23033. default:
  23034. return m_XML_TOK_INVALID
  23035. }
  23036. fallthrough
  23037. default:
  23038. ptr += uintptr(2)
  23039. break
  23040. }
  23041. }
  23042. return -int32(1)
  23043. }
  23044. func _big2_prologTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23045. var n Tsize_t
  23046. var tok, v1, v29, v33, v34, v35, v36 int32
  23047. _, _, _, _, _, _, _, _ = n, tok, v1, v29, v33, v34, v35, v36
  23048. if ptr >= end {
  23049. return -int32(4)
  23050. }
  23051. if int32(2) > int32(1) {
  23052. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23053. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23054. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23055. if n == uint64(0) {
  23056. return -int32(1)
  23057. }
  23058. end = ptr + uintptr(n)
  23059. }
  23060. }
  23061. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23062. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23063. } else {
  23064. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23065. }
  23066. switch v1 {
  23067. case int32(_BT_QUOT):
  23068. goto _2
  23069. case int32(_BT_APOS):
  23070. goto _3
  23071. case int32(_BT_LT):
  23072. goto _4
  23073. case int32(_BT_CR):
  23074. goto _5
  23075. case int32(_BT_LF):
  23076. goto _6
  23077. case int32(_BT_S):
  23078. goto _7
  23079. case int32(_BT_PERCNT):
  23080. goto _8
  23081. case int32(_BT_COMMA):
  23082. goto _9
  23083. case int32(_BT_LSQB):
  23084. goto _10
  23085. case int32(_BT_RSQB):
  23086. goto _11
  23087. case int32(_BT_LPAR):
  23088. goto _12
  23089. case int32(_BT_RPAR):
  23090. goto _13
  23091. case int32(_BT_VERBAR):
  23092. goto _14
  23093. case int32(_BT_GT):
  23094. goto _15
  23095. case int32(_BT_NUM):
  23096. goto _16
  23097. case int32(_BT_LEAD2):
  23098. goto _17
  23099. case int32(_BT_LEAD3):
  23100. goto _18
  23101. case int32(_BT_LEAD4):
  23102. goto _19
  23103. case int32(_BT_HEX):
  23104. goto _20
  23105. case int32(_BT_NMSTRT):
  23106. goto _21
  23107. case int32(_BT_COLON):
  23108. goto _22
  23109. case int32(_BT_MINUS):
  23110. goto _23
  23111. case int32(_BT_NAME):
  23112. goto _24
  23113. case int32(_BT_DIGIT):
  23114. goto _25
  23115. case int32(_BT_NONASCII):
  23116. goto _26
  23117. default:
  23118. goto _27
  23119. }
  23120. goto _28
  23121. _2:
  23122. ;
  23123. return _big2_scanLit(tls, int32(_BT_QUOT), enc, ptr+uintptr(2), end, nextTokPtr)
  23124. _3:
  23125. ;
  23126. return _big2_scanLit(tls, int32(_BT_APOS), enc, ptr+uintptr(2), end, nextTokPtr)
  23127. _4:
  23128. ;
  23129. ptr += uintptr(2)
  23130. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23131. return -int32(1)
  23132. }
  23133. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23134. v29 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23135. } else {
  23136. v29 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23137. }
  23138. switch v29 {
  23139. case int32(_BT_EXCL):
  23140. return _big2_scanDecl(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23141. case int32(_BT_QUEST):
  23142. return _big2_scanPi(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23143. case int32(_BT_NMSTRT):
  23144. fallthrough
  23145. case int32(_BT_HEX):
  23146. fallthrough
  23147. case int32(_BT_NONASCII):
  23148. fallthrough
  23149. case int32(_BT_LEAD2):
  23150. fallthrough
  23151. case int32(_BT_LEAD3):
  23152. fallthrough
  23153. case int32(_BT_LEAD4):
  23154. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr - uintptr(2)
  23155. return int32(m_XML_TOK_INSTANCE_START)
  23156. }
  23157. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23158. return m_XML_TOK_INVALID
  23159. _5:
  23160. ;
  23161. if ptr+uintptr(2) == end {
  23162. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = end
  23163. /* indicate that this might be part of a CR/LF pair */
  23164. return -int32(m_XML_TOK_PROLOG_S)
  23165. }
  23166. /* fall through */
  23167. _7:
  23168. ;
  23169. _6:
  23170. ;
  23171. _32:
  23172. ;
  23173. ptr += uintptr(2)
  23174. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23175. goto _30
  23176. }
  23177. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23178. v33 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23179. } else {
  23180. v33 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23181. }
  23182. switch v33 {
  23183. case int32(_BT_S):
  23184. fallthrough
  23185. case int32(_BT_LF):
  23186. case int32(_BT_CR):
  23187. /* don't split CR/LF pair */
  23188. if ptr+uintptr(2) != end {
  23189. break
  23190. }
  23191. /* fall through */
  23192. fallthrough
  23193. default:
  23194. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23195. return int32(m_XML_TOK_PROLOG_S)
  23196. }
  23197. goto _31
  23198. _31:
  23199. ;
  23200. goto _32
  23201. goto _30
  23202. _30:
  23203. ;
  23204. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23205. return int32(m_XML_TOK_PROLOG_S)
  23206. _8:
  23207. ;
  23208. return _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23209. _9:
  23210. ;
  23211. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23212. return int32(m_XML_TOK_COMMA)
  23213. _10:
  23214. ;
  23215. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23216. return int32(m_XML_TOK_OPEN_BRACKET)
  23217. _11:
  23218. ;
  23219. ptr += uintptr(2)
  23220. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23221. return -int32(m_XML_TOK_CLOSE_BRACKET)
  23222. }
  23223. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  23224. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))) {
  23225. return -int32(1)
  23226. }
  23227. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_GT1) {
  23228. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(libc.Int32FromInt32(2)*libc.Int32FromInt32(2))
  23229. return int32(m_XML_TOK_COND_SECT_CLOSE)
  23230. }
  23231. }
  23232. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23233. return int32(m_XML_TOK_CLOSE_BRACKET)
  23234. _12:
  23235. ;
  23236. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23237. return int32(m_XML_TOK_OPEN_PAREN)
  23238. _13:
  23239. ;
  23240. ptr += uintptr(2)
  23241. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23242. return -int32(m_XML_TOK_CLOSE_PAREN)
  23243. }
  23244. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23245. v34 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23246. } else {
  23247. v34 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23248. }
  23249. switch v34 {
  23250. case int32(_BT_AST):
  23251. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23252. return int32(m_XML_TOK_CLOSE_PAREN_ASTERISK)
  23253. case int32(_BT_QUEST):
  23254. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23255. return int32(m_XML_TOK_CLOSE_PAREN_QUESTION)
  23256. case int32(_BT_PLUS):
  23257. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23258. return int32(m_XML_TOK_CLOSE_PAREN_PLUS)
  23259. case int32(_BT_CR):
  23260. fallthrough
  23261. case int32(_BT_LF):
  23262. fallthrough
  23263. case int32(_BT_S):
  23264. fallthrough
  23265. case int32(_BT_GT):
  23266. fallthrough
  23267. case int32(_BT_COMMA):
  23268. fallthrough
  23269. case int32(_BT_VERBAR):
  23270. fallthrough
  23271. case int32(_BT_RPAR):
  23272. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23273. return int32(m_XML_TOK_CLOSE_PAREN)
  23274. }
  23275. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23276. return m_XML_TOK_INVALID
  23277. _14:
  23278. ;
  23279. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23280. return int32(m_XML_TOK_OR)
  23281. _15:
  23282. ;
  23283. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23284. return int32(m_XML_TOK_DECL_CLOSE)
  23285. _16:
  23286. ;
  23287. return _big2_scanPoundName(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23288. _17:
  23289. ;
  23290. if int64(end)-int64(ptr) < int64(2) {
  23291. return -int32(2)
  23292. }
  23293. if 0 != 0 {
  23294. ptr += uintptr(2)
  23295. tok = int32(m_XML_TOK_NAME)
  23296. goto _28
  23297. }
  23298. if 0 != 0 {
  23299. ptr += uintptr(2)
  23300. tok = int32(m_XML_TOK_NMTOKEN)
  23301. goto _28
  23302. }
  23303. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23304. return m_XML_TOK_INVALID
  23305. _18:
  23306. ;
  23307. if int64(end)-int64(ptr) < int64(3) {
  23308. return -int32(2)
  23309. }
  23310. if 0 != 0 {
  23311. ptr += uintptr(3)
  23312. tok = int32(m_XML_TOK_NAME)
  23313. goto _28
  23314. }
  23315. if 0 != 0 {
  23316. ptr += uintptr(3)
  23317. tok = int32(m_XML_TOK_NMTOKEN)
  23318. goto _28
  23319. }
  23320. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23321. return m_XML_TOK_INVALID
  23322. _19:
  23323. ;
  23324. if int64(end)-int64(ptr) < int64(4) {
  23325. return -int32(2)
  23326. }
  23327. if 0 != 0 {
  23328. ptr += uintptr(4)
  23329. tok = int32(m_XML_TOK_NAME)
  23330. goto _28
  23331. }
  23332. if 0 != 0 {
  23333. ptr += uintptr(4)
  23334. tok = int32(m_XML_TOK_NMTOKEN)
  23335. goto _28
  23336. }
  23337. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23338. return m_XML_TOK_INVALID
  23339. _21:
  23340. ;
  23341. _20:
  23342. ;
  23343. tok = int32(m_XML_TOK_NAME)
  23344. ptr += uintptr(2)
  23345. goto _28
  23346. _25:
  23347. ;
  23348. _24:
  23349. ;
  23350. _23:
  23351. ;
  23352. _22:
  23353. ;
  23354. tok = int32(m_XML_TOK_NMTOKEN)
  23355. ptr += uintptr(2)
  23356. goto _28
  23357. _26:
  23358. ;
  23359. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  23360. ptr += uintptr(2)
  23361. tok = int32(m_XML_TOK_NAME)
  23362. goto _28
  23363. }
  23364. if _namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(uint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&int32(0x1F))) != 0 {
  23365. ptr += uintptr(2)
  23366. tok = int32(m_XML_TOK_NMTOKEN)
  23367. goto _28
  23368. }
  23369. /* fall through */
  23370. _27:
  23371. ;
  23372. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23373. return m_XML_TOK_INVALID
  23374. _28:
  23375. ;
  23376. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23377. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23378. v35 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23379. } else {
  23380. v35 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23381. }
  23382. switch v35 {
  23383. case int32(_BT_NONASCII):
  23384. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  23385. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23386. return m_XML_TOK_INVALID
  23387. } /* fall through */
  23388. fallthrough
  23389. case int32(_BT_NMSTRT):
  23390. fallthrough
  23391. case int32(_BT_HEX):
  23392. fallthrough
  23393. case int32(_BT_DIGIT):
  23394. fallthrough
  23395. case int32(_BT_NAME):
  23396. fallthrough
  23397. case int32(_BT_MINUS):
  23398. ptr += uintptr(2)
  23399. case int32(_BT_LEAD2):
  23400. if int64(end)-int64(ptr) < int64(2) {
  23401. return -int32(2)
  23402. }
  23403. if !(libc.Int32FromInt32(0) != 0) {
  23404. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23405. return m_XML_TOK_INVALID
  23406. }
  23407. ptr += uintptr(2)
  23408. case int32(_BT_LEAD3):
  23409. if int64(end)-int64(ptr) < int64(3) {
  23410. return -int32(2)
  23411. }
  23412. if !(libc.Int32FromInt32(0) != 0) {
  23413. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23414. return m_XML_TOK_INVALID
  23415. }
  23416. ptr += uintptr(3)
  23417. case int32(_BT_LEAD4):
  23418. if int64(end)-int64(ptr) < int64(4) {
  23419. return -int32(2)
  23420. }
  23421. if !(libc.Int32FromInt32(0) != 0) {
  23422. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23423. return m_XML_TOK_INVALID
  23424. }
  23425. ptr += uintptr(4)
  23426. case int32(_BT_GT):
  23427. fallthrough
  23428. case int32(_BT_RPAR):
  23429. fallthrough
  23430. case int32(_BT_COMMA):
  23431. fallthrough
  23432. case int32(_BT_VERBAR):
  23433. fallthrough
  23434. case int32(_BT_LSQB):
  23435. fallthrough
  23436. case int32(_BT_PERCNT):
  23437. fallthrough
  23438. case int32(_BT_S):
  23439. fallthrough
  23440. case int32(_BT_CR):
  23441. fallthrough
  23442. case int32(_BT_LF):
  23443. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23444. return tok
  23445. case int32(_BT_COLON):
  23446. ptr += uintptr(2)
  23447. switch tok {
  23448. case int32(m_XML_TOK_NAME):
  23449. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23450. return -int32(1)
  23451. }
  23452. tok = int32(m_XML_TOK_PREFIXED_NAME)
  23453. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23454. v36 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23455. } else {
  23456. v36 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23457. }
  23458. switch v36 {
  23459. case int32(_BT_NONASCII):
  23460. if !(_namingBitmap[libc.Int32FromUint8(_namePages[*(*uint8)(unsafe.Pointer(ptr))])<<int32(3)+libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))>>int32(5)]&(libc.Uint32FromUint32(1)<<(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))&libc.Int32FromInt32(0x1F))) != 0) {
  23461. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23462. return m_XML_TOK_INVALID
  23463. } /* fall through */
  23464. fallthrough
  23465. case int32(_BT_NMSTRT):
  23466. fallthrough
  23467. case int32(_BT_HEX):
  23468. fallthrough
  23469. case int32(_BT_DIGIT):
  23470. fallthrough
  23471. case int32(_BT_NAME):
  23472. fallthrough
  23473. case int32(_BT_MINUS):
  23474. ptr += uintptr(2)
  23475. case int32(_BT_LEAD2):
  23476. if int64(end)-int64(ptr) < int64(2) {
  23477. return -int32(2)
  23478. }
  23479. if !(libc.Int32FromInt32(0) != 0) {
  23480. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23481. return m_XML_TOK_INVALID
  23482. }
  23483. ptr += uintptr(2)
  23484. case int32(_BT_LEAD3):
  23485. if int64(end)-int64(ptr) < int64(3) {
  23486. return -int32(2)
  23487. }
  23488. if !(libc.Int32FromInt32(0) != 0) {
  23489. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23490. return m_XML_TOK_INVALID
  23491. }
  23492. ptr += uintptr(3)
  23493. case int32(_BT_LEAD4):
  23494. if int64(end)-int64(ptr) < int64(4) {
  23495. return -int32(2)
  23496. }
  23497. if !(libc.Int32FromInt32(0) != 0) {
  23498. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23499. return m_XML_TOK_INVALID
  23500. }
  23501. ptr += uintptr(4)
  23502. default:
  23503. tok = int32(m_XML_TOK_NMTOKEN)
  23504. break
  23505. }
  23506. case int32(m_XML_TOK_PREFIXED_NAME):
  23507. tok = int32(m_XML_TOK_NMTOKEN)
  23508. break
  23509. }
  23510. case int32(_BT_PLUS):
  23511. if tok == int32(m_XML_TOK_NMTOKEN) {
  23512. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23513. return m_XML_TOK_INVALID
  23514. }
  23515. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23516. return int32(m_XML_TOK_NAME_PLUS)
  23517. case int32(_BT_AST):
  23518. if tok == int32(m_XML_TOK_NMTOKEN) {
  23519. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23520. return m_XML_TOK_INVALID
  23521. }
  23522. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23523. return int32(m_XML_TOK_NAME_ASTERISK)
  23524. case int32(_BT_QUEST):
  23525. if tok == int32(m_XML_TOK_NMTOKEN) {
  23526. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23527. return m_XML_TOK_INVALID
  23528. }
  23529. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23530. return int32(m_XML_TOK_NAME_QUESTION)
  23531. default:
  23532. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23533. return m_XML_TOK_INVALID
  23534. }
  23535. }
  23536. return -tok
  23537. }
  23538. func _big2_attributeValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23539. var start uintptr
  23540. var v1, v2 int32
  23541. _, _, _ = start, v1, v2
  23542. if ptr >= end {
  23543. return -int32(4)
  23544. } else {
  23545. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23546. /* This line cannot be executed. The incoming data has already
  23547. * been tokenized once, so incomplete characters like this have
  23548. * already been eliminated from the input. Retaining the paranoia
  23549. * check is still valuable, however.
  23550. */
  23551. return -int32(1) /* LCOV_EXCL_LINE */
  23552. }
  23553. }
  23554. start = ptr
  23555. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23556. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23557. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23558. } else {
  23559. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23560. }
  23561. switch v1 {
  23562. case int32(_BT_LEAD2):
  23563. ptr += uintptr(2)
  23564. case int32(_BT_LEAD3):
  23565. ptr += uintptr(3)
  23566. case int32(_BT_LEAD4):
  23567. ptr += uintptr(4)
  23568. case int32(_BT_AMP):
  23569. if ptr == start {
  23570. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23571. }
  23572. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23573. return int32(m_XML_TOK_DATA_CHARS)
  23574. case int32(_BT_LT):
  23575. /* this is for inside entity references */
  23576. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23577. return m_XML_TOK_INVALID
  23578. case int32(_BT_LF):
  23579. if ptr == start {
  23580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23581. return int32(m_XML_TOK_DATA_NEWLINE)
  23582. }
  23583. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23584. return int32(m_XML_TOK_DATA_CHARS)
  23585. case int32(_BT_CR):
  23586. if ptr == start {
  23587. ptr += uintptr(2)
  23588. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23589. return -int32(3)
  23590. }
  23591. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23592. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23593. } else {
  23594. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23595. }
  23596. if v2 == int32(_BT_LF) {
  23597. ptr += uintptr(2)
  23598. }
  23599. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23600. return int32(m_XML_TOK_DATA_NEWLINE)
  23601. }
  23602. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23603. return int32(m_XML_TOK_DATA_CHARS)
  23604. case int32(_BT_S):
  23605. if ptr == start {
  23606. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23607. return int32(m_XML_TOK_ATTRIBUTE_VALUE_S)
  23608. }
  23609. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23610. return int32(m_XML_TOK_DATA_CHARS)
  23611. default:
  23612. ptr += uintptr(2)
  23613. break
  23614. }
  23615. }
  23616. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23617. return int32(m_XML_TOK_DATA_CHARS)
  23618. }
  23619. func _big2_entityValueTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23620. var start uintptr
  23621. var tok, v1, v2, v3 int32
  23622. _, _, _, _, _ = start, tok, v1, v2, v3
  23623. if ptr >= end {
  23624. return -int32(4)
  23625. } else {
  23626. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23627. /* This line cannot be executed. The incoming data has already
  23628. * been tokenized once, so incomplete characters like this have
  23629. * already been eliminated from the input. Retaining the paranoia
  23630. * check is still valuable, however.
  23631. */
  23632. return -int32(1) /* LCOV_EXCL_LINE */
  23633. }
  23634. }
  23635. start = ptr
  23636. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23637. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23638. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23639. } else {
  23640. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23641. }
  23642. switch v1 {
  23643. case int32(_BT_LEAD2):
  23644. ptr += uintptr(2)
  23645. case int32(_BT_LEAD3):
  23646. ptr += uintptr(3)
  23647. case int32(_BT_LEAD4):
  23648. ptr += uintptr(4)
  23649. case int32(_BT_AMP):
  23650. if ptr == start {
  23651. return _big2_scanRef(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23652. }
  23653. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23654. return int32(m_XML_TOK_DATA_CHARS)
  23655. case int32(_BT_PERCNT):
  23656. if ptr == start {
  23657. tok = _big2_scanPercent(tls, enc, ptr+uintptr(2), end, nextTokPtr)
  23658. if tok == int32(m_XML_TOK_PERCENT) {
  23659. v2 = m_XML_TOK_INVALID
  23660. } else {
  23661. v2 = tok
  23662. }
  23663. return v2
  23664. }
  23665. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23666. return int32(m_XML_TOK_DATA_CHARS)
  23667. case int32(_BT_LF):
  23668. if ptr == start {
  23669. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  23670. return int32(m_XML_TOK_DATA_NEWLINE)
  23671. }
  23672. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23673. return int32(m_XML_TOK_DATA_CHARS)
  23674. case int32(_BT_CR):
  23675. if ptr == start {
  23676. ptr += uintptr(2)
  23677. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23678. return -int32(3)
  23679. }
  23680. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23681. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23682. } else {
  23683. v3 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23684. }
  23685. if v3 == int32(_BT_LF) {
  23686. ptr += uintptr(2)
  23687. }
  23688. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23689. return int32(m_XML_TOK_DATA_NEWLINE)
  23690. }
  23691. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23692. return int32(m_XML_TOK_DATA_CHARS)
  23693. default:
  23694. ptr += uintptr(2)
  23695. break
  23696. }
  23697. }
  23698. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23699. return int32(m_XML_TOK_DATA_CHARS)
  23700. }
  23701. func _big2_ignoreSectionTok(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  23702. var level, v1 int32
  23703. var n Tsize_t
  23704. _, _, _ = level, n, v1
  23705. level = 0
  23706. if int32(2) > int32(1) {
  23707. n = libc.Uint64FromInt64(int64(end) - int64(ptr))
  23708. if n&libc.Uint64FromInt32(libc.Int32FromInt32(2)-libc.Int32FromInt32(1)) != 0 {
  23709. n &= libc.Uint64FromInt32(^(libc.Int32FromInt32(2) - libc.Int32FromInt32(1)))
  23710. end = ptr + uintptr(n)
  23711. }
  23712. }
  23713. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  23714. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23715. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23716. } else {
  23717. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23718. }
  23719. switch v1 {
  23720. case int32(_BT_LEAD2):
  23721. if int64(end)-int64(ptr) < int64(2) {
  23722. return -int32(2)
  23723. }
  23724. if 0 != 0 {
  23725. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23726. return m_XML_TOK_INVALID
  23727. }
  23728. ptr += uintptr(2)
  23729. case int32(_BT_LEAD3):
  23730. if int64(end)-int64(ptr) < int64(3) {
  23731. return -int32(2)
  23732. }
  23733. if 0 != 0 {
  23734. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23735. return m_XML_TOK_INVALID
  23736. }
  23737. ptr += uintptr(3)
  23738. case int32(_BT_LEAD4):
  23739. if int64(end)-int64(ptr) < int64(4) {
  23740. return -int32(2)
  23741. }
  23742. if 0 != 0 {
  23743. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23744. return m_XML_TOK_INVALID
  23745. }
  23746. ptr += uintptr(4)
  23747. case int32(_BT_NONXML):
  23748. fallthrough
  23749. case int32(_BT_MALFORM):
  23750. fallthrough
  23751. case int32(_BT_TRAIL):
  23752. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23753. return m_XML_TOK_INVALID
  23754. case int32(_BT_LT):
  23755. ptr += uintptr(2)
  23756. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23757. return -int32(1)
  23758. }
  23759. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_EXCL) {
  23760. ptr += uintptr(2)
  23761. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23762. return -int32(1)
  23763. }
  23764. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_LSQB1) {
  23765. level++
  23766. ptr += uintptr(2)
  23767. }
  23768. }
  23769. case int32(_BT_RSQB):
  23770. ptr += uintptr(2)
  23771. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23772. return -int32(1)
  23773. }
  23774. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_RSQB1) {
  23775. ptr += uintptr(2)
  23776. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23777. return -int32(1)
  23778. }
  23779. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_GT1) {
  23780. ptr += uintptr(2)
  23781. if level == 0 {
  23782. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  23783. return int32(m_XML_TOK_IGNORE_SECT)
  23784. }
  23785. level--
  23786. }
  23787. }
  23788. default:
  23789. ptr += uintptr(2)
  23790. break
  23791. }
  23792. }
  23793. return -int32(1)
  23794. }
  23795. func _big2_isPublicId(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, badPtr uintptr) (r int32) {
  23796. var v2, v3, v4 int32
  23797. _, _, _ = v2, v3, v4
  23798. ptr += uintptr(2)
  23799. end -= uintptr(2)
  23800. for {
  23801. if !(int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2))) {
  23802. break
  23803. }
  23804. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23805. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23806. } else {
  23807. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23808. }
  23809. switch v2 {
  23810. case int32(_BT_DIGIT):
  23811. fallthrough
  23812. case int32(_BT_HEX):
  23813. fallthrough
  23814. case int32(_BT_MINUS):
  23815. fallthrough
  23816. case int32(_BT_APOS):
  23817. fallthrough
  23818. case int32(_BT_LPAR):
  23819. fallthrough
  23820. case int32(_BT_RPAR):
  23821. fallthrough
  23822. case int32(_BT_PLUS):
  23823. fallthrough
  23824. case int32(_BT_COMMA):
  23825. fallthrough
  23826. case int32(_BT_SOL):
  23827. fallthrough
  23828. case int32(_BT_EQUALS):
  23829. fallthrough
  23830. case int32(_BT_QUEST):
  23831. fallthrough
  23832. case int32(_BT_CR):
  23833. fallthrough
  23834. case int32(_BT_LF):
  23835. fallthrough
  23836. case int32(_BT_SEMI):
  23837. fallthrough
  23838. case int32(_BT_EXCL):
  23839. fallthrough
  23840. case int32(_BT_AST):
  23841. fallthrough
  23842. case int32(_BT_PERCNT):
  23843. fallthrough
  23844. case int32(_BT_NUM):
  23845. fallthrough
  23846. case int32(_BT_COLON):
  23847. case int32(_BT_S):
  23848. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_TAB1) {
  23849. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  23850. return 0
  23851. }
  23852. case int32(_BT_NAME):
  23853. fallthrough
  23854. case int32(_BT_NMSTRT):
  23855. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23856. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23857. } else {
  23858. v3 = -int32(1)
  23859. }
  23860. if !(v3 & ^libc.Int32FromInt32(0x7f) != 0) {
  23861. break
  23862. }
  23863. /* fall through */
  23864. fallthrough
  23865. default:
  23866. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23867. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23868. } else {
  23869. v4 = -int32(1)
  23870. }
  23871. switch v4 {
  23872. case int32(0x24): /* $ */
  23873. fallthrough
  23874. case int32(0x40): /* @ */
  23875. default:
  23876. *(*uintptr)(unsafe.Pointer(badPtr)) = ptr
  23877. return 0
  23878. }
  23879. break
  23880. }
  23881. goto _1
  23882. _1:
  23883. ;
  23884. ptr += uintptr(2)
  23885. }
  23886. return int32(1)
  23887. }
  23888. /* This must only be called for a well-formed start-tag or empty
  23889. element tag. Returns the number of attributes. Pointers to the
  23890. first attsMax attributes are stored in atts.
  23891. */
  23892. func _big2_getAtts(tls *libc.TLS, enc uintptr, ptr uintptr, attsMax int32, atts uintptr) (r int32) {
  23893. var nAtts, open, state, v2, v3, v5, v7 int32
  23894. var v4, v6, v8, v9 bool
  23895. _, _, _, _, _, _, _, _, _, _, _ = nAtts, open, state, v2, v3, v4, v5, v6, v7, v8, v9
  23896. state = 1
  23897. nAtts = 0
  23898. open = 0 /* defined when state == inValue;
  23899. initialization just to shut up compilers */
  23900. ptr += uintptr(2)
  23901. for {
  23902. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23903. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  23904. } else {
  23905. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  23906. }
  23907. switch v2 {
  23908. case int32(_BT_LEAD2):
  23909. if state == 0 {
  23910. if nAtts < attsMax {
  23911. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23912. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23913. }
  23914. state = 1
  23915. }
  23916. ptr += uintptr(libc.Int32FromInt32(2) - libc.Int32FromInt32(2))
  23917. case int32(_BT_LEAD3):
  23918. if state == 0 {
  23919. if nAtts < attsMax {
  23920. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23921. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23922. }
  23923. state = 1
  23924. }
  23925. ptr += uintptr(libc.Int32FromInt32(3) - libc.Int32FromInt32(2))
  23926. case int32(_BT_LEAD4):
  23927. if state == 0 {
  23928. if nAtts < attsMax {
  23929. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23930. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23931. }
  23932. state = 1
  23933. }
  23934. ptr += uintptr(libc.Int32FromInt32(4) - libc.Int32FromInt32(2))
  23935. case int32(_BT_NONASCII):
  23936. fallthrough
  23937. case int32(_BT_NMSTRT):
  23938. fallthrough
  23939. case int32(_BT_HEX):
  23940. if state == 0 {
  23941. if nAtts < attsMax {
  23942. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fname = ptr
  23943. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(1)
  23944. }
  23945. state = 1
  23946. }
  23947. case int32(_BT_QUOT):
  23948. if state != 2 {
  23949. if nAtts < attsMax {
  23950. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  23951. }
  23952. state = 2
  23953. open = int32(_BT_QUOT)
  23954. } else {
  23955. if open == int32(_BT_QUOT) {
  23956. state = 0
  23957. if nAtts < attsMax {
  23958. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  23959. }
  23960. nAtts++
  23961. }
  23962. }
  23963. case int32(_BT_APOS):
  23964. if state != 2 {
  23965. if nAtts < attsMax {
  23966. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr = ptr + uintptr(2)
  23967. }
  23968. state = 2
  23969. open = int32(_BT_APOS)
  23970. } else {
  23971. if open == int32(_BT_APOS) {
  23972. state = 0
  23973. if nAtts < attsMax {
  23974. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvalueEnd = ptr
  23975. }
  23976. nAtts++
  23977. }
  23978. }
  23979. case int32(_BT_AMP):
  23980. if nAtts < attsMax {
  23981. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  23982. }
  23983. case int32(_BT_S):
  23984. if state == 1 {
  23985. state = 0
  23986. } else {
  23987. if v9 = state == 2 && nAtts < attsMax && (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized != 0; v9 {
  23988. if v4 = ptr == (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).FvaluePtr; !v4 {
  23989. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  23990. v3 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  23991. } else {
  23992. v3 = -int32(1)
  23993. }
  23994. }
  23995. if v6 = v4 || v3 != int32(m_ASCII_SPACE1); !v6 {
  23996. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  23997. v5 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  23998. } else {
  23999. v5 = -int32(1)
  24000. }
  24001. }
  24002. if v8 = v6 || v5 == int32(m_ASCII_SPACE1); !v8 {
  24003. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 {
  24004. v7 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))))))
  24005. } else {
  24006. v7 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2))), *(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1)))
  24007. }
  24008. }
  24009. }
  24010. if v9 && (v8 || v7 == open) {
  24011. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  24012. }
  24013. }
  24014. case int32(_BT_CR):
  24015. fallthrough
  24016. case int32(_BT_LF):
  24017. /* This case ensures that the first attribute name is counted
  24018. Apart from that we could just change state on the quote. */
  24019. if state == 1 {
  24020. state = 0
  24021. } else {
  24022. if state == 2 && nAtts < attsMax {
  24023. (*(*TATTRIBUTE)(unsafe.Pointer(atts + uintptr(nAtts)*32))).Fnormalized = uint8(0)
  24024. }
  24025. }
  24026. case int32(_BT_GT):
  24027. fallthrough
  24028. case int32(_BT_SOL):
  24029. if state != 2 {
  24030. return nAtts
  24031. }
  24032. default:
  24033. break
  24034. }
  24035. goto _1
  24036. _1:
  24037. ;
  24038. ptr += uintptr(2)
  24039. }
  24040. /* not reached */
  24041. return r
  24042. }
  24043. func _big2_charRefNumber(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  24044. var c, c1, result, v2, v4 int32
  24045. _, _, _, _, _ = c, c1, result, v2, v4
  24046. result = 0
  24047. /* skip &# */
  24048. _ = enc
  24049. ptr += uintptr(libc.Int32FromInt32(2) * libc.Int32FromInt32(2))
  24050. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_x) {
  24051. ptr += uintptr(2)
  24052. for {
  24053. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  24054. break
  24055. }
  24056. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24057. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  24058. } else {
  24059. v2 = -int32(1)
  24060. }
  24061. c = v2
  24062. switch c {
  24063. case int32(m_ASCII_0):
  24064. fallthrough
  24065. case int32(m_ASCII_1):
  24066. fallthrough
  24067. case int32(m_ASCII_2):
  24068. fallthrough
  24069. case int32(m_ASCII_3):
  24070. fallthrough
  24071. case int32(m_ASCII_41):
  24072. fallthrough
  24073. case int32(m_ASCII_51):
  24074. fallthrough
  24075. case int32(m_ASCII_61):
  24076. fallthrough
  24077. case int32(m_ASCII_71):
  24078. fallthrough
  24079. case int32(m_ASCII_8):
  24080. fallthrough
  24081. case int32(m_ASCII_9):
  24082. result <<= int32(4)
  24083. result |= c - int32(m_ASCII_0)
  24084. case int32(m_ASCII_A):
  24085. fallthrough
  24086. case int32(m_ASCII_B1):
  24087. fallthrough
  24088. case int32(m_ASCII_C):
  24089. fallthrough
  24090. case int32(m_ASCII_D):
  24091. fallthrough
  24092. case int32(m_ASCII_E):
  24093. fallthrough
  24094. case int32(m_ASCII_F):
  24095. result <<= int32(4)
  24096. result += int32(10) + (c - int32(m_ASCII_A))
  24097. case int32(m_ASCII_a):
  24098. fallthrough
  24099. case int32(m_ASCII_b1):
  24100. fallthrough
  24101. case int32(m_ASCII_c):
  24102. fallthrough
  24103. case int32(m_ASCII_d1):
  24104. fallthrough
  24105. case int32(m_ASCII_e):
  24106. fallthrough
  24107. case int32(m_ASCII_f1):
  24108. result <<= int32(4)
  24109. result += int32(10) + (c - int32(m_ASCII_a))
  24110. break
  24111. }
  24112. if result >= int32(0x110000) {
  24113. return -int32(1)
  24114. }
  24115. goto _1
  24116. _1:
  24117. ;
  24118. ptr += uintptr(2)
  24119. }
  24120. } else {
  24121. for {
  24122. if !!(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_SEMI1)) {
  24123. break
  24124. }
  24125. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24126. v4 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  24127. } else {
  24128. v4 = -int32(1)
  24129. }
  24130. c1 = v4
  24131. result *= int32(10)
  24132. result += c1 - int32(m_ASCII_0)
  24133. if result >= int32(0x110000) {
  24134. return -int32(1)
  24135. }
  24136. goto _3
  24137. _3:
  24138. ;
  24139. ptr += uintptr(2)
  24140. }
  24141. }
  24142. return _checkCharRefNumber(tls, result)
  24143. }
  24144. func _big2_predefinedEntityName(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr) (r int32) {
  24145. var v1, v2 int32
  24146. _, _ = v1, v2
  24147. _ = enc
  24148. switch (int64(end) - int64(ptr)) / libc.Int64FromInt32(2) {
  24149. case int64(2):
  24150. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2)))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + libc.UintptrFromInt32(2) + 1))) == int32(m_ASCII_t) {
  24151. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24152. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  24153. } else {
  24154. v1 = -int32(1)
  24155. }
  24156. switch v1 {
  24157. case int32(m_ASCII_l):
  24158. return int32(m_ASCII_LT1)
  24159. case int32(m_ASCII_g):
  24160. return int32(m_ASCII_GT1)
  24161. }
  24162. }
  24163. case int64(3):
  24164. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_a) {
  24165. ptr += uintptr(2)
  24166. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_m) {
  24167. ptr += uintptr(2)
  24168. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p) {
  24169. return int32(m_ASCII_AMP1)
  24170. }
  24171. }
  24172. }
  24173. case int64(4):
  24174. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24175. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1)))
  24176. } else {
  24177. v2 = -int32(1)
  24178. }
  24179. switch v2 {
  24180. case int32(m_ASCII_q1):
  24181. ptr += uintptr(2)
  24182. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_u1) {
  24183. ptr += uintptr(2)
  24184. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o) {
  24185. ptr += uintptr(2)
  24186. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_t) {
  24187. return int32(m_ASCII_QUOT1)
  24188. }
  24189. }
  24190. }
  24191. case int32(m_ASCII_a):
  24192. ptr += uintptr(2)
  24193. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_p) {
  24194. ptr += uintptr(2)
  24195. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_o) {
  24196. ptr += uintptr(2)
  24197. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32(m_ASCII_s) {
  24198. return int32(m_ASCII_APOS1)
  24199. }
  24200. }
  24201. }
  24202. break
  24203. }
  24204. }
  24205. return 0
  24206. }
  24207. func _big2_nameMatchesAscii(tls *libc.TLS, enc uintptr, ptr1 uintptr, end1 uintptr, ptr2 uintptr) (r int32) {
  24208. _ = enc
  24209. for {
  24210. if !(*(*uint8)(unsafe.Pointer(ptr2)) != 0) {
  24211. break
  24212. }
  24213. if int64(end1)-int64(ptr1) < int64(2) {
  24214. /* This line cannot be executed. The incoming data has already
  24215. * been tokenized once, so incomplete characters like this have
  24216. * already been eliminated from the input. Retaining the
  24217. * paranoia check is still valuable, however.
  24218. */
  24219. return 0 /* LCOV_EXCL_LINE */
  24220. }
  24221. if !(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1))) == 0 && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr1 + 1))) == libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr2)))) {
  24222. return 0
  24223. }
  24224. goto _1
  24225. _1:
  24226. ;
  24227. ptr1 += uintptr(2)
  24228. ptr2++
  24229. }
  24230. return libc.BoolInt32(ptr1 == end1)
  24231. }
  24232. func _big2_nameLength(tls *libc.TLS, enc uintptr, ptr uintptr) (r int32) {
  24233. var start uintptr
  24234. var v2 int32
  24235. _, _ = start, v2
  24236. start = ptr
  24237. for {
  24238. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24239. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24240. } else {
  24241. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24242. }
  24243. switch v2 {
  24244. case int32(_BT_LEAD2):
  24245. ptr += uintptr(2)
  24246. case int32(_BT_LEAD3):
  24247. ptr += uintptr(3)
  24248. case int32(_BT_LEAD4):
  24249. ptr += uintptr(4)
  24250. case int32(_BT_NONASCII):
  24251. fallthrough
  24252. case int32(_BT_NMSTRT):
  24253. fallthrough
  24254. case int32(_BT_COLON):
  24255. fallthrough
  24256. case int32(_BT_HEX):
  24257. fallthrough
  24258. case int32(_BT_DIGIT):
  24259. fallthrough
  24260. case int32(_BT_NAME):
  24261. fallthrough
  24262. case int32(_BT_MINUS):
  24263. ptr += uintptr(2)
  24264. default:
  24265. return int32(int64(ptr) - int64(start))
  24266. }
  24267. goto _1
  24268. _1:
  24269. }
  24270. return r
  24271. }
  24272. func _big2_skipS(tls *libc.TLS, enc uintptr, ptr uintptr) (r uintptr) {
  24273. var v2 int32
  24274. _ = v2
  24275. for {
  24276. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24277. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24278. } else {
  24279. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24280. }
  24281. switch v2 {
  24282. case int32(_BT_LF):
  24283. fallthrough
  24284. case int32(_BT_CR):
  24285. fallthrough
  24286. case int32(_BT_S):
  24287. ptr += uintptr(2)
  24288. default:
  24289. return ptr
  24290. }
  24291. goto _1
  24292. _1:
  24293. }
  24294. return r
  24295. }
  24296. func _big2_updatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  24297. var v1, v2 int32
  24298. var v3 bool
  24299. _, _, _ = v1, v2, v3
  24300. for int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)) {
  24301. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24302. v1 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24303. } else {
  24304. v1 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24305. }
  24306. switch v1 {
  24307. case int32(_BT_LEAD2):
  24308. ptr += uintptr(2)
  24309. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24310. case int32(_BT_LEAD3):
  24311. ptr += uintptr(3)
  24312. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24313. case int32(_BT_LEAD4):
  24314. ptr += uintptr(4)
  24315. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24316. case int32(_BT_LF):
  24317. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  24318. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  24319. ptr += uintptr(2)
  24320. case int32(_BT_CR):
  24321. (*TPOSITION)(unsafe.Pointer(pos)).FlineNumber++
  24322. ptr += uintptr(2)
  24323. if v3 = int64(end)-int64(ptr) >= int64(libc.Int32FromInt32(1)*libc.Int32FromInt32(2)); v3 {
  24324. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == 0 {
  24325. v2 = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(ptr + 1))))))
  24326. } else {
  24327. v2 = _unicode_byte_type(tls, *(*uint8)(unsafe.Pointer(ptr)), *(*uint8)(unsafe.Pointer(ptr + 1)))
  24328. }
  24329. }
  24330. if v3 && v2 == int32(_BT_LF) {
  24331. ptr += uintptr(2)
  24332. }
  24333. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber = uint64(0)
  24334. default:
  24335. ptr += uintptr(2)
  24336. (*TPOSITION)(unsafe.Pointer(pos)).FcolumnNumber++
  24337. break
  24338. }
  24339. }
  24340. }
  24341. var _big2_encoding_ns = Tnormal_encoding{
  24342. Fenc: TENCODING{
  24343. Fscanners: [4]TSCANNER{},
  24344. FliteralScanners: [2]TSCANNER{},
  24345. FminBytesPerChar: int32(2),
  24346. },
  24347. Ftype1: [256]uint8{
  24348. 9: uint8(_BT_S),
  24349. 10: uint8(_BT_LF),
  24350. 13: uint8(_BT_CR),
  24351. 32: uint8(_BT_S),
  24352. 33: uint8(_BT_EXCL),
  24353. 34: uint8(_BT_QUOT),
  24354. 35: uint8(_BT_NUM),
  24355. 36: uint8(_BT_OTHER),
  24356. 37: uint8(_BT_PERCNT),
  24357. 38: uint8(_BT_AMP),
  24358. 39: uint8(_BT_APOS),
  24359. 40: uint8(_BT_LPAR),
  24360. 41: uint8(_BT_RPAR),
  24361. 42: uint8(_BT_AST),
  24362. 43: uint8(_BT_PLUS),
  24363. 44: uint8(_BT_COMMA),
  24364. 45: uint8(_BT_MINUS),
  24365. 46: uint8(_BT_NAME),
  24366. 47: uint8(_BT_SOL),
  24367. 48: uint8(_BT_DIGIT),
  24368. 49: uint8(_BT_DIGIT),
  24369. 50: uint8(_BT_DIGIT),
  24370. 51: uint8(_BT_DIGIT),
  24371. 52: uint8(_BT_DIGIT),
  24372. 53: uint8(_BT_DIGIT),
  24373. 54: uint8(_BT_DIGIT),
  24374. 55: uint8(_BT_DIGIT),
  24375. 56: uint8(_BT_DIGIT),
  24376. 57: uint8(_BT_DIGIT),
  24377. 58: uint8(_BT_COLON),
  24378. 59: uint8(_BT_SEMI),
  24379. 60: uint8(_BT_LT),
  24380. 61: uint8(_BT_EQUALS),
  24381. 62: uint8(_BT_GT),
  24382. 63: uint8(_BT_QUEST),
  24383. 64: uint8(_BT_OTHER),
  24384. 65: uint8(_BT_HEX),
  24385. 66: uint8(_BT_HEX),
  24386. 67: uint8(_BT_HEX),
  24387. 68: uint8(_BT_HEX),
  24388. 69: uint8(_BT_HEX),
  24389. 70: uint8(_BT_HEX),
  24390. 71: uint8(_BT_NMSTRT),
  24391. 72: uint8(_BT_NMSTRT),
  24392. 73: uint8(_BT_NMSTRT),
  24393. 74: uint8(_BT_NMSTRT),
  24394. 75: uint8(_BT_NMSTRT),
  24395. 76: uint8(_BT_NMSTRT),
  24396. 77: uint8(_BT_NMSTRT),
  24397. 78: uint8(_BT_NMSTRT),
  24398. 79: uint8(_BT_NMSTRT),
  24399. 80: uint8(_BT_NMSTRT),
  24400. 81: uint8(_BT_NMSTRT),
  24401. 82: uint8(_BT_NMSTRT),
  24402. 83: uint8(_BT_NMSTRT),
  24403. 84: uint8(_BT_NMSTRT),
  24404. 85: uint8(_BT_NMSTRT),
  24405. 86: uint8(_BT_NMSTRT),
  24406. 87: uint8(_BT_NMSTRT),
  24407. 88: uint8(_BT_NMSTRT),
  24408. 89: uint8(_BT_NMSTRT),
  24409. 90: uint8(_BT_NMSTRT),
  24410. 91: uint8(_BT_LSQB),
  24411. 92: uint8(_BT_OTHER),
  24412. 93: uint8(_BT_RSQB),
  24413. 94: uint8(_BT_OTHER),
  24414. 95: uint8(_BT_NMSTRT),
  24415. 96: uint8(_BT_OTHER),
  24416. 97: uint8(_BT_HEX),
  24417. 98: uint8(_BT_HEX),
  24418. 99: uint8(_BT_HEX),
  24419. 100: uint8(_BT_HEX),
  24420. 101: uint8(_BT_HEX),
  24421. 102: uint8(_BT_HEX),
  24422. 103: uint8(_BT_NMSTRT),
  24423. 104: uint8(_BT_NMSTRT),
  24424. 105: uint8(_BT_NMSTRT),
  24425. 106: uint8(_BT_NMSTRT),
  24426. 107: uint8(_BT_NMSTRT),
  24427. 108: uint8(_BT_NMSTRT),
  24428. 109: uint8(_BT_NMSTRT),
  24429. 110: uint8(_BT_NMSTRT),
  24430. 111: uint8(_BT_NMSTRT),
  24431. 112: uint8(_BT_NMSTRT),
  24432. 113: uint8(_BT_NMSTRT),
  24433. 114: uint8(_BT_NMSTRT),
  24434. 115: uint8(_BT_NMSTRT),
  24435. 116: uint8(_BT_NMSTRT),
  24436. 117: uint8(_BT_NMSTRT),
  24437. 118: uint8(_BT_NMSTRT),
  24438. 119: uint8(_BT_NMSTRT),
  24439. 120: uint8(_BT_NMSTRT),
  24440. 121: uint8(_BT_NMSTRT),
  24441. 122: uint8(_BT_NMSTRT),
  24442. 123: uint8(_BT_OTHER),
  24443. 124: uint8(_BT_VERBAR),
  24444. 125: uint8(_BT_OTHER),
  24445. 126: uint8(_BT_OTHER),
  24446. 127: uint8(_BT_OTHER),
  24447. 128: uint8(_BT_OTHER),
  24448. 129: uint8(_BT_OTHER),
  24449. 130: uint8(_BT_OTHER),
  24450. 131: uint8(_BT_OTHER),
  24451. 132: uint8(_BT_OTHER),
  24452. 133: uint8(_BT_OTHER),
  24453. 134: uint8(_BT_OTHER),
  24454. 135: uint8(_BT_OTHER),
  24455. 136: uint8(_BT_OTHER),
  24456. 137: uint8(_BT_OTHER),
  24457. 138: uint8(_BT_OTHER),
  24458. 139: uint8(_BT_OTHER),
  24459. 140: uint8(_BT_OTHER),
  24460. 141: uint8(_BT_OTHER),
  24461. 142: uint8(_BT_OTHER),
  24462. 143: uint8(_BT_OTHER),
  24463. 144: uint8(_BT_OTHER),
  24464. 145: uint8(_BT_OTHER),
  24465. 146: uint8(_BT_OTHER),
  24466. 147: uint8(_BT_OTHER),
  24467. 148: uint8(_BT_OTHER),
  24468. 149: uint8(_BT_OTHER),
  24469. 150: uint8(_BT_OTHER),
  24470. 151: uint8(_BT_OTHER),
  24471. 152: uint8(_BT_OTHER),
  24472. 153: uint8(_BT_OTHER),
  24473. 154: uint8(_BT_OTHER),
  24474. 155: uint8(_BT_OTHER),
  24475. 156: uint8(_BT_OTHER),
  24476. 157: uint8(_BT_OTHER),
  24477. 158: uint8(_BT_OTHER),
  24478. 159: uint8(_BT_OTHER),
  24479. 160: uint8(_BT_OTHER),
  24480. 161: uint8(_BT_OTHER),
  24481. 162: uint8(_BT_OTHER),
  24482. 163: uint8(_BT_OTHER),
  24483. 164: uint8(_BT_OTHER),
  24484. 165: uint8(_BT_OTHER),
  24485. 166: uint8(_BT_OTHER),
  24486. 167: uint8(_BT_OTHER),
  24487. 168: uint8(_BT_OTHER),
  24488. 169: uint8(_BT_OTHER),
  24489. 170: uint8(_BT_NMSTRT),
  24490. 171: uint8(_BT_OTHER),
  24491. 172: uint8(_BT_OTHER),
  24492. 173: uint8(_BT_OTHER),
  24493. 174: uint8(_BT_OTHER),
  24494. 175: uint8(_BT_OTHER),
  24495. 176: uint8(_BT_OTHER),
  24496. 177: uint8(_BT_OTHER),
  24497. 178: uint8(_BT_OTHER),
  24498. 179: uint8(_BT_OTHER),
  24499. 180: uint8(_BT_OTHER),
  24500. 181: uint8(_BT_NMSTRT),
  24501. 182: uint8(_BT_OTHER),
  24502. 183: uint8(_BT_NAME),
  24503. 184: uint8(_BT_OTHER),
  24504. 185: uint8(_BT_OTHER),
  24505. 186: uint8(_BT_NMSTRT),
  24506. 187: uint8(_BT_OTHER),
  24507. 188: uint8(_BT_OTHER),
  24508. 189: uint8(_BT_OTHER),
  24509. 190: uint8(_BT_OTHER),
  24510. 191: uint8(_BT_OTHER),
  24511. 192: uint8(_BT_NMSTRT),
  24512. 193: uint8(_BT_NMSTRT),
  24513. 194: uint8(_BT_NMSTRT),
  24514. 195: uint8(_BT_NMSTRT),
  24515. 196: uint8(_BT_NMSTRT),
  24516. 197: uint8(_BT_NMSTRT),
  24517. 198: uint8(_BT_NMSTRT),
  24518. 199: uint8(_BT_NMSTRT),
  24519. 200: uint8(_BT_NMSTRT),
  24520. 201: uint8(_BT_NMSTRT),
  24521. 202: uint8(_BT_NMSTRT),
  24522. 203: uint8(_BT_NMSTRT),
  24523. 204: uint8(_BT_NMSTRT),
  24524. 205: uint8(_BT_NMSTRT),
  24525. 206: uint8(_BT_NMSTRT),
  24526. 207: uint8(_BT_NMSTRT),
  24527. 208: uint8(_BT_NMSTRT),
  24528. 209: uint8(_BT_NMSTRT),
  24529. 210: uint8(_BT_NMSTRT),
  24530. 211: uint8(_BT_NMSTRT),
  24531. 212: uint8(_BT_NMSTRT),
  24532. 213: uint8(_BT_NMSTRT),
  24533. 214: uint8(_BT_NMSTRT),
  24534. 215: uint8(_BT_OTHER),
  24535. 216: uint8(_BT_NMSTRT),
  24536. 217: uint8(_BT_NMSTRT),
  24537. 218: uint8(_BT_NMSTRT),
  24538. 219: uint8(_BT_NMSTRT),
  24539. 220: uint8(_BT_NMSTRT),
  24540. 221: uint8(_BT_NMSTRT),
  24541. 222: uint8(_BT_NMSTRT),
  24542. 223: uint8(_BT_NMSTRT),
  24543. 224: uint8(_BT_NMSTRT),
  24544. 225: uint8(_BT_NMSTRT),
  24545. 226: uint8(_BT_NMSTRT),
  24546. 227: uint8(_BT_NMSTRT),
  24547. 228: uint8(_BT_NMSTRT),
  24548. 229: uint8(_BT_NMSTRT),
  24549. 230: uint8(_BT_NMSTRT),
  24550. 231: uint8(_BT_NMSTRT),
  24551. 232: uint8(_BT_NMSTRT),
  24552. 233: uint8(_BT_NMSTRT),
  24553. 234: uint8(_BT_NMSTRT),
  24554. 235: uint8(_BT_NMSTRT),
  24555. 236: uint8(_BT_NMSTRT),
  24556. 237: uint8(_BT_NMSTRT),
  24557. 238: uint8(_BT_NMSTRT),
  24558. 239: uint8(_BT_NMSTRT),
  24559. 240: uint8(_BT_NMSTRT),
  24560. 241: uint8(_BT_NMSTRT),
  24561. 242: uint8(_BT_NMSTRT),
  24562. 243: uint8(_BT_NMSTRT),
  24563. 244: uint8(_BT_NMSTRT),
  24564. 245: uint8(_BT_NMSTRT),
  24565. 246: uint8(_BT_NMSTRT),
  24566. 247: uint8(_BT_OTHER),
  24567. 248: uint8(_BT_NMSTRT),
  24568. 249: uint8(_BT_NMSTRT),
  24569. 250: uint8(_BT_NMSTRT),
  24570. 251: uint8(_BT_NMSTRT),
  24571. 252: uint8(_BT_NMSTRT),
  24572. 253: uint8(_BT_NMSTRT),
  24573. 254: uint8(_BT_NMSTRT),
  24574. 255: uint8(_BT_NMSTRT),
  24575. },
  24576. }
  24577. func init() {
  24578. p := unsafe.Pointer(&_big2_encoding_ns)
  24579. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  24580. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  24581. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  24582. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  24583. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  24584. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  24585. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  24586. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  24587. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  24588. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  24589. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  24590. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  24591. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  24592. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  24593. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  24594. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  24595. }
  24596. var _big2_encoding = Tnormal_encoding{
  24597. Fenc: TENCODING{
  24598. Fscanners: [4]TSCANNER{},
  24599. FliteralScanners: [2]TSCANNER{},
  24600. FminBytesPerChar: int32(2),
  24601. },
  24602. Ftype1: [256]uint8{
  24603. 9: uint8(_BT_S),
  24604. 10: uint8(_BT_LF),
  24605. 13: uint8(_BT_CR),
  24606. 32: uint8(_BT_S),
  24607. 33: uint8(_BT_EXCL),
  24608. 34: uint8(_BT_QUOT),
  24609. 35: uint8(_BT_NUM),
  24610. 36: uint8(_BT_OTHER),
  24611. 37: uint8(_BT_PERCNT),
  24612. 38: uint8(_BT_AMP),
  24613. 39: uint8(_BT_APOS),
  24614. 40: uint8(_BT_LPAR),
  24615. 41: uint8(_BT_RPAR),
  24616. 42: uint8(_BT_AST),
  24617. 43: uint8(_BT_PLUS),
  24618. 44: uint8(_BT_COMMA),
  24619. 45: uint8(_BT_MINUS),
  24620. 46: uint8(_BT_NAME),
  24621. 47: uint8(_BT_SOL),
  24622. 48: uint8(_BT_DIGIT),
  24623. 49: uint8(_BT_DIGIT),
  24624. 50: uint8(_BT_DIGIT),
  24625. 51: uint8(_BT_DIGIT),
  24626. 52: uint8(_BT_DIGIT),
  24627. 53: uint8(_BT_DIGIT),
  24628. 54: uint8(_BT_DIGIT),
  24629. 55: uint8(_BT_DIGIT),
  24630. 56: uint8(_BT_DIGIT),
  24631. 57: uint8(_BT_DIGIT),
  24632. 58: uint8(_BT_NMSTRT),
  24633. 59: uint8(_BT_SEMI),
  24634. 60: uint8(_BT_LT),
  24635. 61: uint8(_BT_EQUALS),
  24636. 62: uint8(_BT_GT),
  24637. 63: uint8(_BT_QUEST),
  24638. 64: uint8(_BT_OTHER),
  24639. 65: uint8(_BT_HEX),
  24640. 66: uint8(_BT_HEX),
  24641. 67: uint8(_BT_HEX),
  24642. 68: uint8(_BT_HEX),
  24643. 69: uint8(_BT_HEX),
  24644. 70: uint8(_BT_HEX),
  24645. 71: uint8(_BT_NMSTRT),
  24646. 72: uint8(_BT_NMSTRT),
  24647. 73: uint8(_BT_NMSTRT),
  24648. 74: uint8(_BT_NMSTRT),
  24649. 75: uint8(_BT_NMSTRT),
  24650. 76: uint8(_BT_NMSTRT),
  24651. 77: uint8(_BT_NMSTRT),
  24652. 78: uint8(_BT_NMSTRT),
  24653. 79: uint8(_BT_NMSTRT),
  24654. 80: uint8(_BT_NMSTRT),
  24655. 81: uint8(_BT_NMSTRT),
  24656. 82: uint8(_BT_NMSTRT),
  24657. 83: uint8(_BT_NMSTRT),
  24658. 84: uint8(_BT_NMSTRT),
  24659. 85: uint8(_BT_NMSTRT),
  24660. 86: uint8(_BT_NMSTRT),
  24661. 87: uint8(_BT_NMSTRT),
  24662. 88: uint8(_BT_NMSTRT),
  24663. 89: uint8(_BT_NMSTRT),
  24664. 90: uint8(_BT_NMSTRT),
  24665. 91: uint8(_BT_LSQB),
  24666. 92: uint8(_BT_OTHER),
  24667. 93: uint8(_BT_RSQB),
  24668. 94: uint8(_BT_OTHER),
  24669. 95: uint8(_BT_NMSTRT),
  24670. 96: uint8(_BT_OTHER),
  24671. 97: uint8(_BT_HEX),
  24672. 98: uint8(_BT_HEX),
  24673. 99: uint8(_BT_HEX),
  24674. 100: uint8(_BT_HEX),
  24675. 101: uint8(_BT_HEX),
  24676. 102: uint8(_BT_HEX),
  24677. 103: uint8(_BT_NMSTRT),
  24678. 104: uint8(_BT_NMSTRT),
  24679. 105: uint8(_BT_NMSTRT),
  24680. 106: uint8(_BT_NMSTRT),
  24681. 107: uint8(_BT_NMSTRT),
  24682. 108: uint8(_BT_NMSTRT),
  24683. 109: uint8(_BT_NMSTRT),
  24684. 110: uint8(_BT_NMSTRT),
  24685. 111: uint8(_BT_NMSTRT),
  24686. 112: uint8(_BT_NMSTRT),
  24687. 113: uint8(_BT_NMSTRT),
  24688. 114: uint8(_BT_NMSTRT),
  24689. 115: uint8(_BT_NMSTRT),
  24690. 116: uint8(_BT_NMSTRT),
  24691. 117: uint8(_BT_NMSTRT),
  24692. 118: uint8(_BT_NMSTRT),
  24693. 119: uint8(_BT_NMSTRT),
  24694. 120: uint8(_BT_NMSTRT),
  24695. 121: uint8(_BT_NMSTRT),
  24696. 122: uint8(_BT_NMSTRT),
  24697. 123: uint8(_BT_OTHER),
  24698. 124: uint8(_BT_VERBAR),
  24699. 125: uint8(_BT_OTHER),
  24700. 126: uint8(_BT_OTHER),
  24701. 127: uint8(_BT_OTHER),
  24702. 128: uint8(_BT_OTHER),
  24703. 129: uint8(_BT_OTHER),
  24704. 130: uint8(_BT_OTHER),
  24705. 131: uint8(_BT_OTHER),
  24706. 132: uint8(_BT_OTHER),
  24707. 133: uint8(_BT_OTHER),
  24708. 134: uint8(_BT_OTHER),
  24709. 135: uint8(_BT_OTHER),
  24710. 136: uint8(_BT_OTHER),
  24711. 137: uint8(_BT_OTHER),
  24712. 138: uint8(_BT_OTHER),
  24713. 139: uint8(_BT_OTHER),
  24714. 140: uint8(_BT_OTHER),
  24715. 141: uint8(_BT_OTHER),
  24716. 142: uint8(_BT_OTHER),
  24717. 143: uint8(_BT_OTHER),
  24718. 144: uint8(_BT_OTHER),
  24719. 145: uint8(_BT_OTHER),
  24720. 146: uint8(_BT_OTHER),
  24721. 147: uint8(_BT_OTHER),
  24722. 148: uint8(_BT_OTHER),
  24723. 149: uint8(_BT_OTHER),
  24724. 150: uint8(_BT_OTHER),
  24725. 151: uint8(_BT_OTHER),
  24726. 152: uint8(_BT_OTHER),
  24727. 153: uint8(_BT_OTHER),
  24728. 154: uint8(_BT_OTHER),
  24729. 155: uint8(_BT_OTHER),
  24730. 156: uint8(_BT_OTHER),
  24731. 157: uint8(_BT_OTHER),
  24732. 158: uint8(_BT_OTHER),
  24733. 159: uint8(_BT_OTHER),
  24734. 160: uint8(_BT_OTHER),
  24735. 161: uint8(_BT_OTHER),
  24736. 162: uint8(_BT_OTHER),
  24737. 163: uint8(_BT_OTHER),
  24738. 164: uint8(_BT_OTHER),
  24739. 165: uint8(_BT_OTHER),
  24740. 166: uint8(_BT_OTHER),
  24741. 167: uint8(_BT_OTHER),
  24742. 168: uint8(_BT_OTHER),
  24743. 169: uint8(_BT_OTHER),
  24744. 170: uint8(_BT_NMSTRT),
  24745. 171: uint8(_BT_OTHER),
  24746. 172: uint8(_BT_OTHER),
  24747. 173: uint8(_BT_OTHER),
  24748. 174: uint8(_BT_OTHER),
  24749. 175: uint8(_BT_OTHER),
  24750. 176: uint8(_BT_OTHER),
  24751. 177: uint8(_BT_OTHER),
  24752. 178: uint8(_BT_OTHER),
  24753. 179: uint8(_BT_OTHER),
  24754. 180: uint8(_BT_OTHER),
  24755. 181: uint8(_BT_NMSTRT),
  24756. 182: uint8(_BT_OTHER),
  24757. 183: uint8(_BT_NAME),
  24758. 184: uint8(_BT_OTHER),
  24759. 185: uint8(_BT_OTHER),
  24760. 186: uint8(_BT_NMSTRT),
  24761. 187: uint8(_BT_OTHER),
  24762. 188: uint8(_BT_OTHER),
  24763. 189: uint8(_BT_OTHER),
  24764. 190: uint8(_BT_OTHER),
  24765. 191: uint8(_BT_OTHER),
  24766. 192: uint8(_BT_NMSTRT),
  24767. 193: uint8(_BT_NMSTRT),
  24768. 194: uint8(_BT_NMSTRT),
  24769. 195: uint8(_BT_NMSTRT),
  24770. 196: uint8(_BT_NMSTRT),
  24771. 197: uint8(_BT_NMSTRT),
  24772. 198: uint8(_BT_NMSTRT),
  24773. 199: uint8(_BT_NMSTRT),
  24774. 200: uint8(_BT_NMSTRT),
  24775. 201: uint8(_BT_NMSTRT),
  24776. 202: uint8(_BT_NMSTRT),
  24777. 203: uint8(_BT_NMSTRT),
  24778. 204: uint8(_BT_NMSTRT),
  24779. 205: uint8(_BT_NMSTRT),
  24780. 206: uint8(_BT_NMSTRT),
  24781. 207: uint8(_BT_NMSTRT),
  24782. 208: uint8(_BT_NMSTRT),
  24783. 209: uint8(_BT_NMSTRT),
  24784. 210: uint8(_BT_NMSTRT),
  24785. 211: uint8(_BT_NMSTRT),
  24786. 212: uint8(_BT_NMSTRT),
  24787. 213: uint8(_BT_NMSTRT),
  24788. 214: uint8(_BT_NMSTRT),
  24789. 215: uint8(_BT_OTHER),
  24790. 216: uint8(_BT_NMSTRT),
  24791. 217: uint8(_BT_NMSTRT),
  24792. 218: uint8(_BT_NMSTRT),
  24793. 219: uint8(_BT_NMSTRT),
  24794. 220: uint8(_BT_NMSTRT),
  24795. 221: uint8(_BT_NMSTRT),
  24796. 222: uint8(_BT_NMSTRT),
  24797. 223: uint8(_BT_NMSTRT),
  24798. 224: uint8(_BT_NMSTRT),
  24799. 225: uint8(_BT_NMSTRT),
  24800. 226: uint8(_BT_NMSTRT),
  24801. 227: uint8(_BT_NMSTRT),
  24802. 228: uint8(_BT_NMSTRT),
  24803. 229: uint8(_BT_NMSTRT),
  24804. 230: uint8(_BT_NMSTRT),
  24805. 231: uint8(_BT_NMSTRT),
  24806. 232: uint8(_BT_NMSTRT),
  24807. 233: uint8(_BT_NMSTRT),
  24808. 234: uint8(_BT_NMSTRT),
  24809. 235: uint8(_BT_NMSTRT),
  24810. 236: uint8(_BT_NMSTRT),
  24811. 237: uint8(_BT_NMSTRT),
  24812. 238: uint8(_BT_NMSTRT),
  24813. 239: uint8(_BT_NMSTRT),
  24814. 240: uint8(_BT_NMSTRT),
  24815. 241: uint8(_BT_NMSTRT),
  24816. 242: uint8(_BT_NMSTRT),
  24817. 243: uint8(_BT_NMSTRT),
  24818. 244: uint8(_BT_NMSTRT),
  24819. 245: uint8(_BT_NMSTRT),
  24820. 246: uint8(_BT_NMSTRT),
  24821. 247: uint8(_BT_OTHER),
  24822. 248: uint8(_BT_NMSTRT),
  24823. 249: uint8(_BT_NMSTRT),
  24824. 250: uint8(_BT_NMSTRT),
  24825. 251: uint8(_BT_NMSTRT),
  24826. 252: uint8(_BT_NMSTRT),
  24827. 253: uint8(_BT_NMSTRT),
  24828. 254: uint8(_BT_NMSTRT),
  24829. 255: uint8(_BT_NMSTRT),
  24830. },
  24831. }
  24832. func init() {
  24833. p := unsafe.Pointer(&_big2_encoding)
  24834. *(*uintptr)(unsafe.Add(p, 0)) = __ccgo_fp(_big2_prologTok)
  24835. *(*uintptr)(unsafe.Add(p, 8)) = __ccgo_fp(_big2_contentTok)
  24836. *(*uintptr)(unsafe.Add(p, 16)) = __ccgo_fp(_big2_cdataSectionTok)
  24837. *(*uintptr)(unsafe.Add(p, 24)) = __ccgo_fp(_big2_ignoreSectionTok)
  24838. *(*uintptr)(unsafe.Add(p, 32)) = __ccgo_fp(_big2_attributeValueTok)
  24839. *(*uintptr)(unsafe.Add(p, 40)) = __ccgo_fp(_big2_entityValueTok)
  24840. *(*uintptr)(unsafe.Add(p, 48)) = __ccgo_fp(_big2_nameMatchesAscii)
  24841. *(*uintptr)(unsafe.Add(p, 56)) = __ccgo_fp(_big2_nameLength)
  24842. *(*uintptr)(unsafe.Add(p, 64)) = __ccgo_fp(_big2_skipS)
  24843. *(*uintptr)(unsafe.Add(p, 72)) = __ccgo_fp(_big2_getAtts)
  24844. *(*uintptr)(unsafe.Add(p, 80)) = __ccgo_fp(_big2_charRefNumber)
  24845. *(*uintptr)(unsafe.Add(p, 88)) = __ccgo_fp(_big2_predefinedEntityName)
  24846. *(*uintptr)(unsafe.Add(p, 96)) = __ccgo_fp(_big2_updatePosition)
  24847. *(*uintptr)(unsafe.Add(p, 104)) = __ccgo_fp(_big2_isPublicId)
  24848. *(*uintptr)(unsafe.Add(p, 112)) = __ccgo_fp(_big2_toUtf8)
  24849. *(*uintptr)(unsafe.Add(p, 120)) = __ccgo_fp(_big2_toUtf16)
  24850. }
  24851. func _streqci(tls *libc.TLS, s1 uintptr, s2 uintptr) (r int32) {
  24852. var c1, c2 uint8
  24853. var v2, v3 uintptr
  24854. _, _, _, _ = c1, c2, v2, v3
  24855. for {
  24856. v2 = s1
  24857. s1++
  24858. c1 = *(*uint8)(unsafe.Pointer(v2))
  24859. v3 = s2
  24860. s2++
  24861. c2 = *(*uint8)(unsafe.Pointer(v3))
  24862. if int32(m_ASCII_a) <= libc.Int32FromUint8(c1) && libc.Int32FromUint8(c1) <= int32(m_ASCII_z1) {
  24863. c1 = uint8(int32(c1) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a)))
  24864. }
  24865. if int32(m_ASCII_a) <= libc.Int32FromUint8(c2) && libc.Int32FromUint8(c2) <= int32(m_ASCII_z1) {
  24866. /* The following line will never get executed. streqci() is
  24867. * only called from two places, both of which guarantee to put
  24868. * upper-case strings into s2.
  24869. */
  24870. c2 = uint8(int32(c2) + (libc.Int32FromInt32(m_ASCII_A) - libc.Int32FromInt32(m_ASCII_a)))
  24871. } /* LCOV_EXCL_LINE */
  24872. if libc.Int32FromUint8(c1) != libc.Int32FromUint8(c2) {
  24873. return 0
  24874. }
  24875. if !(c1 != 0) {
  24876. break
  24877. }
  24878. goto _1
  24879. _1:
  24880. }
  24881. return int32(1)
  24882. }
  24883. func _initUpdatePosition(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, pos uintptr) {
  24884. _ = enc
  24885. _normal_updatePosition(tls, uintptr(unsafe.Pointer(&_utf8_encoding)), ptr, end, pos)
  24886. }
  24887. func _toAscii(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r int32) {
  24888. bp := tls.Alloc(32)
  24889. defer tls.Free(32)
  24890. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  24891. var _ /* buf at bp+8 */ [1]uint8
  24892. var _ /* p at bp+16 */ uintptr
  24893. *(*uintptr)(unsafe.Pointer(bp + 16)) = bp + 8
  24894. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+16, *(*uintptr)(unsafe.Pointer(bp + 16))+uintptr(1))
  24895. if *(*uintptr)(unsafe.Pointer(bp + 16)) == bp+8 {
  24896. return -int32(1)
  24897. } else {
  24898. return libc.Int32FromUint8((*(*[1]uint8)(unsafe.Pointer(bp + 8)))[0])
  24899. }
  24900. return r
  24901. }
  24902. func _isSpace(tls *libc.TLS, c int32) (r int32) {
  24903. switch c {
  24904. case int32(0x20):
  24905. fallthrough
  24906. case int32(0xD):
  24907. fallthrough
  24908. case int32(0xA):
  24909. fallthrough
  24910. case int32(0x9):
  24911. return int32(1)
  24912. }
  24913. return 0
  24914. }
  24915. // C documentation
  24916. //
  24917. // /* Return 1 if there's just optional white space or there's an S
  24918. // followed by name=val.
  24919. // */
  24920. func _parsePseudoAttribute(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, namePtr uintptr, nameEndPtr uintptr, valPtr uintptr, nextTokPtr uintptr) (r int32) {
  24921. var c, v2 int32
  24922. var open uint8
  24923. _, _, _ = c, open, v2
  24924. if ptr == end {
  24925. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  24926. return int32(1)
  24927. }
  24928. if !(_isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0) {
  24929. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24930. return 0
  24931. }
  24932. for cond := true; cond; cond = _isSpace(tls, _toAscii(tls, enc, ptr, end)) != 0 {
  24933. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24934. }
  24935. if ptr == end {
  24936. *(*uintptr)(unsafe.Pointer(namePtr)) = libc.UintptrFromInt32(0)
  24937. return int32(1)
  24938. }
  24939. *(*uintptr)(unsafe.Pointer(namePtr)) = ptr
  24940. for {
  24941. c = _toAscii(tls, enc, ptr, end)
  24942. if c == -int32(1) {
  24943. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24944. return 0
  24945. }
  24946. if c == int32(m_ASCII_EQUALS) {
  24947. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  24948. break
  24949. }
  24950. if _isSpace(tls, c) != 0 {
  24951. *(*uintptr)(unsafe.Pointer(nameEndPtr)) = ptr
  24952. for {
  24953. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24954. goto _3
  24955. _3:
  24956. ;
  24957. v2 = _toAscii(tls, enc, ptr, end)
  24958. c = v2
  24959. if !(_isSpace(tls, v2) != 0) {
  24960. break
  24961. }
  24962. }
  24963. if c != int32(m_ASCII_EQUALS) {
  24964. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24965. return 0
  24966. }
  24967. break
  24968. }
  24969. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24970. goto _1
  24971. _1:
  24972. }
  24973. if ptr == *(*uintptr)(unsafe.Pointer(namePtr)) {
  24974. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24975. return 0
  24976. }
  24977. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24978. c = _toAscii(tls, enc, ptr, end)
  24979. for _isSpace(tls, c) != 0 {
  24980. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24981. c = _toAscii(tls, enc, ptr, end)
  24982. }
  24983. if c != int32(m_ASCII_QUOT1) && c != int32(m_ASCII_APOS1) {
  24984. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24985. return 0
  24986. }
  24987. open = libc.Uint8FromInt32(c)
  24988. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  24989. *(*uintptr)(unsafe.Pointer(valPtr)) = ptr
  24990. for {
  24991. c = _toAscii(tls, enc, ptr, end)
  24992. if c == libc.Int32FromUint8(open) {
  24993. break
  24994. }
  24995. if !(int32(m_ASCII_a) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) && !(int32(m_ASCII_0) <= c && c <= int32(m_ASCII_9)) && c != int32(m_ASCII_PERIOD) && c != int32(m_ASCII_MINUS1) && c != int32(m_ASCII_UNDERSCORE1) {
  24996. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr
  24997. return 0
  24998. }
  24999. goto _4
  25000. _4:
  25001. ;
  25002. ptr += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  25003. }
  25004. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  25005. return int32(1)
  25006. }
  25007. var _KW_version = [8]uint8{
  25008. 0: uint8(m_ASCII_v1),
  25009. 1: uint8(m_ASCII_e),
  25010. 2: uint8(m_ASCII_r),
  25011. 3: uint8(m_ASCII_s),
  25012. 4: uint8(m_ASCII_i1),
  25013. 5: uint8(m_ASCII_o),
  25014. 6: uint8(m_ASCII_n),
  25015. }
  25016. var _KW_encoding = [9]uint8{
  25017. 0: uint8(m_ASCII_e),
  25018. 1: uint8(m_ASCII_n),
  25019. 2: uint8(m_ASCII_c),
  25020. 3: uint8(m_ASCII_o),
  25021. 4: uint8(m_ASCII_d1),
  25022. 5: uint8(m_ASCII_i1),
  25023. 6: uint8(m_ASCII_n),
  25024. 7: uint8(m_ASCII_g),
  25025. }
  25026. var _KW_standalone = [11]uint8{
  25027. 0: uint8(m_ASCII_s),
  25028. 1: uint8(m_ASCII_t),
  25029. 2: uint8(m_ASCII_a),
  25030. 3: uint8(m_ASCII_n),
  25031. 4: uint8(m_ASCII_d1),
  25032. 5: uint8(m_ASCII_a),
  25033. 6: uint8(m_ASCII_l),
  25034. 7: uint8(m_ASCII_o),
  25035. 8: uint8(m_ASCII_n),
  25036. 9: uint8(m_ASCII_e),
  25037. }
  25038. var _KW_yes = [4]uint8{
  25039. 0: uint8(m_ASCII_y1),
  25040. 1: uint8(m_ASCII_e),
  25041. 2: uint8(m_ASCII_s),
  25042. }
  25043. var _KW_no = [3]uint8{
  25044. 0: uint8(m_ASCII_n),
  25045. 1: uint8(m_ASCII_o),
  25046. }
  25047. 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) {
  25048. bp := tls.Alloc(32)
  25049. defer tls.Free(32)
  25050. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  25051. var c int32
  25052. var _ /* name at bp+16 */ uintptr
  25053. var _ /* nameEnd at bp+24 */ uintptr
  25054. var _ /* val at bp+8 */ uintptr
  25055. _ = c
  25056. *(*uintptr)(unsafe.Pointer(bp + 8)) = libc.UintptrFromInt32(0)
  25057. *(*uintptr)(unsafe.Pointer(bp + 16)) = libc.UintptrFromInt32(0)
  25058. *(*uintptr)(unsafe.Pointer(bp + 24)) = libc.UintptrFromInt32(0)
  25059. *(*uintptr)(unsafe.Pointer(bp)) += uintptr(int32(5) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  25060. end -= uintptr(int32(2) * (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  25061. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) || !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  25062. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25063. return 0
  25064. }
  25065. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_version))) != 0) {
  25066. if !(isGeneralTextEntity != 0) {
  25067. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  25068. return 0
  25069. }
  25070. } else {
  25071. if versionPtr != 0 {
  25072. *(*uintptr)(unsafe.Pointer(versionPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  25073. }
  25074. if versionEndPtr != 0 {
  25075. *(*uintptr)(unsafe.Pointer(versionEndPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25076. }
  25077. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  25078. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25079. return 0
  25080. }
  25081. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  25082. if isGeneralTextEntity != 0 {
  25083. /* a TextDecl must have an EncodingDecl */
  25084. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25085. return 0
  25086. }
  25087. return int32(1)
  25088. }
  25089. }
  25090. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_encoding))) != 0 {
  25091. c = _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), end)
  25092. if !(int32(m_ASCII_a) <= c && c <= int32(m_ASCII_z1)) && !(int32(m_ASCII_A) <= c && c <= int32(m_ASCII_Z1)) {
  25093. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  25094. return 0
  25095. }
  25096. if encodingName != 0 {
  25097. *(*uintptr)(unsafe.Pointer(encodingName)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  25098. }
  25099. if encoding != 0 {
  25100. *(*uintptr)(unsafe.Pointer(encoding)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(&struct{ uintptr }{encodingFinder})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar))
  25101. }
  25102. if !(_parsePseudoAttribute(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end, bp+16, bp+24, bp+8, bp) != 0) {
  25103. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25104. return 0
  25105. }
  25106. if !(*(*uintptr)(unsafe.Pointer(bp + 16)) != 0) {
  25107. return int32(1)
  25108. }
  25109. }
  25110. if !((*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 16)), *(*uintptr)(unsafe.Pointer(bp + 24)), uintptr(unsafe.Pointer(&_KW_standalone))) != 0) || isGeneralTextEntity != 0 {
  25111. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 16))
  25112. return 0
  25113. }
  25114. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_yes))) != 0 {
  25115. if standalone != 0 {
  25116. *(*int32)(unsafe.Pointer(standalone)) = int32(1)
  25117. }
  25118. } else {
  25119. if (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).FnameMatchesAscii})))(tls, enc, *(*uintptr)(unsafe.Pointer(bp + 8)), *(*uintptr)(unsafe.Pointer(bp))-uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar), uintptr(unsafe.Pointer(&_KW_no))) != 0 {
  25120. if standalone != 0 {
  25121. *(*int32)(unsafe.Pointer(standalone)) = 0
  25122. }
  25123. } else {
  25124. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp + 8))
  25125. return 0
  25126. }
  25127. }
  25128. for _isSpace(tls, _toAscii(tls, enc, *(*uintptr)(unsafe.Pointer(bp)), end)) != 0 {
  25129. *(*uintptr)(unsafe.Pointer(bp)) += uintptr((*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar)
  25130. }
  25131. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  25132. *(*uintptr)(unsafe.Pointer(badPtr)) = *(*uintptr)(unsafe.Pointer(bp))
  25133. return 0
  25134. }
  25135. return int32(1)
  25136. }
  25137. func _checkCharRefNumber(tls *libc.TLS, result int32) (r int32) {
  25138. switch result >> libc.Int32FromInt32(8) {
  25139. case int32(0xD8):
  25140. fallthrough
  25141. case int32(0xD9):
  25142. fallthrough
  25143. case int32(0xDA):
  25144. fallthrough
  25145. case int32(0xDB):
  25146. fallthrough
  25147. case int32(0xDC):
  25148. fallthrough
  25149. case int32(0xDD):
  25150. fallthrough
  25151. case int32(0xDE):
  25152. fallthrough
  25153. case int32(0xDF):
  25154. return -int32(1)
  25155. case 0:
  25156. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(result)))) == int32(_BT_NONXML) {
  25157. return -int32(1)
  25158. }
  25159. case int32(0xFF):
  25160. if result == int32(0xFFFE) || result == int32(0xFFFF) {
  25161. return -int32(1)
  25162. }
  25163. break
  25164. }
  25165. return result
  25166. }
  25167. func XXmlUtf8Encode(tls *libc.TLS, c int32, buf uintptr) (r int32) {
  25168. if c < 0 {
  25169. return 0
  25170. } /* LCOV_EXCL_LINE: this case is always eliminated beforehand */
  25171. if c < 128 {
  25172. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c | int32(_UTF8_cval1))
  25173. return int32(1)
  25174. }
  25175. if c < 2048 {
  25176. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6) | int32(_UTF8_cval2))
  25177. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25178. return int32(2)
  25179. }
  25180. if c < 65536 {
  25181. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12) | int32(_UTF8_cval3))
  25182. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25183. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25184. return int32(3)
  25185. }
  25186. if c < int32(0x110000) {
  25187. *(*uint8)(unsafe.Pointer(buf)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(18) | int32(_UTF8_cval4))
  25188. *(*uint8)(unsafe.Pointer(buf + 1)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(12)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25189. *(*uint8)(unsafe.Pointer(buf + 2)) = libc.Uint8FromInt32(c>>libc.Int32FromInt32(6)&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25190. *(*uint8)(unsafe.Pointer(buf + 3)) = libc.Uint8FromInt32(c&libc.Int32FromInt32(0x3f) | libc.Int32FromInt32(0x80))
  25191. return int32(4)
  25192. }
  25193. return 0 /* LCOV_EXCL_LINE: this case too is eliminated before calling */
  25194. }
  25195. func XXmlUtf16Encode(tls *libc.TLS, charNum int32, buf uintptr) (r int32) {
  25196. if charNum < 0 {
  25197. return 0
  25198. }
  25199. if charNum < int32(0x10000) {
  25200. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum)
  25201. return int32(1)
  25202. }
  25203. if charNum < int32(0x110000) {
  25204. charNum -= int32(0x10000)
  25205. *(*uint16)(unsafe.Pointer(buf)) = libc.Uint16FromInt32(charNum>>libc.Int32FromInt32(10) + libc.Int32FromInt32(0xD800))
  25206. *(*uint16)(unsafe.Pointer(buf + 1*2)) = libc.Uint16FromInt32(charNum&libc.Int32FromInt32(0x3FF) + libc.Int32FromInt32(0xDC00))
  25207. return int32(2)
  25208. }
  25209. return 0
  25210. }
  25211. type Tunknown_encoding = struct {
  25212. Fnormal Tnormal_encoding
  25213. Fconvert TCONVERTER
  25214. FuserData uintptr
  25215. Futf16 [256]uint16
  25216. Futf8 [256][4]uint8
  25217. }
  25218. func XXmlSizeOfUnknownEncoding(tls *libc.TLS) (r int32) {
  25219. return int32(2016)
  25220. }
  25221. func _unknown_isName(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  25222. var c int32
  25223. var uenc uintptr
  25224. _, _ = c, uenc
  25225. uenc = enc
  25226. 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)
  25227. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  25228. return 0
  25229. }
  25230. 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))))
  25231. }
  25232. func _unknown_isNmstrt(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  25233. var c int32
  25234. var uenc uintptr
  25235. _, _ = c, uenc
  25236. uenc = enc
  25237. 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)
  25238. if c & ^libc.Int32FromInt32(0xFFFF) != 0 {
  25239. return 0
  25240. }
  25241. 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))))
  25242. }
  25243. func _unknown_isInvalid(tls *libc.TLS, enc uintptr, p uintptr) (r int32) {
  25244. var c int32
  25245. var uenc uintptr
  25246. _, _ = c, uenc
  25247. uenc = enc
  25248. 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)
  25249. return libc.BoolInt32(c & ^libc.Int32FromInt32(0xFFFF) != 0 || _checkCharRefNumber(tls, c) < 0)
  25250. }
  25251. func _unknown_toUtf8(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  25252. bp := tls.Alloc(16)
  25253. defer tls.Free(16)
  25254. var c, n int32
  25255. var uenc, utf8, v2 uintptr
  25256. var _ /* buf at bp+0 */ [4]uint8
  25257. _, _, _, _, _ = c, n, uenc, utf8, v2
  25258. uenc = enc
  25259. for {
  25260. if *(*uintptr)(unsafe.Pointer(fromP)) == fromLim {
  25261. return int32(_XML_CONVERT_COMPLETED)
  25262. }
  25263. utf8 = uenc + 992 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*4
  25264. v2 = utf8
  25265. utf8++
  25266. n = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(v2)))
  25267. if n == 0 {
  25268. 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)))
  25269. n = XXmlUtf8Encode(tls, c, bp)
  25270. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  25271. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  25272. }
  25273. utf8 = bp
  25274. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  25275. } else {
  25276. if int64(n) > int64(toLim)-int64(*(*uintptr)(unsafe.Pointer(toP))) {
  25277. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  25278. }
  25279. *(*uintptr)(unsafe.Pointer(fromP))++
  25280. }
  25281. libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer(toP)), utf8, libc.Uint64FromInt32(n))
  25282. *(*uintptr)(unsafe.Pointer(toP)) += uintptr(n)
  25283. goto _1
  25284. _1:
  25285. }
  25286. return r
  25287. }
  25288. func _unknown_toUtf16(tls *libc.TLS, enc uintptr, fromP uintptr, fromLim uintptr, toP uintptr, toLim uintptr) (r _XML_Convert_Result) {
  25289. var c uint16
  25290. var uenc, v1, v2 uintptr
  25291. _, _, _, _ = c, uenc, v1, v2
  25292. uenc = enc
  25293. for *(*uintptr)(unsafe.Pointer(fromP)) < fromLim && *(*uintptr)(unsafe.Pointer(toP)) < toLim {
  25294. c = *(*uint16)(unsafe.Pointer(uenc + 480 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))*2))
  25295. if libc.Int32FromUint16(c) == 0 {
  25296. 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))))
  25297. *(*uintptr)(unsafe.Pointer(fromP)) += uintptr(libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(enc + 136 + uintptr(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(fromP)))))))) - (int32(_BT_LEAD2) - libc.Int32FromInt32(2)))
  25298. } else {
  25299. *(*uintptr)(unsafe.Pointer(fromP))++
  25300. }
  25301. v2 = toP
  25302. v1 = *(*uintptr)(unsafe.Pointer(v2))
  25303. *(*uintptr)(unsafe.Pointer(v2)) += 2
  25304. *(*uint16)(unsafe.Pointer(v1)) = c
  25305. }
  25306. if *(*uintptr)(unsafe.Pointer(toP)) == toLim && *(*uintptr)(unsafe.Pointer(fromP)) < fromLim {
  25307. return int32(_XML_CONVERT_OUTPUT_EXHAUSTED)
  25308. } else {
  25309. return int32(_XML_CONVERT_COMPLETED)
  25310. }
  25311. return r
  25312. }
  25313. func XXmlInitUnknownEncoding(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  25314. var c, i, v3 int32
  25315. var e uintptr
  25316. _, _, _, _ = c, e, i, v3
  25317. e = mem
  25318. libc.Xmemcpy(tls, mem, uintptr(unsafe.Pointer(&_latin1_encoding)), uint64(464))
  25319. i = 0
  25320. for {
  25321. if !(i < int32(128)) {
  25322. break
  25323. }
  25324. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(i)))) != int32(_BT_NONXML) && *(*int32)(unsafe.Pointer(table + uintptr(i)*4)) != i {
  25325. return uintptr(0)
  25326. }
  25327. goto _1
  25328. _1:
  25329. ;
  25330. i++
  25331. }
  25332. i = 0
  25333. for {
  25334. if !(i < int32(256)) {
  25335. break
  25336. }
  25337. c = *(*int32)(unsafe.Pointer(table + uintptr(i)*4))
  25338. if c == -int32(1) {
  25339. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_MALFORM)
  25340. /* This shouldn't really get used. */
  25341. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  25342. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  25343. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  25344. } else {
  25345. if c < 0 {
  25346. if c < -int32(4) {
  25347. return uintptr(0)
  25348. }
  25349. /* Multi-byte sequences need a converter function */
  25350. if !(convert != 0) {
  25351. return uintptr(0)
  25352. }
  25353. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = libc.Uint8FromInt32(int32(_BT_LEAD2) - (c + libc.Int32FromInt32(2)))
  25354. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(0)
  25355. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0)
  25356. } else {
  25357. if c < int32(0x80) {
  25358. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_OTHER) && libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))) != int32(_BT_NONXML) && c != i {
  25359. return uintptr(0)
  25360. }
  25361. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&_latin1_encoding)) + 136 + uintptr(c)))
  25362. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  25363. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = libc.Uint8FromInt32(c)
  25364. if c == 0 {
  25365. v3 = int32(0xFFFF)
  25366. } else {
  25367. v3 = c
  25368. }
  25369. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(v3)
  25370. } else {
  25371. if _checkCharRefNumber(tls, c) < 0 {
  25372. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NONXML)
  25373. /* This shouldn't really get used. */
  25374. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = uint16(0xFFFF)
  25375. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = uint8(1)
  25376. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4 + 1)) = uint8(0)
  25377. } else {
  25378. if c > int32(0xFFFF) {
  25379. return uintptr(0)
  25380. }
  25381. if _namingBitmap[libc.Int32FromUint8(_nmstrtPages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  25382. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NMSTRT)
  25383. } else {
  25384. if _namingBitmap[libc.Int32FromUint8(_namePages[c>>int32(8)])<<int32(3)+c&int32(0xff)>>int32(5)]&(uint32(1)<<(c&int32(0xff)&int32(0x1F))) != 0 {
  25385. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_NAME)
  25386. } else {
  25387. *(*uint8)(unsafe.Pointer(e + 136 + uintptr(i))) = uint8(_BT_OTHER)
  25388. }
  25389. }
  25390. *(*uint8)(unsafe.Pointer(e + 992 + uintptr(i)*4)) = libc.Uint8FromInt32(XXmlUtf8Encode(tls, c, e+992+uintptr(i)*4+uintptr(1)))
  25391. *(*uint16)(unsafe.Pointer(e + 480 + uintptr(i)*2)) = libc.Uint16FromInt32(c)
  25392. }
  25393. }
  25394. }
  25395. }
  25396. goto _2
  25397. _2:
  25398. ;
  25399. i++
  25400. }
  25401. (*Tunknown_encoding)(unsafe.Pointer(e)).FuserData = userData
  25402. (*Tunknown_encoding)(unsafe.Pointer(e)).Fconvert = convert
  25403. if convert != 0 {
  25404. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName2 = __ccgo_fp(_unknown_isName)
  25405. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName3 = __ccgo_fp(_unknown_isName)
  25406. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisName4 = __ccgo_fp(_unknown_isName)
  25407. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt2 = __ccgo_fp(_unknown_isNmstrt)
  25408. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt3 = __ccgo_fp(_unknown_isNmstrt)
  25409. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisNmstrt4 = __ccgo_fp(_unknown_isNmstrt)
  25410. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid2 = __ccgo_fp(_unknown_isInvalid)
  25411. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid3 = __ccgo_fp(_unknown_isInvalid)
  25412. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.FisInvalid4 = __ccgo_fp(_unknown_isInvalid)
  25413. }
  25414. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf8Convert = __ccgo_fp(_unknown_toUtf8)
  25415. (*Tunknown_encoding)(unsafe.Pointer(e)).Fnormal.Fenc.Futf16Convert = __ccgo_fp(_unknown_toUtf16)
  25416. return e
  25417. }
  25418. const _UNKNOWN_ENC = -1
  25419. const _ISO_8859_1_ENC = 0
  25420. const _US_ASCII_ENC = 1
  25421. const _UTF_8_ENC = 2
  25422. const _UTF_16_ENC = 3
  25423. const _UTF_16BE_ENC = 4
  25424. const _UTF_16LE_ENC = 5
  25425. const
  25426. /* must match encodingNames up to here */
  25427. _NO_ENC = 6
  25428. var _KW_ISO_8859_1 = [11]uint8{
  25429. 0: uint8(m_ASCII_I),
  25430. 1: uint8(m_ASCII_S),
  25431. 2: uint8(m_ASCII_O),
  25432. 3: uint8(m_ASCII_MINUS1),
  25433. 4: uint8(m_ASCII_8),
  25434. 5: uint8(m_ASCII_8),
  25435. 6: uint8(m_ASCII_51),
  25436. 7: uint8(m_ASCII_9),
  25437. 8: uint8(m_ASCII_MINUS1),
  25438. 9: uint8(m_ASCII_1),
  25439. }
  25440. var _KW_US_ASCII = [9]uint8{
  25441. 0: uint8(m_ASCII_U1),
  25442. 1: uint8(m_ASCII_S),
  25443. 2: uint8(m_ASCII_MINUS1),
  25444. 3: uint8(m_ASCII_A),
  25445. 4: uint8(m_ASCII_S),
  25446. 5: uint8(m_ASCII_C),
  25447. 6: uint8(m_ASCII_I),
  25448. 7: uint8(m_ASCII_I),
  25449. }
  25450. var _KW_UTF_8 = [6]uint8{
  25451. 0: uint8(m_ASCII_U1),
  25452. 1: uint8(m_ASCII_T),
  25453. 2: uint8(m_ASCII_F),
  25454. 3: uint8(m_ASCII_MINUS1),
  25455. 4: uint8(m_ASCII_8),
  25456. }
  25457. var _KW_UTF_16 = [7]uint8{
  25458. 0: uint8(m_ASCII_U1),
  25459. 1: uint8(m_ASCII_T),
  25460. 2: uint8(m_ASCII_F),
  25461. 3: uint8(m_ASCII_MINUS1),
  25462. 4: uint8(m_ASCII_1),
  25463. 5: uint8(m_ASCII_61),
  25464. }
  25465. var _KW_UTF_16BE = [9]uint8{
  25466. 0: uint8(m_ASCII_U1),
  25467. 1: uint8(m_ASCII_T),
  25468. 2: uint8(m_ASCII_F),
  25469. 3: uint8(m_ASCII_MINUS1),
  25470. 4: uint8(m_ASCII_1),
  25471. 5: uint8(m_ASCII_61),
  25472. 6: uint8(m_ASCII_B1),
  25473. 7: uint8(m_ASCII_E),
  25474. }
  25475. var _KW_UTF_16LE = [9]uint8{
  25476. 0: uint8(m_ASCII_U1),
  25477. 1: uint8(m_ASCII_T),
  25478. 2: uint8(m_ASCII_F),
  25479. 3: uint8(m_ASCII_MINUS1),
  25480. 4: uint8(m_ASCII_1),
  25481. 5: uint8(m_ASCII_61),
  25482. 6: uint8(m_ASCII_L),
  25483. 7: uint8(m_ASCII_E),
  25484. }
  25485. func _getEncodingIndex(tls *libc.TLS, name uintptr) (r int32) {
  25486. var i int32
  25487. _ = i
  25488. if name == libc.UintptrFromInt32(0) {
  25489. return int32(_NO_ENC)
  25490. }
  25491. i = 0
  25492. for {
  25493. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(48)/libc.Uint64FromInt64(8))) {
  25494. break
  25495. }
  25496. if _streqci(tls, name, _encodingNames[i]) != 0 {
  25497. return i
  25498. }
  25499. goto _1
  25500. _1:
  25501. ;
  25502. i++
  25503. }
  25504. return int32(_UNKNOWN_ENC)
  25505. }
  25506. var _encodingNames = [6]uintptr{
  25507. 0: uintptr(unsafe.Pointer(&_KW_ISO_8859_1)),
  25508. 1: uintptr(unsafe.Pointer(&_KW_US_ASCII)),
  25509. 2: uintptr(unsafe.Pointer(&_KW_UTF_8)),
  25510. 3: uintptr(unsafe.Pointer(&_KW_UTF_16)),
  25511. 4: uintptr(unsafe.Pointer(&_KW_UTF_16BE)),
  25512. 5: uintptr(unsafe.Pointer(&_KW_UTF_16LE)),
  25513. }
  25514. /* For binary compatibility, we store the index of the encoding
  25515. specified at initialization in the isUtf16 member.
  25516. */
  25517. /* This is what detects the encoding. encodingTable maps from
  25518. encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of
  25519. the external (protocol) specified encoding; state is
  25520. XML_CONTENT_STATE if we're parsing an external text entity, and
  25521. XML_PROLOG_STATE otherwise.
  25522. */
  25523. func _initScan(tls *libc.TLS, encodingTable uintptr, enc uintptr, state int32, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25524. var e int32
  25525. var encPtr uintptr
  25526. _, _ = e, encPtr
  25527. if ptr >= end {
  25528. return -int32(4)
  25529. }
  25530. encPtr = (*TINIT_ENCODING)(unsafe.Pointer(enc)).FencPtr
  25531. if ptr+uintptr(1) == end {
  25532. /* only a single byte available for auto-detection */
  25533. /* so we're parsing an external text entity... */
  25534. /* if UTF-16 was externally specified, then we need at least 2 bytes */
  25535. switch libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) {
  25536. case int32(_UTF_16_ENC):
  25537. fallthrough
  25538. case int32(_UTF_16LE_ENC):
  25539. fallthrough
  25540. case int32(_UTF_16BE_ENC):
  25541. return -int32(1)
  25542. }
  25543. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) {
  25544. case int32(0xFE):
  25545. fallthrough
  25546. case int32(0xFF):
  25547. fallthrough
  25548. case int32(0xEF): /* possibly first byte of UTF-8 BOM */
  25549. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  25550. break
  25551. }
  25552. /* fall through */
  25553. fallthrough
  25554. case 0x00:
  25555. fallthrough
  25556. case int32(0x3C):
  25557. return -int32(1)
  25558. }
  25559. } else {
  25560. switch libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr)))<<libc.Int32FromInt32(8) | libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) {
  25561. case int32(0xFEFF):
  25562. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  25563. break
  25564. }
  25565. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25566. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  25567. return int32(m_XML_TOK_BOM)
  25568. /* 00 3C is handled in the default case */
  25569. fallthrough
  25570. case int32(0x3C00):
  25571. if (libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16BE_ENC) || libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16_ENC)) && state == int32(m_XML_CONTENT_STATE) {
  25572. break
  25573. }
  25574. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  25575. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25576. case int32(0xFFFE):
  25577. if libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_ISO_8859_1_ENC) && state == int32(m_XML_CONTENT_STATE) {
  25578. break
  25579. }
  25580. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(2)
  25581. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  25582. return int32(m_XML_TOK_BOM)
  25583. case int32(0xEFBB):
  25584. /* Maybe a UTF-8 BOM (EF BB BF) */
  25585. /* If there's an explicitly specified (external) encoding
  25586. of ISO-8859-1 or some flavour of UTF-16
  25587. and this is an external text entity,
  25588. don't look for the BOM,
  25589. because it might be a legal data.
  25590. */
  25591. if state == int32(m_XML_CONTENT_STATE) {
  25592. e = libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16)
  25593. if e == int32(_ISO_8859_1_ENC) || e == int32(_UTF_16BE_ENC) || e == int32(_UTF_16LE_ENC) || e == int32(_UTF_16_ENC) {
  25594. break
  25595. }
  25596. }
  25597. if ptr+uintptr(2) == end {
  25598. return -int32(1)
  25599. }
  25600. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 2))) == int32(0xBF) {
  25601. *(*uintptr)(unsafe.Pointer(nextTokPtr)) = ptr + uintptr(3)
  25602. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_8_ENC)*8))
  25603. return int32(m_XML_TOK_BOM)
  25604. }
  25605. default:
  25606. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr))) == int32('\000') {
  25607. /* 0 isn't a legal data character. Furthermore a document
  25608. entity can only start with ASCII characters. So the only
  25609. way this can fail to be big-endian UTF-16 if it it's an
  25610. external parsed general entity that's labelled as
  25611. UTF-16LE.
  25612. */
  25613. if state == int32(m_XML_CONTENT_STATE) && libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16) == int32(_UTF_16LE_ENC) {
  25614. break
  25615. }
  25616. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16BE_ENC)*8))
  25617. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25618. } else {
  25619. if libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(ptr + 1))) == int32('\000') {
  25620. /* We could recover here in the case:
  25621. - parsing an external entity
  25622. - second byte is 0
  25623. - no externally specified encoding
  25624. - no encoding declaration
  25625. by assuming UTF-16LE. But we don't, because this would mean when
  25626. presented just with a single byte, we couldn't reliably determine
  25627. whether we needed further bytes.
  25628. */
  25629. if state == int32(m_XML_CONTENT_STATE) {
  25630. break
  25631. }
  25632. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(_UTF_16LE_ENC)*8))
  25633. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25634. }
  25635. }
  25636. break
  25637. }
  25638. }
  25639. *(*uintptr)(unsafe.Pointer(encPtr)) = *(*uintptr)(unsafe.Pointer(encodingTable + uintptr(libc.Int32FromUint8((*TINIT_ENCODING)(unsafe.Pointer(enc)).FinitEnc.FisUtf16))*8))
  25640. return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(&struct{ uintptr }{*(*TSCANNER)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(encPtr)) + uintptr(state)*8))})))(tls, *(*uintptr)(unsafe.Pointer(encPtr)), ptr, end, nextTokPtr)
  25641. }
  25642. /* This file is included!
  25643. __ __ _
  25644. ___\ \/ /_ __ __ _| |_
  25645. / _ \\ /| '_ \ / _` | __|
  25646. | __// \| |_) | (_| | |_
  25647. \___/_/\_\ .__/ \__,_|\__|
  25648. |_| XML parser
  25649. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  25650. Copyright (c) 2000-2017 Expat development team
  25651. Licensed under the MIT license:
  25652. Permission is hereby granted, free of charge, to any person obtaining
  25653. a copy of this software and associated documentation files (the
  25654. "Software"), to deal in the Software without restriction, including
  25655. without limitation the rights to use, copy, modify, merge, publish,
  25656. distribute, sublicense, and/or sell copies of the Software, and to permit
  25657. persons to whom the Software is furnished to do so, subject to the
  25658. following conditions:
  25659. The above copyright notice and this permission notice shall be included
  25660. in all copies or substantial portions of the Software.
  25661. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25662. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25663. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25664. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25665. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25666. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25667. USE OR OTHER DEALINGS IN THE SOFTWARE.
  25668. */
  25669. func XXmlGetUtf8InternalEncoding(tls *libc.TLS) (r uintptr) {
  25670. return uintptr(unsafe.Pointer(&_internal_utf8_encoding))
  25671. }
  25672. func XXmlGetUtf16InternalEncoding(tls *libc.TLS) (r uintptr) {
  25673. return uintptr(unsafe.Pointer(&_internal_little2_encoding))
  25674. }
  25675. var _encodings = [7]uintptr{
  25676. 0: uintptr(unsafe.Pointer(&_latin1_encoding)),
  25677. 1: uintptr(unsafe.Pointer(&_ascii_encoding)),
  25678. 2: uintptr(unsafe.Pointer(&_utf8_encoding)),
  25679. 3: uintptr(unsafe.Pointer(&_big2_encoding)),
  25680. 4: uintptr(unsafe.Pointer(&_big2_encoding)),
  25681. 5: uintptr(unsafe.Pointer(&_little2_encoding)),
  25682. 6: uintptr(unsafe.Pointer(&_utf8_encoding)),
  25683. }
  25684. func _initScanProlog(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25685. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  25686. }
  25687. func _initScanContent(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25688. return _initScan(tls, uintptr(unsafe.Pointer(&_encodings)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  25689. }
  25690. func XXmlInitEncoding(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  25691. var i int32
  25692. _ = i
  25693. i = _getEncodingIndex(tls, name)
  25694. if i == int32(_UNKNOWN_ENC) {
  25695. return 0
  25696. }
  25697. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  25698. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanProlog)
  25699. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContent)
  25700. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  25701. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  25702. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  25703. return int32(1)
  25704. }
  25705. func _findEncoding(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  25706. bp := tls.Alloc(144)
  25707. defer tls.Free(144)
  25708. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  25709. var i int32
  25710. var _ /* buf at bp+8 */ [128]uint8
  25711. var _ /* p at bp+136 */ uintptr
  25712. _ = i
  25713. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  25714. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  25715. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  25716. return uintptr(0)
  25717. }
  25718. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  25719. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  25720. return enc
  25721. }
  25722. i = _getEncodingIndex(tls, bp+8)
  25723. if i == int32(_UNKNOWN_ENC) {
  25724. return uintptr(0)
  25725. }
  25726. return _encodings[i]
  25727. }
  25728. 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) {
  25729. return _doParseXmlDecl(tls, __ccgo_fp(_findEncoding), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  25730. }
  25731. /* This file is included!
  25732. __ __ _
  25733. ___\ \/ /_ __ __ _| |_
  25734. / _ \\ /| '_ \ / _` | __|
  25735. | __// \| |_) | (_| | |_
  25736. \___/_/\_\ .__/ \__,_|\__|
  25737. |_| XML parser
  25738. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  25739. Copyright (c) 2000-2017 Expat development team
  25740. Licensed under the MIT license:
  25741. Permission is hereby granted, free of charge, to any person obtaining
  25742. a copy of this software and associated documentation files (the
  25743. "Software"), to deal in the Software without restriction, including
  25744. without limitation the rights to use, copy, modify, merge, publish,
  25745. distribute, sublicense, and/or sell copies of the Software, and to permit
  25746. persons to whom the Software is furnished to do so, subject to the
  25747. following conditions:
  25748. The above copyright notice and this permission notice shall be included
  25749. in all copies or substantial portions of the Software.
  25750. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25751. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25752. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25753. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25754. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25755. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25756. USE OR OTHER DEALINGS IN THE SOFTWARE.
  25757. */
  25758. func XXmlGetUtf8InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  25759. return uintptr(unsafe.Pointer(&_internal_utf8_encoding_ns))
  25760. }
  25761. func XXmlGetUtf16InternalEncodingNS(tls *libc.TLS) (r uintptr) {
  25762. return uintptr(unsafe.Pointer(&_internal_little2_encoding_ns))
  25763. }
  25764. var _encodingsNS = [7]uintptr{
  25765. 0: uintptr(unsafe.Pointer(&_latin1_encoding_ns)),
  25766. 1: uintptr(unsafe.Pointer(&_ascii_encoding_ns)),
  25767. 2: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  25768. 3: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  25769. 4: uintptr(unsafe.Pointer(&_big2_encoding_ns)),
  25770. 5: uintptr(unsafe.Pointer(&_little2_encoding_ns)),
  25771. 6: uintptr(unsafe.Pointer(&_utf8_encoding_ns)),
  25772. }
  25773. func _initScanPrologNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25774. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, m_XML_PROLOG_STATE, ptr, end, nextTokPtr)
  25775. }
  25776. func _initScanContentNS(tls *libc.TLS, enc uintptr, ptr uintptr, end uintptr, nextTokPtr uintptr) (r int32) {
  25777. return _initScan(tls, uintptr(unsafe.Pointer(&_encodingsNS)), enc, int32(m_XML_CONTENT_STATE), ptr, end, nextTokPtr)
  25778. }
  25779. func XXmlInitEncodingNS(tls *libc.TLS, p uintptr, encPtr uintptr, name uintptr) (r int32) {
  25780. var i int32
  25781. _ = i
  25782. i = _getEncodingIndex(tls, name)
  25783. if i == int32(_UNKNOWN_ENC) {
  25784. return 0
  25785. }
  25786. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FisUtf16 = libc.Uint8FromInt32(i)
  25787. *(*TSCANNER)(unsafe.Pointer(p)) = __ccgo_fp(_initScanPrologNS)
  25788. *(*TSCANNER)(unsafe.Pointer(p + 1*8)) = __ccgo_fp(_initScanContentNS)
  25789. (*TINIT_ENCODING)(unsafe.Pointer(p)).FinitEnc.FupdatePosition = __ccgo_fp(_initUpdatePosition)
  25790. (*TINIT_ENCODING)(unsafe.Pointer(p)).FencPtr = encPtr
  25791. *(*uintptr)(unsafe.Pointer(encPtr)) = p
  25792. return int32(1)
  25793. }
  25794. func _findEncodingNS(tls *libc.TLS, enc uintptr, _ptr uintptr, end uintptr) (r uintptr) {
  25795. bp := tls.Alloc(144)
  25796. defer tls.Free(144)
  25797. *(*uintptr)(unsafe.Pointer(bp)) = _ptr
  25798. var i int32
  25799. var _ /* buf at bp+8 */ [128]uint8
  25800. var _ /* p at bp+136 */ uintptr
  25801. _ = i
  25802. *(*uintptr)(unsafe.Pointer(bp + 136)) = bp + 8
  25803. (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) _XML_Convert_Result)(unsafe.Pointer(&struct{ uintptr }{(*TENCODING)(unsafe.Pointer(enc)).Futf8Convert})))(tls, enc, bp, end, bp+136, *(*uintptr)(unsafe.Pointer(bp + 136))+uintptr(m_ENCODING_MAX)-uintptr(1))
  25804. if *(*uintptr)(unsafe.Pointer(bp)) != end {
  25805. return uintptr(0)
  25806. }
  25807. *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 136)))) = uint8(0)
  25808. if _streqci(tls, bp+8, uintptr(unsafe.Pointer(&_KW_UTF_16))) != 0 && (*TENCODING)(unsafe.Pointer(enc)).FminBytesPerChar == int32(2) {
  25809. return enc
  25810. }
  25811. i = _getEncodingIndex(tls, bp+8)
  25812. if i == int32(_UNKNOWN_ENC) {
  25813. return uintptr(0)
  25814. }
  25815. return _encodingsNS[i]
  25816. }
  25817. 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) {
  25818. return _doParseXmlDecl(tls, __ccgo_fp(_findEncodingNS), isGeneralTextEntity, enc, ptr, end, badPtr, versionPtr, versionEndPtr, encodingName, encoding, standalone)
  25819. }
  25820. func XXmlInitUnknownEncodingNS(tls *libc.TLS, mem uintptr, table uintptr, convert TCONVERTER, userData uintptr) (r uintptr) {
  25821. var enc uintptr
  25822. _ = enc
  25823. enc = XXmlInitUnknownEncoding(tls, mem, table, convert, userData)
  25824. if enc != 0 {
  25825. *(*uint8)(unsafe.Pointer(enc + 136 + 58)) = uint8(_BT_COLON)
  25826. }
  25827. return enc
  25828. }
  25829. const m_ASCII_01 = 0x30
  25830. const m_ASCII_11 = 0x31
  25831. const m_ASCII_21 = 0x32
  25832. const m_ASCII_31 = 0x33
  25833. const m_ASCII_42 = 0x34
  25834. const m_ASCII_52 = 0x35
  25835. const m_ASCII_62 = 0x36
  25836. const m_ASCII_72 = 0x37
  25837. const m_ASCII_81 = 0x38
  25838. const m_ASCII_91 = 0x39
  25839. const m_ASCII_AMP2 = 0x26
  25840. const m_ASCII_APOS2 = 0x27
  25841. const m_ASCII_COLON1 = 0x3A
  25842. const m_ASCII_EQUALS1 = 0x3D
  25843. const m_ASCII_EXCL1 = 0x21
  25844. const m_ASCII_G1 = 71
  25845. const m_ASCII_GT2 = 0x3E
  25846. const m_ASCII_K2 = 75
  25847. const m_ASCII_LSQB2 = 0x5B
  25848. const m_ASCII_LT2 = 0x3C
  25849. const m_ASCII_MINUS2 = 0x2D
  25850. const m_ASCII_N2 = 78
  25851. const m_ASCII_P1 = 80
  25852. const m_ASCII_PERIOD1 = 0x2E
  25853. const m_ASCII_Q1 = 81
  25854. const m_ASCII_QUOT2 = 0x22
  25855. const m_ASCII_R2 = 82
  25856. const m_ASCII_RSQB2 = 0x5D
  25857. const m_ASCII_SEMI2 = 0x3B
  25858. const m_ASCII_SPACE2 = 0x20
  25859. const m_ASCII_TAB2 = 0x09
  25860. const m_ASCII_UNDERSCORE2 = 0x5F
  25861. const m_ASCII_Y2 = 89
  25862. const m_ASCII_Z2 = 0x5A
  25863. const m_ASCII_a1 = 0x61
  25864. const m_ASCII_b2 = 0x62
  25865. const m_ASCII_c1 = 0x63
  25866. const m_ASCII_d2 = 0x64
  25867. const m_ASCII_e1 = 0x65
  25868. const m_ASCII_f2 = 0x66
  25869. const m_ASCII_g1 = 0x67
  25870. const m_ASCII_i2 = 0x69
  25871. const m_ASCII_l1 = 0x6C
  25872. const m_ASCII_m1 = 0x6D
  25873. const m_ASCII_n1 = 0x6E
  25874. const m_ASCII_o1 = 0x6F
  25875. const m_ASCII_p1 = 0x70
  25876. const m_ASCII_q2 = 0x71
  25877. const m_ASCII_r1 = 0x72
  25878. const m_ASCII_s1 = 0x73
  25879. const m_ASCII_t1 = 0x74
  25880. const m_ASCII_u2 = 0x75
  25881. const m_ASCII_v2 = 0x76
  25882. const m_ASCII_x1 = 0x78
  25883. const m_ASCII_y2 = 0x79
  25884. const m_ASCII_z2 = 0x7A
  25885. /*
  25886. __ __ _
  25887. ___\ \/ /_ __ __ _| |_
  25888. / _ \\ /| '_ \ / _` | __|
  25889. | __// \| |_) | (_| | |_
  25890. \___/_/\_\ .__/ \__,_|\__|
  25891. |_| XML parser
  25892. Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
  25893. Copyright (c) 2000-2017 Expat development team
  25894. Licensed under the MIT license:
  25895. Permission is hereby granted, free of charge, to any person obtaining
  25896. a copy of this software and associated documentation files (the
  25897. "Software"), to deal in the Software without restriction, including
  25898. without limitation the rights to use, copy, modify, merge, publish,
  25899. distribute, sublicense, and/or sell copies of the Software, and to permit
  25900. persons to whom the Software is furnished to do so, subject to the
  25901. following conditions:
  25902. The above copyright notice and this permission notice shall be included
  25903. in all copies or substantial portions of the Software.
  25904. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25905. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25906. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  25907. NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  25908. DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  25909. OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  25910. USE OR OTHER DEALINGS IN THE SOFTWARE.
  25911. */
  25912. /* Doesn't check:
  25913. that ,| are not mixed in a model group
  25914. content of literals
  25915. */
  25916. var _KW_ANY = [4]uint8{
  25917. 0: uint8(m_ASCII_A),
  25918. 1: uint8(m_ASCII_N2),
  25919. 2: uint8(m_ASCII_Y2),
  25920. }
  25921. var _KW_ATTLIST = [8]uint8{
  25922. 0: uint8(m_ASCII_A),
  25923. 1: uint8(m_ASCII_T),
  25924. 2: uint8(m_ASCII_T),
  25925. 3: uint8(m_ASCII_L),
  25926. 4: uint8(m_ASCII_I),
  25927. 5: uint8(m_ASCII_S),
  25928. 6: uint8(m_ASCII_T),
  25929. }
  25930. var _KW_CDATA = [6]uint8{
  25931. 0: uint8(m_ASCII_C),
  25932. 1: uint8(m_ASCII_D),
  25933. 2: uint8(m_ASCII_A),
  25934. 3: uint8(m_ASCII_T),
  25935. 4: uint8(m_ASCII_A),
  25936. }
  25937. var _KW_DOCTYPE = [8]uint8{
  25938. 0: uint8(m_ASCII_D),
  25939. 1: uint8(m_ASCII_O),
  25940. 2: uint8(m_ASCII_C),
  25941. 3: uint8(m_ASCII_T),
  25942. 4: uint8(m_ASCII_Y2),
  25943. 5: uint8(m_ASCII_P1),
  25944. 6: uint8(m_ASCII_E),
  25945. }
  25946. var _KW_ELEMENT = [8]uint8{
  25947. 0: uint8(m_ASCII_E),
  25948. 1: uint8(m_ASCII_L),
  25949. 2: uint8(m_ASCII_E),
  25950. 3: uint8(m_ASCII_M),
  25951. 4: uint8(m_ASCII_E),
  25952. 5: uint8(m_ASCII_N2),
  25953. 6: uint8(m_ASCII_T),
  25954. }
  25955. var _KW_EMPTY = [6]uint8{
  25956. 0: uint8(m_ASCII_E),
  25957. 1: uint8(m_ASCII_M),
  25958. 2: uint8(m_ASCII_P1),
  25959. 3: uint8(m_ASCII_T),
  25960. 4: uint8(m_ASCII_Y2),
  25961. }
  25962. var _KW_ENTITIES = [9]uint8{
  25963. 0: uint8(m_ASCII_E),
  25964. 1: uint8(m_ASCII_N2),
  25965. 2: uint8(m_ASCII_T),
  25966. 3: uint8(m_ASCII_I),
  25967. 4: uint8(m_ASCII_T),
  25968. 5: uint8(m_ASCII_I),
  25969. 6: uint8(m_ASCII_E),
  25970. 7: uint8(m_ASCII_S),
  25971. }
  25972. var _KW_ENTITY = [7]uint8{
  25973. 0: uint8(m_ASCII_E),
  25974. 1: uint8(m_ASCII_N2),
  25975. 2: uint8(m_ASCII_T),
  25976. 3: uint8(m_ASCII_I),
  25977. 4: uint8(m_ASCII_T),
  25978. 5: uint8(m_ASCII_Y2),
  25979. }
  25980. var _KW_FIXED = [6]uint8{
  25981. 0: uint8(m_ASCII_F),
  25982. 1: uint8(m_ASCII_I),
  25983. 2: uint8(m_ASCII_X),
  25984. 3: uint8(m_ASCII_E),
  25985. 4: uint8(m_ASCII_D),
  25986. }
  25987. var _KW_ID = [3]uint8{
  25988. 0: uint8(m_ASCII_I),
  25989. 1: uint8(m_ASCII_D),
  25990. }
  25991. var _KW_IDREF = [6]uint8{
  25992. 0: uint8(m_ASCII_I),
  25993. 1: uint8(m_ASCII_D),
  25994. 2: uint8(m_ASCII_R2),
  25995. 3: uint8(m_ASCII_E),
  25996. 4: uint8(m_ASCII_F),
  25997. }
  25998. var _KW_IDREFS = [7]uint8{
  25999. 0: uint8(m_ASCII_I),
  26000. 1: uint8(m_ASCII_D),
  26001. 2: uint8(m_ASCII_R2),
  26002. 3: uint8(m_ASCII_E),
  26003. 4: uint8(m_ASCII_F),
  26004. 5: uint8(m_ASCII_S),
  26005. }
  26006. var _KW_IGNORE = [7]uint8{
  26007. 0: uint8(m_ASCII_I),
  26008. 1: uint8(m_ASCII_G1),
  26009. 2: uint8(m_ASCII_N2),
  26010. 3: uint8(m_ASCII_O),
  26011. 4: uint8(m_ASCII_R2),
  26012. 5: uint8(m_ASCII_E),
  26013. }
  26014. var _KW_IMPLIED = [8]uint8{
  26015. 0: uint8(m_ASCII_I),
  26016. 1: uint8(m_ASCII_M),
  26017. 2: uint8(m_ASCII_P1),
  26018. 3: uint8(m_ASCII_L),
  26019. 4: uint8(m_ASCII_I),
  26020. 5: uint8(m_ASCII_E),
  26021. 6: uint8(m_ASCII_D),
  26022. }
  26023. var _KW_INCLUDE = [8]uint8{
  26024. 0: uint8(m_ASCII_I),
  26025. 1: uint8(m_ASCII_N2),
  26026. 2: uint8(m_ASCII_C),
  26027. 3: uint8(m_ASCII_L),
  26028. 4: uint8(m_ASCII_U1),
  26029. 5: uint8(m_ASCII_D),
  26030. 6: uint8(m_ASCII_E),
  26031. }
  26032. var _KW_NDATA = [6]uint8{
  26033. 0: uint8(m_ASCII_N2),
  26034. 1: uint8(m_ASCII_D),
  26035. 2: uint8(m_ASCII_A),
  26036. 3: uint8(m_ASCII_T),
  26037. 4: uint8(m_ASCII_A),
  26038. }
  26039. var _KW_NMTOKEN = [8]uint8{
  26040. 0: uint8(m_ASCII_N2),
  26041. 1: uint8(m_ASCII_M),
  26042. 2: uint8(m_ASCII_T),
  26043. 3: uint8(m_ASCII_O),
  26044. 4: uint8(m_ASCII_K2),
  26045. 5: uint8(m_ASCII_E),
  26046. 6: uint8(m_ASCII_N2),
  26047. }
  26048. var _KW_NMTOKENS = [9]uint8{
  26049. 0: uint8(m_ASCII_N2),
  26050. 1: uint8(m_ASCII_M),
  26051. 2: uint8(m_ASCII_T),
  26052. 3: uint8(m_ASCII_O),
  26053. 4: uint8(m_ASCII_K2),
  26054. 5: uint8(m_ASCII_E),
  26055. 6: uint8(m_ASCII_N2),
  26056. 7: uint8(m_ASCII_S),
  26057. }
  26058. var _KW_NOTATION = [9]uint8{
  26059. 0: uint8(m_ASCII_N2),
  26060. 1: uint8(m_ASCII_O),
  26061. 2: uint8(m_ASCII_T),
  26062. 3: uint8(m_ASCII_A),
  26063. 4: uint8(m_ASCII_T),
  26064. 5: uint8(m_ASCII_I),
  26065. 6: uint8(m_ASCII_O),
  26066. 7: uint8(m_ASCII_N2),
  26067. }
  26068. var _KW_PCDATA = [7]uint8{
  26069. 0: uint8(m_ASCII_P1),
  26070. 1: uint8(m_ASCII_C),
  26071. 2: uint8(m_ASCII_D),
  26072. 3: uint8(m_ASCII_A),
  26073. 4: uint8(m_ASCII_T),
  26074. 5: uint8(m_ASCII_A),
  26075. }
  26076. var _KW_PUBLIC = [7]uint8{
  26077. 0: uint8(m_ASCII_P1),
  26078. 1: uint8(m_ASCII_U1),
  26079. 2: uint8(m_ASCII_B1),
  26080. 3: uint8(m_ASCII_L),
  26081. 4: uint8(m_ASCII_I),
  26082. 5: uint8(m_ASCII_C),
  26083. }
  26084. var _KW_REQUIRED = [9]uint8{
  26085. 0: uint8(m_ASCII_R2),
  26086. 1: uint8(m_ASCII_E),
  26087. 2: uint8(m_ASCII_Q1),
  26088. 3: uint8(m_ASCII_U1),
  26089. 4: uint8(m_ASCII_I),
  26090. 5: uint8(m_ASCII_R2),
  26091. 6: uint8(m_ASCII_E),
  26092. 7: uint8(m_ASCII_D),
  26093. }
  26094. var _KW_SYSTEM = [7]uint8{
  26095. 0: uint8(m_ASCII_S),
  26096. 1: uint8(m_ASCII_Y2),
  26097. 2: uint8(m_ASCII_S),
  26098. 3: uint8(m_ASCII_T),
  26099. 4: uint8(m_ASCII_E),
  26100. 5: uint8(m_ASCII_M),
  26101. }
  26102. func _prolog0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26103. switch tok {
  26104. case int32(m_XML_TOK_PROLOG_S):
  26105. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26106. return int32(_XML_ROLE_NONE)
  26107. case int32(m_XML_TOK_XML_DECL):
  26108. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26109. return int32(_XML_ROLE_XML_DECL)
  26110. case int32(m_XML_TOK_PI):
  26111. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26112. return int32(_XML_ROLE_PI)
  26113. case int32(m_XML_TOK_COMMENT):
  26114. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog1)
  26115. return int32(_XML_ROLE_COMMENT)
  26116. case int32(m_XML_TOK_BOM):
  26117. return int32(_XML_ROLE_NONE)
  26118. case int32(m_XML_TOK_DECL_OPEN):
  26119. 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) {
  26120. break
  26121. }
  26122. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  26123. return int32(_XML_ROLE_DOCTYPE_NONE)
  26124. case int32(m_XML_TOK_INSTANCE_START):
  26125. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  26126. return int32(_XML_ROLE_INSTANCE_START)
  26127. }
  26128. return _common(tls, state, tok)
  26129. }
  26130. func _prolog1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26131. switch tok {
  26132. case int32(m_XML_TOK_PROLOG_S):
  26133. return int32(_XML_ROLE_NONE)
  26134. case int32(m_XML_TOK_PI):
  26135. return int32(_XML_ROLE_PI)
  26136. case int32(m_XML_TOK_COMMENT):
  26137. return int32(_XML_ROLE_COMMENT)
  26138. case int32(m_XML_TOK_BOM):
  26139. /* This case can never arise. To reach this role function, the
  26140. * parse must have passed through prolog0 and therefore have had
  26141. * some form of input, even if only a space. At that point, a
  26142. * byte order mark is no longer a valid character (though
  26143. * technically it should be interpreted as a non-breaking space),
  26144. * so will be rejected by the tokenizing stages.
  26145. */
  26146. return int32(_XML_ROLE_NONE) /* LCOV_EXCL_LINE */
  26147. case int32(m_XML_TOK_DECL_OPEN):
  26148. 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) {
  26149. break
  26150. }
  26151. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype0)
  26152. return int32(_XML_ROLE_DOCTYPE_NONE)
  26153. case int32(m_XML_TOK_INSTANCE_START):
  26154. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  26155. return int32(_XML_ROLE_INSTANCE_START)
  26156. }
  26157. return _common(tls, state, tok)
  26158. }
  26159. func _prolog2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26160. _ = ptr
  26161. _ = end
  26162. _ = enc
  26163. switch tok {
  26164. case int32(m_XML_TOK_PROLOG_S):
  26165. return int32(_XML_ROLE_NONE)
  26166. case int32(m_XML_TOK_PI):
  26167. return int32(_XML_ROLE_PI)
  26168. case int32(m_XML_TOK_COMMENT):
  26169. return int32(_XML_ROLE_COMMENT)
  26170. case int32(m_XML_TOK_INSTANCE_START):
  26171. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  26172. return int32(_XML_ROLE_INSTANCE_START)
  26173. }
  26174. return _common(tls, state, tok)
  26175. }
  26176. func _doctype0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26177. _ = ptr
  26178. _ = end
  26179. _ = enc
  26180. switch tok {
  26181. case int32(m_XML_TOK_PROLOG_S):
  26182. return int32(_XML_ROLE_DOCTYPE_NONE)
  26183. case int32(m_XML_TOK_NAME):
  26184. fallthrough
  26185. case int32(m_XML_TOK_PREFIXED_NAME):
  26186. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype1)
  26187. return int32(_XML_ROLE_DOCTYPE_NAME)
  26188. }
  26189. return _common(tls, state, tok)
  26190. }
  26191. func _doctype1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26192. switch tok {
  26193. case int32(m_XML_TOK_PROLOG_S):
  26194. return int32(_XML_ROLE_DOCTYPE_NONE)
  26195. case int32(m_XML_TOK_OPEN_BRACKET):
  26196. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  26197. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  26198. case int32(m_XML_TOK_DECL_CLOSE):
  26199. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  26200. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  26201. case int32(m_XML_TOK_NAME):
  26202. 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 {
  26203. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  26204. return int32(_XML_ROLE_DOCTYPE_NONE)
  26205. }
  26206. 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 {
  26207. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype2)
  26208. return int32(_XML_ROLE_DOCTYPE_NONE)
  26209. }
  26210. break
  26211. }
  26212. return _common(tls, state, tok)
  26213. }
  26214. func _doctype2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26215. _ = ptr
  26216. _ = end
  26217. _ = enc
  26218. switch tok {
  26219. case int32(m_XML_TOK_PROLOG_S):
  26220. return int32(_XML_ROLE_DOCTYPE_NONE)
  26221. case int32(m_XML_TOK_LITERAL):
  26222. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype3)
  26223. return int32(_XML_ROLE_DOCTYPE_PUBLIC_ID)
  26224. }
  26225. return _common(tls, state, tok)
  26226. }
  26227. func _doctype3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26228. _ = ptr
  26229. _ = end
  26230. _ = enc
  26231. switch tok {
  26232. case int32(m_XML_TOK_PROLOG_S):
  26233. return int32(_XML_ROLE_DOCTYPE_NONE)
  26234. case int32(m_XML_TOK_LITERAL):
  26235. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype4)
  26236. return int32(_XML_ROLE_DOCTYPE_SYSTEM_ID)
  26237. }
  26238. return _common(tls, state, tok)
  26239. }
  26240. func _doctype4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26241. _ = ptr
  26242. _ = end
  26243. _ = enc
  26244. switch tok {
  26245. case int32(m_XML_TOK_PROLOG_S):
  26246. return int32(_XML_ROLE_DOCTYPE_NONE)
  26247. case int32(m_XML_TOK_OPEN_BRACKET):
  26248. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_internalSubset)
  26249. return int32(_XML_ROLE_DOCTYPE_INTERNAL_SUBSET)
  26250. case int32(m_XML_TOK_DECL_CLOSE):
  26251. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  26252. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  26253. }
  26254. return _common(tls, state, tok)
  26255. }
  26256. func _doctype5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26257. _ = ptr
  26258. _ = end
  26259. _ = enc
  26260. switch tok {
  26261. case int32(m_XML_TOK_PROLOG_S):
  26262. return int32(_XML_ROLE_DOCTYPE_NONE)
  26263. case int32(m_XML_TOK_DECL_CLOSE):
  26264. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog2)
  26265. return int32(_XML_ROLE_DOCTYPE_CLOSE)
  26266. }
  26267. return _common(tls, state, tok)
  26268. }
  26269. func _internalSubset(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26270. switch tok {
  26271. case int32(m_XML_TOK_PROLOG_S):
  26272. return int32(_XML_ROLE_NONE)
  26273. case int32(m_XML_TOK_DECL_OPEN):
  26274. 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 {
  26275. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity0)
  26276. return int32(_XML_ROLE_ENTITY_NONE)
  26277. }
  26278. 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 {
  26279. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist0)
  26280. return int32(_XML_ROLE_ATTLIST_NONE)
  26281. }
  26282. 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 {
  26283. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element0)
  26284. return int32(_XML_ROLE_ELEMENT_NONE)
  26285. }
  26286. 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 {
  26287. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation0)
  26288. return int32(_XML_ROLE_NOTATION_NONE)
  26289. }
  26290. case int32(m_XML_TOK_PI):
  26291. return int32(_XML_ROLE_PI)
  26292. case int32(m_XML_TOK_COMMENT):
  26293. return int32(_XML_ROLE_COMMENT)
  26294. case int32(m_XML_TOK_PARAM_ENTITY_REF):
  26295. return int32(_XML_ROLE_PARAM_ENTITY_REF)
  26296. case int32(m_XML_TOK_CLOSE_BRACKET):
  26297. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_doctype5)
  26298. return int32(_XML_ROLE_DOCTYPE_NONE)
  26299. case -int32(4):
  26300. return int32(_XML_ROLE_NONE)
  26301. }
  26302. return _common(tls, state, tok)
  26303. }
  26304. func _externalSubset0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26305. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  26306. if tok == int32(m_XML_TOK_XML_DECL) {
  26307. return int32(_XML_ROLE_TEXT_DECL)
  26308. }
  26309. return _externalSubset1(tls, state, tok, ptr, end, enc)
  26310. }
  26311. func _externalSubset1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26312. switch tok {
  26313. case int32(m_XML_TOK_COND_SECT_OPEN):
  26314. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect0)
  26315. return int32(_XML_ROLE_NONE)
  26316. case int32(m_XML_TOK_COND_SECT_CLOSE):
  26317. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel == uint32(0) {
  26318. break
  26319. }
  26320. *(*uint32)(unsafe.Pointer(state + 16)) -= uint32(1)
  26321. return int32(_XML_ROLE_NONE)
  26322. case int32(m_XML_TOK_PROLOG_S):
  26323. return int32(_XML_ROLE_NONE)
  26324. case int32(m_XML_TOK_CLOSE_BRACKET):
  26325. case -int32(4):
  26326. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel != 0 {
  26327. break
  26328. }
  26329. return int32(_XML_ROLE_NONE)
  26330. default:
  26331. return _internalSubset(tls, state, tok, ptr, end, enc)
  26332. }
  26333. return _common(tls, state, tok)
  26334. }
  26335. func _entity0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26336. _ = ptr
  26337. _ = end
  26338. _ = enc
  26339. switch tok {
  26340. case int32(m_XML_TOK_PROLOG_S):
  26341. return int32(_XML_ROLE_ENTITY_NONE)
  26342. case int32(m_XML_TOK_PERCENT):
  26343. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity1)
  26344. return int32(_XML_ROLE_ENTITY_NONE)
  26345. case int32(m_XML_TOK_NAME):
  26346. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity2)
  26347. return int32(_XML_ROLE_GENERAL_ENTITY_NAME)
  26348. }
  26349. return _common(tls, state, tok)
  26350. }
  26351. func _entity1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26352. _ = ptr
  26353. _ = end
  26354. _ = enc
  26355. switch tok {
  26356. case int32(m_XML_TOK_PROLOG_S):
  26357. return int32(_XML_ROLE_ENTITY_NONE)
  26358. case int32(m_XML_TOK_NAME):
  26359. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity7)
  26360. return int32(_XML_ROLE_PARAM_ENTITY_NAME)
  26361. }
  26362. return _common(tls, state, tok)
  26363. }
  26364. func _entity2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26365. switch tok {
  26366. case int32(m_XML_TOK_PROLOG_S):
  26367. return int32(_XML_ROLE_ENTITY_NONE)
  26368. case int32(m_XML_TOK_NAME):
  26369. 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 {
  26370. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  26371. return int32(_XML_ROLE_ENTITY_NONE)
  26372. }
  26373. 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 {
  26374. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity3)
  26375. return int32(_XML_ROLE_ENTITY_NONE)
  26376. }
  26377. case int32(m_XML_TOK_LITERAL):
  26378. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26379. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  26380. return int32(_XML_ROLE_ENTITY_VALUE)
  26381. }
  26382. return _common(tls, state, tok)
  26383. }
  26384. func _entity3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26385. _ = ptr
  26386. _ = end
  26387. _ = enc
  26388. switch tok {
  26389. case int32(m_XML_TOK_PROLOG_S):
  26390. return int32(_XML_ROLE_ENTITY_NONE)
  26391. case int32(m_XML_TOK_LITERAL):
  26392. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity4)
  26393. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  26394. }
  26395. return _common(tls, state, tok)
  26396. }
  26397. func _entity4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26398. _ = ptr
  26399. _ = end
  26400. _ = enc
  26401. switch tok {
  26402. case int32(m_XML_TOK_PROLOG_S):
  26403. return int32(_XML_ROLE_ENTITY_NONE)
  26404. case int32(m_XML_TOK_LITERAL):
  26405. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity5)
  26406. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  26407. }
  26408. return _common(tls, state, tok)
  26409. }
  26410. func _entity5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26411. var v1 uintptr
  26412. _ = v1
  26413. switch tok {
  26414. case int32(m_XML_TOK_PROLOG_S):
  26415. return int32(_XML_ROLE_ENTITY_NONE)
  26416. case int32(m_XML_TOK_DECL_CLOSE):
  26417. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26418. v1 = __ccgo_fp(_internalSubset)
  26419. } else {
  26420. v1 = __ccgo_fp(_externalSubset1)
  26421. }
  26422. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26423. return int32(_XML_ROLE_ENTITY_COMPLETE)
  26424. case int32(m_XML_TOK_NAME):
  26425. 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 {
  26426. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity6)
  26427. return int32(_XML_ROLE_ENTITY_NONE)
  26428. }
  26429. break
  26430. }
  26431. return _common(tls, state, tok)
  26432. }
  26433. func _entity6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26434. _ = ptr
  26435. _ = end
  26436. _ = enc
  26437. switch tok {
  26438. case int32(m_XML_TOK_PROLOG_S):
  26439. return int32(_XML_ROLE_ENTITY_NONE)
  26440. case int32(m_XML_TOK_NAME):
  26441. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26442. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  26443. return int32(_XML_ROLE_ENTITY_NOTATION_NAME)
  26444. }
  26445. return _common(tls, state, tok)
  26446. }
  26447. func _entity7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26448. switch tok {
  26449. case int32(m_XML_TOK_PROLOG_S):
  26450. return int32(_XML_ROLE_ENTITY_NONE)
  26451. case int32(m_XML_TOK_NAME):
  26452. 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 {
  26453. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  26454. return int32(_XML_ROLE_ENTITY_NONE)
  26455. }
  26456. 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 {
  26457. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity8)
  26458. return int32(_XML_ROLE_ENTITY_NONE)
  26459. }
  26460. case int32(m_XML_TOK_LITERAL):
  26461. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26462. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ENTITY_NONE)
  26463. return int32(_XML_ROLE_ENTITY_VALUE)
  26464. }
  26465. return _common(tls, state, tok)
  26466. }
  26467. func _entity8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26468. _ = ptr
  26469. _ = end
  26470. _ = enc
  26471. switch tok {
  26472. case int32(m_XML_TOK_PROLOG_S):
  26473. return int32(_XML_ROLE_ENTITY_NONE)
  26474. case int32(m_XML_TOK_LITERAL):
  26475. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity9)
  26476. return int32(_XML_ROLE_ENTITY_PUBLIC_ID)
  26477. }
  26478. return _common(tls, state, tok)
  26479. }
  26480. func _entity9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26481. _ = ptr
  26482. _ = end
  26483. _ = enc
  26484. switch tok {
  26485. case int32(m_XML_TOK_PROLOG_S):
  26486. return int32(_XML_ROLE_ENTITY_NONE)
  26487. case int32(m_XML_TOK_LITERAL):
  26488. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_entity10)
  26489. return int32(_XML_ROLE_ENTITY_SYSTEM_ID)
  26490. }
  26491. return _common(tls, state, tok)
  26492. }
  26493. func _entity10(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26494. var v1 uintptr
  26495. _ = v1
  26496. _ = ptr
  26497. _ = end
  26498. _ = enc
  26499. switch tok {
  26500. case int32(m_XML_TOK_PROLOG_S):
  26501. return int32(_XML_ROLE_ENTITY_NONE)
  26502. case int32(m_XML_TOK_DECL_CLOSE):
  26503. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26504. v1 = __ccgo_fp(_internalSubset)
  26505. } else {
  26506. v1 = __ccgo_fp(_externalSubset1)
  26507. }
  26508. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26509. return int32(_XML_ROLE_ENTITY_COMPLETE)
  26510. }
  26511. return _common(tls, state, tok)
  26512. }
  26513. func _notation0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26514. _ = ptr
  26515. _ = end
  26516. _ = enc
  26517. switch tok {
  26518. case int32(m_XML_TOK_PROLOG_S):
  26519. return int32(_XML_ROLE_NOTATION_NONE)
  26520. case int32(m_XML_TOK_NAME):
  26521. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation1)
  26522. return int32(_XML_ROLE_NOTATION_NAME)
  26523. }
  26524. return _common(tls, state, tok)
  26525. }
  26526. func _notation1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26527. switch tok {
  26528. case int32(m_XML_TOK_PROLOG_S):
  26529. return int32(_XML_ROLE_NOTATION_NONE)
  26530. case int32(m_XML_TOK_NAME):
  26531. 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 {
  26532. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation3)
  26533. return int32(_XML_ROLE_NOTATION_NONE)
  26534. }
  26535. 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 {
  26536. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation2)
  26537. return int32(_XML_ROLE_NOTATION_NONE)
  26538. }
  26539. break
  26540. }
  26541. return _common(tls, state, tok)
  26542. }
  26543. func _notation2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26544. _ = ptr
  26545. _ = end
  26546. _ = enc
  26547. switch tok {
  26548. case int32(m_XML_TOK_PROLOG_S):
  26549. return int32(_XML_ROLE_NOTATION_NONE)
  26550. case int32(m_XML_TOK_LITERAL):
  26551. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_notation4)
  26552. return int32(_XML_ROLE_NOTATION_PUBLIC_ID)
  26553. }
  26554. return _common(tls, state, tok)
  26555. }
  26556. func _notation3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26557. _ = ptr
  26558. _ = end
  26559. _ = enc
  26560. switch tok {
  26561. case int32(m_XML_TOK_PROLOG_S):
  26562. return int32(_XML_ROLE_NOTATION_NONE)
  26563. case int32(m_XML_TOK_LITERAL):
  26564. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26565. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  26566. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  26567. }
  26568. return _common(tls, state, tok)
  26569. }
  26570. func _notation4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26571. var v1 uintptr
  26572. _ = v1
  26573. _ = ptr
  26574. _ = end
  26575. _ = enc
  26576. switch tok {
  26577. case int32(m_XML_TOK_PROLOG_S):
  26578. return int32(_XML_ROLE_NOTATION_NONE)
  26579. case int32(m_XML_TOK_LITERAL):
  26580. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26581. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_NOTATION_NONE)
  26582. return int32(_XML_ROLE_NOTATION_SYSTEM_ID)
  26583. case int32(m_XML_TOK_DECL_CLOSE):
  26584. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26585. v1 = __ccgo_fp(_internalSubset)
  26586. } else {
  26587. v1 = __ccgo_fp(_externalSubset1)
  26588. }
  26589. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26590. return int32(_XML_ROLE_NOTATION_NO_SYSTEM_ID)
  26591. }
  26592. return _common(tls, state, tok)
  26593. }
  26594. func _attlist0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26595. _ = ptr
  26596. _ = end
  26597. _ = enc
  26598. switch tok {
  26599. case int32(m_XML_TOK_PROLOG_S):
  26600. return int32(_XML_ROLE_ATTLIST_NONE)
  26601. case int32(m_XML_TOK_NAME):
  26602. fallthrough
  26603. case int32(m_XML_TOK_PREFIXED_NAME):
  26604. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26605. return int32(_XML_ROLE_ATTLIST_ELEMENT_NAME)
  26606. }
  26607. return _common(tls, state, tok)
  26608. }
  26609. func _attlist1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26610. var v1 uintptr
  26611. _ = v1
  26612. _ = ptr
  26613. _ = end
  26614. _ = enc
  26615. switch tok {
  26616. case int32(m_XML_TOK_PROLOG_S):
  26617. return int32(_XML_ROLE_ATTLIST_NONE)
  26618. case int32(m_XML_TOK_DECL_CLOSE):
  26619. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  26620. v1 = __ccgo_fp(_internalSubset)
  26621. } else {
  26622. v1 = __ccgo_fp(_externalSubset1)
  26623. }
  26624. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  26625. return int32(_XML_ROLE_ATTLIST_NONE)
  26626. case int32(m_XML_TOK_NAME):
  26627. fallthrough
  26628. case int32(m_XML_TOK_PREFIXED_NAME):
  26629. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist2)
  26630. return int32(_XML_ROLE_ATTRIBUTE_NAME)
  26631. }
  26632. return _common(tls, state, tok)
  26633. }
  26634. func _attlist2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26635. var i int32
  26636. _ = i
  26637. switch tok {
  26638. case int32(m_XML_TOK_PROLOG_S):
  26639. return int32(_XML_ROLE_ATTLIST_NONE)
  26640. case int32(m_XML_TOK_NAME):
  26641. i = 0
  26642. for {
  26643. if !(i < libc.Int32FromUint64(libc.Uint64FromInt64(64)/libc.Uint64FromInt64(8))) {
  26644. break
  26645. }
  26646. 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 {
  26647. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  26648. return int32(_XML_ROLE_ATTRIBUTE_TYPE_CDATA) + i
  26649. }
  26650. goto _1
  26651. _1:
  26652. ;
  26653. i++
  26654. }
  26655. 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 {
  26656. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist5)
  26657. return int32(_XML_ROLE_ATTLIST_NONE)
  26658. }
  26659. case int32(m_XML_TOK_OPEN_PAREN):
  26660. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  26661. return int32(_XML_ROLE_ATTLIST_NONE)
  26662. }
  26663. return _common(tls, state, tok)
  26664. }
  26665. var _types = [8]uintptr{
  26666. 0: uintptr(unsafe.Pointer(&_KW_CDATA)),
  26667. 1: uintptr(unsafe.Pointer(&_KW_ID)),
  26668. 2: uintptr(unsafe.Pointer(&_KW_IDREF)),
  26669. 3: uintptr(unsafe.Pointer(&_KW_IDREFS)),
  26670. 4: uintptr(unsafe.Pointer(&_KW_ENTITY)),
  26671. 5: uintptr(unsafe.Pointer(&_KW_ENTITIES)),
  26672. 6: uintptr(unsafe.Pointer(&_KW_NMTOKEN)),
  26673. 7: uintptr(unsafe.Pointer(&_KW_NMTOKENS)),
  26674. }
  26675. func _attlist3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26676. _ = ptr
  26677. _ = end
  26678. _ = enc
  26679. switch tok {
  26680. case int32(m_XML_TOK_PROLOG_S):
  26681. return int32(_XML_ROLE_ATTLIST_NONE)
  26682. case int32(m_XML_TOK_NMTOKEN):
  26683. fallthrough
  26684. case int32(m_XML_TOK_NAME):
  26685. fallthrough
  26686. case int32(m_XML_TOK_PREFIXED_NAME):
  26687. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist4)
  26688. return int32(_XML_ROLE_ATTRIBUTE_ENUM_VALUE)
  26689. }
  26690. return _common(tls, state, tok)
  26691. }
  26692. func _attlist4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26693. _ = ptr
  26694. _ = end
  26695. _ = enc
  26696. switch tok {
  26697. case int32(m_XML_TOK_PROLOG_S):
  26698. return int32(_XML_ROLE_ATTLIST_NONE)
  26699. case int32(m_XML_TOK_CLOSE_PAREN):
  26700. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  26701. return int32(_XML_ROLE_ATTLIST_NONE)
  26702. case int32(m_XML_TOK_OR):
  26703. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist3)
  26704. return int32(_XML_ROLE_ATTLIST_NONE)
  26705. }
  26706. return _common(tls, state, tok)
  26707. }
  26708. func _attlist5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26709. _ = ptr
  26710. _ = end
  26711. _ = enc
  26712. switch tok {
  26713. case int32(m_XML_TOK_PROLOG_S):
  26714. return int32(_XML_ROLE_ATTLIST_NONE)
  26715. case int32(m_XML_TOK_OPEN_PAREN):
  26716. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  26717. return int32(_XML_ROLE_ATTLIST_NONE)
  26718. }
  26719. return _common(tls, state, tok)
  26720. }
  26721. func _attlist6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26722. _ = ptr
  26723. _ = end
  26724. _ = enc
  26725. switch tok {
  26726. case int32(m_XML_TOK_PROLOG_S):
  26727. return int32(_XML_ROLE_ATTLIST_NONE)
  26728. case int32(m_XML_TOK_NAME):
  26729. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist7)
  26730. return int32(_XML_ROLE_ATTRIBUTE_NOTATION_VALUE)
  26731. }
  26732. return _common(tls, state, tok)
  26733. }
  26734. func _attlist7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26735. _ = ptr
  26736. _ = end
  26737. _ = enc
  26738. switch tok {
  26739. case int32(m_XML_TOK_PROLOG_S):
  26740. return int32(_XML_ROLE_ATTLIST_NONE)
  26741. case int32(m_XML_TOK_CLOSE_PAREN):
  26742. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist8)
  26743. return int32(_XML_ROLE_ATTLIST_NONE)
  26744. case int32(m_XML_TOK_OR):
  26745. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist6)
  26746. return int32(_XML_ROLE_ATTLIST_NONE)
  26747. }
  26748. return _common(tls, state, tok)
  26749. }
  26750. // C documentation
  26751. //
  26752. // /* default value */
  26753. func _attlist8(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26754. switch tok {
  26755. case int32(m_XML_TOK_PROLOG_S):
  26756. return int32(_XML_ROLE_ATTLIST_NONE)
  26757. case int32(m_XML_TOK_POUND_NAME):
  26758. 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 {
  26759. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26760. return int32(_XML_ROLE_IMPLIED_ATTRIBUTE_VALUE)
  26761. }
  26762. 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 {
  26763. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26764. return int32(_XML_ROLE_REQUIRED_ATTRIBUTE_VALUE)
  26765. }
  26766. 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 {
  26767. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist9)
  26768. return int32(_XML_ROLE_ATTLIST_NONE)
  26769. }
  26770. case int32(m_XML_TOK_LITERAL):
  26771. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26772. return int32(_XML_ROLE_DEFAULT_ATTRIBUTE_VALUE)
  26773. }
  26774. return _common(tls, state, tok)
  26775. }
  26776. func _attlist9(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26777. _ = ptr
  26778. _ = end
  26779. _ = enc
  26780. switch tok {
  26781. case int32(m_XML_TOK_PROLOG_S):
  26782. return int32(_XML_ROLE_ATTLIST_NONE)
  26783. case int32(m_XML_TOK_LITERAL):
  26784. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_attlist1)
  26785. return int32(_XML_ROLE_FIXED_ATTRIBUTE_VALUE)
  26786. }
  26787. return _common(tls, state, tok)
  26788. }
  26789. func _element0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26790. _ = ptr
  26791. _ = end
  26792. _ = enc
  26793. switch tok {
  26794. case int32(m_XML_TOK_PROLOG_S):
  26795. return int32(_XML_ROLE_ELEMENT_NONE)
  26796. case int32(m_XML_TOK_NAME):
  26797. fallthrough
  26798. case int32(m_XML_TOK_PREFIXED_NAME):
  26799. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element1)
  26800. return int32(_XML_ROLE_ELEMENT_NAME)
  26801. }
  26802. return _common(tls, state, tok)
  26803. }
  26804. func _element1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26805. switch tok {
  26806. case int32(m_XML_TOK_PROLOG_S):
  26807. return int32(_XML_ROLE_ELEMENT_NONE)
  26808. case int32(m_XML_TOK_NAME):
  26809. 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 {
  26810. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26811. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26812. return int32(_XML_ROLE_CONTENT_EMPTY)
  26813. }
  26814. 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 {
  26815. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26816. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26817. return int32(_XML_ROLE_CONTENT_ANY)
  26818. }
  26819. case int32(m_XML_TOK_OPEN_PAREN):
  26820. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element2)
  26821. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(1)
  26822. return int32(_XML_ROLE_GROUP_OPEN)
  26823. }
  26824. return _common(tls, state, tok)
  26825. }
  26826. func _element2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26827. switch tok {
  26828. case int32(m_XML_TOK_PROLOG_S):
  26829. return int32(_XML_ROLE_ELEMENT_NONE)
  26830. case int32(m_XML_TOK_POUND_NAME):
  26831. 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 {
  26832. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element3)
  26833. return int32(_XML_ROLE_CONTENT_PCDATA)
  26834. }
  26835. case int32(m_XML_TOK_OPEN_PAREN):
  26836. (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel = uint32(2)
  26837. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  26838. return int32(_XML_ROLE_GROUP_OPEN)
  26839. case int32(m_XML_TOK_NAME):
  26840. fallthrough
  26841. case int32(m_XML_TOK_PREFIXED_NAME):
  26842. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26843. return int32(_XML_ROLE_CONTENT_ELEMENT)
  26844. case int32(m_XML_TOK_NAME_QUESTION):
  26845. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26846. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  26847. case int32(m_XML_TOK_NAME_ASTERISK):
  26848. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26849. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  26850. case int32(m_XML_TOK_NAME_PLUS):
  26851. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26852. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  26853. }
  26854. return _common(tls, state, tok)
  26855. }
  26856. func _element3(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26857. _ = ptr
  26858. _ = end
  26859. _ = enc
  26860. switch tok {
  26861. case int32(m_XML_TOK_PROLOG_S):
  26862. return int32(_XML_ROLE_ELEMENT_NONE)
  26863. case int32(m_XML_TOK_CLOSE_PAREN):
  26864. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26865. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26866. return int32(_XML_ROLE_GROUP_CLOSE)
  26867. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  26868. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26869. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26870. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  26871. case int32(m_XML_TOK_OR):
  26872. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  26873. return int32(_XML_ROLE_ELEMENT_NONE)
  26874. }
  26875. return _common(tls, state, tok)
  26876. }
  26877. func _element4(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26878. _ = ptr
  26879. _ = end
  26880. _ = enc
  26881. switch tok {
  26882. case int32(m_XML_TOK_PROLOG_S):
  26883. return int32(_XML_ROLE_ELEMENT_NONE)
  26884. case int32(m_XML_TOK_NAME):
  26885. fallthrough
  26886. case int32(m_XML_TOK_PREFIXED_NAME):
  26887. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element5)
  26888. return int32(_XML_ROLE_CONTENT_ELEMENT)
  26889. }
  26890. return _common(tls, state, tok)
  26891. }
  26892. func _element5(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26893. _ = ptr
  26894. _ = end
  26895. _ = enc
  26896. switch tok {
  26897. case int32(m_XML_TOK_PROLOG_S):
  26898. return int32(_XML_ROLE_ELEMENT_NONE)
  26899. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  26900. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26901. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26902. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  26903. case int32(m_XML_TOK_OR):
  26904. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element4)
  26905. return int32(_XML_ROLE_ELEMENT_NONE)
  26906. }
  26907. return _common(tls, state, tok)
  26908. }
  26909. func _element6(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26910. _ = ptr
  26911. _ = end
  26912. _ = enc
  26913. switch tok {
  26914. case int32(m_XML_TOK_PROLOG_S):
  26915. return int32(_XML_ROLE_ELEMENT_NONE)
  26916. case int32(m_XML_TOK_OPEN_PAREN):
  26917. *(*uint32)(unsafe.Pointer(state + 8)) += uint32(1)
  26918. return int32(_XML_ROLE_GROUP_OPEN)
  26919. case int32(m_XML_TOK_NAME):
  26920. fallthrough
  26921. case int32(m_XML_TOK_PREFIXED_NAME):
  26922. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26923. return int32(_XML_ROLE_CONTENT_ELEMENT)
  26924. case int32(m_XML_TOK_NAME_QUESTION):
  26925. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26926. return int32(_XML_ROLE_CONTENT_ELEMENT_OPT)
  26927. case int32(m_XML_TOK_NAME_ASTERISK):
  26928. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26929. return int32(_XML_ROLE_CONTENT_ELEMENT_REP)
  26930. case int32(m_XML_TOK_NAME_PLUS):
  26931. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element7)
  26932. return int32(_XML_ROLE_CONTENT_ELEMENT_PLUS)
  26933. }
  26934. return _common(tls, state, tok)
  26935. }
  26936. func _element7(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26937. _ = ptr
  26938. _ = end
  26939. _ = enc
  26940. switch tok {
  26941. case int32(m_XML_TOK_PROLOG_S):
  26942. return int32(_XML_ROLE_ELEMENT_NONE)
  26943. case int32(m_XML_TOK_CLOSE_PAREN):
  26944. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26945. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26946. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26947. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26948. }
  26949. return int32(_XML_ROLE_GROUP_CLOSE)
  26950. case int32(m_XML_TOK_CLOSE_PAREN_ASTERISK):
  26951. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26952. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26953. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26954. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26955. }
  26956. return int32(_XML_ROLE_GROUP_CLOSE_REP)
  26957. case int32(m_XML_TOK_CLOSE_PAREN_QUESTION):
  26958. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26959. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26960. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26961. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26962. }
  26963. return int32(_XML_ROLE_GROUP_CLOSE_OPT)
  26964. case int32(m_XML_TOK_CLOSE_PAREN_PLUS):
  26965. *(*uint32)(unsafe.Pointer(state + 8)) -= uint32(1)
  26966. if (*TPROLOG_STATE)(unsafe.Pointer(state)).Flevel == uint32(0) {
  26967. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_declClose)
  26968. (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none = int32(_XML_ROLE_ELEMENT_NONE)
  26969. }
  26970. return int32(_XML_ROLE_GROUP_CLOSE_PLUS)
  26971. case int32(m_XML_TOK_COMMA):
  26972. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  26973. return int32(_XML_ROLE_GROUP_SEQUENCE)
  26974. case int32(m_XML_TOK_OR):
  26975. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_element6)
  26976. return int32(_XML_ROLE_GROUP_CHOICE)
  26977. }
  26978. return _common(tls, state, tok)
  26979. }
  26980. func _condSect0(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26981. switch tok {
  26982. case int32(m_XML_TOK_PROLOG_S):
  26983. return int32(_XML_ROLE_NONE)
  26984. case int32(m_XML_TOK_NAME):
  26985. 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 {
  26986. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect1)
  26987. return int32(_XML_ROLE_NONE)
  26988. }
  26989. 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 {
  26990. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_condSect2)
  26991. return int32(_XML_ROLE_NONE)
  26992. }
  26993. break
  26994. }
  26995. return _common(tls, state, tok)
  26996. }
  26997. func _condSect1(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  26998. _ = ptr
  26999. _ = end
  27000. _ = enc
  27001. switch tok {
  27002. case int32(m_XML_TOK_PROLOG_S):
  27003. return int32(_XML_ROLE_NONE)
  27004. case int32(m_XML_TOK_OPEN_BRACKET):
  27005. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  27006. *(*uint32)(unsafe.Pointer(state + 16)) += uint32(1)
  27007. return int32(_XML_ROLE_NONE)
  27008. }
  27009. return _common(tls, state, tok)
  27010. }
  27011. func _condSect2(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  27012. _ = ptr
  27013. _ = end
  27014. _ = enc
  27015. switch tok {
  27016. case int32(m_XML_TOK_PROLOG_S):
  27017. return int32(_XML_ROLE_NONE)
  27018. case int32(m_XML_TOK_OPEN_BRACKET):
  27019. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset1)
  27020. return int32(_XML_ROLE_IGNORE_SECT)
  27021. }
  27022. return _common(tls, state, tok)
  27023. }
  27024. func _declClose(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  27025. var v1 uintptr
  27026. _ = v1
  27027. _ = ptr
  27028. _ = end
  27029. _ = enc
  27030. switch tok {
  27031. case int32(m_XML_TOK_PROLOG_S):
  27032. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  27033. case int32(m_XML_TOK_DECL_CLOSE):
  27034. if (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0 {
  27035. v1 = __ccgo_fp(_internalSubset)
  27036. } else {
  27037. v1 = __ccgo_fp(_externalSubset1)
  27038. }
  27039. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = v1
  27040. return (*TPROLOG_STATE)(unsafe.Pointer(state)).Frole_none
  27041. }
  27042. return _common(tls, state, tok)
  27043. }
  27044. // C documentation
  27045. //
  27046. // /* This function will only be invoked if the internal logic of the
  27047. // * parser has broken down. It is used in two cases:
  27048. // *
  27049. // * 1: When the XML prolog has been finished. At this point the
  27050. // * processor (the parser level above these role handlers) should
  27051. // * switch from prologProcessor to contentProcessor and reinitialise
  27052. // * the handler function.
  27053. // *
  27054. // * 2: When an error has been detected (via common() below). At this
  27055. // * point again the processor should be switched to errorProcessor,
  27056. // * which will never call a handler.
  27057. // *
  27058. // * The result of this is that error() can only be called if the
  27059. // * processor switch failed to happen, which is an internal error and
  27060. // * therefore we shouldn't be able to provoke it simply by using the
  27061. // * library. It is a necessary backstop, however, so we merely exclude
  27062. // * it from the coverage statistics.
  27063. // *
  27064. // * LCOV_EXCL_START
  27065. // */
  27066. func _error(tls *libc.TLS, state uintptr, tok int32, ptr uintptr, end uintptr, enc uintptr) (r int32) {
  27067. _ = state
  27068. _ = tok
  27069. _ = ptr
  27070. _ = end
  27071. _ = enc
  27072. return int32(_XML_ROLE_NONE)
  27073. }
  27074. /* LCOV_EXCL_STOP */
  27075. func _common(tls *libc.TLS, state uintptr, tok int32) (r int32) {
  27076. if !((*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity != 0) && tok == int32(m_XML_TOK_PARAM_ENTITY_REF) {
  27077. return int32(_XML_ROLE_INNER_PARAM_ENTITY_REF)
  27078. }
  27079. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_error)
  27080. return int32(_XML_ROLE_ERROR)
  27081. }
  27082. func XXmlPrologStateInit(tls *libc.TLS, state uintptr) {
  27083. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_prolog0)
  27084. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = int32(1)
  27085. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  27086. (*TPROLOG_STATE)(unsafe.Pointer(state)).FinEntityValue = 0
  27087. }
  27088. func XXmlPrologStateInitExternalEntity(tls *libc.TLS, state uintptr) {
  27089. (*TPROLOG_STATE)(unsafe.Pointer(state)).Fhandler = __ccgo_fp(_externalSubset0)
  27090. (*TPROLOG_STATE)(unsafe.Pointer(state)).FdocumentEntity = 0
  27091. (*TPROLOG_STATE)(unsafe.Pointer(state)).FincludeLevel = uint32(0)
  27092. }
  27093. func __ccgo_fp(f interface{}) uintptr {
  27094. type iface [2]uintptr
  27095. return (*iface)(unsafe.Pointer(&f))[1]
  27096. }
  27097. var __ccgo_ts = (*reflect.StringHeader)(unsafe.Pointer(&__ccgo_ts1)).Data
  27098. var __ccgo_ts1 = "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0e\x0f\x00/dev/urandom\x00EXPAT_ENTROPY_DEBUG\x001\x00Entropy: %s --> 0x%0*lx (%lu bytes)\n\x00getrandom\x00fallback(4)\x00fallback(8)\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\x00expat_2.2.10\x00sizeof(XML_Char)\x00sizeof(XML_LChar)\x00XML_DTD\x00XML_CONTEXT_BYTES\x00XML_NS\x00"