xpp_1_40_i3ipcpp_0_71.patch 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298
  1. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/3rd/auss/include/auss.hpp polybar-3.2.1/lib/i3ipcpp/3rd/auss/include/auss.hpp
  2. --- polybar-3.2.1.orig/lib/i3ipcpp/3rd/auss/include/auss.hpp 1970-01-01 02:00:00.000000000 +0200
  3. +++ polybar-3.2.1/lib/i3ipcpp/3rd/auss/include/auss.hpp 2017-12-03 19:05:22.000000000 +0300
  4. @@ -0,0 +1,47 @@
  5. +#pragma once
  6. +
  7. +#define AUSS_HPP
  8. +
  9. +#include <sstream>
  10. +
  11. +#ifdef AUSS_USE_OWN_NAMESPACE
  12. + #ifndef AUSS_OWN_NAMESPACE_NAME
  13. + #define AUSS_OWN_NAMESPACE_NAME auss
  14. + #endif
  15. +namespace AUSS_OWN_NAMESPACE_NAME {
  16. +#endif
  17. +
  18. +class AutoStringStream {
  19. +public:
  20. + AutoStringStream() : m_stream() {}
  21. + virtual ~AutoStringStream() {}
  22. +
  23. + template<typename T>
  24. + AutoStringStream& operator<<(const T& arg) {
  25. + m_stream << arg;
  26. + return *this;
  27. + }
  28. +
  29. + AutoStringStream& operator<<(const bool arg) {
  30. + m_stream << (arg ? "true" : "false");
  31. + return *this;
  32. + }
  33. +
  34. + operator std::string() const {
  35. + return m_stream.str();
  36. + }
  37. +
  38. + const std::string to_string() const {
  39. + return m_stream.str();
  40. + }
  41. +private:
  42. + std::stringstream m_stream;
  43. +};
  44. +
  45. +#ifndef AUSS_CUSTOM_TYPEDEF
  46. +typedef AutoStringStream auss_t;
  47. +#endif
  48. +
  49. +#ifdef AUSS_USE_OWN_NAMESPACE
  50. +}
  51. +#endif
  52. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/3rd/auss/LICENSE polybar-3.2.1/lib/i3ipcpp/3rd/auss/LICENSE
  53. --- polybar-3.2.1.orig/lib/i3ipcpp/3rd/auss/LICENSE 1970-01-01 02:00:00.000000000 +0200
  54. +++ polybar-3.2.1/lib/i3ipcpp/3rd/auss/LICENSE 2017-12-03 19:05:22.000000000 +0300
  55. @@ -0,0 +1,24 @@
  56. +This is free and unencumbered software released into the public domain.
  57. +
  58. +Anyone is free to copy, modify, publish, use, compile, sell, or
  59. +distribute this software, either in source code form or as a compiled
  60. +binary, for any purpose, commercial or non-commercial, and by any
  61. +means.
  62. +
  63. +In jurisdictions that recognize copyright laws, the author or authors
  64. +of this software dedicate any and all copyright interest in the
  65. +software to the public domain. We make this dedication for the benefit
  66. +of the public at large and to the detriment of our heirs and
  67. +successors. We intend this dedication to be an overt act of
  68. +relinquishment in perpetuity of all present and future rights to this
  69. +software under copyright law.
  70. +
  71. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  72. +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  73. +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  74. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  75. +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  76. +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  77. +OTHER DEALINGS IN THE SOFTWARE.
  78. +
  79. +For more information, please refer to <http://unlicense.org/>
  80. \ Dosya sonunda yenisatır yok.
  81. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/3rd/auss/README.md polybar-3.2.1/lib/i3ipcpp/3rd/auss/README.md
  82. --- polybar-3.2.1.orig/lib/i3ipcpp/3rd/auss/README.md 1970-01-01 02:00:00.000000000 +0200
  83. +++ polybar-3.2.1/lib/i3ipcpp/3rd/auss/README.md 2017-12-03 19:05:22.000000000 +0300
  84. @@ -0,0 +1,27 @@
  85. +# AutoStringStream ![license](https://img.shields.io/npm/l/chas-storage.svg)
  86. +
  87. +Simple header-only wrapper on `std::stringstream` with automatic casting to `std::string`
  88. +
  89. +## Usage
  90. +
  91. +```c++
  92. +#include <auss.hpp>
  93. +```
  94. +```c++
  95. +auss_t() << "Hello, " << user_name
  96. +```
  97. +```c++
  98. +throw std::runtime_error(auss_t() << "Something gone wrong, See " << log_path)
  99. +```
  100. +
  101. +### Own namespace
  102. +If you wouldn't pollute global namespace just define `AUSS_USE_OWN_NAMESPACE`. Either before `#include` or in compiler flags (`-DAUSS_USE_OWN_NAMESPACE` for GCC).
  103. +
  104. +Also you can specifiy the name of namespace with `AUSS_OWN_NAMESPACE_NAME`:
  105. +```
  106. +-DAUSS_OWN_NAMESPACE_NAME="theauss"
  107. +```
  108. +
  109. +## License
  110. +
  111. +Licensed under Unlicense. See `LICENSE` file for more info.
  112. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/CHANGELOG polybar-3.2.1/lib/i3ipcpp/CHANGELOG
  113. --- polybar-3.2.1.orig/lib/i3ipcpp/CHANGELOG 1970-01-01 02:00:00.000000000 +0200
  114. +++ polybar-3.2.1/lib/i3ipcpp/CHANGELOG 2017-12-03 19:05:22.000000000 +0300
  115. @@ -0,0 +1,33 @@
  116. +0.4
  117. + + Added support of GET_BARCONFIG and barconfig_update event and examples for them
  118. + + Added getters form main and event sockets
  119. + + Added i3ipc::get_version()
  120. +
  121. + ~ Calling i3ipc::connection::prepare_to_event_handling() is no more necessary
  122. + ~ Using i3ipc::errno_error when calling c-functions instead of std::runtime_error
  123. + ~ Logging-subsystem became public
  124. + ~ Refactoring of CMakeLists.txt
  125. +
  126. + - i3ipc::connection::get_file_descriptor() removed
  127. +
  128. +0.3
  129. + + Added support of BINDING event
  130. +
  131. + ~ Removed submodules
  132. +
  133. + * Bug fixies
  134. +
  135. +0.2.1
  136. + + Added example of event handling
  137. + * Fixed SIGSEGV in parse_*_from_json functions
  138. +
  139. +0.2.0
  140. + + Implemented GET_TREE (i3ipc::connection::get_tree())
  141. +
  142. + ~ Shipping all available payload with workspace and window events (issue #2)
  143. + ~ i3ipc::I3Connection renamed to i3ipc::connection
  144. +
  145. + ~ Internal refreactoring
  146. +
  147. + * Fixing failed build: Parts of a struct were initialised in wrong order, C99-style designated initialisers did not prevent this from causing an error [mox]
  148. + * Minor documentation and code fixies
  149. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/CMakeLists.txt
  150. --- polybar-3.2.1.orig/lib/i3ipcpp/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  151. +++ polybar-3.2.1/lib/i3ipcpp/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  152. @@ -0,0 +1,74 @@
  153. +# Project setup
  154. +
  155. +cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
  156. +project(i3ipc++ CXX)
  157. +
  158. +option(WITH_LOGGING "Build with log support" OFF)
  159. +option(WITH_TESTS "Build unit tests executables" OFF)
  160. +option(BUILD_EXAMPLES "Build example executables" OFF)
  161. +
  162. +add_library(${PROJECT_NAME} STATIC
  163. + ${PROJECT_SOURCE_DIR}/3rd/auss/include/auss.hpp
  164. + ${PROJECT_SOURCE_DIR}/include/i3ipc++/ipc.hpp
  165. + ${PROJECT_SOURCE_DIR}/include/i3ipc++/ipc-util.hpp
  166. + ${PROJECT_SOURCE_DIR}/src/ipc.cpp
  167. + ${PROJECT_SOURCE_DIR}/src/ipc-util.cpp)
  168. +
  169. +target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/3rd/auss/include)
  170. +target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)
  171. +
  172. +target_compile_options(${PROJECT_NAME} PRIVATE -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations)
  173. +target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Debug>:-g3 -DDEBUG>)
  174. +target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Release>:-O2>)
  175. +
  176. +# External library: jsoncpp-1.7.7 {{{
  177. +
  178. +find_package(PkgConfig)
  179. +pkg_check_modules(JSONCPP jsoncpp>=1.7.7)
  180. +
  181. +if(NOT JSONCPP_FOUND)
  182. + message(STATUS "Could not find jsoncpp>=1.7.7 -- building static lib...")
  183. + add_subdirectory(${PROJECT_SOURCE_DIR}/libs/jsoncpp-1.7.7 EXCLUDE_FROM_ALL)
  184. + set(JSONCPP_LIBRARIES jsoncpp_lib_static)
  185. + set(JSONCPP_INCLUDEDIR ${PROJECT_SOURCE_DIR}/libs/jsoncpp-1.7.7/include)
  186. +elseif(NOT JSONCPP_LIBRARIES AND JSONCPP_LIBS)
  187. + set(JSONCPP_LIBRARIES "${JSONCPP_LIBS}")
  188. +endif()
  189. +
  190. +target_link_libraries(${PROJECT_NAME} PUBLIC ${JSONCPP_LIBRARIES})
  191. +target_include_directories(${PROJECT_NAME} PUBLIC ${JSONCPP_INCLUDEDIR})
  192. +
  193. +# }}}
  194. +# Export lists to the parent scope if there are any {{{
  195. +
  196. +get_directory_property(HAS_PARENT PARENT_DIRECTORY)
  197. +if(HAS_PARENT)
  198. + set(I3IPCPP_LIBRARIES ${PROJECT_NAME} PARENT_SCOPE)
  199. + set(I3IPCPP_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/include ${JSONCPP_INCLUDEDIR})
  200. +endif()
  201. +
  202. +# }}}
  203. +# Build examples if the option was given {{{
  204. +
  205. +if(BUILD_EXAMPLES)
  206. + add_subdirectory("${PROJECT_SOURCE_DIR}/examples")
  207. +endif()
  208. +
  209. +# }}}
  210. +# Build cpp tests if the option was given {{{
  211. +
  212. +if(WITH_TESTS)
  213. + find_package(CxxTest)
  214. + if(CXXTEST_FOUND)
  215. + include_directories(${CXXTEST_INCLUDE_DIR} "${PROJECT_SOURCE_DIR}/src")
  216. + add_definitions("-DTEST_SRC_ROOT=${PROJECT_SOURCE_DIR}/test")
  217. + enable_testing()
  218. + file(GLOB SRC_TEST "${PROJECT_SOURCE_DIR}/test/*.hpp")
  219. + CXXTEST_ADD_TEST(i3ipcpp_check test.cpp ${SRC_TEST})
  220. + target_link_libraries(i3ipcpp_check ${I3IPCPP_LIBRARIES})
  221. + else()
  222. + message(WARNING "CxxTest not found. Unable to run unit-tests")
  223. + endif()
  224. +endif()
  225. +
  226. +# }}}
  227. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/Doxyfile polybar-3.2.1/lib/i3ipcpp/Doxyfile
  228. --- polybar-3.2.1.orig/lib/i3ipcpp/Doxyfile 1970-01-01 02:00:00.000000000 +0200
  229. +++ polybar-3.2.1/lib/i3ipcpp/Doxyfile 2017-12-03 19:05:22.000000000 +0300
  230. @@ -0,0 +1,2353 @@
  231. +# Doxyfile 1.8.8
  232. +
  233. +# This file describes the settings to be used by the documentation system
  234. +# doxygen (www.doxygen.org) for a project.
  235. +#
  236. +# All text after a double hash (##) is considered a comment and is placed in
  237. +# front of the TAG it is preceding.
  238. +#
  239. +# All text after a single hash (#) is considered a comment and will be ignored.
  240. +# The format is:
  241. +# TAG = value [value, ...]
  242. +# For lists, items can also be appended using:
  243. +# TAG += value [value, ...]
  244. +# Values that contain spaces should be placed between quotes (\" \").
  245. +
  246. +#---------------------------------------------------------------------------
  247. +# Project related configuration options
  248. +#---------------------------------------------------------------------------
  249. +
  250. +# This tag specifies the encoding used for all characters in the config file
  251. +# that follow. The default is UTF-8 which is also the encoding used for all text
  252. +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
  253. +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
  254. +# for the list of possible encodings.
  255. +# The default value is: UTF-8.
  256. +
  257. +DOXYFILE_ENCODING = UTF-8
  258. +
  259. +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
  260. +# double-quotes, unless you are using Doxywizard) that should identify the
  261. +# project for which the documentation is generated. This name is used in the
  262. +# title of most generated pages and in a few other places.
  263. +# The default value is: My Project.
  264. +
  265. +PROJECT_NAME = i3ipc++
  266. +
  267. +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
  268. +# could be handy for archiving the generated documentation or if some version
  269. +# control system is used.
  270. +
  271. +PROJECT_NUMBER =
  272. +
  273. +# Using the PROJECT_BRIEF tag one can provide an optional one line description
  274. +# for a project that appears at the top of each page and should give viewer a
  275. +# quick idea about the purpose of the project. Keep the description short.
  276. +
  277. +PROJECT_BRIEF = "An C++ implementaiton of the i3 IPC"
  278. +
  279. +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
  280. +# the documentation. The maximum height of the logo should not exceed 55 pixels
  281. +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
  282. +# to the output directory.
  283. +
  284. +PROJECT_LOGO =
  285. +
  286. +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
  287. +# into which the generated documentation will be written. If a relative path is
  288. +# entered, it will be relative to the location where doxygen was started. If
  289. +# left blank the current directory will be used.
  290. +
  291. +OUTPUT_DIRECTORY = doc
  292. +
  293. +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
  294. +# directories (in 2 levels) under the output directory of each output format and
  295. +# will distribute the generated files over these directories. Enabling this
  296. +# option can be useful when feeding doxygen a huge amount of source files, where
  297. +# putting all generated files in the same directory would otherwise causes
  298. +# performance problems for the file system.
  299. +# The default value is: NO.
  300. +
  301. +CREATE_SUBDIRS = YES
  302. +
  303. +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
  304. +# characters to appear in the names of generated files. If set to NO, non-ASCII
  305. +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
  306. +# U+3044.
  307. +# The default value is: NO.
  308. +
  309. +ALLOW_UNICODE_NAMES = NO
  310. +
  311. +# The OUTPUT_LANGUAGE tag is used to specify the language in which all
  312. +# documentation generated by doxygen is written. Doxygen will use this
  313. +# information to generate all constant output in the proper language.
  314. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
  315. +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
  316. +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
  317. +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
  318. +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
  319. +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
  320. +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
  321. +# Ukrainian and Vietnamese.
  322. +# The default value is: English.
  323. +
  324. +OUTPUT_LANGUAGE = English
  325. +
  326. +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
  327. +# descriptions after the members that are listed in the file and class
  328. +# documentation (similar to Javadoc). Set to NO to disable this.
  329. +# The default value is: YES.
  330. +
  331. +BRIEF_MEMBER_DESC = YES
  332. +
  333. +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
  334. +# description of a member or function before the detailed description
  335. +#
  336. +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
  337. +# brief descriptions will be completely suppressed.
  338. +# The default value is: YES.
  339. +
  340. +REPEAT_BRIEF = YES
  341. +
  342. +# This tag implements a quasi-intelligent brief description abbreviator that is
  343. +# used to form the text in various listings. Each string in this list, if found
  344. +# as the leading text of the brief description, will be stripped from the text
  345. +# and the result, after processing the whole list, is used as the annotated
  346. +# text. Otherwise, the brief description is used as-is. If left blank, the
  347. +# following values are used ($name is automatically replaced with the name of
  348. +# the entity):The $name class, The $name widget, The $name file, is, provides,
  349. +# specifies, contains, represents, a, an and the.
  350. +
  351. +ABBREVIATE_BRIEF =
  352. +
  353. +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
  354. +# doxygen will generate a detailed section even if there is only a brief
  355. +# description.
  356. +# The default value is: NO.
  357. +
  358. +ALWAYS_DETAILED_SEC = NO
  359. +
  360. +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
  361. +# inherited members of a class in the documentation of that class as if those
  362. +# members were ordinary class members. Constructors, destructors and assignment
  363. +# operators of the base classes will not be shown.
  364. +# The default value is: NO.
  365. +
  366. +INLINE_INHERITED_MEMB = NO
  367. +
  368. +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
  369. +# before files name in the file list and in the header files. If set to NO the
  370. +# shortest path that makes the file name unique will be used
  371. +# The default value is: YES.
  372. +
  373. +FULL_PATH_NAMES = YES
  374. +
  375. +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
  376. +# Stripping is only done if one of the specified strings matches the left-hand
  377. +# part of the path. The tag can be used to show relative paths in the file list.
  378. +# If left blank the directory from which doxygen is run is used as the path to
  379. +# strip.
  380. +#
  381. +# Note that you can specify absolute paths here, but also relative paths, which
  382. +# will be relative from the directory where doxygen is started.
  383. +# This tag requires that the tag FULL_PATH_NAMES is set to YES.
  384. +
  385. +STRIP_FROM_PATH =
  386. +
  387. +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
  388. +# path mentioned in the documentation of a class, which tells the reader which
  389. +# header file to include in order to use a class. If left blank only the name of
  390. +# the header file containing the class definition is used. Otherwise one should
  391. +# specify the list of include paths that are normally passed to the compiler
  392. +# using the -I flag.
  393. +
  394. +STRIP_FROM_INC_PATH =
  395. +
  396. +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
  397. +# less readable) file names. This can be useful is your file systems doesn't
  398. +# support long names like on DOS, Mac, or CD-ROM.
  399. +# The default value is: NO.
  400. +
  401. +SHORT_NAMES = NO
  402. +
  403. +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
  404. +# first line (until the first dot) of a Javadoc-style comment as the brief
  405. +# description. If set to NO, the Javadoc-style will behave just like regular Qt-
  406. +# style comments (thus requiring an explicit @brief command for a brief
  407. +# description.)
  408. +# The default value is: NO.
  409. +
  410. +JAVADOC_AUTOBRIEF = YES
  411. +
  412. +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
  413. +# line (until the first dot) of a Qt-style comment as the brief description. If
  414. +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
  415. +# requiring an explicit \brief command for a brief description.)
  416. +# The default value is: NO.
  417. +
  418. +QT_AUTOBRIEF = NO
  419. +
  420. +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
  421. +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
  422. +# a brief description. This used to be the default behavior. The new default is
  423. +# to treat a multi-line C++ comment block as a detailed description. Set this
  424. +# tag to YES if you prefer the old behavior instead.
  425. +#
  426. +# Note that setting this tag to YES also means that rational rose comments are
  427. +# not recognized any more.
  428. +# The default value is: NO.
  429. +
  430. +MULTILINE_CPP_IS_BRIEF = NO
  431. +
  432. +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
  433. +# documentation from any documented member that it re-implements.
  434. +# The default value is: YES.
  435. +
  436. +INHERIT_DOCS = YES
  437. +
  438. +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
  439. +# new page for each member. If set to NO, the documentation of a member will be
  440. +# part of the file/class/namespace that contains it.
  441. +# The default value is: NO.
  442. +
  443. +SEPARATE_MEMBER_PAGES = NO
  444. +
  445. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
  446. +# uses this value to replace tabs by spaces in code fragments.
  447. +# Minimum value: 1, maximum value: 16, default value: 4.
  448. +
  449. +TAB_SIZE = 4
  450. +
  451. +# This tag can be used to specify a number of aliases that act as commands in
  452. +# the documentation. An alias has the form:
  453. +# name=value
  454. +# For example adding
  455. +# "sideeffect=@par Side Effects:\n"
  456. +# will allow you to put the command \sideeffect (or @sideeffect) in the
  457. +# documentation, which will result in a user-defined paragraph with heading
  458. +# "Side Effects:". You can put \n's in the value part of an alias to insert
  459. +# newlines.
  460. +
  461. +ALIASES =
  462. +
  463. +# This tag can be used to specify a number of word-keyword mappings (TCL only).
  464. +# A mapping has the form "name=value". For example adding "class=itcl::class"
  465. +# will allow you to use the command class in the itcl::class meaning.
  466. +
  467. +TCL_SUBST =
  468. +
  469. +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
  470. +# only. Doxygen will then generate output that is more tailored for C. For
  471. +# instance, some of the names that are used will be different. The list of all
  472. +# members will be omitted, etc.
  473. +# The default value is: NO.
  474. +
  475. +OPTIMIZE_OUTPUT_FOR_C = NO
  476. +
  477. +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
  478. +# Python sources only. Doxygen will then generate output that is more tailored
  479. +# for that language. For instance, namespaces will be presented as packages,
  480. +# qualified scopes will look different, etc.
  481. +# The default value is: NO.
  482. +
  483. +OPTIMIZE_OUTPUT_JAVA = NO
  484. +
  485. +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
  486. +# sources. Doxygen will then generate output that is tailored for Fortran.
  487. +# The default value is: NO.
  488. +
  489. +OPTIMIZE_FOR_FORTRAN = NO
  490. +
  491. +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
  492. +# sources. Doxygen will then generate output that is tailored for VHDL.
  493. +# The default value is: NO.
  494. +
  495. +OPTIMIZE_OUTPUT_VHDL = NO
  496. +
  497. +# Doxygen selects the parser to use depending on the extension of the files it
  498. +# parses. With this tag you can assign which parser to use for a given
  499. +# extension. Doxygen has a built-in mapping, but you can override or extend it
  500. +# using this tag. The format is ext=language, where ext is a file extension, and
  501. +# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
  502. +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
  503. +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
  504. +# Fortran. In the later case the parser tries to guess whether the code is fixed
  505. +# or free formatted code, this is the default for Fortran type files), VHDL. For
  506. +# instance to make doxygen treat .inc files as Fortran files (default is PHP),
  507. +# and .f files as C (default is Fortran), use: inc=Fortran f=C.
  508. +#
  509. +# Note For files without extension you can use no_extension as a placeholder.
  510. +#
  511. +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
  512. +# the files are not read by doxygen.
  513. +
  514. +EXTENSION_MAPPING =
  515. +
  516. +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
  517. +# according to the Markdown format, which allows for more readable
  518. +# documentation. See http://daringfireball.net/projects/markdown/ for details.
  519. +# The output of markdown processing is further processed by doxygen, so you can
  520. +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
  521. +# case of backward compatibilities issues.
  522. +# The default value is: YES.
  523. +
  524. +MARKDOWN_SUPPORT = YES
  525. +
  526. +# When enabled doxygen tries to link words that correspond to documented
  527. +# classes, or namespaces to their corresponding documentation. Such a link can
  528. +# be prevented in individual cases by by putting a % sign in front of the word
  529. +# or globally by setting AUTOLINK_SUPPORT to NO.
  530. +# The default value is: YES.
  531. +
  532. +AUTOLINK_SUPPORT = YES
  533. +
  534. +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
  535. +# to include (a tag file for) the STL sources as input, then you should set this
  536. +# tag to YES in order to let doxygen match functions declarations and
  537. +# definitions whose arguments contain STL classes (e.g. func(std::string);
  538. +# versus func(std::string) {}). This also make the inheritance and collaboration
  539. +# diagrams that involve STL classes more complete and accurate.
  540. +# The default value is: NO.
  541. +
  542. +BUILTIN_STL_SUPPORT = YES
  543. +
  544. +# If you use Microsoft's C++/CLI language, you should set this option to YES to
  545. +# enable parsing support.
  546. +# The default value is: NO.
  547. +
  548. +CPP_CLI_SUPPORT = NO
  549. +
  550. +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
  551. +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
  552. +# will parse them like normal C++ but will assume all classes use public instead
  553. +# of private inheritance when no explicit protection keyword is present.
  554. +# The default value is: NO.
  555. +
  556. +SIP_SUPPORT = NO
  557. +
  558. +# For Microsoft's IDL there are propget and propput attributes to indicate
  559. +# getter and setter methods for a property. Setting this option to YES will make
  560. +# doxygen to replace the get and set methods by a property in the documentation.
  561. +# This will only work if the methods are indeed getting or setting a simple
  562. +# type. If this is not the case, or you want to show the methods anyway, you
  563. +# should set this option to NO.
  564. +# The default value is: YES.
  565. +
  566. +IDL_PROPERTY_SUPPORT = YES
  567. +
  568. +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
  569. +# tag is set to YES, then doxygen will reuse the documentation of the first
  570. +# member in the group (if any) for the other members of the group. By default
  571. +# all members of a group must be documented explicitly.
  572. +# The default value is: NO.
  573. +
  574. +DISTRIBUTE_GROUP_DOC = NO
  575. +
  576. +# Set the SUBGROUPING tag to YES to allow class member groups of the same type
  577. +# (for instance a group of public functions) to be put as a subgroup of that
  578. +# type (e.g. under the Public Functions section). Set it to NO to prevent
  579. +# subgrouping. Alternatively, this can be done per class using the
  580. +# \nosubgrouping command.
  581. +# The default value is: YES.
  582. +
  583. +SUBGROUPING = YES
  584. +
  585. +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
  586. +# are shown inside the group in which they are included (e.g. using \ingroup)
  587. +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
  588. +# and RTF).
  589. +#
  590. +# Note that this feature does not work in combination with
  591. +# SEPARATE_MEMBER_PAGES.
  592. +# The default value is: NO.
  593. +
  594. +INLINE_GROUPED_CLASSES = NO
  595. +
  596. +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
  597. +# with only public data fields or simple typedef fields will be shown inline in
  598. +# the documentation of the scope in which they are defined (i.e. file,
  599. +# namespace, or group documentation), provided this scope is documented. If set
  600. +# to NO, structs, classes, and unions are shown on a separate page (for HTML and
  601. +# Man pages) or section (for LaTeX and RTF).
  602. +# The default value is: NO.
  603. +
  604. +INLINE_SIMPLE_STRUCTS = NO
  605. +
  606. +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
  607. +# enum is documented as struct, union, or enum with the name of the typedef. So
  608. +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
  609. +# with name TypeT. When disabled the typedef will appear as a member of a file,
  610. +# namespace, or class. And the struct will be named TypeS. This can typically be
  611. +# useful for C code in case the coding convention dictates that all compound
  612. +# types are typedef'ed and only the typedef is referenced, never the tag name.
  613. +# The default value is: NO.
  614. +
  615. +TYPEDEF_HIDES_STRUCT = NO
  616. +
  617. +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
  618. +# cache is used to resolve symbols given their name and scope. Since this can be
  619. +# an expensive process and often the same symbol appears multiple times in the
  620. +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
  621. +# doxygen will become slower. If the cache is too large, memory is wasted. The
  622. +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
  623. +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
  624. +# symbols. At the end of a run doxygen will report the cache usage and suggest
  625. +# the optimal cache size from a speed point of view.
  626. +# Minimum value: 0, maximum value: 9, default value: 0.
  627. +
  628. +LOOKUP_CACHE_SIZE = 0
  629. +
  630. +#---------------------------------------------------------------------------
  631. +# Build related configuration options
  632. +#---------------------------------------------------------------------------
  633. +
  634. +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
  635. +# documentation are documented, even if no documentation was available. Private
  636. +# class members and static file members will be hidden unless the
  637. +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
  638. +# Note: This will also disable the warnings about undocumented members that are
  639. +# normally produced when WARNINGS is set to YES.
  640. +# The default value is: NO.
  641. +
  642. +EXTRACT_ALL = NO
  643. +
  644. +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
  645. +# be included in the documentation.
  646. +# The default value is: NO.
  647. +
  648. +EXTRACT_PRIVATE = NO
  649. +
  650. +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
  651. +# scope will be included in the documentation.
  652. +# The default value is: NO.
  653. +
  654. +EXTRACT_PACKAGE = NO
  655. +
  656. +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
  657. +# included in the documentation.
  658. +# The default value is: NO.
  659. +
  660. +EXTRACT_STATIC = YES
  661. +
  662. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
  663. +# locally in source files will be included in the documentation. If set to NO
  664. +# only classes defined in header files are included. Does not have any effect
  665. +# for Java sources.
  666. +# The default value is: YES.
  667. +
  668. +EXTRACT_LOCAL_CLASSES = YES
  669. +
  670. +# This flag is only useful for Objective-C code. When set to YES local methods,
  671. +# which are defined in the implementation section but not in the interface are
  672. +# included in the documentation. If set to NO only methods in the interface are
  673. +# included.
  674. +# The default value is: NO.
  675. +
  676. +EXTRACT_LOCAL_METHODS = NO
  677. +
  678. +# If this flag is set to YES, the members of anonymous namespaces will be
  679. +# extracted and appear in the documentation as a namespace called
  680. +# 'anonymous_namespace{file}', where file will be replaced with the base name of
  681. +# the file that contains the anonymous namespace. By default anonymous namespace
  682. +# are hidden.
  683. +# The default value is: NO.
  684. +
  685. +EXTRACT_ANON_NSPACES = NO
  686. +
  687. +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
  688. +# undocumented members inside documented classes or files. If set to NO these
  689. +# members will be included in the various overviews, but no documentation
  690. +# section is generated. This option has no effect if EXTRACT_ALL is enabled.
  691. +# The default value is: NO.
  692. +
  693. +HIDE_UNDOC_MEMBERS = NO
  694. +
  695. +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
  696. +# undocumented classes that are normally visible in the class hierarchy. If set
  697. +# to NO these classes will be included in the various overviews. This option has
  698. +# no effect if EXTRACT_ALL is enabled.
  699. +# The default value is: NO.
  700. +
  701. +HIDE_UNDOC_CLASSES = NO
  702. +
  703. +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
  704. +# (class|struct|union) declarations. If set to NO these declarations will be
  705. +# included in the documentation.
  706. +# The default value is: NO.
  707. +
  708. +HIDE_FRIEND_COMPOUNDS = NO
  709. +
  710. +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
  711. +# documentation blocks found inside the body of a function. If set to NO these
  712. +# blocks will be appended to the function's detailed documentation block.
  713. +# The default value is: NO.
  714. +
  715. +HIDE_IN_BODY_DOCS = NO
  716. +
  717. +# The INTERNAL_DOCS tag determines if documentation that is typed after a
  718. +# \internal command is included. If the tag is set to NO then the documentation
  719. +# will be excluded. Set it to YES to include the internal documentation.
  720. +# The default value is: NO.
  721. +
  722. +INTERNAL_DOCS = NO
  723. +
  724. +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
  725. +# names in lower-case letters. If set to YES upper-case letters are also
  726. +# allowed. This is useful if you have classes or files whose names only differ
  727. +# in case and if your file system supports case sensitive file names. Windows
  728. +# and Mac users are advised to set this option to NO.
  729. +# The default value is: system dependent.
  730. +
  731. +CASE_SENSE_NAMES = NO
  732. +
  733. +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
  734. +# their full class and namespace scopes in the documentation. If set to YES the
  735. +# scope will be hidden.
  736. +# The default value is: NO.
  737. +
  738. +HIDE_SCOPE_NAMES = NO
  739. +
  740. +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
  741. +# the files that are included by a file in the documentation of that file.
  742. +# The default value is: YES.
  743. +
  744. +SHOW_INCLUDE_FILES = YES
  745. +
  746. +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
  747. +# grouped member an include statement to the documentation, telling the reader
  748. +# which file to include in order to use the member.
  749. +# The default value is: NO.
  750. +
  751. +SHOW_GROUPED_MEMB_INC = NO
  752. +
  753. +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
  754. +# files with double quotes in the documentation rather than with sharp brackets.
  755. +# The default value is: NO.
  756. +
  757. +FORCE_LOCAL_INCLUDES = NO
  758. +
  759. +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
  760. +# documentation for inline members.
  761. +# The default value is: YES.
  762. +
  763. +INLINE_INFO = YES
  764. +
  765. +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
  766. +# (detailed) documentation of file and class members alphabetically by member
  767. +# name. If set to NO the members will appear in declaration order.
  768. +# The default value is: YES.
  769. +
  770. +SORT_MEMBER_DOCS = YES
  771. +
  772. +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
  773. +# descriptions of file, namespace and class members alphabetically by member
  774. +# name. If set to NO the members will appear in declaration order. Note that
  775. +# this will also influence the order of the classes in the class list.
  776. +# The default value is: NO.
  777. +
  778. +SORT_BRIEF_DOCS = NO
  779. +
  780. +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
  781. +# (brief and detailed) documentation of class members so that constructors and
  782. +# destructors are listed first. If set to NO the constructors will appear in the
  783. +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
  784. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
  785. +# member documentation.
  786. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
  787. +# detailed member documentation.
  788. +# The default value is: NO.
  789. +
  790. +SORT_MEMBERS_CTORS_1ST = NO
  791. +
  792. +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
  793. +# of group names into alphabetical order. If set to NO the group names will
  794. +# appear in their defined order.
  795. +# The default value is: NO.
  796. +
  797. +SORT_GROUP_NAMES = NO
  798. +
  799. +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
  800. +# fully-qualified names, including namespaces. If set to NO, the class list will
  801. +# be sorted only by class name, not including the namespace part.
  802. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
  803. +# Note: This option applies only to the class list, not to the alphabetical
  804. +# list.
  805. +# The default value is: NO.
  806. +
  807. +SORT_BY_SCOPE_NAME = NO
  808. +
  809. +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
  810. +# type resolution of all parameters of a function it will reject a match between
  811. +# the prototype and the implementation of a member function even if there is
  812. +# only one candidate or it is obvious which candidate to choose by doing a
  813. +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
  814. +# accept a match between prototype and implementation in such cases.
  815. +# The default value is: NO.
  816. +
  817. +STRICT_PROTO_MATCHING = NO
  818. +
  819. +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
  820. +# todo list. This list is created by putting \todo commands in the
  821. +# documentation.
  822. +# The default value is: YES.
  823. +
  824. +GENERATE_TODOLIST = YES
  825. +
  826. +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
  827. +# test list. This list is created by putting \test commands in the
  828. +# documentation.
  829. +# The default value is: YES.
  830. +
  831. +GENERATE_TESTLIST = YES
  832. +
  833. +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
  834. +# list. This list is created by putting \bug commands in the documentation.
  835. +# The default value is: YES.
  836. +
  837. +GENERATE_BUGLIST = YES
  838. +
  839. +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
  840. +# the deprecated list. This list is created by putting \deprecated commands in
  841. +# the documentation.
  842. +# The default value is: YES.
  843. +
  844. +GENERATE_DEPRECATEDLIST= YES
  845. +
  846. +# The ENABLED_SECTIONS tag can be used to enable conditional documentation
  847. +# sections, marked by \if <section_label> ... \endif and \cond <section_label>
  848. +# ... \endcond blocks.
  849. +
  850. +ENABLED_SECTIONS =
  851. +
  852. +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
  853. +# initial value of a variable or macro / define can have for it to appear in the
  854. +# documentation. If the initializer consists of more lines than specified here
  855. +# it will be hidden. Use a value of 0 to hide initializers completely. The
  856. +# appearance of the value of individual variables and macros / defines can be
  857. +# controlled using \showinitializer or \hideinitializer command in the
  858. +# documentation regardless of this setting.
  859. +# Minimum value: 0, maximum value: 10000, default value: 30.
  860. +
  861. +MAX_INITIALIZER_LINES = 30
  862. +
  863. +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
  864. +# the bottom of the documentation of classes and structs. If set to YES the list
  865. +# will mention the files that were used to generate the documentation.
  866. +# The default value is: YES.
  867. +
  868. +SHOW_USED_FILES = YES
  869. +
  870. +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
  871. +# will remove the Files entry from the Quick Index and from the Folder Tree View
  872. +# (if specified).
  873. +# The default value is: YES.
  874. +
  875. +SHOW_FILES = YES
  876. +
  877. +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
  878. +# page. This will remove the Namespaces entry from the Quick Index and from the
  879. +# Folder Tree View (if specified).
  880. +# The default value is: YES.
  881. +
  882. +SHOW_NAMESPACES = YES
  883. +
  884. +# The FILE_VERSION_FILTER tag can be used to specify a program or script that
  885. +# doxygen should invoke to get the current version for each file (typically from
  886. +# the version control system). Doxygen will invoke the program by executing (via
  887. +# popen()) the command command input-file, where command is the value of the
  888. +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
  889. +# by doxygen. Whatever the program writes to standard output is used as the file
  890. +# version. For an example see the documentation.
  891. +
  892. +FILE_VERSION_FILTER =
  893. +
  894. +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
  895. +# by doxygen. The layout file controls the global structure of the generated
  896. +# output files in an output format independent way. To create the layout file
  897. +# that represents doxygen's defaults, run doxygen with the -l option. You can
  898. +# optionally specify a file name after the option, if omitted DoxygenLayout.xml
  899. +# will be used as the name of the layout file.
  900. +#
  901. +# Note that if you run doxygen from a directory containing a file called
  902. +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
  903. +# tag is left empty.
  904. +
  905. +LAYOUT_FILE =
  906. +
  907. +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
  908. +# the reference definitions. This must be a list of .bib files. The .bib
  909. +# extension is automatically appended if omitted. This requires the bibtex tool
  910. +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
  911. +# For LaTeX the style of the bibliography can be controlled using
  912. +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
  913. +# search path. See also \cite for info how to create references.
  914. +
  915. +CITE_BIB_FILES =
  916. +
  917. +#---------------------------------------------------------------------------
  918. +# Configuration options related to warning and progress messages
  919. +#---------------------------------------------------------------------------
  920. +
  921. +# The QUIET tag can be used to turn on/off the messages that are generated to
  922. +# standard output by doxygen. If QUIET is set to YES this implies that the
  923. +# messages are off.
  924. +# The default value is: NO.
  925. +
  926. +QUIET = NO
  927. +
  928. +# The WARNINGS tag can be used to turn on/off the warning messages that are
  929. +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
  930. +# this implies that the warnings are on.
  931. +#
  932. +# Tip: Turn warnings on while writing the documentation.
  933. +# The default value is: YES.
  934. +
  935. +WARNINGS = YES
  936. +
  937. +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
  938. +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
  939. +# will automatically be disabled.
  940. +# The default value is: YES.
  941. +
  942. +WARN_IF_UNDOCUMENTED = YES
  943. +
  944. +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
  945. +# potential errors in the documentation, such as not documenting some parameters
  946. +# in a documented function, or documenting parameters that don't exist or using
  947. +# markup commands wrongly.
  948. +# The default value is: YES.
  949. +
  950. +WARN_IF_DOC_ERROR = YES
  951. +
  952. +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
  953. +# are documented, but have no documentation for their parameters or return
  954. +# value. If set to NO doxygen will only warn about wrong or incomplete parameter
  955. +# documentation, but not about the absence of documentation.
  956. +# The default value is: NO.
  957. +
  958. +WARN_NO_PARAMDOC = NO
  959. +
  960. +# The WARN_FORMAT tag determines the format of the warning messages that doxygen
  961. +# can produce. The string should contain the $file, $line, and $text tags, which
  962. +# will be replaced by the file and line number from which the warning originated
  963. +# and the warning text. Optionally the format may contain $version, which will
  964. +# be replaced by the version of the file (if it could be obtained via
  965. +# FILE_VERSION_FILTER)
  966. +# The default value is: $file:$line: $text.
  967. +
  968. +WARN_FORMAT = "$file:$line: $text"
  969. +
  970. +# The WARN_LOGFILE tag can be used to specify a file to which warning and error
  971. +# messages should be written. If left blank the output is written to standard
  972. +# error (stderr).
  973. +
  974. +WARN_LOGFILE = doxygen-warning.log
  975. +
  976. +#---------------------------------------------------------------------------
  977. +# Configuration options related to the input files
  978. +#---------------------------------------------------------------------------
  979. +
  980. +# The INPUT tag is used to specify the files and/or directories that contain
  981. +# documented source files. You may enter file names like myfile.cpp or
  982. +# directories like /usr/src/myproject. Separate the files or directories with
  983. +# spaces.
  984. +# Note: If this tag is empty the current directory is searched.
  985. +
  986. +INPUT = include
  987. +
  988. +# This tag can be used to specify the character encoding of the source files
  989. +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
  990. +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
  991. +# documentation (see: http://www.gnu.org/software/libiconv) for the list of
  992. +# possible encodings.
  993. +# The default value is: UTF-8.
  994. +
  995. +INPUT_ENCODING = UTF-8
  996. +
  997. +# If the value of the INPUT tag contains directories, you can use the
  998. +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
  999. +# *.h) to filter out the source-files in the directories. If left blank the
  1000. +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
  1001. +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
  1002. +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
  1003. +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
  1004. +# *.qsf, *.as and *.js.
  1005. +
  1006. +FILE_PATTERNS = *.hpp \
  1007. + *.h
  1008. +
  1009. +# The RECURSIVE tag can be used to specify whether or not subdirectories should
  1010. +# be searched for input files as well.
  1011. +# The default value is: NO.
  1012. +
  1013. +RECURSIVE = YES
  1014. +
  1015. +# The EXCLUDE tag can be used to specify files and/or directories that should be
  1016. +# excluded from the INPUT source files. This way you can easily exclude a
  1017. +# subdirectory from a directory tree whose root is specified with the INPUT tag.
  1018. +#
  1019. +# Note that relative paths are relative to the directory from which doxygen is
  1020. +# run.
  1021. +
  1022. +EXCLUDE =
  1023. +
  1024. +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
  1025. +# directories that are symbolic links (a Unix file system feature) are excluded
  1026. +# from the input.
  1027. +# The default value is: NO.
  1028. +
  1029. +EXCLUDE_SYMLINKS = NO
  1030. +
  1031. +# If the value of the INPUT tag contains directories, you can use the
  1032. +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
  1033. +# certain files from those directories.
  1034. +#
  1035. +# Note that the wildcards are matched against the file with absolute path, so to
  1036. +# exclude all test directories for example use the pattern */test/*
  1037. +
  1038. +EXCLUDE_PATTERNS = *.cpp
  1039. +
  1040. +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
  1041. +# (namespaces, classes, functions, etc.) that should be excluded from the
  1042. +# output. The symbol name can be a fully qualified name, a word, or if the
  1043. +# wildcard * is used, a substring. Examples: ANamespace, AClass,
  1044. +# AClass::ANamespace, ANamespace::*Test
  1045. +#
  1046. +# Note that the wildcards are matched against the file with absolute path, so to
  1047. +# exclude all test directories use the pattern */test/*
  1048. +
  1049. +EXCLUDE_SYMBOLS =
  1050. +
  1051. +# The EXAMPLE_PATH tag can be used to specify one or more files or directories
  1052. +# that contain example code fragments that are included (see the \include
  1053. +# command).
  1054. +
  1055. +EXAMPLE_PATH =
  1056. +
  1057. +# If the value of the EXAMPLE_PATH tag contains directories, you can use the
  1058. +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
  1059. +# *.h) to filter out the source-files in the directories. If left blank all
  1060. +# files are included.
  1061. +
  1062. +EXAMPLE_PATTERNS =
  1063. +
  1064. +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
  1065. +# searched for input files to be used with the \include or \dontinclude commands
  1066. +# irrespective of the value of the RECURSIVE tag.
  1067. +# The default value is: NO.
  1068. +
  1069. +EXAMPLE_RECURSIVE = NO
  1070. +
  1071. +# The IMAGE_PATH tag can be used to specify one or more files or directories
  1072. +# that contain images that are to be included in the documentation (see the
  1073. +# \image command).
  1074. +
  1075. +IMAGE_PATH =
  1076. +
  1077. +# The INPUT_FILTER tag can be used to specify a program that doxygen should
  1078. +# invoke to filter for each input file. Doxygen will invoke the filter program
  1079. +# by executing (via popen()) the command:
  1080. +#
  1081. +# <filter> <input-file>
  1082. +#
  1083. +# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
  1084. +# name of an input file. Doxygen will then use the output that the filter
  1085. +# program writes to standard output. If FILTER_PATTERNS is specified, this tag
  1086. +# will be ignored.
  1087. +#
  1088. +# Note that the filter must not add or remove lines; it is applied before the
  1089. +# code is scanned, but not when the output code is generated. If lines are added
  1090. +# or removed, the anchors will not be placed correctly.
  1091. +
  1092. +INPUT_FILTER =
  1093. +
  1094. +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
  1095. +# basis. Doxygen will compare the file name with each pattern and apply the
  1096. +# filter if there is a match. The filters are a list of the form: pattern=filter
  1097. +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
  1098. +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
  1099. +# patterns match the file name, INPUT_FILTER is applied.
  1100. +
  1101. +FILTER_PATTERNS =
  1102. +
  1103. +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
  1104. +# INPUT_FILTER ) will also be used to filter the input files that are used for
  1105. +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
  1106. +# The default value is: NO.
  1107. +
  1108. +FILTER_SOURCE_FILES = NO
  1109. +
  1110. +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
  1111. +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
  1112. +# it is also possible to disable source filtering for a specific pattern using
  1113. +# *.ext= (so without naming a filter).
  1114. +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
  1115. +
  1116. +FILTER_SOURCE_PATTERNS =
  1117. +
  1118. +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
  1119. +# is part of the input, its contents will be placed on the main page
  1120. +# (index.html). This can be useful if you have a project on for instance GitHub
  1121. +# and want to reuse the introduction page also for the doxygen output.
  1122. +
  1123. +USE_MDFILE_AS_MAINPAGE =
  1124. +
  1125. +#---------------------------------------------------------------------------
  1126. +# Configuration options related to source browsing
  1127. +#---------------------------------------------------------------------------
  1128. +
  1129. +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
  1130. +# generated. Documented entities will be cross-referenced with these sources.
  1131. +#
  1132. +# Note: To get rid of all source code in the generated output, make sure that
  1133. +# also VERBATIM_HEADERS is set to NO.
  1134. +# The default value is: NO.
  1135. +
  1136. +SOURCE_BROWSER = NO
  1137. +
  1138. +# Setting the INLINE_SOURCES tag to YES will include the body of functions,
  1139. +# classes and enums directly into the documentation.
  1140. +# The default value is: NO.
  1141. +
  1142. +INLINE_SOURCES = NO
  1143. +
  1144. +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
  1145. +# special comment blocks from generated source code fragments. Normal C, C++ and
  1146. +# Fortran comments will always remain visible.
  1147. +# The default value is: YES.
  1148. +
  1149. +STRIP_CODE_COMMENTS = YES
  1150. +
  1151. +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
  1152. +# function all documented functions referencing it will be listed.
  1153. +# The default value is: NO.
  1154. +
  1155. +REFERENCED_BY_RELATION = NO
  1156. +
  1157. +# If the REFERENCES_RELATION tag is set to YES then for each documented function
  1158. +# all documented entities called/used by that function will be listed.
  1159. +# The default value is: NO.
  1160. +
  1161. +REFERENCES_RELATION = NO
  1162. +
  1163. +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
  1164. +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
  1165. +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
  1166. +# link to the documentation.
  1167. +# The default value is: YES.
  1168. +
  1169. +REFERENCES_LINK_SOURCE = YES
  1170. +
  1171. +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
  1172. +# source code will show a tooltip with additional information such as prototype,
  1173. +# brief description and links to the definition and documentation. Since this
  1174. +# will make the HTML file larger and loading of large files a bit slower, you
  1175. +# can opt to disable this feature.
  1176. +# The default value is: YES.
  1177. +# This tag requires that the tag SOURCE_BROWSER is set to YES.
  1178. +
  1179. +SOURCE_TOOLTIPS = YES
  1180. +
  1181. +# If the USE_HTAGS tag is set to YES then the references to source code will
  1182. +# point to the HTML generated by the htags(1) tool instead of doxygen built-in
  1183. +# source browser. The htags tool is part of GNU's global source tagging system
  1184. +# (see http://www.gnu.org/software/global/global.html). You will need version
  1185. +# 4.8.6 or higher.
  1186. +#
  1187. +# To use it do the following:
  1188. +# - Install the latest version of global
  1189. +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
  1190. +# - Make sure the INPUT points to the root of the source tree
  1191. +# - Run doxygen as normal
  1192. +#
  1193. +# Doxygen will invoke htags (and that will in turn invoke gtags), so these
  1194. +# tools must be available from the command line (i.e. in the search path).
  1195. +#
  1196. +# The result: instead of the source browser generated by doxygen, the links to
  1197. +# source code will now point to the output of htags.
  1198. +# The default value is: NO.
  1199. +# This tag requires that the tag SOURCE_BROWSER is set to YES.
  1200. +
  1201. +USE_HTAGS = NO
  1202. +
  1203. +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
  1204. +# verbatim copy of the header file for each class for which an include is
  1205. +# specified. Set to NO to disable this.
  1206. +# See also: Section \class.
  1207. +# The default value is: YES.
  1208. +
  1209. +VERBATIM_HEADERS = YES
  1210. +
  1211. +# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the
  1212. +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
  1213. +# cost of reduced performance. This can be particularly helpful with template
  1214. +# rich C++ code for which doxygen's built-in parser lacks the necessary type
  1215. +# information.
  1216. +# Note: The availability of this option depends on whether or not doxygen was
  1217. +# compiled with the --with-libclang option.
  1218. +# The default value is: NO.
  1219. +
  1220. +CLANG_ASSISTED_PARSING = NO
  1221. +
  1222. +# If clang assisted parsing is enabled you can provide the compiler with command
  1223. +# line options that you would normally use when invoking the compiler. Note that
  1224. +# the include paths will already be set by doxygen for the files and directories
  1225. +# specified with INPUT and INCLUDE_PATH.
  1226. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
  1227. +
  1228. +CLANG_OPTIONS =
  1229. +
  1230. +#---------------------------------------------------------------------------
  1231. +# Configuration options related to the alphabetical class index
  1232. +#---------------------------------------------------------------------------
  1233. +
  1234. +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
  1235. +# compounds will be generated. Enable this if the project contains a lot of
  1236. +# classes, structs, unions or interfaces.
  1237. +# The default value is: YES.
  1238. +
  1239. +ALPHABETICAL_INDEX = YES
  1240. +
  1241. +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
  1242. +# which the alphabetical index list will be split.
  1243. +# Minimum value: 1, maximum value: 20, default value: 5.
  1244. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
  1245. +
  1246. +COLS_IN_ALPHA_INDEX = 5
  1247. +
  1248. +# In case all classes in a project start with a common prefix, all classes will
  1249. +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
  1250. +# can be used to specify a prefix (or a list of prefixes) that should be ignored
  1251. +# while generating the index headers.
  1252. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
  1253. +
  1254. +IGNORE_PREFIX =
  1255. +
  1256. +#---------------------------------------------------------------------------
  1257. +# Configuration options related to the HTML output
  1258. +#---------------------------------------------------------------------------
  1259. +
  1260. +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
  1261. +# The default value is: YES.
  1262. +
  1263. +GENERATE_HTML = YES
  1264. +
  1265. +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
  1266. +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
  1267. +# it.
  1268. +# The default directory is: html.
  1269. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1270. +
  1271. +HTML_OUTPUT = html
  1272. +
  1273. +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
  1274. +# generated HTML page (for example: .htm, .php, .asp).
  1275. +# The default value is: .html.
  1276. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1277. +
  1278. +HTML_FILE_EXTENSION = .html
  1279. +
  1280. +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
  1281. +# each generated HTML page. If the tag is left blank doxygen will generate a
  1282. +# standard header.
  1283. +#
  1284. +# To get valid HTML the header file that includes any scripts and style sheets
  1285. +# that doxygen needs, which is dependent on the configuration options used (e.g.
  1286. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
  1287. +# default header using
  1288. +# doxygen -w html new_header.html new_footer.html new_stylesheet.css
  1289. +# YourConfigFile
  1290. +# and then modify the file new_header.html. See also section "Doxygen usage"
  1291. +# for information on how to generate the default header that doxygen normally
  1292. +# uses.
  1293. +# Note: The header is subject to change so you typically have to regenerate the
  1294. +# default header when upgrading to a newer version of doxygen. For a description
  1295. +# of the possible markers and block names see the documentation.
  1296. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1297. +
  1298. +HTML_HEADER =
  1299. +
  1300. +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
  1301. +# generated HTML page. If the tag is left blank doxygen will generate a standard
  1302. +# footer. See HTML_HEADER for more information on how to generate a default
  1303. +# footer and what special commands can be used inside the footer. See also
  1304. +# section "Doxygen usage" for information on how to generate the default footer
  1305. +# that doxygen normally uses.
  1306. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1307. +
  1308. +HTML_FOOTER =
  1309. +
  1310. +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
  1311. +# sheet that is used by each HTML page. It can be used to fine-tune the look of
  1312. +# the HTML output. If left blank doxygen will generate a default style sheet.
  1313. +# See also section "Doxygen usage" for information on how to generate the style
  1314. +# sheet that doxygen normally uses.
  1315. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
  1316. +# it is more robust and this tag (HTML_STYLESHEET) will in the future become
  1317. +# obsolete.
  1318. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1319. +
  1320. +HTML_STYLESHEET =
  1321. +
  1322. +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
  1323. +# cascading style sheets that are included after the standard style sheets
  1324. +# created by doxygen. Using this option one can overrule certain style aspects.
  1325. +# This is preferred over using HTML_STYLESHEET since it does not replace the
  1326. +# standard style sheet and is therefor more robust against future updates.
  1327. +# Doxygen will copy the style sheet files to the output directory.
  1328. +# Note: The order of the extra stylesheet files is of importance (e.g. the last
  1329. +# stylesheet in the list overrules the setting of the previous ones in the
  1330. +# list). For an example see the documentation.
  1331. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1332. +
  1333. +HTML_EXTRA_STYLESHEET =
  1334. +
  1335. +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
  1336. +# other source files which should be copied to the HTML output directory. Note
  1337. +# that these files will be copied to the base HTML output directory. Use the
  1338. +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
  1339. +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
  1340. +# files will be copied as-is; there are no commands or markers available.
  1341. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1342. +
  1343. +HTML_EXTRA_FILES =
  1344. +
  1345. +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
  1346. +# will adjust the colors in the stylesheet and background images according to
  1347. +# this color. Hue is specified as an angle on a colorwheel, see
  1348. +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
  1349. +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
  1350. +# purple, and 360 is red again.
  1351. +# Minimum value: 0, maximum value: 359, default value: 220.
  1352. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1353. +
  1354. +HTML_COLORSTYLE_HUE = 220
  1355. +
  1356. +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
  1357. +# in the HTML output. For a value of 0 the output will use grayscales only. A
  1358. +# value of 255 will produce the most vivid colors.
  1359. +# Minimum value: 0, maximum value: 255, default value: 100.
  1360. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1361. +
  1362. +HTML_COLORSTYLE_SAT = 100
  1363. +
  1364. +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
  1365. +# luminance component of the colors in the HTML output. Values below 100
  1366. +# gradually make the output lighter, whereas values above 100 make the output
  1367. +# darker. The value divided by 100 is the actual gamma applied, so 80 represents
  1368. +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
  1369. +# change the gamma.
  1370. +# Minimum value: 40, maximum value: 240, default value: 80.
  1371. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1372. +
  1373. +HTML_COLORSTYLE_GAMMA = 80
  1374. +
  1375. +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
  1376. +# page will contain the date and time when the page was generated. Setting this
  1377. +# to NO can help when comparing the output of multiple runs.
  1378. +# The default value is: YES.
  1379. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1380. +
  1381. +HTML_TIMESTAMP = YES
  1382. +
  1383. +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
  1384. +# documentation will contain sections that can be hidden and shown after the
  1385. +# page has loaded.
  1386. +# The default value is: NO.
  1387. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1388. +
  1389. +HTML_DYNAMIC_SECTIONS = NO
  1390. +
  1391. +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
  1392. +# shown in the various tree structured indices initially; the user can expand
  1393. +# and collapse entries dynamically later on. Doxygen will expand the tree to
  1394. +# such a level that at most the specified number of entries are visible (unless
  1395. +# a fully collapsed tree already exceeds this amount). So setting the number of
  1396. +# entries 1 will produce a full collapsed tree by default. 0 is a special value
  1397. +# representing an infinite number of entries and will result in a full expanded
  1398. +# tree by default.
  1399. +# Minimum value: 0, maximum value: 9999, default value: 100.
  1400. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1401. +
  1402. +HTML_INDEX_NUM_ENTRIES = 100
  1403. +
  1404. +# If the GENERATE_DOCSET tag is set to YES, additional index files will be
  1405. +# generated that can be used as input for Apple's Xcode 3 integrated development
  1406. +# environment (see: http://developer.apple.com/tools/xcode/), introduced with
  1407. +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
  1408. +# Makefile in the HTML output directory. Running make will produce the docset in
  1409. +# that directory and running make install will install the docset in
  1410. +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
  1411. +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
  1412. +# for more information.
  1413. +# The default value is: NO.
  1414. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1415. +
  1416. +GENERATE_DOCSET = NO
  1417. +
  1418. +# This tag determines the name of the docset feed. A documentation feed provides
  1419. +# an umbrella under which multiple documentation sets from a single provider
  1420. +# (such as a company or product suite) can be grouped.
  1421. +# The default value is: Doxygen generated docs.
  1422. +# This tag requires that the tag GENERATE_DOCSET is set to YES.
  1423. +
  1424. +DOCSET_FEEDNAME = "Doxygen generated docs"
  1425. +
  1426. +# This tag specifies a string that should uniquely identify the documentation
  1427. +# set bundle. This should be a reverse domain-name style string, e.g.
  1428. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
  1429. +# The default value is: org.doxygen.Project.
  1430. +# This tag requires that the tag GENERATE_DOCSET is set to YES.
  1431. +
  1432. +DOCSET_BUNDLE_ID = org.doxygen.Project
  1433. +
  1434. +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
  1435. +# the documentation publisher. This should be a reverse domain-name style
  1436. +# string, e.g. com.mycompany.MyDocSet.documentation.
  1437. +# The default value is: org.doxygen.Publisher.
  1438. +# This tag requires that the tag GENERATE_DOCSET is set to YES.
  1439. +
  1440. +DOCSET_PUBLISHER_ID = org.doxygen.Publisher
  1441. +
  1442. +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
  1443. +# The default value is: Publisher.
  1444. +# This tag requires that the tag GENERATE_DOCSET is set to YES.
  1445. +
  1446. +DOCSET_PUBLISHER_NAME = Publisher
  1447. +
  1448. +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
  1449. +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
  1450. +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
  1451. +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
  1452. +# Windows.
  1453. +#
  1454. +# The HTML Help Workshop contains a compiler that can convert all HTML output
  1455. +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
  1456. +# files are now used as the Windows 98 help format, and will replace the old
  1457. +# Windows help format (.hlp) on all Windows platforms in the future. Compressed
  1458. +# HTML files also contain an index, a table of contents, and you can search for
  1459. +# words in the documentation. The HTML workshop also contains a viewer for
  1460. +# compressed HTML files.
  1461. +# The default value is: NO.
  1462. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1463. +
  1464. +GENERATE_HTMLHELP = NO
  1465. +
  1466. +# The CHM_FILE tag can be used to specify the file name of the resulting .chm
  1467. +# file. You can add a path in front of the file if the result should not be
  1468. +# written to the html output directory.
  1469. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
  1470. +
  1471. +CHM_FILE =
  1472. +
  1473. +# The HHC_LOCATION tag can be used to specify the location (absolute path
  1474. +# including file name) of the HTML help compiler ( hhc.exe). If non-empty
  1475. +# doxygen will try to run the HTML help compiler on the generated index.hhp.
  1476. +# The file has to be specified with full path.
  1477. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
  1478. +
  1479. +HHC_LOCATION =
  1480. +
  1481. +# The GENERATE_CHI flag controls if a separate .chi index file is generated (
  1482. +# YES) or that it should be included in the master .chm file ( NO).
  1483. +# The default value is: NO.
  1484. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
  1485. +
  1486. +GENERATE_CHI = NO
  1487. +
  1488. +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
  1489. +# and project file content.
  1490. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
  1491. +
  1492. +CHM_INDEX_ENCODING =
  1493. +
  1494. +# The BINARY_TOC flag controls whether a binary table of contents is generated (
  1495. +# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
  1496. +# enables the Previous and Next buttons.
  1497. +# The default value is: NO.
  1498. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
  1499. +
  1500. +BINARY_TOC = NO
  1501. +
  1502. +# The TOC_EXPAND flag can be set to YES to add extra items for group members to
  1503. +# the table of contents of the HTML help documentation and to the tree view.
  1504. +# The default value is: NO.
  1505. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
  1506. +
  1507. +TOC_EXPAND = NO
  1508. +
  1509. +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
  1510. +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
  1511. +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
  1512. +# (.qch) of the generated HTML documentation.
  1513. +# The default value is: NO.
  1514. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1515. +
  1516. +GENERATE_QHP = NO
  1517. +
  1518. +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
  1519. +# the file name of the resulting .qch file. The path specified is relative to
  1520. +# the HTML output folder.
  1521. +# This tag requires that the tag GENERATE_QHP is set to YES.
  1522. +
  1523. +QCH_FILE =
  1524. +
  1525. +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
  1526. +# Project output. For more information please see Qt Help Project / Namespace
  1527. +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
  1528. +# The default value is: org.doxygen.Project.
  1529. +# This tag requires that the tag GENERATE_QHP is set to YES.
  1530. +
  1531. +QHP_NAMESPACE = org.doxygen.Project
  1532. +
  1533. +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
  1534. +# Help Project output. For more information please see Qt Help Project / Virtual
  1535. +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
  1536. +# folders).
  1537. +# The default value is: doc.
  1538. +# This tag requires that the tag GENERATE_QHP is set to YES.
  1539. +
  1540. +QHP_VIRTUAL_FOLDER = doc
  1541. +
  1542. +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
  1543. +# filter to add. For more information please see Qt Help Project / Custom
  1544. +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
  1545. +# filters).
  1546. +# This tag requires that the tag GENERATE_QHP is set to YES.
  1547. +
  1548. +QHP_CUST_FILTER_NAME =
  1549. +
  1550. +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
  1551. +# custom filter to add. For more information please see Qt Help Project / Custom
  1552. +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
  1553. +# filters).
  1554. +# This tag requires that the tag GENERATE_QHP is set to YES.
  1555. +
  1556. +QHP_CUST_FILTER_ATTRS =
  1557. +
  1558. +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
  1559. +# project's filter section matches. Qt Help Project / Filter Attributes (see:
  1560. +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
  1561. +# This tag requires that the tag GENERATE_QHP is set to YES.
  1562. +
  1563. +QHP_SECT_FILTER_ATTRS =
  1564. +
  1565. +# The QHG_LOCATION tag can be used to specify the location of Qt's
  1566. +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
  1567. +# generated .qhp file.
  1568. +# This tag requires that the tag GENERATE_QHP is set to YES.
  1569. +
  1570. +QHG_LOCATION =
  1571. +
  1572. +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
  1573. +# generated, together with the HTML files, they form an Eclipse help plugin. To
  1574. +# install this plugin and make it available under the help contents menu in
  1575. +# Eclipse, the contents of the directory containing the HTML and XML files needs
  1576. +# to be copied into the plugins directory of eclipse. The name of the directory
  1577. +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
  1578. +# After copying Eclipse needs to be restarted before the help appears.
  1579. +# The default value is: NO.
  1580. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1581. +
  1582. +GENERATE_ECLIPSEHELP = NO
  1583. +
  1584. +# A unique identifier for the Eclipse help plugin. When installing the plugin
  1585. +# the directory name containing the HTML and XML files should also have this
  1586. +# name. Each documentation set should have its own identifier.
  1587. +# The default value is: org.doxygen.Project.
  1588. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
  1589. +
  1590. +ECLIPSE_DOC_ID = org.doxygen.Project
  1591. +
  1592. +# If you want full control over the layout of the generated HTML pages it might
  1593. +# be necessary to disable the index and replace it with your own. The
  1594. +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
  1595. +# of each HTML page. A value of NO enables the index and the value YES disables
  1596. +# it. Since the tabs in the index contain the same information as the navigation
  1597. +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
  1598. +# The default value is: NO.
  1599. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1600. +
  1601. +DISABLE_INDEX = NO
  1602. +
  1603. +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
  1604. +# structure should be generated to display hierarchical information. If the tag
  1605. +# value is set to YES, a side panel will be generated containing a tree-like
  1606. +# index structure (just like the one that is generated for HTML Help). For this
  1607. +# to work a browser that supports JavaScript, DHTML, CSS and frames is required
  1608. +# (i.e. any modern browser). Windows users are probably better off using the
  1609. +# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
  1610. +# further fine-tune the look of the index. As an example, the default style
  1611. +# sheet generated by doxygen has an example that shows how to put an image at
  1612. +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
  1613. +# the same information as the tab index, you could consider setting
  1614. +# DISABLE_INDEX to YES when enabling this option.
  1615. +# The default value is: NO.
  1616. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1617. +
  1618. +GENERATE_TREEVIEW = YES
  1619. +
  1620. +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
  1621. +# doxygen will group on one line in the generated HTML documentation.
  1622. +#
  1623. +# Note that a value of 0 will completely suppress the enum values from appearing
  1624. +# in the overview section.
  1625. +# Minimum value: 0, maximum value: 20, default value: 4.
  1626. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1627. +
  1628. +ENUM_VALUES_PER_LINE = 4
  1629. +
  1630. +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
  1631. +# to set the initial width (in pixels) of the frame in which the tree is shown.
  1632. +# Minimum value: 0, maximum value: 1500, default value: 250.
  1633. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1634. +
  1635. +TREEVIEW_WIDTH = 250
  1636. +
  1637. +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
  1638. +# external symbols imported via tag files in a separate window.
  1639. +# The default value is: NO.
  1640. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1641. +
  1642. +EXT_LINKS_IN_WINDOW = NO
  1643. +
  1644. +# Use this tag to change the font size of LaTeX formulas included as images in
  1645. +# the HTML documentation. When you change the font size after a successful
  1646. +# doxygen run you need to manually remove any form_*.png images from the HTML
  1647. +# output directory to force them to be regenerated.
  1648. +# Minimum value: 8, maximum value: 50, default value: 10.
  1649. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1650. +
  1651. +FORMULA_FONTSIZE = 10
  1652. +
  1653. +# Use the FORMULA_TRANPARENT tag to determine whether or not the images
  1654. +# generated for formulas are transparent PNGs. Transparent PNGs are not
  1655. +# supported properly for IE 6.0, but are supported on all modern browsers.
  1656. +#
  1657. +# Note that when changing this option you need to delete any form_*.png files in
  1658. +# the HTML output directory before the changes have effect.
  1659. +# The default value is: YES.
  1660. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1661. +
  1662. +FORMULA_TRANSPARENT = YES
  1663. +
  1664. +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
  1665. +# http://www.mathjax.org) which uses client side Javascript for the rendering
  1666. +# instead of using prerendered bitmaps. Use this if you do not have LaTeX
  1667. +# installed or if you want to formulas look prettier in the HTML output. When
  1668. +# enabled you may also need to install MathJax separately and configure the path
  1669. +# to it using the MATHJAX_RELPATH option.
  1670. +# The default value is: NO.
  1671. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1672. +
  1673. +USE_MATHJAX = NO
  1674. +
  1675. +# When MathJax is enabled you can set the default output format to be used for
  1676. +# the MathJax output. See the MathJax site (see:
  1677. +# http://docs.mathjax.org/en/latest/output.html) for more details.
  1678. +# Possible values are: HTML-CSS (which is slower, but has the best
  1679. +# compatibility), NativeMML (i.e. MathML) and SVG.
  1680. +# The default value is: HTML-CSS.
  1681. +# This tag requires that the tag USE_MATHJAX is set to YES.
  1682. +
  1683. +MATHJAX_FORMAT = HTML-CSS
  1684. +
  1685. +# When MathJax is enabled you need to specify the location relative to the HTML
  1686. +# output directory using the MATHJAX_RELPATH option. The destination directory
  1687. +# should contain the MathJax.js script. For instance, if the mathjax directory
  1688. +# is located at the same level as the HTML output directory, then
  1689. +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
  1690. +# Content Delivery Network so you can quickly see the result without installing
  1691. +# MathJax. However, it is strongly recommended to install a local copy of
  1692. +# MathJax from http://www.mathjax.org before deployment.
  1693. +# The default value is: http://cdn.mathjax.org/mathjax/latest.
  1694. +# This tag requires that the tag USE_MATHJAX is set to YES.
  1695. +
  1696. +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
  1697. +
  1698. +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
  1699. +# extension names that should be enabled during MathJax rendering. For example
  1700. +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
  1701. +# This tag requires that the tag USE_MATHJAX is set to YES.
  1702. +
  1703. +MATHJAX_EXTENSIONS =
  1704. +
  1705. +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
  1706. +# of code that will be used on startup of the MathJax code. See the MathJax site
  1707. +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
  1708. +# example see the documentation.
  1709. +# This tag requires that the tag USE_MATHJAX is set to YES.
  1710. +
  1711. +MATHJAX_CODEFILE =
  1712. +
  1713. +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
  1714. +# the HTML output. The underlying search engine uses javascript and DHTML and
  1715. +# should work on any modern browser. Note that when using HTML help
  1716. +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
  1717. +# there is already a search function so this one should typically be disabled.
  1718. +# For large projects the javascript based search engine can be slow, then
  1719. +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
  1720. +# search using the keyboard; to jump to the search box use <access key> + S
  1721. +# (what the <access key> is depends on the OS and browser, but it is typically
  1722. +# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
  1723. +# key> to jump into the search results window, the results can be navigated
  1724. +# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
  1725. +# the search. The filter options can be selected when the cursor is inside the
  1726. +# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
  1727. +# to select a filter and <Enter> or <escape> to activate or cancel the filter
  1728. +# option.
  1729. +# The default value is: YES.
  1730. +# This tag requires that the tag GENERATE_HTML is set to YES.
  1731. +
  1732. +SEARCHENGINE = YES
  1733. +
  1734. +# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
  1735. +# implemented using a web server instead of a web client using Javascript. There
  1736. +# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
  1737. +# setting. When disabled, doxygen will generate a PHP script for searching and
  1738. +# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
  1739. +# and searching needs to be provided by external tools. See the section
  1740. +# "External Indexing and Searching" for details.
  1741. +# The default value is: NO.
  1742. +# This tag requires that the tag SEARCHENGINE is set to YES.
  1743. +
  1744. +SERVER_BASED_SEARCH = NO
  1745. +
  1746. +# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
  1747. +# script for searching. Instead the search results are written to an XML file
  1748. +# which needs to be processed by an external indexer. Doxygen will invoke an
  1749. +# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
  1750. +# search results.
  1751. +#
  1752. +# Doxygen ships with an example indexer ( doxyindexer) and search engine
  1753. +# (doxysearch.cgi) which are based on the open source search engine library
  1754. +# Xapian (see: http://xapian.org/).
  1755. +#
  1756. +# See the section "External Indexing and Searching" for details.
  1757. +# The default value is: NO.
  1758. +# This tag requires that the tag SEARCHENGINE is set to YES.
  1759. +
  1760. +EXTERNAL_SEARCH = NO
  1761. +
  1762. +# The SEARCHENGINE_URL should point to a search engine hosted by a web server
  1763. +# which will return the search results when EXTERNAL_SEARCH is enabled.
  1764. +#
  1765. +# Doxygen ships with an example indexer ( doxyindexer) and search engine
  1766. +# (doxysearch.cgi) which are based on the open source search engine library
  1767. +# Xapian (see: http://xapian.org/). See the section "External Indexing and
  1768. +# Searching" for details.
  1769. +# This tag requires that the tag SEARCHENGINE is set to YES.
  1770. +
  1771. +SEARCHENGINE_URL =
  1772. +
  1773. +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
  1774. +# search data is written to a file for indexing by an external tool. With the
  1775. +# SEARCHDATA_FILE tag the name of this file can be specified.
  1776. +# The default file is: searchdata.xml.
  1777. +# This tag requires that the tag SEARCHENGINE is set to YES.
  1778. +
  1779. +SEARCHDATA_FILE = searchdata.xml
  1780. +
  1781. +# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
  1782. +# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
  1783. +# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
  1784. +# projects and redirect the results back to the right project.
  1785. +# This tag requires that the tag SEARCHENGINE is set to YES.
  1786. +
  1787. +EXTERNAL_SEARCH_ID =
  1788. +
  1789. +# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
  1790. +# projects other than the one defined by this configuration file, but that are
  1791. +# all added to the same external search index. Each project needs to have a
  1792. +# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
  1793. +# to a relative location where the documentation can be found. The format is:
  1794. +# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
  1795. +# This tag requires that the tag SEARCHENGINE is set to YES.
  1796. +
  1797. +EXTRA_SEARCH_MAPPINGS =
  1798. +
  1799. +#---------------------------------------------------------------------------
  1800. +# Configuration options related to the LaTeX output
  1801. +#---------------------------------------------------------------------------
  1802. +
  1803. +# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
  1804. +# The default value is: YES.
  1805. +
  1806. +GENERATE_LATEX = NO
  1807. +
  1808. +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
  1809. +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
  1810. +# it.
  1811. +# The default directory is: latex.
  1812. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1813. +
  1814. +LATEX_OUTPUT = latex
  1815. +
  1816. +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
  1817. +# invoked.
  1818. +#
  1819. +# Note that when enabling USE_PDFLATEX this option is only used for generating
  1820. +# bitmaps for formulas in the HTML output, but not in the Makefile that is
  1821. +# written to the output directory.
  1822. +# The default file is: latex.
  1823. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1824. +
  1825. +LATEX_CMD_NAME = latex
  1826. +
  1827. +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
  1828. +# index for LaTeX.
  1829. +# The default file is: makeindex.
  1830. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1831. +
  1832. +MAKEINDEX_CMD_NAME = makeindex
  1833. +
  1834. +# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
  1835. +# documents. This may be useful for small projects and may help to save some
  1836. +# trees in general.
  1837. +# The default value is: NO.
  1838. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1839. +
  1840. +COMPACT_LATEX = NO
  1841. +
  1842. +# The PAPER_TYPE tag can be used to set the paper type that is used by the
  1843. +# printer.
  1844. +# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
  1845. +# 14 inches) and executive (7.25 x 10.5 inches).
  1846. +# The default value is: a4.
  1847. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1848. +
  1849. +PAPER_TYPE = a4
  1850. +
  1851. +# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
  1852. +# that should be included in the LaTeX output. To get the times font for
  1853. +# instance you can specify
  1854. +# EXTRA_PACKAGES=times
  1855. +# If left blank no extra packages will be included.
  1856. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1857. +
  1858. +EXTRA_PACKAGES =
  1859. +
  1860. +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
  1861. +# generated LaTeX document. The header should contain everything until the first
  1862. +# chapter. If it is left blank doxygen will generate a standard header. See
  1863. +# section "Doxygen usage" for information on how to let doxygen write the
  1864. +# default header to a separate file.
  1865. +#
  1866. +# Note: Only use a user-defined header if you know what you are doing! The
  1867. +# following commands have a special meaning inside the header: $title,
  1868. +# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
  1869. +# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string,
  1870. +# for the replacement values of the other commands the user is refered to
  1871. +# HTML_HEADER.
  1872. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1873. +
  1874. +LATEX_HEADER =
  1875. +
  1876. +# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
  1877. +# generated LaTeX document. The footer should contain everything after the last
  1878. +# chapter. If it is left blank doxygen will generate a standard footer. See
  1879. +# LATEX_HEADER for more information on how to generate a default footer and what
  1880. +# special commands can be used inside the footer.
  1881. +#
  1882. +# Note: Only use a user-defined footer if you know what you are doing!
  1883. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1884. +
  1885. +LATEX_FOOTER =
  1886. +
  1887. +# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
  1888. +# other source files which should be copied to the LATEX_OUTPUT output
  1889. +# directory. Note that the files will be copied as-is; there are no commands or
  1890. +# markers available.
  1891. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1892. +
  1893. +LATEX_EXTRA_FILES =
  1894. +
  1895. +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
  1896. +# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
  1897. +# contain links (just like the HTML output) instead of page references. This
  1898. +# makes the output suitable for online browsing using a PDF viewer.
  1899. +# The default value is: YES.
  1900. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1901. +
  1902. +PDF_HYPERLINKS = YES
  1903. +
  1904. +# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
  1905. +# the PDF file directly from the LaTeX files. Set this option to YES to get a
  1906. +# higher quality PDF documentation.
  1907. +# The default value is: YES.
  1908. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1909. +
  1910. +USE_PDFLATEX = YES
  1911. +
  1912. +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
  1913. +# command to the generated LaTeX files. This will instruct LaTeX to keep running
  1914. +# if errors occur, instead of asking the user for help. This option is also used
  1915. +# when generating formulas in HTML.
  1916. +# The default value is: NO.
  1917. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1918. +
  1919. +LATEX_BATCHMODE = NO
  1920. +
  1921. +# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
  1922. +# index chapters (such as File Index, Compound Index, etc.) in the output.
  1923. +# The default value is: NO.
  1924. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1925. +
  1926. +LATEX_HIDE_INDICES = NO
  1927. +
  1928. +# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
  1929. +# code with syntax highlighting in the LaTeX output.
  1930. +#
  1931. +# Note that which sources are shown also depends on other settings such as
  1932. +# SOURCE_BROWSER.
  1933. +# The default value is: NO.
  1934. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1935. +
  1936. +LATEX_SOURCE_CODE = NO
  1937. +
  1938. +# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
  1939. +# bibliography, e.g. plainnat, or ieeetr. See
  1940. +# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
  1941. +# The default value is: plain.
  1942. +# This tag requires that the tag GENERATE_LATEX is set to YES.
  1943. +
  1944. +LATEX_BIB_STYLE = plain
  1945. +
  1946. +#---------------------------------------------------------------------------
  1947. +# Configuration options related to the RTF output
  1948. +#---------------------------------------------------------------------------
  1949. +
  1950. +# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
  1951. +# RTF output is optimized for Word 97 and may not look too pretty with other RTF
  1952. +# readers/editors.
  1953. +# The default value is: NO.
  1954. +
  1955. +GENERATE_RTF = NO
  1956. +
  1957. +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
  1958. +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
  1959. +# it.
  1960. +# The default directory is: rtf.
  1961. +# This tag requires that the tag GENERATE_RTF is set to YES.
  1962. +
  1963. +RTF_OUTPUT = rtf
  1964. +
  1965. +# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
  1966. +# documents. This may be useful for small projects and may help to save some
  1967. +# trees in general.
  1968. +# The default value is: NO.
  1969. +# This tag requires that the tag GENERATE_RTF is set to YES.
  1970. +
  1971. +COMPACT_RTF = NO
  1972. +
  1973. +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
  1974. +# contain hyperlink fields. The RTF file will contain links (just like the HTML
  1975. +# output) instead of page references. This makes the output suitable for online
  1976. +# browsing using Word or some other Word compatible readers that support those
  1977. +# fields.
  1978. +#
  1979. +# Note: WordPad (write) and others do not support links.
  1980. +# The default value is: NO.
  1981. +# This tag requires that the tag GENERATE_RTF is set to YES.
  1982. +
  1983. +RTF_HYPERLINKS = NO
  1984. +
  1985. +# Load stylesheet definitions from file. Syntax is similar to doxygen's config
  1986. +# file, i.e. a series of assignments. You only have to provide replacements,
  1987. +# missing definitions are set to their default value.
  1988. +#
  1989. +# See also section "Doxygen usage" for information on how to generate the
  1990. +# default style sheet that doxygen normally uses.
  1991. +# This tag requires that the tag GENERATE_RTF is set to YES.
  1992. +
  1993. +RTF_STYLESHEET_FILE =
  1994. +
  1995. +# Set optional variables used in the generation of an RTF document. Syntax is
  1996. +# similar to doxygen's config file. A template extensions file can be generated
  1997. +# using doxygen -e rtf extensionFile.
  1998. +# This tag requires that the tag GENERATE_RTF is set to YES.
  1999. +
  2000. +RTF_EXTENSIONS_FILE =
  2001. +
  2002. +#---------------------------------------------------------------------------
  2003. +# Configuration options related to the man page output
  2004. +#---------------------------------------------------------------------------
  2005. +
  2006. +# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
  2007. +# classes and files.
  2008. +# The default value is: NO.
  2009. +
  2010. +GENERATE_MAN = NO
  2011. +
  2012. +# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
  2013. +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
  2014. +# it. A directory man3 will be created inside the directory specified by
  2015. +# MAN_OUTPUT.
  2016. +# The default directory is: man.
  2017. +# This tag requires that the tag GENERATE_MAN is set to YES.
  2018. +
  2019. +MAN_OUTPUT = man
  2020. +
  2021. +# The MAN_EXTENSION tag determines the extension that is added to the generated
  2022. +# man pages. In case the manual section does not start with a number, the number
  2023. +# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
  2024. +# optional.
  2025. +# The default value is: .3.
  2026. +# This tag requires that the tag GENERATE_MAN is set to YES.
  2027. +
  2028. +MAN_EXTENSION = .3
  2029. +
  2030. +# The MAN_SUBDIR tag determines the name of the directory created within
  2031. +# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
  2032. +# MAN_EXTENSION with the initial . removed.
  2033. +# This tag requires that the tag GENERATE_MAN is set to YES.
  2034. +
  2035. +MAN_SUBDIR =
  2036. +
  2037. +# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
  2038. +# will generate one additional man file for each entity documented in the real
  2039. +# man page(s). These additional files only source the real man page, but without
  2040. +# them the man command would be unable to find the correct page.
  2041. +# The default value is: NO.
  2042. +# This tag requires that the tag GENERATE_MAN is set to YES.
  2043. +
  2044. +MAN_LINKS = NO
  2045. +
  2046. +#---------------------------------------------------------------------------
  2047. +# Configuration options related to the XML output
  2048. +#---------------------------------------------------------------------------
  2049. +
  2050. +# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
  2051. +# captures the structure of the code including all documentation.
  2052. +# The default value is: NO.
  2053. +
  2054. +GENERATE_XML = NO
  2055. +
  2056. +# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
  2057. +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
  2058. +# it.
  2059. +# The default directory is: xml.
  2060. +# This tag requires that the tag GENERATE_XML is set to YES.
  2061. +
  2062. +XML_OUTPUT = xml
  2063. +
  2064. +# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
  2065. +# listings (including syntax highlighting and cross-referencing information) to
  2066. +# the XML output. Note that enabling this will significantly increase the size
  2067. +# of the XML output.
  2068. +# The default value is: YES.
  2069. +# This tag requires that the tag GENERATE_XML is set to YES.
  2070. +
  2071. +XML_PROGRAMLISTING = YES
  2072. +
  2073. +#---------------------------------------------------------------------------
  2074. +# Configuration options related to the DOCBOOK output
  2075. +#---------------------------------------------------------------------------
  2076. +
  2077. +# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
  2078. +# that can be used to generate PDF.
  2079. +# The default value is: NO.
  2080. +
  2081. +GENERATE_DOCBOOK = NO
  2082. +
  2083. +# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
  2084. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
  2085. +# front of it.
  2086. +# The default directory is: docbook.
  2087. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
  2088. +
  2089. +DOCBOOK_OUTPUT = docbook
  2090. +
  2091. +# If the DOCBOOK_PROGRAMLISTING tag is set to YES doxygen will include the
  2092. +# program listings (including syntax highlighting and cross-referencing
  2093. +# information) to the DOCBOOK output. Note that enabling this will significantly
  2094. +# increase the size of the DOCBOOK output.
  2095. +# The default value is: NO.
  2096. +# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
  2097. +
  2098. +DOCBOOK_PROGRAMLISTING = NO
  2099. +
  2100. +#---------------------------------------------------------------------------
  2101. +# Configuration options for the AutoGen Definitions output
  2102. +#---------------------------------------------------------------------------
  2103. +
  2104. +# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
  2105. +# Definitions (see http://autogen.sf.net) file that captures the structure of
  2106. +# the code including all documentation. Note that this feature is still
  2107. +# experimental and incomplete at the moment.
  2108. +# The default value is: NO.
  2109. +
  2110. +GENERATE_AUTOGEN_DEF = NO
  2111. +
  2112. +#---------------------------------------------------------------------------
  2113. +# Configuration options related to the Perl module output
  2114. +#---------------------------------------------------------------------------
  2115. +
  2116. +# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
  2117. +# file that captures the structure of the code including all documentation.
  2118. +#
  2119. +# Note that this feature is still experimental and incomplete at the moment.
  2120. +# The default value is: NO.
  2121. +
  2122. +GENERATE_PERLMOD = NO
  2123. +
  2124. +# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
  2125. +# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
  2126. +# output from the Perl module output.
  2127. +# The default value is: NO.
  2128. +# This tag requires that the tag GENERATE_PERLMOD is set to YES.
  2129. +
  2130. +PERLMOD_LATEX = NO
  2131. +
  2132. +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
  2133. +# formatted so it can be parsed by a human reader. This is useful if you want to
  2134. +# understand what is going on. On the other hand, if this tag is set to NO the
  2135. +# size of the Perl module output will be much smaller and Perl will parse it
  2136. +# just the same.
  2137. +# The default value is: YES.
  2138. +# This tag requires that the tag GENERATE_PERLMOD is set to YES.
  2139. +
  2140. +PERLMOD_PRETTY = YES
  2141. +
  2142. +# The names of the make variables in the generated doxyrules.make file are
  2143. +# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
  2144. +# so different doxyrules.make files included by the same Makefile don't
  2145. +# overwrite each other's variables.
  2146. +# This tag requires that the tag GENERATE_PERLMOD is set to YES.
  2147. +
  2148. +PERLMOD_MAKEVAR_PREFIX =
  2149. +
  2150. +#---------------------------------------------------------------------------
  2151. +# Configuration options related to the preprocessor
  2152. +#---------------------------------------------------------------------------
  2153. +
  2154. +# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
  2155. +# C-preprocessor directives found in the sources and include files.
  2156. +# The default value is: YES.
  2157. +
  2158. +ENABLE_PREPROCESSING = YES
  2159. +
  2160. +# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
  2161. +# in the source code. If set to NO only conditional compilation will be
  2162. +# performed. Macro expansion can be done in a controlled way by setting
  2163. +# EXPAND_ONLY_PREDEF to YES.
  2164. +# The default value is: NO.
  2165. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
  2166. +
  2167. +MACRO_EXPANSION = NO
  2168. +
  2169. +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
  2170. +# the macro expansion is limited to the macros specified with the PREDEFINED and
  2171. +# EXPAND_AS_DEFINED tags.
  2172. +# The default value is: NO.
  2173. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
  2174. +
  2175. +EXPAND_ONLY_PREDEF = NO
  2176. +
  2177. +# If the SEARCH_INCLUDES tag is set to YES the includes files in the
  2178. +# INCLUDE_PATH will be searched if a #include is found.
  2179. +# The default value is: YES.
  2180. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
  2181. +
  2182. +SEARCH_INCLUDES = YES
  2183. +
  2184. +# The INCLUDE_PATH tag can be used to specify one or more directories that
  2185. +# contain include files that are not input files but should be processed by the
  2186. +# preprocessor.
  2187. +# This tag requires that the tag SEARCH_INCLUDES is set to YES.
  2188. +
  2189. +INCLUDE_PATH =
  2190. +
  2191. +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
  2192. +# patterns (like *.h and *.hpp) to filter out the header-files in the
  2193. +# directories. If left blank, the patterns specified with FILE_PATTERNS will be
  2194. +# used.
  2195. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
  2196. +
  2197. +INCLUDE_FILE_PATTERNS =
  2198. +
  2199. +# The PREDEFINED tag can be used to specify one or more macro names that are
  2200. +# defined before the preprocessor is started (similar to the -D option of e.g.
  2201. +# gcc). The argument of the tag is a list of macros of the form: name or
  2202. +# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
  2203. +# is assumed. To prevent a macro definition from being undefined via #undef or
  2204. +# recursively expanded use the := operator instead of the = operator.
  2205. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
  2206. +
  2207. +PREDEFINED =
  2208. +
  2209. +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
  2210. +# tag can be used to specify a list of macro names that should be expanded. The
  2211. +# macro definition that is found in the sources will be used. Use the PREDEFINED
  2212. +# tag if you want to use a different macro definition that overrules the
  2213. +# definition found in the source code.
  2214. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
  2215. +
  2216. +EXPAND_AS_DEFINED =
  2217. +
  2218. +# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
  2219. +# remove all references to function-like macros that are alone on a line, have
  2220. +# an all uppercase name, and do not end with a semicolon. Such function macros
  2221. +# are typically used for boiler-plate code, and will confuse the parser if not
  2222. +# removed.
  2223. +# The default value is: YES.
  2224. +# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
  2225. +
  2226. +SKIP_FUNCTION_MACROS = YES
  2227. +
  2228. +#---------------------------------------------------------------------------
  2229. +# Configuration options related to external references
  2230. +#---------------------------------------------------------------------------
  2231. +
  2232. +# The TAGFILES tag can be used to specify one or more tag files. For each tag
  2233. +# file the location of the external documentation should be added. The format of
  2234. +# a tag file without this location is as follows:
  2235. +# TAGFILES = file1 file2 ...
  2236. +# Adding location for the tag files is done as follows:
  2237. +# TAGFILES = file1=loc1 "file2 = loc2" ...
  2238. +# where loc1 and loc2 can be relative or absolute paths or URLs. See the
  2239. +# section "Linking to external documentation" for more information about the use
  2240. +# of tag files.
  2241. +# Note: Each tag file must have a unique name (where the name does NOT include
  2242. +# the path). If a tag file is not located in the directory in which doxygen is
  2243. +# run, you must also specify the path to the tagfile here.
  2244. +
  2245. +TAGFILES =
  2246. +
  2247. +# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
  2248. +# tag file that is based on the input files it reads. See section "Linking to
  2249. +# external documentation" for more information about the usage of tag files.
  2250. +
  2251. +GENERATE_TAGFILE =
  2252. +
  2253. +# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
  2254. +# class index. If set to NO only the inherited external classes will be listed.
  2255. +# The default value is: NO.
  2256. +
  2257. +ALLEXTERNALS = NO
  2258. +
  2259. +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
  2260. +# the modules index. If set to NO, only the current project's groups will be
  2261. +# listed.
  2262. +# The default value is: YES.
  2263. +
  2264. +EXTERNAL_GROUPS = YES
  2265. +
  2266. +# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
  2267. +# the related pages index. If set to NO, only the current project's pages will
  2268. +# be listed.
  2269. +# The default value is: YES.
  2270. +
  2271. +EXTERNAL_PAGES = YES
  2272. +
  2273. +# The PERL_PATH should be the absolute path and name of the perl script
  2274. +# interpreter (i.e. the result of 'which perl').
  2275. +# The default file (with absolute path) is: /usr/bin/perl.
  2276. +
  2277. +PERL_PATH = /usr/bin/perl
  2278. +
  2279. +#---------------------------------------------------------------------------
  2280. +# Configuration options related to the dot tool
  2281. +#---------------------------------------------------------------------------
  2282. +
  2283. +# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
  2284. +# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
  2285. +# NO turns the diagrams off. Note that this option also works with HAVE_DOT
  2286. +# disabled, but it is recommended to install and use dot, since it yields more
  2287. +# powerful graphs.
  2288. +# The default value is: YES.
  2289. +
  2290. +CLASS_DIAGRAMS = YES
  2291. +
  2292. +# You can define message sequence charts within doxygen comments using the \msc
  2293. +# command. Doxygen will then run the mscgen tool (see:
  2294. +# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
  2295. +# documentation. The MSCGEN_PATH tag allows you to specify the directory where
  2296. +# the mscgen tool resides. If left empty the tool is assumed to be found in the
  2297. +# default search path.
  2298. +
  2299. +MSCGEN_PATH =
  2300. +
  2301. +# You can include diagrams made with dia in doxygen documentation. Doxygen will
  2302. +# then run dia to produce the diagram and insert it in the documentation. The
  2303. +# DIA_PATH tag allows you to specify the directory where the dia binary resides.
  2304. +# If left empty dia is assumed to be found in the default search path.
  2305. +
  2306. +DIA_PATH =
  2307. +
  2308. +# If set to YES, the inheritance and collaboration graphs will hide inheritance
  2309. +# and usage relations if the target is undocumented or is not a class.
  2310. +# The default value is: YES.
  2311. +
  2312. +HIDE_UNDOC_RELATIONS = YES
  2313. +
  2314. +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
  2315. +# available from the path. This tool is part of Graphviz (see:
  2316. +# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
  2317. +# Bell Labs. The other options in this section have no effect if this option is
  2318. +# set to NO
  2319. +# The default value is: YES.
  2320. +
  2321. +HAVE_DOT = YES
  2322. +
  2323. +# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
  2324. +# to run in parallel. When set to 0 doxygen will base this on the number of
  2325. +# processors available in the system. You can set it explicitly to a value
  2326. +# larger than 0 to get control over the balance between CPU load and processing
  2327. +# speed.
  2328. +# Minimum value: 0, maximum value: 32, default value: 0.
  2329. +# This tag requires that the tag HAVE_DOT is set to YES.
  2330. +
  2331. +DOT_NUM_THREADS = 0
  2332. +
  2333. +# When you want a differently looking font in the dot files that doxygen
  2334. +# generates you can specify the font name using DOT_FONTNAME. You need to make
  2335. +# sure dot is able to find the font, which can be done by putting it in a
  2336. +# standard location or by setting the DOTFONTPATH environment variable or by
  2337. +# setting DOT_FONTPATH to the directory containing the font.
  2338. +# The default value is: Helvetica.
  2339. +# This tag requires that the tag HAVE_DOT is set to YES.
  2340. +
  2341. +DOT_FONTNAME = Helvetica
  2342. +
  2343. +# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
  2344. +# dot graphs.
  2345. +# Minimum value: 4, maximum value: 24, default value: 10.
  2346. +# This tag requires that the tag HAVE_DOT is set to YES.
  2347. +
  2348. +DOT_FONTSIZE = 10
  2349. +
  2350. +# By default doxygen will tell dot to use the default font as specified with
  2351. +# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
  2352. +# the path where dot can find it using this tag.
  2353. +# This tag requires that the tag HAVE_DOT is set to YES.
  2354. +
  2355. +DOT_FONTPATH =
  2356. +
  2357. +# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
  2358. +# each documented class showing the direct and indirect inheritance relations.
  2359. +# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
  2360. +# The default value is: YES.
  2361. +# This tag requires that the tag HAVE_DOT is set to YES.
  2362. +
  2363. +CLASS_GRAPH = YES
  2364. +
  2365. +# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
  2366. +# graph for each documented class showing the direct and indirect implementation
  2367. +# dependencies (inheritance, containment, and class references variables) of the
  2368. +# class with other documented classes.
  2369. +# The default value is: YES.
  2370. +# This tag requires that the tag HAVE_DOT is set to YES.
  2371. +
  2372. +COLLABORATION_GRAPH = YES
  2373. +
  2374. +# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
  2375. +# groups, showing the direct groups dependencies.
  2376. +# The default value is: YES.
  2377. +# This tag requires that the tag HAVE_DOT is set to YES.
  2378. +
  2379. +GROUP_GRAPHS = YES
  2380. +
  2381. +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
  2382. +# collaboration diagrams in a style similar to the OMG's Unified Modeling
  2383. +# Language.
  2384. +# The default value is: NO.
  2385. +# This tag requires that the tag HAVE_DOT is set to YES.
  2386. +
  2387. +UML_LOOK = NO
  2388. +
  2389. +# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
  2390. +# class node. If there are many fields or methods and many nodes the graph may
  2391. +# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
  2392. +# number of items for each type to make the size more manageable. Set this to 0
  2393. +# for no limit. Note that the threshold may be exceeded by 50% before the limit
  2394. +# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
  2395. +# but if the number exceeds 15, the total amount of fields shown is limited to
  2396. +# 10.
  2397. +# Minimum value: 0, maximum value: 100, default value: 10.
  2398. +# This tag requires that the tag HAVE_DOT is set to YES.
  2399. +
  2400. +UML_LIMIT_NUM_FIELDS = 10
  2401. +
  2402. +# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
  2403. +# collaboration graphs will show the relations between templates and their
  2404. +# instances.
  2405. +# The default value is: NO.
  2406. +# This tag requires that the tag HAVE_DOT is set to YES.
  2407. +
  2408. +TEMPLATE_RELATIONS = NO
  2409. +
  2410. +# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
  2411. +# YES then doxygen will generate a graph for each documented file showing the
  2412. +# direct and indirect include dependencies of the file with other documented
  2413. +# files.
  2414. +# The default value is: YES.
  2415. +# This tag requires that the tag HAVE_DOT is set to YES.
  2416. +
  2417. +INCLUDE_GRAPH = YES
  2418. +
  2419. +# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
  2420. +# set to YES then doxygen will generate a graph for each documented file showing
  2421. +# the direct and indirect include dependencies of the file with other documented
  2422. +# files.
  2423. +# The default value is: YES.
  2424. +# This tag requires that the tag HAVE_DOT is set to YES.
  2425. +
  2426. +INCLUDED_BY_GRAPH = YES
  2427. +
  2428. +# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
  2429. +# dependency graph for every global function or class method.
  2430. +#
  2431. +# Note that enabling this option will significantly increase the time of a run.
  2432. +# So in most cases it will be better to enable call graphs for selected
  2433. +# functions only using the \callgraph command.
  2434. +# The default value is: NO.
  2435. +# This tag requires that the tag HAVE_DOT is set to YES.
  2436. +
  2437. +CALL_GRAPH = NO
  2438. +
  2439. +# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
  2440. +# dependency graph for every global function or class method.
  2441. +#
  2442. +# Note that enabling this option will significantly increase the time of a run.
  2443. +# So in most cases it will be better to enable caller graphs for selected
  2444. +# functions only using the \callergraph command.
  2445. +# The default value is: NO.
  2446. +# This tag requires that the tag HAVE_DOT is set to YES.
  2447. +
  2448. +CALLER_GRAPH = NO
  2449. +
  2450. +# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
  2451. +# hierarchy of all classes instead of a textual one.
  2452. +# The default value is: YES.
  2453. +# This tag requires that the tag HAVE_DOT is set to YES.
  2454. +
  2455. +GRAPHICAL_HIERARCHY = YES
  2456. +
  2457. +# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
  2458. +# dependencies a directory has on other directories in a graphical way. The
  2459. +# dependency relations are determined by the #include relations between the
  2460. +# files in the directories.
  2461. +# The default value is: YES.
  2462. +# This tag requires that the tag HAVE_DOT is set to YES.
  2463. +
  2464. +DIRECTORY_GRAPH = YES
  2465. +
  2466. +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
  2467. +# generated by dot.
  2468. +# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
  2469. +# to make the SVG files visible in IE 9+ (other browsers do not have this
  2470. +# requirement).
  2471. +# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
  2472. +# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
  2473. +# gif:cairo:gd, gif:gd, gif:gd:gd and svg.
  2474. +# The default value is: png.
  2475. +# This tag requires that the tag HAVE_DOT is set to YES.
  2476. +
  2477. +DOT_IMAGE_FORMAT = png
  2478. +
  2479. +# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
  2480. +# enable generation of interactive SVG images that allow zooming and panning.
  2481. +#
  2482. +# Note that this requires a modern browser other than Internet Explorer. Tested
  2483. +# and working are Firefox, Chrome, Safari, and Opera.
  2484. +# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
  2485. +# the SVG files visible. Older versions of IE do not have SVG support.
  2486. +# The default value is: NO.
  2487. +# This tag requires that the tag HAVE_DOT is set to YES.
  2488. +
  2489. +INTERACTIVE_SVG = NO
  2490. +
  2491. +# The DOT_PATH tag can be used to specify the path where the dot tool can be
  2492. +# found. If left blank, it is assumed the dot tool can be found in the path.
  2493. +# This tag requires that the tag HAVE_DOT is set to YES.
  2494. +
  2495. +DOT_PATH =
  2496. +
  2497. +# The DOTFILE_DIRS tag can be used to specify one or more directories that
  2498. +# contain dot files that are included in the documentation (see the \dotfile
  2499. +# command).
  2500. +# This tag requires that the tag HAVE_DOT is set to YES.
  2501. +
  2502. +DOTFILE_DIRS =
  2503. +
  2504. +# The MSCFILE_DIRS tag can be used to specify one or more directories that
  2505. +# contain msc files that are included in the documentation (see the \mscfile
  2506. +# command).
  2507. +
  2508. +MSCFILE_DIRS =
  2509. +
  2510. +# The DIAFILE_DIRS tag can be used to specify one or more directories that
  2511. +# contain dia files that are included in the documentation (see the \diafile
  2512. +# command).
  2513. +
  2514. +DIAFILE_DIRS =
  2515. +
  2516. +# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
  2517. +# path where java can find the plantuml.jar file. If left blank, it is assumed
  2518. +# PlantUML is not used or called during a preprocessing step. Doxygen will
  2519. +# generate a warning when it encounters a \startuml command in this case and
  2520. +# will not generate output for the diagram.
  2521. +# This tag requires that the tag HAVE_DOT is set to YES.
  2522. +
  2523. +PLANTUML_JAR_PATH =
  2524. +
  2525. +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
  2526. +# that will be shown in the graph. If the number of nodes in a graph becomes
  2527. +# larger than this value, doxygen will truncate the graph, which is visualized
  2528. +# by representing a node as a red box. Note that doxygen if the number of direct
  2529. +# children of the root node in a graph is already larger than
  2530. +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
  2531. +# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
  2532. +# Minimum value: 0, maximum value: 10000, default value: 50.
  2533. +# This tag requires that the tag HAVE_DOT is set to YES.
  2534. +
  2535. +DOT_GRAPH_MAX_NODES = 50
  2536. +
  2537. +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
  2538. +# generated by dot. A depth value of 3 means that only nodes reachable from the
  2539. +# root by following a path via at most 3 edges will be shown. Nodes that lay
  2540. +# further from the root node will be omitted. Note that setting this option to 1
  2541. +# or 2 may greatly reduce the computation time needed for large code bases. Also
  2542. +# note that the size of a graph can be further restricted by
  2543. +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
  2544. +# Minimum value: 0, maximum value: 1000, default value: 0.
  2545. +# This tag requires that the tag HAVE_DOT is set to YES.
  2546. +
  2547. +MAX_DOT_GRAPH_DEPTH = 0
  2548. +
  2549. +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
  2550. +# background. This is disabled by default, because dot on Windows does not seem
  2551. +# to support this out of the box.
  2552. +#
  2553. +# Warning: Depending on the platform used, enabling this option may lead to
  2554. +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
  2555. +# read).
  2556. +# The default value is: NO.
  2557. +# This tag requires that the tag HAVE_DOT is set to YES.
  2558. +
  2559. +DOT_TRANSPARENT = NO
  2560. +
  2561. +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
  2562. +# files in one run (i.e. multiple -o and -T options on the command line). This
  2563. +# makes dot run faster, but since only newer versions of dot (>1.8.10) support
  2564. +# this, this feature is disabled by default.
  2565. +# The default value is: NO.
  2566. +# This tag requires that the tag HAVE_DOT is set to YES.
  2567. +
  2568. +DOT_MULTI_TARGETS = NO
  2569. +
  2570. +# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
  2571. +# explaining the meaning of the various boxes and arrows in the dot generated
  2572. +# graphs.
  2573. +# The default value is: YES.
  2574. +# This tag requires that the tag HAVE_DOT is set to YES.
  2575. +
  2576. +GENERATE_LEGEND = YES
  2577. +
  2578. +# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
  2579. +# files that are used to generate the various graphs.
  2580. +# The default value is: YES.
  2581. +# This tag requires that the tag HAVE_DOT is set to YES.
  2582. +
  2583. +DOT_CLEANUP = YES
  2584. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/examples/bar-configs.cpp polybar-3.2.1/lib/i3ipcpp/examples/bar-configs.cpp
  2585. --- polybar-3.2.1.orig/lib/i3ipcpp/examples/bar-configs.cpp 1970-01-01 02:00:00.000000000 +0200
  2586. +++ polybar-3.2.1/lib/i3ipcpp/examples/bar-configs.cpp 2017-12-03 19:05:22.000000000 +0300
  2587. @@ -0,0 +1,43 @@
  2588. +/**
  2589. + * This program dumps all available barconfigs
  2590. + */
  2591. +
  2592. +#include <iostream>
  2593. +
  2594. +#include <i3ipc++/ipc.hpp>
  2595. +
  2596. +
  2597. +static void dump_bar_config(const i3ipc::bar_config_t& bc) {
  2598. + std::cout << '"' << bc.id << '"' << std::endl
  2599. + << "\tmode = " << static_cast<char>(bc.mode) << std::endl
  2600. + << "\tposition = " << static_cast<char>(bc.position) << std::endl
  2601. + << "\tstatus_command = \"" << bc.status_command << '"' << std::endl
  2602. + << "\tfont = \"" << bc.font << '"' << std::endl
  2603. + << "\tworkspace_buttons = " << (bc.workspace_buttons ? "true" : "false") << std::endl
  2604. + << "\tbinding_mode_indicator = " << (bc.binding_mode_indicator ? "true" : "false") << std::endl
  2605. + << "\tverbose = " << (bc.verbose ? "true" : "false") << std::endl
  2606. + << "\tcolors:" << std::endl;
  2607. +
  2608. + std::cout << std::hex;
  2609. + for (auto iter = bc.colors.begin(); iter != bc.colors.end(); iter++) {
  2610. + std::cout << "\t\t\"" << iter->first << "\" = #" << iter->second << std::endl;
  2611. + }
  2612. + std::cout << std::dec;
  2613. +}
  2614. +
  2615. +
  2616. +int main() {
  2617. + // First of all needs to create a connection
  2618. + i3ipc::connection conn;
  2619. +
  2620. + // Then request a list of barconfigs
  2621. + std::vector<std::string> bar_configs = conn.get_bar_configs_list();
  2622. +
  2623. + // And dump 'em all!!!!!
  2624. + for (auto& name : bar_configs) {
  2625. + std::shared_ptr<i3ipc::bar_config_t> bc = conn.get_bar_config(name);
  2626. + dump_bar_config(*bc);
  2627. + }
  2628. +
  2629. + return 0;
  2630. +}
  2631. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/examples/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/examples/CMakeLists.txt
  2632. --- polybar-3.2.1.orig/lib/i3ipcpp/examples/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  2633. +++ polybar-3.2.1/lib/i3ipcpp/examples/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  2634. @@ -0,0 +1,23 @@
  2635. +cmake_minimum_required(VERSION 3.0)
  2636. +project(i3ipc++-examples)
  2637. +
  2638. +include_directories(
  2639. + ${I3IPCpp_INCLUDE_DIRS}
  2640. +)
  2641. +
  2642. +link_directories(
  2643. + ${I3IPCpp_LIBRARY_DIRS}
  2644. +)
  2645. +
  2646. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wextra -Wno-unused-parameter")
  2647. +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -DDEBUG")
  2648. +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
  2649. +
  2650. +add_executable(workspaces workspaces.cpp)
  2651. +target_link_libraries(workspaces ${I3IPCpp_LIBRARIES})
  2652. +
  2653. +add_executable(events events.cpp)
  2654. +target_link_libraries(events ${I3IPCpp_LIBRARIES})
  2655. +
  2656. +add_executable(bar-configs bar-configs.cpp)
  2657. +target_link_libraries(bar-configs ${I3IPCpp_LIBRARIES})
  2658. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/examples/events.cpp polybar-3.2.1/lib/i3ipcpp/examples/events.cpp
  2659. --- polybar-3.2.1.orig/lib/i3ipcpp/examples/events.cpp 1970-01-01 02:00:00.000000000 +0200
  2660. +++ polybar-3.2.1/lib/i3ipcpp/examples/events.cpp 2017-12-03 19:05:22.000000000 +0300
  2661. @@ -0,0 +1,46 @@
  2662. +/**
  2663. + * This programs handle events and dump them to console
  2664. + */
  2665. +
  2666. +#include <iostream>
  2667. +
  2668. +#include <i3ipc++/ipc.hpp>
  2669. +
  2670. +
  2671. +int main() {
  2672. + // First of all we need to connect to an i3 process
  2673. + i3ipc::connection conn;
  2674. +
  2675. + // Then we subscribing on events (see i3ipc::EVENT_TYPE)
  2676. + conn.subscribe(i3ipc::ET_WORKSPACE | i3ipc::ET_WINDOW | i3ipc::ET_BINDING);
  2677. +
  2678. + // Handler of workspace_event
  2679. + conn.signal_workspace_event.connect([](const i3ipc::workspace_event_t& ev) {
  2680. + std::cout << "workspace_event: " << (char)ev.type << std::endl;
  2681. + });
  2682. +
  2683. + // Handler of window_event
  2684. + conn.signal_window_event.connect([](const i3ipc::window_event_t& ev) {
  2685. + std::cout << "window_event: " << (char)ev.type << std::endl;
  2686. + });
  2687. +
  2688. + // Handler of binding event
  2689. + conn.signal_binding_event.connect([](const i3ipc::binding_t& b) {
  2690. + std::cout << "binding_event:" << std::endl
  2691. + << "\tcommand = \"" << b.command << '"' << std::endl
  2692. + << "\tinput_code = " << b.input_code << std::endl
  2693. + << "\tsymbol = " << b.symbol << std::endl
  2694. + << "\tinput_type = " << static_cast<char>(b.input_type) << std::endl
  2695. + << "\tevent_state_mask =" << std::endl;
  2696. + for (const std::string& s : b.event_state_mask) {
  2697. + std::cout << "\t\t\"" << s << '"' << std::endl;
  2698. + }
  2699. + });
  2700. +
  2701. + // And starting an event-handling loop
  2702. + while (true) {
  2703. + conn.handle_event();
  2704. + }
  2705. +
  2706. + return 0;
  2707. +}
  2708. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/examples/workspaces.cpp polybar-3.2.1/lib/i3ipcpp/examples/workspaces.cpp
  2709. --- polybar-3.2.1.orig/lib/i3ipcpp/examples/workspaces.cpp 1970-01-01 02:00:00.000000000 +0200
  2710. +++ polybar-3.2.1/lib/i3ipcpp/examples/workspaces.cpp 2017-12-03 19:05:22.000000000 +0300
  2711. @@ -0,0 +1,64 @@
  2712. +/**
  2713. + * This program dumps a tree of windows and workspaces to console
  2714. + */
  2715. +
  2716. +#include <iostream>
  2717. +
  2718. +#include <i3ipc++/ipc.hpp>
  2719. +
  2720. +
  2721. +/**
  2722. + * Reqursively dump containers of a tree
  2723. + * @param c a root container
  2724. + * @param prefix an alignment
  2725. + */
  2726. +void dump_tree_container(const i3ipc::container_t& c, std::string& prefix) {
  2727. + std::cout << prefix << "ID: " << c.id << " (i3's; X11's - " << c.xwindow_id << ")" << std::endl;
  2728. + prefix.push_back('\t');
  2729. + std::cout << prefix << "name = \"" << c.name << "\"" << std::endl;
  2730. + std::cout << prefix << "type = \"" << c.type << "\"" << std::endl;
  2731. + std::cout << prefix << "border = \"" << c.border_raw << "\"" << std::endl;
  2732. + std::cout << prefix << "current_border_width = " << c.current_border_width << std::endl;
  2733. + std::cout << prefix << "layout = \"" << c.layout_raw << "\"" << std::endl;
  2734. + std::cout << prefix << "percent = " << c.percent << std::endl;
  2735. + if (c.urgent) {
  2736. + std::cout << prefix << "urgent" << std::endl;
  2737. + }
  2738. + if (c.focused) {
  2739. + std::cout << prefix << "focused" << std::endl;
  2740. + }
  2741. + prefix.push_back('\t');
  2742. + for (auto& n : c.nodes) {
  2743. + dump_tree_container(*n, prefix);
  2744. + }
  2745. + prefix.pop_back();
  2746. + prefix.pop_back();
  2747. +}
  2748. +
  2749. +
  2750. +int main() {
  2751. + // First of all needs to create a connection
  2752. + i3ipc::connection conn;
  2753. +
  2754. + // Then we dump workspaces
  2755. + for (auto& w : conn.get_workspaces()) {
  2756. + std::cout << '#' << std::hex << w->num << std::dec
  2757. + << "\n\tName: " << w->name
  2758. + << "\n\tVisible: " << w->visible
  2759. + << "\n\tFocused: " << w->focused
  2760. + << "\n\tUrgent: " << w->urgent
  2761. + << "\n\tRect: "
  2762. + << "\n\t\tX: " << w->rect.x
  2763. + << "\n\t\tY: " << w->rect.y
  2764. + << "\n\t\tWidth: " << w->rect.width
  2765. + << "\n\t\tHeight: " << w->rect.height
  2766. + << "\n\tOutput: " << w->output
  2767. + << std::endl;
  2768. + }
  2769. +
  2770. + // Then we dump the tree
  2771. + std::string prefix_buf;
  2772. + dump_tree_container(*conn.get_tree(), prefix_buf);
  2773. +
  2774. + return 0;
  2775. +}
  2776. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/.gitignore polybar-3.2.1/lib/i3ipcpp/.gitignore
  2777. --- polybar-3.2.1.orig/lib/i3ipcpp/.gitignore 1970-01-01 02:00:00.000000000 +0200
  2778. +++ polybar-3.2.1/lib/i3ipcpp/.gitignore 2017-12-03 19:05:22.000000000 +0300
  2779. @@ -0,0 +1,4 @@
  2780. +build
  2781. +doc
  2782. +*.sublime-workspace
  2783. +*.log
  2784. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/include/i3ipc++/ipc.hpp polybar-3.2.1/lib/i3ipcpp/include/i3ipc++/ipc.hpp
  2785. --- polybar-3.2.1.orig/lib/i3ipcpp/include/i3ipc++/ipc.hpp 1970-01-01 02:00:00.000000000 +0200
  2786. +++ polybar-3.2.1/lib/i3ipcpp/include/i3ipc++/ipc.hpp 2017-12-03 19:05:22.000000000 +0300
  2787. @@ -0,0 +1,377 @@
  2788. +#pragma once
  2789. +
  2790. +#include <cstdint>
  2791. +#include <string>
  2792. +#include <memory>
  2793. +#include <vector>
  2794. +#include <map>
  2795. +#include <list>
  2796. +#include <functional>
  2797. +
  2798. +extern "C" {
  2799. +#include <i3/ipc.h>
  2800. +}
  2801. +
  2802. +/**
  2803. + * @addtogroup i3ipc i3 IPC C++ binding
  2804. + * @{
  2805. + */
  2806. +namespace i3ipc {
  2807. +
  2808. +/**
  2809. + * Get path to the i3 IPC socket
  2810. + * @return Path to a socket
  2811. + */
  2812. +std::string get_socketpath();
  2813. +
  2814. +/**
  2815. + * Primitive of rectangle
  2816. + */
  2817. +struct rect_t {
  2818. + uint32_t x; ///< Position on X axis
  2819. + uint32_t y; ///< Position on Y axis
  2820. + uint32_t width; ///< Width of rectangle
  2821. + uint32_t height; ///< Height of rectangle
  2822. +};
  2823. +
  2824. +/**
  2825. + * i3's workspace
  2826. + */
  2827. +struct workspace_t {
  2828. + int num; ///< Index of the worksapce
  2829. + std::string name; ///< Name of the workspace
  2830. + bool visible; ///< Is the workspace visible
  2831. + bool focused; ///< Is the workspace is currently focused
  2832. + bool urgent; ///< Is the workspace is urgent
  2833. + rect_t rect; ///< A size of the workspace
  2834. + std::string output; ///< An output of the workspace
  2835. +};
  2836. +
  2837. +/**
  2838. + * i3's output
  2839. + */
  2840. +struct output_t {
  2841. + std::string name; ///< Name of the output
  2842. + bool active; ///< Is the output currently active
  2843. + std::string current_workspace; ///< Name of current workspace
  2844. + rect_t rect; ///< Size of the output
  2845. +};
  2846. +
  2847. +/**
  2848. + * Version of i3
  2849. + */
  2850. +struct version_t {
  2851. + std::string human_readable; ///< Human redable version string
  2852. + std::string loaded_config_file_name; ///< Path to current config of i3
  2853. + uint32_t major; ///< Major version of i3
  2854. + uint32_t minor; ///< Minor version of i3
  2855. + uint32_t patch; ///< Patch number of i3
  2856. +};
  2857. +
  2858. +
  2859. +/**
  2860. + * Types of the events of i3
  2861. + */
  2862. +enum EventType {
  2863. + ET_WORKSPACE = (1 << 0), ///< Workspace event
  2864. + ET_OUTPUT = (1 << 1), ///< Output event
  2865. + ET_MODE = (1 << 2), ///< Output mode event
  2866. + ET_WINDOW = (1 << 3), ///< Window event
  2867. + ET_BARCONFIG_UPDATE = (1 << 4), ///< Bar config update event @attention Yet is not implemented as signal in connection
  2868. + ET_BINDING = (1 << 5), ///< Binding event
  2869. +};
  2870. +
  2871. +/**
  2872. + * Types of workspace events
  2873. + */
  2874. +enum class WorkspaceEventType : char {
  2875. + FOCUS = 'f', ///< Focused
  2876. + INIT = 'i', ///< Initialized
  2877. + EMPTY = 'e', ///< Became empty
  2878. + URGENT = 'u', ///< Became urgent
  2879. + RENAME = 'r', ///< Renamed
  2880. + RELOAD = 'l', ///< Reloaded
  2881. + RESTORED = 's', ///< Restored
  2882. +};
  2883. +
  2884. +/**
  2885. + * Types of window events
  2886. + */
  2887. +enum class WindowEventType : char {
  2888. + NEW = 'n', ///< Window created
  2889. + CLOSE = 'c', ///< Window closed
  2890. + FOCUS = 'f', ///< Window got focus
  2891. + TITLE = 't', ///< Title of window has been changed
  2892. + FULLSCREEN_MODE = 'F', ///< Window toggled to fullscreen mode
  2893. + MOVE = 'M', ///< Window moved
  2894. + FLOATING = '_', ///< Window toggled floating mode
  2895. + URGENT = 'u', ///< Window became urgent
  2896. +};
  2897. +
  2898. +
  2899. +/**
  2900. + * A style of a container's border
  2901. + */
  2902. +enum class BorderStyle : char {
  2903. + UNKNOWN = '?', //< If got an unknown border style in reply
  2904. + NONE = 'N',
  2905. + NORMAL = 'n',
  2906. + PIXEL = 'P',
  2907. + ONE_PIXEL = '1',
  2908. +};
  2909. +
  2910. +
  2911. +/**
  2912. + * A type of a container's layout
  2913. + */
  2914. +enum class ContainerLayout : char {
  2915. + UNKNOWN = '?', //< If got an unknown border style in reply
  2916. + SPLIT_H = 'h',
  2917. + SPLIT_V = 'v',
  2918. + STACKED = 's',
  2919. + TABBED = 't',
  2920. + DOCKAREA = 'd',
  2921. + OUTPUT = 'o',
  2922. +};
  2923. +
  2924. +
  2925. +/**
  2926. + * A type of the input of bindings
  2927. + */
  2928. +enum class InputType : char {
  2929. + UNKNOWN = '?', //< If got an unknown input_type in binding_event
  2930. + KEYBOARD = 'k',
  2931. + MOUSE = 'm',
  2932. +};
  2933. +
  2934. +
  2935. +/**
  2936. + * A mode of a bar
  2937. + */
  2938. +enum class BarMode : char {
  2939. + UNKNOWN = '?',
  2940. + DOCK = 'd', ///< The bar sets the dock window type
  2941. + HIDE = 'h', ///< The bar does not show unless a specific key is pressed
  2942. +};
  2943. +
  2944. +
  2945. +/**
  2946. + * A position (of a bar?)
  2947. + */
  2948. +enum class Position : char {
  2949. + UNKNOWN = '?',
  2950. + TOP = 't',
  2951. + BOTTOM = 'b',
  2952. +};
  2953. +
  2954. +
  2955. +/**
  2956. + * A node of tree of windows
  2957. + */
  2958. +struct container_t {
  2959. + uint64_t id; ///< The internal ID (actually a C pointer value) of this container. Do not make any assumptions about it. You can use it to (re-)identify and address containers when talking to i3
  2960. + uint64_t xwindow_id; ///< The X11 window ID of the actual client window inside this container. This field is set to null for split containers or otherwise empty containers. This ID corresponds to what xwininfo(1) and other X11-related tools display (usually in hex)
  2961. + std::string name; ///< The internal name of this container. For all containers which are part of the tree structure down to the workspace contents, this is set to a nice human-readable name of the container. For containers that have an X11 window, the content is the title (_NET_WM_NAME property) of that window. For all other containers, the content is not defined (yet)
  2962. + std::string type; ///< Type of this container
  2963. + BorderStyle border; ///< A style of the container's border
  2964. + std::string border_raw; ///< A "border" field of TREE reply. NOT empty only if border equals BorderStyle::UNKNOWN
  2965. + uint32_t current_border_width; ///< Number of pixels of the border width
  2966. + ContainerLayout layout; ///< A type of the container's layout
  2967. + std::string layout_raw; ///< A "layout" field of TREE reply. NOT empty only if layout equals ContainerLayout::UNKNOWN
  2968. + float percent; ///< The percentage which this container takes in its parent. A value of < 0 means that the percent property does not make sense for this container, for example for the root container.
  2969. + rect_t rect; ///< The absolute display coordinates for this container
  2970. + rect_t window_rect; ///< The coordinates of the actual client window inside its container. These coordinates are relative to the container and do not include the window decoration (which is actually rendered on the parent container)
  2971. + rect_t deco_rect; ///< The coordinates of the window decoration inside its container. These coordinates are relative to the container and do not include the actual client window
  2972. + rect_t geometry; ///< The original geometry the window specified when i3 mapped it. Used when switching a window to floating mode, for example
  2973. + bool urgent;
  2974. + bool focused;
  2975. +
  2976. + std::list< std::shared_ptr<container_t> > nodes;
  2977. +};
  2978. +
  2979. +
  2980. +/**
  2981. + * A workspace event
  2982. + */
  2983. +struct workspace_event_t {
  2984. + WorkspaceEventType type;
  2985. + std::shared_ptr<workspace_t> current; ///< Current focused workspace
  2986. + std::shared_ptr<workspace_t> old; ///< Old (previous) workspace @note With some WindowEventType could be null
  2987. +};
  2988. +
  2989. +
  2990. +/**
  2991. + * A window event
  2992. + */
  2993. +struct window_event_t {
  2994. + WindowEventType type;
  2995. + std::shared_ptr<container_t> container; ///< A container event associated with @note With some WindowEventType could be null
  2996. +};
  2997. +
  2998. +
  2999. +/**
  3000. + * A binding
  3001. + */
  3002. +struct binding_t {
  3003. + std::string command; ///< The i3 command that is configured to run for this binding
  3004. + std::vector<std::string> event_state_mask; ///< The group and modifier keys that were configured with this binding
  3005. + int32_t input_code; ///< If the binding was configured with bindcode, this will be the key code that was given for the binding. If the binding is a mouse binding, it will be the number of the mouse button that was pressed. Otherwise it will be 0
  3006. + std::string symbol; ///< If this is a keyboard binding that was configured with bindsym, this field will contain the given symbol. Otherwise it will be null
  3007. + InputType input_type;
  3008. +};
  3009. +
  3010. +
  3011. +/**
  3012. + * A mode
  3013. + */
  3014. +struct mode_t {
  3015. + std::string change; ///< The current mode in use
  3016. + bool pango_markup; ///< Should pango markup be used for displaying this mode
  3017. +};
  3018. +
  3019. +
  3020. +/**
  3021. + * A bar configuration
  3022. + */
  3023. +struct bar_config_t {
  3024. + std::string id; ///< The ID for this bar. Included in case you request multiple configurations and want to differentiate the different replies.
  3025. + BarMode mode;
  3026. + Position position;
  3027. + std::string status_command; ///< Command which will be run to generate a statusline. Each line on stdout of this command will be displayed in the bar. At the moment, no formatting is supported
  3028. + std::string font; ///< The font to use for text on the bar
  3029. + bool workspace_buttons; ///< Display workspace buttons or not? Defaults to true.
  3030. + bool binding_mode_indicator; ///< Display the mode indicator or not? Defaults to true.
  3031. + bool verbose; ///< Should the bar enable verbose output for debugging? Defaults to false.
  3032. + std::map<std::string, uint32_t> colors; ///< Contains key/value pairs of colors. Each value is a color code in format 0xRRGGBB
  3033. +};
  3034. +
  3035. +
  3036. +struct buf_t;
  3037. +/**
  3038. + * Connection to the i3
  3039. + */
  3040. +class connection {
  3041. +public:
  3042. + /**
  3043. + * Connect to the i3
  3044. + * @param socket_path path to a i3 IPC socket
  3045. + */
  3046. + connection(const std::string& socket_path = get_socketpath());
  3047. + ~connection();
  3048. +
  3049. + /**
  3050. + * Send a command to i3
  3051. + * @param command command
  3052. + * @return Is command successfully executed
  3053. + */
  3054. + bool send_command(const std::string& command) const;
  3055. +
  3056. + /**
  3057. + * Request a list of workspaces
  3058. + * @return List of workspaces
  3059. + */
  3060. + std::vector< std::shared_ptr<workspace_t> > get_workspaces() const;
  3061. +
  3062. + /**
  3063. + * Request a list of outputs
  3064. + * @return List of outputs
  3065. + */
  3066. + std::vector< std::shared_ptr<output_t> > get_outputs() const;
  3067. +
  3068. + /**
  3069. + * Request a version of i3
  3070. + * @return Version of i3
  3071. + */
  3072. + version_t get_version() const;
  3073. +
  3074. + /**
  3075. + * Request a tree of windows
  3076. + * @return A root container
  3077. + */
  3078. + std::shared_ptr<container_t> get_tree() const;
  3079. +
  3080. + /**
  3081. + * Request a list of names of available barconfigs
  3082. + * @return A list of names of barconfigs
  3083. + */
  3084. + std::vector<std::string> get_bar_configs_list() const;
  3085. +
  3086. + /**
  3087. + * Request a barconfig
  3088. + * @param name name of barconfig
  3089. + * @return The barconfig
  3090. + */
  3091. + std::shared_ptr<bar_config_t> get_bar_config(const std::string& name) const;
  3092. +
  3093. + /**
  3094. + * Subscribe on an events of i3
  3095. + *
  3096. + * If connection isn't handling events at the moment, event numer will be added to subscription list.
  3097. + * Else will also send subscripe request to i3
  3098. + *
  3099. + * Example:
  3100. + * @code{.cpp}
  3101. + * connection conn;
  3102. + * conn.subscribe(i3ipc::ipc::ET_WORKSPACE | i3ipc::ipc::ET_WINDOW);
  3103. + * @endcode
  3104. + *
  3105. + * @param events event type (EventType enum)
  3106. + * @return Is successfully subscribed. If connection isn't handling events at the moment, then always true.
  3107. + */
  3108. + bool subscribe(const int32_t events);
  3109. +
  3110. + /**
  3111. + * Handle an event from i3
  3112. + * @note Used only in main()
  3113. + */
  3114. + bool handle_event();
  3115. +
  3116. + /**
  3117. + * Get the fd of the main socket
  3118. + * @return the file descriptor of the main socket.
  3119. + */
  3120. + int32_t get_main_socket_fd();
  3121. +
  3122. + /**
  3123. + * Get the fd of the event socket
  3124. + * @return the file descriptor of the event socket.
  3125. + */
  3126. + int32_t get_event_socket_fd();
  3127. +
  3128. + /**
  3129. + * Connect the event socket to IPC
  3130. + * @param reconnect if true the event socket will be disconnected and connected again
  3131. + * @note Automaticly called, when calling handle_event();
  3132. + */
  3133. + void connect_event_socket(const bool reconnect = false);
  3134. +
  3135. + /**
  3136. + * Disconnect the event socket
  3137. + */
  3138. + void disconnect_event_socket();
  3139. +
  3140. + std::function<void(const workspace_event_t&)> on_workspace_event; ///< Workspace event signal
  3141. + std::function<void()> on_output_event; ///< Output event signal
  3142. + std::function<void(const mode_t&)> on_mode_event; ///< Output mode event signal
  3143. + std::function<void(const window_event_t&)> on_window_event; ///< Window event signal
  3144. + std::function<void(const bar_config_t&)> on_barconfig_update_event; ///< Barconfig update event signal
  3145. + std::function<void(const binding_t&)> on_binding_event; ///< Binding event signal
  3146. + std::function<void(EventType, const std::shared_ptr<const buf_t>&)> on_event; ///< i3 event signal @note Default handler routes event to signal according to type
  3147. +private:
  3148. + const int32_t m_main_socket;
  3149. + int32_t m_event_socket;
  3150. + int32_t m_subscriptions;
  3151. + const std::string m_socket_path;
  3152. +};
  3153. +
  3154. +/**
  3155. + * Get version of i3ipc++
  3156. + * @return the version of i3ipc++
  3157. + */
  3158. +const version_t& get_version();
  3159. +
  3160. +}
  3161. +
  3162. +/**
  3163. + * @}
  3164. + */
  3165. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/include/i3ipc++/ipc-util.hpp polybar-3.2.1/lib/i3ipcpp/include/i3ipc++/ipc-util.hpp
  3166. --- polybar-3.2.1.orig/lib/i3ipcpp/include/i3ipc++/ipc-util.hpp 1970-01-01 02:00:00.000000000 +0200
  3167. +++ polybar-3.2.1/lib/i3ipcpp/include/i3ipc++/ipc-util.hpp 2017-12-03 19:05:22.000000000 +0300
  3168. @@ -0,0 +1,169 @@
  3169. +#pragma once
  3170. +
  3171. +#include <cstdint>
  3172. +#include <string>
  3173. +#include <memory>
  3174. +#include <stdexcept>
  3175. +
  3176. +// extern "C" {
  3177. +// #include <i3/ipc.h>
  3178. +// }
  3179. +
  3180. +namespace i3ipc {
  3181. +
  3182. +/** @defgroup i3ipc_util i3 IPC internal utilities
  3183. + * Stuff for internal usage in I3Connection
  3184. + * @{
  3185. + */
  3186. +
  3187. +// extern "C" {
  3188. +
  3189. +/**
  3190. + * i3 IPC header
  3191. + */
  3192. +struct header_t {
  3193. + /* 6 = strlen(I3_IPC_MAGIC) */
  3194. + char magic[6]; ///< Magic string @see I3_IPC_MAGIC
  3195. + uint32_t size; ///< Size of payload
  3196. + uint32_t type; ///< Message type
  3197. +} __attribute__ ((packed));
  3198. +
  3199. +
  3200. +/**
  3201. + * @brief Base class of i3 IPC errors
  3202. + */
  3203. +class ipc_error : public std::runtime_error { using std::runtime_error::runtime_error; };
  3204. +
  3205. +/**
  3206. + * @brief Something wrong in message header (wrong magic number, message type etc.)
  3207. + */
  3208. +class invalid_header_error : public ipc_error { using ipc_error::ipc_error; };
  3209. +
  3210. +/**
  3211. + * @brief Socket return EOF, but expected a data
  3212. + */
  3213. +class eof_error : public ipc_error { using ipc_error::ipc_error; };
  3214. +
  3215. +/**
  3216. + * @brief If something wrong in a payload of i3's reply
  3217. + */
  3218. +class invalid_reply_payload_error : public ipc_error { using ipc_error::ipc_error; };
  3219. +
  3220. +/**
  3221. + * @brief If any error occured, while using C-functions
  3222. + */
  3223. +class errno_error : public ipc_error {
  3224. +public:
  3225. + errno_error();
  3226. + errno_error(const std::string& msg);
  3227. +};
  3228. +
  3229. +
  3230. +/**
  3231. + * @brief Messages (requests), that can be sended from the client
  3232. + */
  3233. +enum class ClientMessageType : uint32_t {
  3234. + COMMAND = 0,
  3235. + GET_WORKSPACES = 1,
  3236. + SUBSCRIBE = 2,
  3237. + GET_OUTPUTS = 3,
  3238. + GET_TREE = 4,
  3239. + GET_MARKS = 5,
  3240. + GET_BAR_CONFIG = 6,
  3241. + GET_VERSION = 7,
  3242. +};
  3243. +
  3244. +
  3245. +/**
  3246. + * @brief Replies, that can be sended from the i3 to the client
  3247. + */
  3248. +enum class ReplyType : uint32_t {
  3249. + COMMAND = 0,
  3250. + WORKSPACES = 1,
  3251. + SUBSCRIBE = 2,
  3252. + OUTPUTS = 3,
  3253. + TREE = 4,
  3254. + MARKS = 5,
  3255. + BAR_CONFIG = 6,
  3256. + VERSION = 7,
  3257. +};
  3258. +
  3259. +
  3260. +/**
  3261. + * @brief i3 IPC message buffer
  3262. + */
  3263. +struct buf_t {
  3264. + uint32_t size; ///< @brief Size of whole buffer
  3265. + uint8_t* data; ///< @brief Pointer to the message
  3266. +
  3267. + /**
  3268. + * @brief i3 IPC message header
  3269. + *
  3270. + * Pointing on the begining
  3271. + */
  3272. + header_t* header;
  3273. +
  3274. + /**
  3275. + * @brief Message payload
  3276. + *
  3277. + * Pointing on the byte after the header
  3278. + */
  3279. + char* payload;
  3280. +
  3281. + buf_t(uint32_t payload_size);
  3282. + ~buf_t();
  3283. +
  3284. + /**
  3285. + * @brief Resize payload to the payload_size in the header
  3286. + */
  3287. + void realloc_payload_to_header();
  3288. +};
  3289. +
  3290. +/**
  3291. + * Connect to the i3 socket
  3292. + * @param socket_path a socket path
  3293. + * @return socket id
  3294. + */
  3295. +int32_t i3_connect(const std::string& socket_path);
  3296. +
  3297. +/**
  3298. + * @brief Close the connection
  3299. + * @param sockfd socket
  3300. + */
  3301. +void i3_disconnect(const int32_t sockfd);
  3302. +
  3303. +/**
  3304. + * @brief Send message to the socket
  3305. + * @param sockfd a socket
  3306. + * @param buff a message
  3307. + */
  3308. +void i3_send(const int32_t sockfd, const buf_t& buff);
  3309. +
  3310. +/**
  3311. + * @brief Recive a message from i3
  3312. + * @param sockfd a socket
  3313. + * @return a buffer of the message
  3314. + */
  3315. +std::shared_ptr<buf_t> i3_recv(const int32_t sockfd);
  3316. +
  3317. +/**
  3318. + * @brief Pack a buffer of message
  3319. + */
  3320. +std::shared_ptr<buf_t> i3_pack(const ClientMessageType type, const std::string& payload);
  3321. +
  3322. +/**
  3323. + * @brief Pack, send a message and receiv a reply
  3324. + *
  3325. + * Almost same to:
  3326. + * @code{.cpp}
  3327. + * i3_send(sockfd, i3_pack(type, payload));
  3328. + * auto reply = i3_recv(sockfd);
  3329. + * @endcode
  3330. + */
  3331. +std::shared_ptr<buf_t> i3_msg(const int32_t sockfd, const ClientMessageType type, const std::string& payload = std::string());
  3332. +
  3333. +/**
  3334. + * @}
  3335. + */
  3336. +
  3337. +}
  3338. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/include/i3ipc++/log.hpp polybar-3.2.1/lib/i3ipcpp/include/i3ipc++/log.hpp
  3339. --- polybar-3.2.1.orig/lib/i3ipcpp/include/i3ipc++/log.hpp 1970-01-01 02:00:00.000000000 +0200
  3340. +++ polybar-3.2.1/lib/i3ipcpp/include/i3ipc++/log.hpp 2017-12-03 19:05:22.000000000 +0300
  3341. @@ -0,0 +1,97 @@
  3342. +#pragma once
  3343. +
  3344. +#include <ostream>
  3345. +#include <vector>
  3346. +#include <auss.hpp>
  3347. +
  3348. +/**
  3349. + * @addtogroup logging Logging
  3350. + * @{
  3351. + */
  3352. +
  3353. +namespace i3ipc {
  3354. +
  3355. +/**
  3356. + * @brief Common logging outputs
  3357. + */
  3358. +extern std::vector<std::ostream*> g_logging_outs;
  3359. +
  3360. +/**
  3361. + * @brief Logging outputs for error messages
  3362. + */
  3363. +extern std::vector<std::ostream*> g_logging_err_outs;
  3364. +
  3365. +/**
  3366. + * @brief Put to a logging outputs some dtat
  3367. + * @param data data, that you want to put to the logging outputs
  3368. + * @param err is your information is error report or something that must be putted to the error logging outputs
  3369. + */
  3370. +template<typename T>
  3371. +inline void log(const T& data, const bool err=false) {
  3372. + for (auto out : (err ? g_logging_err_outs : g_logging_outs)) {
  3373. + *out << data << std::endl;
  3374. + }
  3375. +}
  3376. +
  3377. +template<>
  3378. +inline void log(const auss_t& data, const bool err) {
  3379. + log(data.to_string());
  3380. +}
  3381. +
  3382. +}
  3383. +
  3384. +#ifdef WITH_LOGGING
  3385. +
  3386. +/**
  3387. + * Internal macro used in I3IPC_*-logging macros
  3388. + */
  3389. +#define I3IPC_LOG(T, ERR) \
  3390. + ::i3ipc::log((T), (ERR));
  3391. +
  3392. +/**
  3393. + * Put information message to log
  3394. + * @param T message
  3395. + */
  3396. +#define I3IPC_INFO(T) I3IPC_LOG(auss_t() << "i: " << T, false)
  3397. +
  3398. +/**
  3399. + * Put error message to log
  3400. + * @param T message
  3401. + */
  3402. +#define I3IPC_ERR(T) I3IPC_LOG(auss_t() << "E: " << T, true)
  3403. +
  3404. +/**
  3405. + * Put warning message to log
  3406. + * @param T message
  3407. + */
  3408. +#define I3IPC_WARN(T) I3IPC_LOG(auss_t() << "W: " << T, true)
  3409. +
  3410. +#ifdef DEBUG
  3411. +
  3412. +/**
  3413. + * Put debug message to log
  3414. + * @param T message
  3415. + */
  3416. +#define I3IPC_DEBUG(T) I3IPC_LOG(auss_t() << "D: " << T, true)
  3417. +
  3418. +#else
  3419. +
  3420. +/**
  3421. + * Put debug message to log
  3422. + * @param T message
  3423. + */
  3424. +#define I3IPC_DEBUG(T)
  3425. +#endif
  3426. +
  3427. +#else
  3428. +#define I3IPC_LOG(T, ERR)
  3429. +#define I3IPC_INFO(T)
  3430. +#define I3IPC_ERR(T)
  3431. +#define I3IPC_WARN(T)
  3432. +#define I3IPC_DEBUG(T)
  3433. +#define I3IPC_DEBUG(T)
  3434. +#endif
  3435. +
  3436. +/**
  3437. + * @}
  3438. + */
  3439. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/LICENSE polybar-3.2.1/lib/i3ipcpp/LICENSE
  3440. --- polybar-3.2.1.orig/lib/i3ipcpp/LICENSE 1970-01-01 02:00:00.000000000 +0200
  3441. +++ polybar-3.2.1/lib/i3ipcpp/LICENSE 2017-12-03 19:05:22.000000000 +0300
  3442. @@ -0,0 +1,21 @@
  3443. +The MIT License (MIT)
  3444. +
  3445. +Copyright (c) 2015 Sergey Naumov
  3446. +
  3447. +Permission is hereby granted, free of charge, to any person obtaining a copy
  3448. +of this software and associated documentation files (the "Software"), to deal
  3449. +in the Software without restriction, including without limitation the rights
  3450. +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  3451. +copies of the Software, and to permit persons to whom the Software is
  3452. +furnished to do so, subject to the following conditions:
  3453. +
  3454. +The above copyright notice and this permission notice shall be included in all
  3455. +copies or substantial portions of the Software.
  3456. +
  3457. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  3458. +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  3459. +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  3460. +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  3461. +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  3462. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  3463. +SOFTWARE.
  3464. \ Dosya sonunda yenisatır yok.
  3465. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/amalgamate.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/amalgamate.py
  3466. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/amalgamate.py 1970-01-01 02:00:00.000000000 +0200
  3467. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/amalgamate.py 2017-12-03 19:05:22.000000000 +0300
  3468. @@ -0,0 +1,155 @@
  3469. +"""Amalgate json-cpp library sources into a single source and header file.
  3470. +
  3471. +Works with python2.6+ and python3.4+.
  3472. +
  3473. +Example of invocation (must be invoked from json-cpp top directory):
  3474. +python amalgate.py
  3475. +"""
  3476. +import os
  3477. +import os.path
  3478. +import sys
  3479. +
  3480. +class AmalgamationFile:
  3481. + def __init__(self, top_dir):
  3482. + self.top_dir = top_dir
  3483. + self.blocks = []
  3484. +
  3485. + def add_text(self, text):
  3486. + if not text.endswith("\n"):
  3487. + text += "\n"
  3488. + self.blocks.append(text)
  3489. +
  3490. + def add_file(self, relative_input_path, wrap_in_comment=False):
  3491. + def add_marker(prefix):
  3492. + self.add_text("")
  3493. + self.add_text("// " + "/"*70)
  3494. + self.add_text("// %s of content of file: %s" % (prefix, relative_input_path.replace("\\","/")))
  3495. + self.add_text("// " + "/"*70)
  3496. + self.add_text("")
  3497. + add_marker("Beginning")
  3498. + f = open(os.path.join(self.top_dir, relative_input_path), "rt")
  3499. + content = f.read()
  3500. + if wrap_in_comment:
  3501. + content = "/*\n" + content + "\n*/"
  3502. + self.add_text(content)
  3503. + f.close()
  3504. + add_marker("End")
  3505. + self.add_text("\n\n\n\n")
  3506. +
  3507. + def get_value(self):
  3508. + return "".join(self.blocks).replace("\r\n","\n")
  3509. +
  3510. + def write_to(self, output_path):
  3511. + output_dir = os.path.dirname(output_path)
  3512. + if output_dir and not os.path.isdir(output_dir):
  3513. + os.makedirs(output_dir)
  3514. + f = open(output_path, "wb")
  3515. + f.write(str.encode(self.get_value(), 'UTF-8'))
  3516. + f.close()
  3517. +
  3518. +def amalgamate_source(source_top_dir=None,
  3519. + target_source_path=None,
  3520. + header_include_path=None):
  3521. + """Produces amalgated source.
  3522. + Parameters:
  3523. + source_top_dir: top-directory
  3524. + target_source_path: output .cpp path
  3525. + header_include_path: generated header path relative to target_source_path.
  3526. + """
  3527. + print("Amalgating header...")
  3528. + header = AmalgamationFile(source_top_dir)
  3529. + header.add_text("/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/).")
  3530. + header.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
  3531. + header.add_file("LICENSE", wrap_in_comment=True)
  3532. + header.add_text("#ifndef JSON_AMALGATED_H_INCLUDED")
  3533. + header.add_text("# define JSON_AMALGATED_H_INCLUDED")
  3534. + header.add_text("/// If defined, indicates that the source file is amalgated")
  3535. + header.add_text("/// to prevent private header inclusion.")
  3536. + header.add_text("#define JSON_IS_AMALGAMATION")
  3537. + header.add_file("include/json/version.h")
  3538. + #header.add_file("include/json/allocator.h") # Not available here.
  3539. + header.add_file("include/json/config.h")
  3540. + header.add_file("include/json/forwards.h")
  3541. + header.add_file("include/json/features.h")
  3542. + header.add_file("include/json/value.h")
  3543. + header.add_file("include/json/reader.h")
  3544. + header.add_file("include/json/writer.h")
  3545. + header.add_file("include/json/assertions.h")
  3546. + header.add_text("#endif //ifndef JSON_AMALGATED_H_INCLUDED")
  3547. +
  3548. + target_header_path = os.path.join(os.path.dirname(target_source_path), header_include_path)
  3549. + print("Writing amalgated header to %r" % target_header_path)
  3550. + header.write_to(target_header_path)
  3551. +
  3552. + base, ext = os.path.splitext(header_include_path)
  3553. + forward_header_include_path = base + "-forwards" + ext
  3554. + print("Amalgating forward header...")
  3555. + header = AmalgamationFile(source_top_dir)
  3556. + header.add_text("/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/).")
  3557. + header.add_text('/// It is intended to be used with #include "%s"' % forward_header_include_path)
  3558. + header.add_text("/// This header provides forward declaration for all JsonCpp types.")
  3559. + header.add_file("LICENSE", wrap_in_comment=True)
  3560. + header.add_text("#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
  3561. + header.add_text("# define JSON_FORWARD_AMALGATED_H_INCLUDED")
  3562. + header.add_text("/// If defined, indicates that the source file is amalgated")
  3563. + header.add_text("/// to prevent private header inclusion.")
  3564. + header.add_text("#define JSON_IS_AMALGAMATION")
  3565. + header.add_file("include/json/config.h")
  3566. + header.add_file("include/json/forwards.h")
  3567. + header.add_text("#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED")
  3568. +
  3569. + target_forward_header_path = os.path.join(os.path.dirname(target_source_path),
  3570. + forward_header_include_path)
  3571. + print("Writing amalgated forward header to %r" % target_forward_header_path)
  3572. + header.write_to(target_forward_header_path)
  3573. +
  3574. + print("Amalgating source...")
  3575. + source = AmalgamationFile(source_top_dir)
  3576. + source.add_text("/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/).")
  3577. + source.add_text('/// It is intended to be used with #include "%s"' % header_include_path)
  3578. + source.add_file("LICENSE", wrap_in_comment=True)
  3579. + source.add_text("")
  3580. + source.add_text('#include "%s"' % header_include_path)
  3581. + source.add_text("""
  3582. +#ifndef JSON_IS_AMALGAMATION
  3583. +#error "Compile with -I PATH_TO_JSON_DIRECTORY"
  3584. +#endif
  3585. +""")
  3586. + source.add_text("")
  3587. + lib_json = "src/lib_json"
  3588. + source.add_file(os.path.join(lib_json, "json_tool.h"))
  3589. + source.add_file(os.path.join(lib_json, "json_reader.cpp"))
  3590. + source.add_file(os.path.join(lib_json, "json_valueiterator.inl"))
  3591. + source.add_file(os.path.join(lib_json, "json_value.cpp"))
  3592. + source.add_file(os.path.join(lib_json, "json_writer.cpp"))
  3593. +
  3594. + print("Writing amalgated source to %r" % target_source_path)
  3595. + source.write_to(target_source_path)
  3596. +
  3597. +def main():
  3598. + usage = """%prog [options]
  3599. +Generate a single amalgated source and header file from the sources.
  3600. +"""
  3601. + from optparse import OptionParser
  3602. + parser = OptionParser(usage=usage)
  3603. + parser.allow_interspersed_args = False
  3604. + parser.add_option("-s", "--source", dest="target_source_path", action="store", default="dist/jsoncpp.cpp",
  3605. + help="""Output .cpp source path. [Default: %default]""")
  3606. + parser.add_option("-i", "--include", dest="header_include_path", action="store", default="json/json.h",
  3607. + help="""Header include path. Used to include the header from the amalgated source file. [Default: %default]""")
  3608. + parser.add_option("-t", "--top-dir", dest="top_dir", action="store", default=os.getcwd(),
  3609. + help="""Source top-directory. [Default: %default]""")
  3610. + parser.enable_interspersed_args()
  3611. + options, args = parser.parse_args()
  3612. +
  3613. + msg = amalgamate_source(source_top_dir=options.top_dir,
  3614. + target_source_path=options.target_source_path,
  3615. + header_include_path=options.header_include_path)
  3616. + if msg:
  3617. + sys.stderr.write(msg + "\n")
  3618. + sys.exit(1)
  3619. + else:
  3620. + print("Source succesfully amalagated")
  3621. +
  3622. +if __name__ == "__main__":
  3623. + main()
  3624. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/appveyor.yml polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/appveyor.yml
  3625. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/appveyor.yml 1970-01-01 02:00:00.000000000 +0200
  3626. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/appveyor.yml 2017-12-03 19:05:22.000000000 +0300
  3627. @@ -0,0 +1,35 @@
  3628. +# This is a comment.
  3629. +
  3630. +version: build.{build}
  3631. +
  3632. +os: Windows Server 2012 R2
  3633. +
  3634. +clone_folder: c:\projects\jsoncpp
  3635. +
  3636. +platform:
  3637. + - Win32
  3638. + - x64
  3639. +
  3640. +configuration:
  3641. + - Debug
  3642. + - Release
  3643. +
  3644. +# scripts to run before build
  3645. +before_build:
  3646. + - echo "Running cmake..."
  3647. + - cd c:\projects\jsoncpp
  3648. + - cmake --version
  3649. + - set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
  3650. + - if %PLATFORM% == Win32 cmake .
  3651. + - if %PLATFORM% == x64 cmake -G "Visual Studio 12 2013 Win64" .
  3652. +
  3653. +build:
  3654. + project: jsoncpp.sln # path to Visual Studio solution or project
  3655. +
  3656. +deploy:
  3657. + provider: GitHub
  3658. + auth_token:
  3659. + secure: K2Tp1q8pIZ7rs0Ot24ZMWuwr12Ev6Tc6QkhMjGQxoQG3ng1pXtgPasiJ45IDXGdg
  3660. + on:
  3661. + branch: master
  3662. + appveyor_repo_tag: true
  3663. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/AUTHORS polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/AUTHORS
  3664. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/AUTHORS 1970-01-01 02:00:00.000000000 +0200
  3665. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/AUTHORS 2017-12-03 19:05:22.000000000 +0300
  3666. @@ -0,0 +1 @@
  3667. +Baptiste Lepilleur <blep@users.sourceforge.net>
  3668. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.clang-format polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.clang-format
  3669. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.clang-format 1970-01-01 02:00:00.000000000 +0200
  3670. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.clang-format 2017-12-03 19:05:22.000000000 +0300
  3671. @@ -0,0 +1,47 @@
  3672. +---
  3673. +# BasedOnStyle: LLVM
  3674. +AccessModifierOffset: -2
  3675. +ConstructorInitializerIndentWidth: 4
  3676. +AlignEscapedNewlinesLeft: false
  3677. +AlignTrailingComments: true
  3678. +AllowAllParametersOfDeclarationOnNextLine: true
  3679. +AllowShortIfStatementsOnASingleLine: false
  3680. +AllowShortLoopsOnASingleLine: false
  3681. +AlwaysBreakTemplateDeclarations: false
  3682. +AlwaysBreakBeforeMultilineStrings: false
  3683. +BreakBeforeBinaryOperators: false
  3684. +BreakBeforeTernaryOperators: true
  3685. +BreakConstructorInitializersBeforeComma: false
  3686. +BinPackParameters: false
  3687. +ColumnLimit: 80
  3688. +ConstructorInitializerAllOnOneLineOrOnePerLine: false
  3689. +DerivePointerBinding: false
  3690. +ExperimentalAutoDetectBinPacking: false
  3691. +IndentCaseLabels: false
  3692. +MaxEmptyLinesToKeep: 1
  3693. +NamespaceIndentation: None
  3694. +ObjCSpaceBeforeProtocolList: true
  3695. +PenaltyBreakBeforeFirstCallParameter: 19
  3696. +PenaltyBreakComment: 60
  3697. +PenaltyBreakString: 1000
  3698. +PenaltyBreakFirstLessLess: 120
  3699. +PenaltyExcessCharacter: 1000000
  3700. +PenaltyReturnTypeOnItsOwnLine: 60
  3701. +PointerBindsToType: true
  3702. +SpacesBeforeTrailingComments: 1
  3703. +Cpp11BracedListStyle: false
  3704. +Standard: Cpp03
  3705. +IndentWidth: 2
  3706. +TabWidth: 8
  3707. +UseTab: Never
  3708. +BreakBeforeBraces: Attach
  3709. +IndentFunctionDeclarationAfterType: false
  3710. +SpacesInParentheses: false
  3711. +SpacesInAngles: false
  3712. +SpaceInEmptyParentheses: false
  3713. +SpacesInCStyleCastParentheses: false
  3714. +SpaceAfterControlStatementKeyword: true
  3715. +SpaceBeforeAssignmentOperators: true
  3716. +ContinuationIndentWidth: 4
  3717. +...
  3718. +
  3719. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/CMakeLists.txt
  3720. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  3721. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  3722. @@ -0,0 +1,160 @@
  3723. +# vim: et ts=4 sts=4 sw=4 tw=0
  3724. +
  3725. +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
  3726. +PROJECT(jsoncpp)
  3727. +ENABLE_TESTING()
  3728. +
  3729. +OPTION(JSONCPP_WITH_TESTS "Compile and (for jsoncpp_check) run JsonCpp test executables" ON)
  3730. +OPTION(JSONCPP_WITH_POST_BUILD_UNITTEST "Automatically run unit-tests as a post build step" ON)
  3731. +OPTION(JSONCPP_WITH_WARNING_AS_ERROR "Force compilation to fail if a warning occurs" OFF)
  3732. +OPTION(JSONCPP_WITH_STRICT_ISO "Issue all the warnings demanded by strict ISO C and ISO C++" ON)
  3733. +OPTION(JSONCPP_WITH_PKGCONFIG_SUPPORT "Generate and install .pc files" ON)
  3734. +OPTION(JSONCPP_WITH_CMAKE_PACKAGE "Generate and install cmake package files" OFF)
  3735. +OPTION(BUILD_SHARED_LIBS "Build jsoncpp_lib as a shared library." OFF)
  3736. +OPTION(BUILD_STATIC_LIBS "Build jsoncpp_lib static library." ON)
  3737. +
  3738. +# Ensures that CMAKE_BUILD_TYPE is visible in cmake-gui on Unix
  3739. +IF(NOT WIN32)
  3740. + IF(NOT CMAKE_BUILD_TYPE)
  3741. + SET(CMAKE_BUILD_TYPE Release CACHE STRING
  3742. + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel Coverage."
  3743. + FORCE)
  3744. + ENDIF()
  3745. +ENDIF()
  3746. +
  3747. +# Enable runtime search path support for dynamic libraries on OSX
  3748. +IF(APPLE)
  3749. + SET(CMAKE_MACOSX_RPATH 1)
  3750. +ENDIF()
  3751. +
  3752. +SET(DEBUG_LIBNAME_SUFFIX "" CACHE STRING "Optional suffix to append to the library name for a debug build")
  3753. +SET(LIB_SUFFIX "" CACHE STRING "Optional arch-dependent suffix for the library installation directory")
  3754. +
  3755. +SET(RUNTIME_INSTALL_DIR bin
  3756. + CACHE PATH "Install dir for executables and dlls")
  3757. +SET(ARCHIVE_INSTALL_DIR lib${LIB_SUFFIX}
  3758. + CACHE PATH "Install dir for static libraries")
  3759. +SET(LIBRARY_INSTALL_DIR lib${LIB_SUFFIX}
  3760. + CACHE PATH "Install dir for shared libraries")
  3761. +SET(INCLUDE_INSTALL_DIR include
  3762. + CACHE PATH "Install dir for headers")
  3763. +SET(PACKAGE_INSTALL_DIR lib${LIB_SUFFIX}/cmake
  3764. + CACHE PATH "Install dir for cmake package config files")
  3765. +MARK_AS_ADVANCED( RUNTIME_INSTALL_DIR ARCHIVE_INSTALL_DIR INCLUDE_INSTALL_DIR PACKAGE_INSTALL_DIR )
  3766. +
  3767. +# Set variable named ${VAR_NAME} to value ${VALUE}
  3768. +FUNCTION(set_using_dynamic_name VAR_NAME VALUE)
  3769. + SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
  3770. +ENDFUNCTION()
  3771. +
  3772. +# Extract major, minor, patch from version text
  3773. +# Parse a version string "X.Y.Z" and outputs
  3774. +# version parts in ${OUPUT_PREFIX}_MAJOR, _MINOR, _PATCH.
  3775. +# If parse succeeds then ${OUPUT_PREFIX}_FOUND is TRUE.
  3776. +MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
  3777. + SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?")
  3778. + IF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
  3779. + STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${VERSION_TEXT})
  3780. + LIST(GET VERSION_PARTS 0 ${OUPUT_PREFIX}_MAJOR)
  3781. + LIST(GET VERSION_PARTS 1 ${OUPUT_PREFIX}_MINOR)
  3782. + LIST(GET VERSION_PARTS 2 ${OUPUT_PREFIX}_PATCH)
  3783. + set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
  3784. + ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
  3785. + set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
  3786. + ENDIF()
  3787. +ENDMACRO()
  3788. +
  3789. +# Read out version from "version" file
  3790. +#FILE(STRINGS "version" JSONCPP_VERSION)
  3791. +#SET( JSONCPP_VERSION_MAJOR X )
  3792. +#SET( JSONCPP_VERSION_MINOR Y )
  3793. +#SET( JSONCPP_VERSION_PATCH Z )
  3794. +SET( JSONCPP_VERSION 1.7.7 )
  3795. +jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
  3796. +#IF(NOT JSONCPP_VERSION_FOUND)
  3797. +# MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
  3798. +#ENDIF(NOT JSONCPP_VERSION_FOUND)
  3799. +SET( JSONCPP_SOVERSION 11 )
  3800. +SET( JSONCPP_USE_SECURE_MEMORY "0" CACHE STRING "-D...=1 to use memory-wiping allocator for STL" )
  3801. +
  3802. +MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
  3803. +# File version.h is only regenerated on CMake configure step
  3804. +CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/lib_json/version.h.in"
  3805. + "${PROJECT_SOURCE_DIR}/include/json/version.h"
  3806. + NEWLINE_STYLE UNIX )
  3807. +CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/version.in"
  3808. + "${PROJECT_SOURCE_DIR}/version"
  3809. + NEWLINE_STYLE UNIX )
  3810. +
  3811. +macro(UseCompilationWarningAsError)
  3812. + if ( MSVC )
  3813. + # Only enabled in debug because some old versions of VS STL generate
  3814. + # warnings when compiled in release configuration.
  3815. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX ")
  3816. + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  3817. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
  3818. + if (JSONCPP_WITH_STRICT_ISO)
  3819. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic-errors")
  3820. + endif ()
  3821. + endif()
  3822. +endmacro()
  3823. +
  3824. +# Include our configuration header
  3825. +INCLUDE_DIRECTORIES( ${jsoncpp_SOURCE_DIR}/include )
  3826. +
  3827. +if ( MSVC )
  3828. + # Only enabled in debug because some old versions of VS STL generate
  3829. + # unreachable code warning when compiled in release configuration.
  3830. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /W4 ")
  3831. +endif()
  3832. +
  3833. +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  3834. + # using regular Clang or AppleClang
  3835. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Werror=conversion -Werror=sign-compare")
  3836. +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  3837. + # using GCC
  3838. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra")
  3839. + # not yet ready for -Wsign-conversion
  3840. +
  3841. + if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
  3842. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=conversion -pedantic")
  3843. + endif ()
  3844. +elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
  3845. + # using Intel compiler
  3846. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wconversion -Wshadow -Wextra -Werror=conversion")
  3847. +
  3848. + if (JSONCPP_WITH_STRICT_ISO AND NOT JSONCPP_WITH_WARNING_AS_ERROR)
  3849. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
  3850. + endif ()
  3851. +endif()
  3852. +
  3853. +find_program(CCACHE_FOUND ccache)
  3854. +if(CCACHE_FOUND)
  3855. + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
  3856. + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
  3857. +endif(CCACHE_FOUND)
  3858. +
  3859. +IF(JSONCPP_WITH_WARNING_AS_ERROR)
  3860. + UseCompilationWarningAsError()
  3861. +ENDIF()
  3862. +
  3863. +IF(JSONCPP_WITH_PKGCONFIG_SUPPORT)
  3864. + CONFIGURE_FILE(
  3865. + "pkg-config/jsoncpp.pc.in"
  3866. + "pkg-config/jsoncpp.pc"
  3867. + @ONLY)
  3868. + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkg-config/jsoncpp.pc"
  3869. + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
  3870. +ENDIF()
  3871. +
  3872. +IF(JSONCPP_WITH_CMAKE_PACKAGE)
  3873. + INSTALL(EXPORT jsoncpp
  3874. + DESTINATION ${PACKAGE_INSTALL_DIR}/jsoncpp
  3875. + FILE jsoncppConfig.cmake)
  3876. +ENDIF()
  3877. +
  3878. +# Build the different applications
  3879. +ADD_SUBDIRECTORY( src )
  3880. +
  3881. +#install the includes
  3882. +ADD_SUBDIRECTORY( include )
  3883. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/dev.makefile polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/dev.makefile
  3884. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/dev.makefile 1970-01-01 02:00:00.000000000 +0200
  3885. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/dev.makefile 2017-12-03 19:05:22.000000000 +0300
  3886. @@ -0,0 +1,35 @@
  3887. +# This is only for jsoncpp developers/contributors.
  3888. +# We use this to sign releases, generate documentation, etc.
  3889. +VER?=$(shell cat version)
  3890. +
  3891. +default:
  3892. + @echo "VER=${VER}"
  3893. +sign: jsoncpp-${VER}.tar.gz
  3894. + gpg --armor --detach-sign $<
  3895. + gpg --verify $<.asc
  3896. + # Then upload .asc to the release.
  3897. +jsoncpp-%.tar.gz:
  3898. + curl https://github.com/open-source-parsers/jsoncpp/archive/$*.tar.gz -o $@
  3899. +dox:
  3900. + python doxybuild.py --doxygen=$$(which doxygen) --in doc/web_doxyfile.in
  3901. + rsync -va --delete dist/doxygen/jsoncpp-api-html-${VER}/ ../jsoncpp-docs/doxygen/
  3902. + # Then 'git add -A' and 'git push' in jsoncpp-docs.
  3903. +build:
  3904. + mkdir -p build/debug
  3905. + cd build/debug; cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_SHARED_LIBS=ON -G "Unix Makefiles" ../..
  3906. + make -C build/debug
  3907. +
  3908. +# Currently, this depends on include/json/version.h generated
  3909. +# by cmake.
  3910. +test-amalgamate:
  3911. + python2.7 amalgamate.py
  3912. + python3.4 amalgamate.py
  3913. + cd dist; gcc -I. -c jsoncpp.cpp
  3914. +
  3915. +valgrind:
  3916. + valgrind --error-exitcode=42 --leak-check=full ./build/debug/src/test_lib_json/jsoncpp_test
  3917. +
  3918. +clean:
  3919. + \rm -rf *.gz *.asc dist/
  3920. +
  3921. +.PHONY: build
  3922. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmw7.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmw7.json
  3923. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmw7.json 1970-01-01 02:00:00.000000000 +0200
  3924. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmw7.json 2017-12-03 19:05:22.000000000 +0300
  3925. @@ -0,0 +1,33 @@
  3926. +{
  3927. + "cmake_variants" : [
  3928. + {"name": "generator",
  3929. + "generators": [
  3930. + {"generator": [
  3931. + "Visual Studio 7 .NET 2003",
  3932. + "Visual Studio 9 2008",
  3933. + "Visual Studio 9 2008 Win64",
  3934. + "Visual Studio 10",
  3935. + "Visual Studio 10 Win64",
  3936. + "Visual Studio 11",
  3937. + "Visual Studio 11 Win64"
  3938. + ]
  3939. + },
  3940. + {"generator": ["MinGW Makefiles"],
  3941. + "env_prepend": [{"path": "c:/wut/prg/MinGW/bin"}]
  3942. + }
  3943. + ]
  3944. + },
  3945. + {"name": "shared_dll",
  3946. + "variables": [
  3947. + ["BUILD_SHARED_LIBS=true"],
  3948. + ["BUILD_SHARED_LIBS=false"]
  3949. + ]
  3950. + },
  3951. + {"name": "build_type",
  3952. + "build_types": [
  3953. + "debug",
  3954. + "release"
  3955. + ]
  3956. + }
  3957. + ]
  3958. +}
  3959. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmxp.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmxp.json
  3960. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmxp.json 1970-01-01 02:00:00.000000000 +0200
  3961. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/agent_vmxp.json 2017-12-03 19:05:22.000000000 +0300
  3962. @@ -0,0 +1,26 @@
  3963. +{
  3964. + "cmake_variants" : [
  3965. + {"name": "generator",
  3966. + "generators": [
  3967. + {"generator": [
  3968. + "Visual Studio 6",
  3969. + "Visual Studio 7",
  3970. + "Visual Studio 8 2005"
  3971. + ]
  3972. + }
  3973. + ]
  3974. + },
  3975. + {"name": "shared_dll",
  3976. + "variables": [
  3977. + ["BUILD_SHARED_LIBS=true"],
  3978. + ["BUILD_SHARED_LIBS=false"]
  3979. + ]
  3980. + },
  3981. + {"name": "build_type",
  3982. + "build_types": [
  3983. + "debug",
  3984. + "release"
  3985. + ]
  3986. + }
  3987. + ]
  3988. +}
  3989. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/antglob.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/antglob.py
  3990. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/antglob.py 1970-01-01 02:00:00.000000000 +0200
  3991. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/antglob.py 2017-12-03 19:05:22.000000000 +0300
  3992. @@ -0,0 +1,205 @@
  3993. +#!/usr/bin/env python
  3994. +# encoding: utf-8
  3995. +# Copyright 2009 Baptiste Lepilleur
  3996. +# Distributed under MIT license, or public domain if desired and
  3997. +# recognized in your jurisdiction.
  3998. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  3999. +
  4000. +from __future__ import print_function
  4001. +from dircache import listdir
  4002. +import re
  4003. +import fnmatch
  4004. +import os.path
  4005. +
  4006. +
  4007. +# These fnmatch expressions are used by default to prune the directory tree
  4008. +# while doing the recursive traversal in the glob_impl method of glob function.
  4009. +prune_dirs = '.git .bzr .hg .svn _MTN _darcs CVS SCCS '
  4010. +
  4011. +# These fnmatch expressions are used by default to exclude files and dirs
  4012. +# while doing the recursive traversal in the glob_impl method of glob function.
  4013. +##exclude_pats = prune_pats + '*~ #*# .#* %*% ._* .gitignore .cvsignore vssver.scc .DS_Store'.split()
  4014. +
  4015. +# These ant_glob expressions are used by default to exclude files and dirs and also prune the directory tree
  4016. +# while doing the recursive traversal in the glob_impl method of glob function.
  4017. +default_excludes = '''
  4018. +**/*~
  4019. +**/#*#
  4020. +**/.#*
  4021. +**/%*%
  4022. +**/._*
  4023. +**/CVS
  4024. +**/CVS/**
  4025. +**/.cvsignore
  4026. +**/SCCS
  4027. +**/SCCS/**
  4028. +**/vssver.scc
  4029. +**/.svn
  4030. +**/.svn/**
  4031. +**/.git
  4032. +**/.git/**
  4033. +**/.gitignore
  4034. +**/.bzr
  4035. +**/.bzr/**
  4036. +**/.hg
  4037. +**/.hg/**
  4038. +**/_MTN
  4039. +**/_MTN/**
  4040. +**/_darcs
  4041. +**/_darcs/**
  4042. +**/.DS_Store '''
  4043. +
  4044. +DIR = 1
  4045. +FILE = 2
  4046. +DIR_LINK = 4
  4047. +FILE_LINK = 8
  4048. +LINKS = DIR_LINK | FILE_LINK
  4049. +ALL_NO_LINK = DIR | FILE
  4050. +ALL = DIR | FILE | LINKS
  4051. +
  4052. +_ANT_RE = re.compile(r'(/\*\*/)|(\*\*/)|(/\*\*)|(\*)|(/)|([^\*/]*)')
  4053. +
  4054. +def ant_pattern_to_re(ant_pattern):
  4055. + """Generates a regular expression from the ant pattern.
  4056. + Matching convention:
  4057. + **/a: match 'a', 'dir/a', 'dir1/dir2/a'
  4058. + a/**/b: match 'a/b', 'a/c/b', 'a/d/c/b'
  4059. + *.py: match 'script.py' but not 'a/script.py'
  4060. + """
  4061. + rex = ['^']
  4062. + next_pos = 0
  4063. + sep_rex = r'(?:/|%s)' % re.escape(os.path.sep)
  4064. +## print 'Converting', ant_pattern
  4065. + for match in _ANT_RE.finditer(ant_pattern):
  4066. +## print 'Matched', match.group()
  4067. +## print match.start(0), next_pos
  4068. + if match.start(0) != next_pos:
  4069. + raise ValueError("Invalid ant pattern")
  4070. + if match.group(1): # /**/
  4071. + rex.append(sep_rex + '(?:.*%s)?' % sep_rex)
  4072. + elif match.group(2): # **/
  4073. + rex.append('(?:.*%s)?' % sep_rex)
  4074. + elif match.group(3): # /**
  4075. + rex.append(sep_rex + '.*')
  4076. + elif match.group(4): # *
  4077. + rex.append('[^/%s]*' % re.escape(os.path.sep))
  4078. + elif match.group(5): # /
  4079. + rex.append(sep_rex)
  4080. + else: # somepath
  4081. + rex.append(re.escape(match.group(6)))
  4082. + next_pos = match.end()
  4083. + rex.append('$')
  4084. + return re.compile(''.join(rex))
  4085. +
  4086. +def _as_list(l):
  4087. + if isinstance(l, basestring):
  4088. + return l.split()
  4089. + return l
  4090. +
  4091. +def glob(dir_path,
  4092. + includes = '**/*',
  4093. + excludes = default_excludes,
  4094. + entry_type = FILE,
  4095. + prune_dirs = prune_dirs,
  4096. + max_depth = 25):
  4097. + include_filter = [ant_pattern_to_re(p) for p in _as_list(includes)]
  4098. + exclude_filter = [ant_pattern_to_re(p) for p in _as_list(excludes)]
  4099. + prune_dirs = [p.replace('/',os.path.sep) for p in _as_list(prune_dirs)]
  4100. + dir_path = dir_path.replace('/',os.path.sep)
  4101. + entry_type_filter = entry_type
  4102. +
  4103. + def is_pruned_dir(dir_name):
  4104. + for pattern in prune_dirs:
  4105. + if fnmatch.fnmatch(dir_name, pattern):
  4106. + return True
  4107. + return False
  4108. +
  4109. + def apply_filter(full_path, filter_rexs):
  4110. + """Return True if at least one of the filter regular expression match full_path."""
  4111. + for rex in filter_rexs:
  4112. + if rex.match(full_path):
  4113. + return True
  4114. + return False
  4115. +
  4116. + def glob_impl(root_dir_path):
  4117. + child_dirs = [root_dir_path]
  4118. + while child_dirs:
  4119. + dir_path = child_dirs.pop()
  4120. + for entry in listdir(dir_path):
  4121. + full_path = os.path.join(dir_path, entry)
  4122. +## print 'Testing:', full_path,
  4123. + is_dir = os.path.isdir(full_path)
  4124. + if is_dir and not is_pruned_dir(entry): # explore child directory ?
  4125. +## print '===> marked for recursion',
  4126. + child_dirs.append(full_path)
  4127. + included = apply_filter(full_path, include_filter)
  4128. + rejected = apply_filter(full_path, exclude_filter)
  4129. + if not included or rejected: # do not include entry ?
  4130. +## print '=> not included or rejected'
  4131. + continue
  4132. + link = os.path.islink(full_path)
  4133. + is_file = os.path.isfile(full_path)
  4134. + if not is_file and not is_dir:
  4135. +## print '=> unknown entry type'
  4136. + continue
  4137. + if link:
  4138. + entry_type = is_file and FILE_LINK or DIR_LINK
  4139. + else:
  4140. + entry_type = is_file and FILE or DIR
  4141. +## print '=> type: %d' % entry_type,
  4142. + if (entry_type & entry_type_filter) != 0:
  4143. +## print ' => KEEP'
  4144. + yield os.path.join(dir_path, entry)
  4145. +## else:
  4146. +## print ' => TYPE REJECTED'
  4147. + return list(glob_impl(dir_path))
  4148. +
  4149. +
  4150. +if __name__ == "__main__":
  4151. + import unittest
  4152. +
  4153. + class AntPatternToRETest(unittest.TestCase):
  4154. +## def test_conversion(self):
  4155. +## self.assertEqual('^somepath$', ant_pattern_to_re('somepath').pattern)
  4156. +
  4157. + def test_matching(self):
  4158. + test_cases = [ ('path',
  4159. + ['path'],
  4160. + ['somepath', 'pathsuffix', '/path', '/path']),
  4161. + ('*.py',
  4162. + ['source.py', 'source.ext.py', '.py'],
  4163. + ['path/source.py', '/.py', 'dir.py/z', 'z.pyc', 'z.c']),
  4164. + ('**/path',
  4165. + ['path', '/path', '/a/path', 'c:/a/path', '/a/b/path', '//a/path', '/a/path/b/path'],
  4166. + ['path/', 'a/path/b', 'dir.py/z', 'somepath', 'pathsuffix', 'a/somepath']),
  4167. + ('path/**',
  4168. + ['path/a', 'path/path/a', 'path//'],
  4169. + ['path', 'somepath/a', 'a/path', 'a/path/a', 'pathsuffix/a']),
  4170. + ('/**/path',
  4171. + ['/path', '/a/path', '/a/b/path/path', '/path/path'],
  4172. + ['path', 'path/', 'a/path', '/pathsuffix', '/somepath']),
  4173. + ('a/b',
  4174. + ['a/b'],
  4175. + ['somea/b', 'a/bsuffix', 'a/b/c']),
  4176. + ('**/*.py',
  4177. + ['script.py', 'src/script.py', 'a/b/script.py', '/a/b/script.py'],
  4178. + ['script.pyc', 'script.pyo', 'a.py/b']),
  4179. + ('src/**/*.py',
  4180. + ['src/a.py', 'src/dir/a.py'],
  4181. + ['a/src/a.py', '/src/a.py']),
  4182. + ]
  4183. + for ant_pattern, accepted_matches, rejected_matches in list(test_cases):
  4184. + def local_path(paths):
  4185. + return [ p.replace('/',os.path.sep) for p in paths ]
  4186. + test_cases.append((ant_pattern, local_path(accepted_matches), local_path(rejected_matches)))
  4187. + for ant_pattern, accepted_matches, rejected_matches in test_cases:
  4188. + rex = ant_pattern_to_re(ant_pattern)
  4189. + print('ant_pattern:', ant_pattern, ' => ', rex.pattern)
  4190. + for accepted_match in accepted_matches:
  4191. + print('Accepted?:', accepted_match)
  4192. + self.assertTrue(rex.match(accepted_match) is not None)
  4193. + for rejected_match in rejected_matches:
  4194. + print('Rejected?:', rejected_match)
  4195. + self.assertTrue(rex.match(rejected_match) is None)
  4196. +
  4197. + unittest.main()
  4198. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/batchbuild.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/batchbuild.py
  4199. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/batchbuild.py 1970-01-01 02:00:00.000000000 +0200
  4200. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/batchbuild.py 2017-12-03 19:05:22.000000000 +0300
  4201. @@ -0,0 +1,278 @@
  4202. +from __future__ import print_function
  4203. +import collections
  4204. +import itertools
  4205. +import json
  4206. +import os
  4207. +import os.path
  4208. +import re
  4209. +import shutil
  4210. +import string
  4211. +import subprocess
  4212. +import sys
  4213. +import cgi
  4214. +
  4215. +class BuildDesc:
  4216. + def __init__(self, prepend_envs=None, variables=None, build_type=None, generator=None):
  4217. + self.prepend_envs = prepend_envs or [] # [ { "var": "value" } ]
  4218. + self.variables = variables or []
  4219. + self.build_type = build_type
  4220. + self.generator = generator
  4221. +
  4222. + def merged_with(self, build_desc):
  4223. + """Returns a new BuildDesc by merging field content.
  4224. + Prefer build_desc fields to self fields for single valued field.
  4225. + """
  4226. + return BuildDesc(self.prepend_envs + build_desc.prepend_envs,
  4227. + self.variables + build_desc.variables,
  4228. + build_desc.build_type or self.build_type,
  4229. + build_desc.generator or self.generator)
  4230. +
  4231. + def env(self):
  4232. + environ = os.environ.copy()
  4233. + for values_by_name in self.prepend_envs:
  4234. + for var, value in list(values_by_name.items()):
  4235. + var = var.upper()
  4236. + if type(value) is unicode:
  4237. + value = value.encode(sys.getdefaultencoding())
  4238. + if var in environ:
  4239. + environ[var] = value + os.pathsep + environ[var]
  4240. + else:
  4241. + environ[var] = value
  4242. + return environ
  4243. +
  4244. + def cmake_args(self):
  4245. + args = ["-D%s" % var for var in self.variables]
  4246. + # skip build type for Visual Studio solution as it cause warning
  4247. + if self.build_type and 'Visual' not in self.generator:
  4248. + args.append("-DCMAKE_BUILD_TYPE=%s" % self.build_type)
  4249. + if self.generator:
  4250. + args.extend(['-G', self.generator])
  4251. + return args
  4252. +
  4253. + def __repr__(self):
  4254. + return "BuildDesc(%s, build_type=%s)" % (" ".join(self.cmake_args()), self.build_type)
  4255. +
  4256. +class BuildData:
  4257. + def __init__(self, desc, work_dir, source_dir):
  4258. + self.desc = desc
  4259. + self.work_dir = work_dir
  4260. + self.source_dir = source_dir
  4261. + self.cmake_log_path = os.path.join(work_dir, 'batchbuild_cmake.log')
  4262. + self.build_log_path = os.path.join(work_dir, 'batchbuild_build.log')
  4263. + self.cmake_succeeded = False
  4264. + self.build_succeeded = False
  4265. +
  4266. + def execute_build(self):
  4267. + print('Build %s' % self.desc)
  4268. + self._make_new_work_dir()
  4269. + self.cmake_succeeded = self._generate_makefiles()
  4270. + if self.cmake_succeeded:
  4271. + self.build_succeeded = self._build_using_makefiles()
  4272. + return self.build_succeeded
  4273. +
  4274. + def _generate_makefiles(self):
  4275. + print(' Generating makefiles: ', end=' ')
  4276. + cmd = ['cmake'] + self.desc.cmake_args() + [os.path.abspath(self.source_dir)]
  4277. + succeeded = self._execute_build_subprocess(cmd, self.desc.env(), self.cmake_log_path)
  4278. + print('done' if succeeded else 'FAILED')
  4279. + return succeeded
  4280. +
  4281. + def _build_using_makefiles(self):
  4282. + print(' Building:', end=' ')
  4283. + cmd = ['cmake', '--build', self.work_dir]
  4284. + if self.desc.build_type:
  4285. + cmd += ['--config', self.desc.build_type]
  4286. + succeeded = self._execute_build_subprocess(cmd, self.desc.env(), self.build_log_path)
  4287. + print('done' if succeeded else 'FAILED')
  4288. + return succeeded
  4289. +
  4290. + def _execute_build_subprocess(self, cmd, env, log_path):
  4291. + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=self.work_dir,
  4292. + env=env)
  4293. + stdout, _ = process.communicate()
  4294. + succeeded = (process.returncode == 0)
  4295. + with open(log_path, 'wb') as flog:
  4296. + log = ' '.join(cmd) + '\n' + stdout + '\nExit code: %r\n' % process.returncode
  4297. + flog.write(fix_eol(log))
  4298. + return succeeded
  4299. +
  4300. + def _make_new_work_dir(self):
  4301. + if os.path.isdir(self.work_dir):
  4302. + print(' Removing work directory', self.work_dir)
  4303. + shutil.rmtree(self.work_dir, ignore_errors=True)
  4304. + if not os.path.isdir(self.work_dir):
  4305. + os.makedirs(self.work_dir)
  4306. +
  4307. +def fix_eol(stdout):
  4308. + """Fixes wrong EOL produced by cmake --build on Windows (\r\r\n instead of \r\n).
  4309. + """
  4310. + return re.sub('\r*\n', os.linesep, stdout)
  4311. +
  4312. +def load_build_variants_from_config(config_path):
  4313. + with open(config_path, 'rb') as fconfig:
  4314. + data = json.load(fconfig)
  4315. + variants = data[ 'cmake_variants' ]
  4316. + build_descs_by_axis = collections.defaultdict(list)
  4317. + for axis in variants:
  4318. + axis_name = axis["name"]
  4319. + build_descs = []
  4320. + if "generators" in axis:
  4321. + for generator_data in axis["generators"]:
  4322. + for generator in generator_data["generator"]:
  4323. + build_desc = BuildDesc(generator=generator,
  4324. + prepend_envs=generator_data.get("env_prepend"))
  4325. + build_descs.append(build_desc)
  4326. + elif "variables" in axis:
  4327. + for variables in axis["variables"]:
  4328. + build_desc = BuildDesc(variables=variables)
  4329. + build_descs.append(build_desc)
  4330. + elif "build_types" in axis:
  4331. + for build_type in axis["build_types"]:
  4332. + build_desc = BuildDesc(build_type=build_type)
  4333. + build_descs.append(build_desc)
  4334. + build_descs_by_axis[axis_name].extend(build_descs)
  4335. + return build_descs_by_axis
  4336. +
  4337. +def generate_build_variants(build_descs_by_axis):
  4338. + """Returns a list of BuildDesc generated for the partial BuildDesc for each axis."""
  4339. + axis_names = list(build_descs_by_axis.keys())
  4340. + build_descs = []
  4341. + for axis_name, axis_build_descs in list(build_descs_by_axis.items()):
  4342. + if len(build_descs):
  4343. + # for each existing build_desc and each axis build desc, create a new build_desc
  4344. + new_build_descs = []
  4345. + for prototype_build_desc, axis_build_desc in itertools.product(build_descs, axis_build_descs):
  4346. + new_build_descs.append(prototype_build_desc.merged_with(axis_build_desc))
  4347. + build_descs = new_build_descs
  4348. + else:
  4349. + build_descs = axis_build_descs
  4350. + return build_descs
  4351. +
  4352. +HTML_TEMPLATE = string.Template('''<html>
  4353. +<head>
  4354. + <title>$title</title>
  4355. + <style type="text/css">
  4356. + td.failed {background-color:#f08080;}
  4357. + td.ok {background-color:#c0eec0;}
  4358. + </style>
  4359. +</head>
  4360. +<body>
  4361. +<table border="1">
  4362. +<thead>
  4363. + <tr>
  4364. + <th>Variables</th>
  4365. + $th_vars
  4366. + </tr>
  4367. + <tr>
  4368. + <th>Build type</th>
  4369. + $th_build_types
  4370. + </tr>
  4371. +</thead>
  4372. +<tbody>
  4373. +$tr_builds
  4374. +</tbody>
  4375. +</table>
  4376. +</body></html>''')
  4377. +
  4378. +def generate_html_report(html_report_path, builds):
  4379. + report_dir = os.path.dirname(html_report_path)
  4380. + # Vertical axis: generator
  4381. + # Horizontal: variables, then build_type
  4382. + builds_by_generator = collections.defaultdict(list)
  4383. + variables = set()
  4384. + build_types_by_variable = collections.defaultdict(set)
  4385. + build_by_pos_key = {} # { (generator, var_key, build_type): build }
  4386. + for build in builds:
  4387. + builds_by_generator[build.desc.generator].append(build)
  4388. + var_key = tuple(sorted(build.desc.variables))
  4389. + variables.add(var_key)
  4390. + build_types_by_variable[var_key].add(build.desc.build_type)
  4391. + pos_key = (build.desc.generator, var_key, build.desc.build_type)
  4392. + build_by_pos_key[pos_key] = build
  4393. + variables = sorted(variables)
  4394. + th_vars = []
  4395. + th_build_types = []
  4396. + for variable in variables:
  4397. + build_types = sorted(build_types_by_variable[variable])
  4398. + nb_build_type = len(build_types_by_variable[variable])
  4399. + th_vars.append('<th colspan="%d">%s</th>' % (nb_build_type, cgi.escape(' '.join(variable))))
  4400. + for build_type in build_types:
  4401. + th_build_types.append('<th>%s</th>' % cgi.escape(build_type))
  4402. + tr_builds = []
  4403. + for generator in sorted(builds_by_generator):
  4404. + tds = [ '<td>%s</td>\n' % cgi.escape(generator) ]
  4405. + for variable in variables:
  4406. + build_types = sorted(build_types_by_variable[variable])
  4407. + for build_type in build_types:
  4408. + pos_key = (generator, variable, build_type)
  4409. + build = build_by_pos_key.get(pos_key)
  4410. + if build:
  4411. + cmake_status = 'ok' if build.cmake_succeeded else 'FAILED'
  4412. + build_status = 'ok' if build.build_succeeded else 'FAILED'
  4413. + cmake_log_url = os.path.relpath(build.cmake_log_path, report_dir)
  4414. + build_log_url = os.path.relpath(build.build_log_path, report_dir)
  4415. + td = '<td class="%s"><a href="%s" class="%s">CMake: %s</a>' % ( build_status.lower(), cmake_log_url, cmake_status.lower(), cmake_status)
  4416. + if build.cmake_succeeded:
  4417. + td += '<br><a href="%s" class="%s">Build: %s</a>' % ( build_log_url, build_status.lower(), build_status)
  4418. + td += '</td>'
  4419. + else:
  4420. + td = '<td></td>'
  4421. + tds.append(td)
  4422. + tr_builds.append('<tr>%s</tr>' % '\n'.join(tds))
  4423. + html = HTML_TEMPLATE.substitute( title='Batch build report',
  4424. + th_vars=' '.join(th_vars),
  4425. + th_build_types=' '.join(th_build_types),
  4426. + tr_builds='\n'.join(tr_builds))
  4427. + with open(html_report_path, 'wt') as fhtml:
  4428. + fhtml.write(html)
  4429. + print('HTML report generated in:', html_report_path)
  4430. +
  4431. +def main():
  4432. + usage = r"""%prog WORK_DIR SOURCE_DIR CONFIG_JSON_PATH [CONFIG2_JSON_PATH...]
  4433. +Build a given CMake based project located in SOURCE_DIR with multiple generators/options.dry_run
  4434. +as described in CONFIG_JSON_PATH building in WORK_DIR.
  4435. +
  4436. +Example of call:
  4437. +python devtools\batchbuild.py e:\buildbots\jsoncpp\build . devtools\agent_vmw7.json
  4438. +"""
  4439. + from optparse import OptionParser
  4440. + parser = OptionParser(usage=usage)
  4441. + parser.allow_interspersed_args = True
  4442. +# parser.add_option('-v', '--verbose', dest="verbose", action='store_true',
  4443. +# help="""Be verbose.""")
  4444. + parser.enable_interspersed_args()
  4445. + options, args = parser.parse_args()
  4446. + if len(args) < 3:
  4447. + parser.error("Missing one of WORK_DIR SOURCE_DIR CONFIG_JSON_PATH.")
  4448. + work_dir = args[0]
  4449. + source_dir = args[1].rstrip('/\\')
  4450. + config_paths = args[2:]
  4451. + for config_path in config_paths:
  4452. + if not os.path.isfile(config_path):
  4453. + parser.error("Can not read: %r" % config_path)
  4454. +
  4455. + # generate build variants
  4456. + build_descs = []
  4457. + for config_path in config_paths:
  4458. + build_descs_by_axis = load_build_variants_from_config(config_path)
  4459. + build_descs.extend(generate_build_variants(build_descs_by_axis))
  4460. + print('Build variants (%d):' % len(build_descs))
  4461. + # assign build directory for each variant
  4462. + if not os.path.isdir(work_dir):
  4463. + os.makedirs(work_dir)
  4464. + builds = []
  4465. + with open(os.path.join(work_dir, 'matrix-dir-map.txt'), 'wt') as fmatrixmap:
  4466. + for index, build_desc in enumerate(build_descs):
  4467. + build_desc_work_dir = os.path.join(work_dir, '%03d' % (index+1))
  4468. + builds.append(BuildData(build_desc, build_desc_work_dir, source_dir))
  4469. + fmatrixmap.write('%s: %s\n' % (build_desc_work_dir, build_desc))
  4470. + for build in builds:
  4471. + build.execute_build()
  4472. + html_report_path = os.path.join(work_dir, 'batchbuild-report.html')
  4473. + generate_html_report(html_report_path, builds)
  4474. + print('Done')
  4475. +
  4476. +
  4477. +if __name__ == '__main__':
  4478. + main()
  4479. +
  4480. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/fixeol.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/fixeol.py
  4481. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/fixeol.py 1970-01-01 02:00:00.000000000 +0200
  4482. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/fixeol.py 2017-12-03 19:05:22.000000000 +0300
  4483. @@ -0,0 +1,70 @@
  4484. +# Copyright 2010 Baptiste Lepilleur
  4485. +# Distributed under MIT license, or public domain if desired and
  4486. +# recognized in your jurisdiction.
  4487. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  4488. +
  4489. +from __future__ import print_function
  4490. +import os.path
  4491. +import sys
  4492. +
  4493. +def fix_source_eol(path, is_dry_run = True, verbose = True, eol = '\n'):
  4494. + """Makes sure that all sources have the specified eol sequence (default: unix)."""
  4495. + if not os.path.isfile(path):
  4496. + raise ValueError('Path "%s" is not a file' % path)
  4497. + try:
  4498. + f = open(path, 'rb')
  4499. + except IOError as msg:
  4500. + print("%s: I/O Error: %s" % (file, str(msg)), file=sys.stderr)
  4501. + return False
  4502. + try:
  4503. + raw_lines = f.readlines()
  4504. + finally:
  4505. + f.close()
  4506. + fixed_lines = [line.rstrip('\r\n') + eol for line in raw_lines]
  4507. + if raw_lines != fixed_lines:
  4508. + print('%s =>' % path, end=' ')
  4509. + if not is_dry_run:
  4510. + f = open(path, "wb")
  4511. + try:
  4512. + f.writelines(fixed_lines)
  4513. + finally:
  4514. + f.close()
  4515. + if verbose:
  4516. + print(is_dry_run and ' NEED FIX' or ' FIXED')
  4517. + return True
  4518. +##
  4519. +##
  4520. +##
  4521. +##def _do_fix(is_dry_run = True):
  4522. +## from waftools import antglob
  4523. +## python_sources = antglob.glob('.',
  4524. +## includes = '**/*.py **/wscript **/wscript_build',
  4525. +## excludes = antglob.default_excludes + './waf.py',
  4526. +## prune_dirs = antglob.prune_dirs + 'waf-* ./build')
  4527. +## for path in python_sources:
  4528. +## _fix_python_source(path, is_dry_run)
  4529. +##
  4530. +## cpp_sources = antglob.glob('.',
  4531. +## includes = '**/*.cpp **/*.h **/*.inl',
  4532. +## prune_dirs = antglob.prune_dirs + 'waf-* ./build')
  4533. +## for path in cpp_sources:
  4534. +## _fix_source_eol(path, is_dry_run)
  4535. +##
  4536. +##
  4537. +##def dry_fix(context):
  4538. +## _do_fix(is_dry_run = True)
  4539. +##
  4540. +##def fix(context):
  4541. +## _do_fix(is_dry_run = False)
  4542. +##
  4543. +##def shutdown():
  4544. +## pass
  4545. +##
  4546. +##def check(context):
  4547. +## # Unit tests are run when "check" target is used
  4548. +## ut = UnitTest.unit_test()
  4549. +## ut.change_to_testfile_dir = True
  4550. +## ut.want_to_see_test_output = True
  4551. +## ut.want_to_see_test_error = True
  4552. +## ut.run()
  4553. +## ut.print_results()
  4554. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/__init__.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/__init__.py
  4555. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/__init__.py 1970-01-01 02:00:00.000000000 +0200
  4556. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/__init__.py 2017-12-03 19:05:22.000000000 +0300
  4557. @@ -0,0 +1,6 @@
  4558. +# Copyright 2010 Baptiste Lepilleur
  4559. +# Distributed under MIT license, or public domain if desired and
  4560. +# recognized in your jurisdiction.
  4561. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  4562. +
  4563. +# module
  4564. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/licenseupdater.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/licenseupdater.py
  4565. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/licenseupdater.py 1970-01-01 02:00:00.000000000 +0200
  4566. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/licenseupdater.py 2017-12-03 19:05:22.000000000 +0300
  4567. @@ -0,0 +1,94 @@
  4568. +"""Updates the license text in source file.
  4569. +"""
  4570. +from __future__ import print_function
  4571. +
  4572. +# An existing license is found if the file starts with the string below,
  4573. +# and ends with the first blank line.
  4574. +LICENSE_BEGIN = "// Copyright "
  4575. +
  4576. +BRIEF_LICENSE = LICENSE_BEGIN + """2007-2010 Baptiste Lepilleur
  4577. +// Distributed under MIT license, or public domain if desired and
  4578. +// recognized in your jurisdiction.
  4579. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  4580. +
  4581. +""".replace('\r\n','\n')
  4582. +
  4583. +def update_license(path, dry_run, show_diff):
  4584. + """Update the license statement in the specified file.
  4585. + Parameters:
  4586. + path: path of the C++ source file to update.
  4587. + dry_run: if True, just print the path of the file that would be updated,
  4588. + but don't change it.
  4589. + show_diff: if True, print the path of the file that would be modified,
  4590. + as well as the change made to the file.
  4591. + """
  4592. + with open(path, 'rt') as fin:
  4593. + original_text = fin.read().replace('\r\n','\n')
  4594. + newline = fin.newlines and fin.newlines[0] or '\n'
  4595. + if not original_text.startswith(LICENSE_BEGIN):
  4596. + # No existing license found => prepend it
  4597. + new_text = BRIEF_LICENSE + original_text
  4598. + else:
  4599. + license_end_index = original_text.index('\n\n') # search first blank line
  4600. + new_text = BRIEF_LICENSE + original_text[license_end_index+2:]
  4601. + if original_text != new_text:
  4602. + if not dry_run:
  4603. + with open(path, 'wb') as fout:
  4604. + fout.write(new_text.replace('\n', newline))
  4605. + print('Updated', path)
  4606. + if show_diff:
  4607. + import difflib
  4608. + print('\n'.join(difflib.unified_diff(original_text.split('\n'),
  4609. + new_text.split('\n'))))
  4610. + return True
  4611. + return False
  4612. +
  4613. +def update_license_in_source_directories(source_dirs, dry_run, show_diff):
  4614. + """Updates license text in C++ source files found in directory source_dirs.
  4615. + Parameters:
  4616. + source_dirs: list of directory to scan for C++ sources. Directories are
  4617. + scanned recursively.
  4618. + dry_run: if True, just print the path of the file that would be updated,
  4619. + but don't change it.
  4620. + show_diff: if True, print the path of the file that would be modified,
  4621. + as well as the change made to the file.
  4622. + """
  4623. + from devtools import antglob
  4624. + prune_dirs = antglob.prune_dirs + 'scons-local* ./build* ./libs ./dist'
  4625. + for source_dir in source_dirs:
  4626. + cpp_sources = antglob.glob(source_dir,
  4627. + includes = '''**/*.h **/*.cpp **/*.inl''',
  4628. + prune_dirs = prune_dirs)
  4629. + for source in cpp_sources:
  4630. + update_license(source, dry_run, show_diff)
  4631. +
  4632. +def main():
  4633. + usage = """%prog DIR [DIR2...]
  4634. +Updates license text in sources of the project in source files found
  4635. +in the directory specified on the command-line.
  4636. +
  4637. +Example of call:
  4638. +python devtools\licenseupdater.py include src -n --diff
  4639. +=> Show change that would be made to the sources.
  4640. +
  4641. +python devtools\licenseupdater.py include src
  4642. +=> Update license statement on all sources in directories include/ and src/.
  4643. +"""
  4644. + from optparse import OptionParser
  4645. + parser = OptionParser(usage=usage)
  4646. + parser.allow_interspersed_args = False
  4647. + parser.add_option('-n', '--dry-run', dest="dry_run", action='store_true', default=False,
  4648. + help="""Only show what files are updated, do not update the files""")
  4649. + parser.add_option('--diff', dest="show_diff", action='store_true', default=False,
  4650. + help="""On update, show change made to the file.""")
  4651. + parser.enable_interspersed_args()
  4652. + options, args = parser.parse_args()
  4653. + update_license_in_source_directories(args, options.dry_run, options.show_diff)
  4654. + print('Done')
  4655. +
  4656. +if __name__ == '__main__':
  4657. + import sys
  4658. + import os.path
  4659. + sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  4660. + main()
  4661. +
  4662. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/tarball.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/tarball.py
  4663. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/tarball.py 1970-01-01 02:00:00.000000000 +0200
  4664. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/devtools/tarball.py 2017-12-03 19:05:22.000000000 +0300
  4665. @@ -0,0 +1,52 @@
  4666. +# Copyright 2010 Baptiste Lepilleur
  4667. +# Distributed under MIT license, or public domain if desired and
  4668. +# recognized in your jurisdiction.
  4669. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  4670. +
  4671. +from contextlib import closing
  4672. +import os
  4673. +import tarfile
  4674. +
  4675. +TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
  4676. +
  4677. +def make_tarball(tarball_path, sources, base_dir, prefix_dir=''):
  4678. + """Parameters:
  4679. + tarball_path: output path of the .tar.gz file
  4680. + sources: list of sources to include in the tarball, relative to the current directory
  4681. + base_dir: if a source file is in a sub-directory of base_dir, then base_dir is stripped
  4682. + from path in the tarball.
  4683. + prefix_dir: all files stored in the tarball be sub-directory of prefix_dir. Set to ''
  4684. + to make them child of root.
  4685. + """
  4686. + base_dir = os.path.normpath(os.path.abspath(base_dir))
  4687. + def archive_name(path):
  4688. + """Makes path relative to base_dir."""
  4689. + path = os.path.normpath(os.path.abspath(path))
  4690. + common_path = os.path.commonprefix((base_dir, path))
  4691. + archive_name = path[len(common_path):]
  4692. + if os.path.isabs(archive_name):
  4693. + archive_name = archive_name[1:]
  4694. + return os.path.join(prefix_dir, archive_name)
  4695. + def visit(tar, dirname, names):
  4696. + for name in names:
  4697. + path = os.path.join(dirname, name)
  4698. + if os.path.isfile(path):
  4699. + path_in_tar = archive_name(path)
  4700. + tar.add(path, path_in_tar)
  4701. + compression = TARGZ_DEFAULT_COMPRESSION_LEVEL
  4702. + with closing(tarfile.TarFile.open(tarball_path, 'w:gz',
  4703. + compresslevel=compression)) as tar:
  4704. + for source in sources:
  4705. + source_path = source
  4706. + if os.path.isdir(source):
  4707. + for dirpath, dirnames, filenames in os.walk(source_path):
  4708. + visit(tar, dirpath, filenames)
  4709. + else:
  4710. + path_in_tar = archive_name(source_path)
  4711. + tar.add(source_path, path_in_tar) # filename, arcname
  4712. +
  4713. +def decompress(tarball_path, base_dir):
  4714. + """Decompress the gzipped tarball into directory base_dir.
  4715. + """
  4716. + with closing(tarfile.TarFile.open(tarball_path)) as tar:
  4717. + tar.extractall(base_dir)
  4718. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/doxybuild.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/doxybuild.py
  4719. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/doxybuild.py 1970-01-01 02:00:00.000000000 +0200
  4720. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/doxybuild.py 2017-12-03 19:05:22.000000000 +0300
  4721. @@ -0,0 +1,189 @@
  4722. +"""Script to generate doxygen documentation.
  4723. +"""
  4724. +from __future__ import print_function
  4725. +from __future__ import unicode_literals
  4726. +from devtools import tarball
  4727. +from contextlib import contextmanager
  4728. +import subprocess
  4729. +import traceback
  4730. +import re
  4731. +import os
  4732. +import sys
  4733. +import shutil
  4734. +
  4735. +@contextmanager
  4736. +def cd(newdir):
  4737. + """
  4738. + http://stackoverflow.com/questions/431684/how-do-i-cd-in-python
  4739. + """
  4740. + prevdir = os.getcwd()
  4741. + os.chdir(newdir)
  4742. + try:
  4743. + yield
  4744. + finally:
  4745. + os.chdir(prevdir)
  4746. +
  4747. +def find_program(*filenames):
  4748. + """find a program in folders path_lst, and sets env[var]
  4749. + @param filenames: a list of possible names of the program to search for
  4750. + @return: the full path of the filename if found, or '' if filename could not be found
  4751. +"""
  4752. + paths = os.environ.get('PATH', '').split(os.pathsep)
  4753. + suffixes = ('win32' in sys.platform) and '.exe .com .bat .cmd' or ''
  4754. + for filename in filenames:
  4755. + for name in [filename+ext for ext in suffixes.split(' ')]:
  4756. + for directory in paths:
  4757. + full_path = os.path.join(directory, name)
  4758. + if os.path.isfile(full_path):
  4759. + return full_path
  4760. + return ''
  4761. +
  4762. +def do_subst_in_file(targetfile, sourcefile, dict):
  4763. + """Replace all instances of the keys of dict with their values.
  4764. + For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
  4765. + then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
  4766. + """
  4767. + with open(sourcefile, 'r') as f:
  4768. + contents = f.read()
  4769. + for (k,v) in list(dict.items()):
  4770. + v = v.replace('\\','\\\\')
  4771. + contents = re.sub(k, v, contents)
  4772. + with open(targetfile, 'w') as f:
  4773. + f.write(contents)
  4774. +
  4775. +def getstatusoutput(cmd):
  4776. + """cmd is a list.
  4777. + """
  4778. + try:
  4779. + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  4780. + output, _ = process.communicate()
  4781. + status = process.returncode
  4782. + except:
  4783. + status = -1
  4784. + output = traceback.format_exc()
  4785. + return status, output
  4786. +
  4787. +def run_cmd(cmd, silent=False):
  4788. + """Raise exception on failure.
  4789. + """
  4790. + info = 'Running: %r in %r' %(' '.join(cmd), os.getcwd())
  4791. + print(info)
  4792. + sys.stdout.flush()
  4793. + if silent:
  4794. + status, output = getstatusoutput(cmd)
  4795. + else:
  4796. + status, output = subprocess.call(cmd), ''
  4797. + if status:
  4798. + msg = 'Error while %s ...\n\terror=%d, output="""%s"""' %(info, status, output)
  4799. + raise Exception(msg)
  4800. +
  4801. +def assert_is_exe(path):
  4802. + if not path:
  4803. + raise Exception('path is empty.')
  4804. + if not os.path.isfile(path):
  4805. + raise Exception('%r is not a file.' %path)
  4806. + if not os.access(path, os.X_OK):
  4807. + raise Exception('%r is not executable by this user.' %path)
  4808. +
  4809. +def run_doxygen(doxygen_path, config_file, working_dir, is_silent):
  4810. + assert_is_exe(doxygen_path)
  4811. + config_file = os.path.abspath(config_file)
  4812. + with cd(working_dir):
  4813. + cmd = [doxygen_path, config_file]
  4814. + run_cmd(cmd, is_silent)
  4815. +
  4816. +def build_doc(options, make_release=False):
  4817. + if make_release:
  4818. + options.make_tarball = True
  4819. + options.with_dot = True
  4820. + options.with_html_help = True
  4821. + options.with_uml_look = True
  4822. + options.open = False
  4823. + options.silent = True
  4824. +
  4825. + version = open('version', 'rt').read().strip()
  4826. + output_dir = 'dist/doxygen' # relative to doc/doxyfile location.
  4827. + if not os.path.isdir(output_dir):
  4828. + os.makedirs(output_dir)
  4829. + top_dir = os.path.abspath('.')
  4830. + html_output_dirname = 'jsoncpp-api-html-' + version
  4831. + tarball_path = os.path.join('dist', html_output_dirname + '.tar.gz')
  4832. + warning_log_path = os.path.join(output_dir, '../jsoncpp-doxygen-warning.log')
  4833. + html_output_path = os.path.join(output_dir, html_output_dirname)
  4834. + def yesno(bool):
  4835. + return bool and 'YES' or 'NO'
  4836. + subst_keys = {
  4837. + '%JSONCPP_VERSION%': version,
  4838. + '%DOC_TOPDIR%': '',
  4839. + '%TOPDIR%': top_dir,
  4840. + '%HTML_OUTPUT%': os.path.join('..', output_dir, html_output_dirname),
  4841. + '%HAVE_DOT%': yesno(options.with_dot),
  4842. + '%DOT_PATH%': os.path.split(options.dot_path)[0],
  4843. + '%HTML_HELP%': yesno(options.with_html_help),
  4844. + '%UML_LOOK%': yesno(options.with_uml_look),
  4845. + '%WARNING_LOG_PATH%': os.path.join('..', warning_log_path)
  4846. + }
  4847. +
  4848. + if os.path.isdir(output_dir):
  4849. + print('Deleting directory:', output_dir)
  4850. + shutil.rmtree(output_dir)
  4851. + if not os.path.isdir(output_dir):
  4852. + os.makedirs(output_dir)
  4853. +
  4854. + do_subst_in_file('doc/doxyfile', options.doxyfile_input_path, subst_keys)
  4855. + run_doxygen(options.doxygen_path, 'doc/doxyfile', 'doc', is_silent=options.silent)
  4856. + if not options.silent:
  4857. + print(open(warning_log_path, 'r').read())
  4858. + index_path = os.path.abspath(os.path.join('doc', subst_keys['%HTML_OUTPUT%'], 'index.html'))
  4859. + print('Generated documentation can be found in:')
  4860. + print(index_path)
  4861. + if options.open:
  4862. + import webbrowser
  4863. + webbrowser.open('file://' + index_path)
  4864. + if options.make_tarball:
  4865. + print('Generating doc tarball to', tarball_path)
  4866. + tarball_sources = [
  4867. + output_dir,
  4868. + 'README.md',
  4869. + 'LICENSE',
  4870. + 'NEWS.txt',
  4871. + 'version'
  4872. + ]
  4873. + tarball_basedir = os.path.join(output_dir, html_output_dirname)
  4874. + tarball.make_tarball(tarball_path, tarball_sources, tarball_basedir, html_output_dirname)
  4875. + return tarball_path, html_output_dirname
  4876. +
  4877. +def main():
  4878. + usage = """%prog
  4879. + Generates doxygen documentation in build/doxygen.
  4880. + Optionaly makes a tarball of the documentation to dist/.
  4881. +
  4882. + Must be started in the project top directory.
  4883. + """
  4884. + from optparse import OptionParser
  4885. + parser = OptionParser(usage=usage)
  4886. + parser.allow_interspersed_args = False
  4887. + parser.add_option('--with-dot', dest="with_dot", action='store_true', default=False,
  4888. + help="""Enable usage of DOT to generate collaboration diagram""")
  4889. + parser.add_option('--dot', dest="dot_path", action='store', default=find_program('dot'),
  4890. + help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""")
  4891. + parser.add_option('--doxygen', dest="doxygen_path", action='store', default=find_program('doxygen'),
  4892. + help="""Path to Doxygen tool. [Default: %default]""")
  4893. + parser.add_option('--in', dest="doxyfile_input_path", action='store', default='doc/doxyfile.in',
  4894. + help="""Path to doxygen inputs. [Default: %default]""")
  4895. + parser.add_option('--with-html-help', dest="with_html_help", action='store_true', default=False,
  4896. + help="""Enable generation of Microsoft HTML HELP""")
  4897. + parser.add_option('--no-uml-look', dest="with_uml_look", action='store_false', default=True,
  4898. + help="""Generates DOT graph without UML look [Default: False]""")
  4899. + parser.add_option('--open', dest="open", action='store_true', default=False,
  4900. + help="""Open the HTML index in the web browser after generation""")
  4901. + parser.add_option('--tarball', dest="make_tarball", action='store_true', default=False,
  4902. + help="""Generates a tarball of the documentation in dist/ directory""")
  4903. + parser.add_option('-s', '--silent', dest="silent", action='store_true', default=False,
  4904. + help="""Hides doxygen output""")
  4905. + parser.enable_interspersed_args()
  4906. + options, args = parser.parse_args()
  4907. + build_doc(options)
  4908. +
  4909. +if __name__ == '__main__':
  4910. + main()
  4911. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitattributes polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitattributes
  4912. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitattributes 1970-01-01 02:00:00.000000000 +0200
  4913. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitattributes 2017-12-03 19:05:22.000000000 +0300
  4914. @@ -0,0 +1,11 @@
  4915. +* text=auto
  4916. +*.h text
  4917. +*.cpp text
  4918. +*.json text
  4919. +*.in text
  4920. +*.sh eol=lf
  4921. +*.bat eol=crlf
  4922. +*.vcproj eol=crlf
  4923. +*.vcxproj eol=crlf
  4924. +*.sln eol=crlf
  4925. +devtools/agent_vm* eol=crlf
  4926. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitignore polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitignore
  4927. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitignore 1970-01-01 02:00:00.000000000 +0200
  4928. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.gitignore 2017-12-03 19:05:22.000000000 +0300
  4929. @@ -0,0 +1,52 @@
  4930. +/build/
  4931. +*.pyc
  4932. +*.swp
  4933. +*.actual
  4934. +*.actual-rewrite
  4935. +*.process-output
  4936. +*.rewrite
  4937. +/bin/
  4938. +/buildscons/
  4939. +/libs/
  4940. +/doc/doxyfile
  4941. +/dist/
  4942. +#/version
  4943. +#/include/json/version.h
  4944. +
  4945. +# MSVC project files:
  4946. +*.sln
  4947. +*.vcxproj
  4948. +*.filters
  4949. +*.user
  4950. +*.sdf
  4951. +*.opensdf
  4952. +*.suo
  4953. +
  4954. +# MSVC build files:
  4955. +*.lib
  4956. +*.obj
  4957. +*.tlog/
  4958. +*.pdb
  4959. +
  4960. +# CMake-generated files:
  4961. +CMakeFiles/
  4962. +CTestTestFile.cmake
  4963. +cmake_install.cmake
  4964. +pkg-config/jsoncpp.pc
  4965. +jsoncpp_lib_static.dir/
  4966. +
  4967. +# In case someone runs cmake in the root-dir:
  4968. +/CMakeCache.txt
  4969. +/Makefile
  4970. +/include/Makefile
  4971. +/src/Makefile
  4972. +/src/jsontestrunner/Makefile
  4973. +/src/jsontestrunner/jsontestrunner_exe
  4974. +/src/lib_json/Makefile
  4975. +/src/test_lib_json/Makefile
  4976. +/src/test_lib_json/jsoncpp_test
  4977. +
  4978. +# eclipse project files
  4979. +.project
  4980. +.cproject
  4981. +/.settings/
  4982. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/CMakeLists.txt
  4983. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  4984. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  4985. @@ -0,0 +1,2 @@
  4986. +FILE(GLOB INCLUDE_FILES "json/*.h")
  4987. +INSTALL(FILES ${INCLUDE_FILES} DESTINATION ${INCLUDE_INSTALL_DIR}/json)
  4988. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/allocator.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/allocator.h
  4989. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/allocator.h 1970-01-01 02:00:00.000000000 +0200
  4990. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/allocator.h 2017-12-03 19:05:22.000000000 +0300
  4991. @@ -0,0 +1,94 @@
  4992. +// Copyright 2007-2010 Baptiste Lepilleur
  4993. +// Distributed under MIT license, or public domain if desired and
  4994. +// recognized in your jurisdiction.
  4995. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  4996. +
  4997. +#ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED
  4998. +#define CPPTL_JSON_ALLOCATOR_H_INCLUDED
  4999. +
  5000. +#include <cstring>
  5001. +#include <memory>
  5002. +
  5003. +namespace Json {
  5004. +template<typename T>
  5005. +class SecureAllocator {
  5006. + public:
  5007. + // Type definitions
  5008. + using value_type = T;
  5009. + using pointer = T*;
  5010. + using const_pointer = const T*;
  5011. + using reference = T&;
  5012. + using const_reference = const T&;
  5013. + using size_type = std::size_t;
  5014. + using difference_type = std::ptrdiff_t;
  5015. +
  5016. + /**
  5017. + * Allocate memory for N items using the standard allocator.
  5018. + */
  5019. + pointer allocate(size_type n) {
  5020. + // allocate using "global operator new"
  5021. + return static_cast<pointer>(::operator new(n * sizeof(T)));
  5022. + }
  5023. +
  5024. + /**
  5025. + * Release memory which was allocated for N items at pointer P.
  5026. + *
  5027. + * The memory block is filled with zeroes before being released.
  5028. + * The pointer argument is tagged as "volatile" to prevent the
  5029. + * compiler optimizing out this critical step.
  5030. + */
  5031. + void deallocate(volatile pointer p, size_type n) {
  5032. + std::memset(p, 0, n * sizeof(T));
  5033. + // free using "global operator delete"
  5034. + ::operator delete(p);
  5035. + }
  5036. +
  5037. + /**
  5038. + * Construct an item in-place at pointer P.
  5039. + */
  5040. + template<typename... Args>
  5041. + void construct(pointer p, Args&&... args) {
  5042. + // construct using "placement new" and "perfect forwarding"
  5043. + ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
  5044. + }
  5045. +
  5046. + size_type max_size() const {
  5047. + return size_t(-1) / sizeof(T);
  5048. + }
  5049. +
  5050. + pointer address( reference x ) const {
  5051. + return std::addressof(x);
  5052. + }
  5053. +
  5054. + const_pointer address( const_reference x ) const {
  5055. + return std::addressof(x);
  5056. + }
  5057. +
  5058. + /**
  5059. + * Destroy an item in-place at pointer P.
  5060. + */
  5061. + void destroy(pointer p) {
  5062. + // destroy using "explicit destructor"
  5063. + p->~T();
  5064. + }
  5065. +
  5066. + // Boilerplate
  5067. + SecureAllocator() {}
  5068. + template<typename U> SecureAllocator(const SecureAllocator<U>&) {}
  5069. + template<typename U> struct rebind { using other = SecureAllocator<U>; };
  5070. +};
  5071. +
  5072. +
  5073. +template<typename T, typename U>
  5074. +bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
  5075. + return true;
  5076. +}
  5077. +
  5078. +template<typename T, typename U>
  5079. +bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
  5080. + return false;
  5081. +}
  5082. +
  5083. +} //namespace Json
  5084. +
  5085. +#endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
  5086. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/assertions.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/assertions.h
  5087. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/assertions.h 1970-01-01 02:00:00.000000000 +0200
  5088. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/assertions.h 2017-12-03 19:05:22.000000000 +0300
  5089. @@ -0,0 +1,54 @@
  5090. +// Copyright 2007-2010 Baptiste Lepilleur
  5091. +// Distributed under MIT license, or public domain if desired and
  5092. +// recognized in your jurisdiction.
  5093. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5094. +
  5095. +#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
  5096. +#define CPPTL_JSON_ASSERTIONS_H_INCLUDED
  5097. +
  5098. +#include <stdlib.h>
  5099. +#include <sstream>
  5100. +
  5101. +#if !defined(JSON_IS_AMALGAMATION)
  5102. +#include "config.h"
  5103. +#endif // if !defined(JSON_IS_AMALGAMATION)
  5104. +
  5105. +/** It should not be possible for a maliciously designed file to
  5106. + * cause an abort() or seg-fault, so these macros are used only
  5107. + * for pre-condition violations and internal logic errors.
  5108. + */
  5109. +#if JSON_USE_EXCEPTION
  5110. +
  5111. +// @todo <= add detail about condition in exception
  5112. +# define JSON_ASSERT(condition) \
  5113. + {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
  5114. +
  5115. +# define JSON_FAIL_MESSAGE(message) \
  5116. + { \
  5117. + JSONCPP_OSTRINGSTREAM oss; oss << message; \
  5118. + Json::throwLogicError(oss.str()); \
  5119. + abort(); \
  5120. + }
  5121. +
  5122. +#else // JSON_USE_EXCEPTION
  5123. +
  5124. +# define JSON_ASSERT(condition) assert(condition)
  5125. +
  5126. +// The call to assert() will show the failure message in debug builds. In
  5127. +// release builds we abort, for a core-dump or debugger.
  5128. +# define JSON_FAIL_MESSAGE(message) \
  5129. + { \
  5130. + JSONCPP_OSTRINGSTREAM oss; oss << message; \
  5131. + assert(false && oss.str().c_str()); \
  5132. + abort(); \
  5133. + }
  5134. +
  5135. +
  5136. +#endif
  5137. +
  5138. +#define JSON_ASSERT_MESSAGE(condition, message) \
  5139. + if (!(condition)) { \
  5140. + JSON_FAIL_MESSAGE(message); \
  5141. + }
  5142. +
  5143. +#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
  5144. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/autolink.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/autolink.h
  5145. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/autolink.h 1970-01-01 02:00:00.000000000 +0200
  5146. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/autolink.h 2017-12-03 19:05:22.000000000 +0300
  5147. @@ -0,0 +1,25 @@
  5148. +// Copyright 2007-2010 Baptiste Lepilleur
  5149. +// Distributed under MIT license, or public domain if desired and
  5150. +// recognized in your jurisdiction.
  5151. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5152. +
  5153. +#ifndef JSON_AUTOLINK_H_INCLUDED
  5154. +#define JSON_AUTOLINK_H_INCLUDED
  5155. +
  5156. +#include "config.h"
  5157. +
  5158. +#ifdef JSON_IN_CPPTL
  5159. +#include <cpptl/cpptl_autolink.h>
  5160. +#endif
  5161. +
  5162. +#if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \
  5163. + !defined(JSON_IN_CPPTL)
  5164. +#define CPPTL_AUTOLINK_NAME "json"
  5165. +#undef CPPTL_AUTOLINK_DLL
  5166. +#ifdef JSON_DLL
  5167. +#define CPPTL_AUTOLINK_DLL
  5168. +#endif
  5169. +#include "autolink.h"
  5170. +#endif
  5171. +
  5172. +#endif // JSON_AUTOLINK_H_INCLUDED
  5173. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/config.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/config.h
  5174. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/config.h 1970-01-01 02:00:00.000000000 +0200
  5175. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/config.h 2017-12-03 19:05:22.000000000 +0300
  5176. @@ -0,0 +1,178 @@
  5177. +// Copyright 2007-2010 Baptiste Lepilleur
  5178. +// Distributed under MIT license, or public domain if desired and
  5179. +// recognized in your jurisdiction.
  5180. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5181. +
  5182. +#ifndef JSON_CONFIG_H_INCLUDED
  5183. +#define JSON_CONFIG_H_INCLUDED
  5184. +#include <stddef.h>
  5185. +#include <string> //typedef String
  5186. +#include <stdint.h> //typedef int64_t, uint64_t
  5187. +
  5188. +/// If defined, indicates that json library is embedded in CppTL library.
  5189. +//# define JSON_IN_CPPTL 1
  5190. +
  5191. +/// If defined, indicates that json may leverage CppTL library
  5192. +//# define JSON_USE_CPPTL 1
  5193. +/// If defined, indicates that cpptl vector based map should be used instead of
  5194. +/// std::map
  5195. +/// as Value container.
  5196. +//# define JSON_USE_CPPTL_SMALLMAP 1
  5197. +
  5198. +// If non-zero, the library uses exceptions to report bad input instead of C
  5199. +// assertion macros. The default is to use exceptions.
  5200. +#ifndef JSON_USE_EXCEPTION
  5201. +#define JSON_USE_EXCEPTION 1
  5202. +#endif
  5203. +
  5204. +/// If defined, indicates that the source file is amalgated
  5205. +/// to prevent private header inclusion.
  5206. +/// Remarks: it is automatically defined in the generated amalgated header.
  5207. +// #define JSON_IS_AMALGAMATION
  5208. +
  5209. +#ifdef JSON_IN_CPPTL
  5210. +#include <cpptl/config.h>
  5211. +#ifndef JSON_USE_CPPTL
  5212. +#define JSON_USE_CPPTL 1
  5213. +#endif
  5214. +#endif
  5215. +
  5216. +#ifdef JSON_IN_CPPTL
  5217. +#define JSON_API CPPTL_API
  5218. +#elif defined(JSON_DLL_BUILD)
  5219. +#if defined(_MSC_VER) || defined(__MINGW32__)
  5220. +#define JSON_API __declspec(dllexport)
  5221. +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
  5222. +#endif // if defined(_MSC_VER)
  5223. +#elif defined(JSON_DLL)
  5224. +#if defined(_MSC_VER) || defined(__MINGW32__)
  5225. +#define JSON_API __declspec(dllimport)
  5226. +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
  5227. +#endif // if defined(_MSC_VER)
  5228. +#endif // ifdef JSON_IN_CPPTL
  5229. +#if !defined(JSON_API)
  5230. +#define JSON_API
  5231. +#endif
  5232. +
  5233. +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
  5234. +// integer
  5235. +// Storages, and 64 bits integer support is disabled.
  5236. +// #define JSON_NO_INT64 1
  5237. +
  5238. +#if defined(_MSC_VER) // MSVC
  5239. +# if _MSC_VER <= 1200 // MSVC 6
  5240. + // Microsoft Visual Studio 6 only support conversion from __int64 to double
  5241. + // (no conversion from unsigned __int64).
  5242. +# define JSON_USE_INT64_DOUBLE_CONVERSION 1
  5243. + // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
  5244. + // characters in the debug information)
  5245. + // All projects I've ever seen with VS6 were using this globally (not bothering
  5246. + // with pragma push/pop).
  5247. +# pragma warning(disable : 4786)
  5248. +# endif // MSVC 6
  5249. +
  5250. +# if _MSC_VER >= 1500 // MSVC 2008
  5251. + /// Indicates that the following function is deprecated.
  5252. +# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
  5253. +# endif
  5254. +
  5255. +#endif // defined(_MSC_VER)
  5256. +
  5257. +// In c++11 the override keyword allows you to explicity define that a function
  5258. +// is intended to override the base-class version. This makes the code more
  5259. +// managable and fixes a set of common hard-to-find bugs.
  5260. +#if __cplusplus >= 201103L
  5261. +# define JSONCPP_OVERRIDE override
  5262. +#elif defined(_MSC_VER) && _MSC_VER > 1600
  5263. +# define JSONCPP_OVERRIDE override
  5264. +#else
  5265. +# define JSONCPP_OVERRIDE
  5266. +#endif
  5267. +
  5268. +#ifndef JSON_HAS_RVALUE_REFERENCES
  5269. +
  5270. +#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
  5271. +#define JSON_HAS_RVALUE_REFERENCES 1
  5272. +#endif // MSVC >= 2010
  5273. +
  5274. +#ifdef __clang__
  5275. +#if __has_feature(cxx_rvalue_references)
  5276. +#define JSON_HAS_RVALUE_REFERENCES 1
  5277. +#endif // has_feature
  5278. +
  5279. +#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
  5280. +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
  5281. +#define JSON_HAS_RVALUE_REFERENCES 1
  5282. +#endif // GXX_EXPERIMENTAL
  5283. +
  5284. +#endif // __clang__ || __GNUC__
  5285. +
  5286. +#endif // not defined JSON_HAS_RVALUE_REFERENCES
  5287. +
  5288. +#ifndef JSON_HAS_RVALUE_REFERENCES
  5289. +#define JSON_HAS_RVALUE_REFERENCES 0
  5290. +#endif
  5291. +
  5292. +#ifdef __clang__
  5293. +#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
  5294. +# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
  5295. +# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
  5296. +# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
  5297. +# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
  5298. +# endif // GNUC version
  5299. +#endif // __clang__ || __GNUC__
  5300. +
  5301. +#if !defined(JSONCPP_DEPRECATED)
  5302. +#define JSONCPP_DEPRECATED(message)
  5303. +#endif // if !defined(JSONCPP_DEPRECATED)
  5304. +
  5305. +#if __GNUC__ >= 6
  5306. +# define JSON_USE_INT64_DOUBLE_CONVERSION 1
  5307. +#endif
  5308. +
  5309. +#if !defined(JSON_IS_AMALGAMATION)
  5310. +
  5311. +# include "version.h"
  5312. +
  5313. +# if JSONCPP_USING_SECURE_MEMORY
  5314. +# include "allocator.h" //typedef Allocator
  5315. +# endif
  5316. +
  5317. +#endif // if !defined(JSON_IS_AMALGAMATION)
  5318. +
  5319. +namespace Json {
  5320. +typedef int Int;
  5321. +typedef unsigned int UInt;
  5322. +#if defined(JSON_NO_INT64)
  5323. +typedef int LargestInt;
  5324. +typedef unsigned int LargestUInt;
  5325. +#undef JSON_HAS_INT64
  5326. +#else // if defined(JSON_NO_INT64)
  5327. +// For Microsoft Visual use specific types as long long is not supported
  5328. +#if defined(_MSC_VER) // Microsoft Visual Studio
  5329. +typedef __int64 Int64;
  5330. +typedef unsigned __int64 UInt64;
  5331. +#else // if defined(_MSC_VER) // Other platforms, use long long
  5332. +typedef int64_t Int64;
  5333. +typedef uint64_t UInt64;
  5334. +#endif // if defined(_MSC_VER)
  5335. +typedef Int64 LargestInt;
  5336. +typedef UInt64 LargestUInt;
  5337. +#define JSON_HAS_INT64
  5338. +#endif // if defined(JSON_NO_INT64)
  5339. +#if JSONCPP_USING_SECURE_MEMORY
  5340. +#define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
  5341. +#define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
  5342. +#define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
  5343. +#define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
  5344. +#define JSONCPP_ISTREAM std::istream
  5345. +#else
  5346. +#define JSONCPP_STRING std::string
  5347. +#define JSONCPP_OSTRINGSTREAM std::ostringstream
  5348. +#define JSONCPP_OSTREAM std::ostream
  5349. +#define JSONCPP_ISTRINGSTREAM std::istringstream
  5350. +#define JSONCPP_ISTREAM std::istream
  5351. +#endif // if JSONCPP_USING_SECURE_MEMORY
  5352. +} // end namespace Json
  5353. +
  5354. +#endif // JSON_CONFIG_H_INCLUDED
  5355. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/features.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/features.h
  5356. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/features.h 1970-01-01 02:00:00.000000000 +0200
  5357. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/features.h 2017-12-03 19:05:22.000000000 +0300
  5358. @@ -0,0 +1,57 @@
  5359. +// Copyright 2007-2010 Baptiste Lepilleur
  5360. +// Distributed under MIT license, or public domain if desired and
  5361. +// recognized in your jurisdiction.
  5362. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5363. +
  5364. +#ifndef CPPTL_JSON_FEATURES_H_INCLUDED
  5365. +#define CPPTL_JSON_FEATURES_H_INCLUDED
  5366. +
  5367. +#if !defined(JSON_IS_AMALGAMATION)
  5368. +#include "forwards.h"
  5369. +#endif // if !defined(JSON_IS_AMALGAMATION)
  5370. +
  5371. +namespace Json {
  5372. +
  5373. +/** \brief Configuration passed to reader and writer.
  5374. + * This configuration object can be used to force the Reader or Writer
  5375. + * to behave in a standard conforming way.
  5376. + */
  5377. +class JSON_API Features {
  5378. +public:
  5379. + /** \brief A configuration that allows all features and assumes all strings
  5380. + * are UTF-8.
  5381. + * - C & C++ comments are allowed
  5382. + * - Root object can be any JSON value
  5383. + * - Assumes Value strings are encoded in UTF-8
  5384. + */
  5385. + static Features all();
  5386. +
  5387. + /** \brief A configuration that is strictly compatible with the JSON
  5388. + * specification.
  5389. + * - Comments are forbidden.
  5390. + * - Root object must be either an array or an object value.
  5391. + * - Assumes Value strings are encoded in UTF-8
  5392. + */
  5393. + static Features strictMode();
  5394. +
  5395. + /** \brief Initialize the configuration like JsonConfig::allFeatures;
  5396. + */
  5397. + Features();
  5398. +
  5399. + /// \c true if comments are allowed. Default: \c true.
  5400. + bool allowComments_;
  5401. +
  5402. + /// \c true if root must be either an array or an object value. Default: \c
  5403. + /// false.
  5404. + bool strictRoot_;
  5405. +
  5406. + /// \c true if dropped null placeholders are allowed. Default: \c false.
  5407. + bool allowDroppedNullPlaceholders_;
  5408. +
  5409. + /// \c true if numeric object key are allowed. Default: \c false.
  5410. + bool allowNumericKeys_;
  5411. +};
  5412. +
  5413. +} // namespace Json
  5414. +
  5415. +#endif // CPPTL_JSON_FEATURES_H_INCLUDED
  5416. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/forwards.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/forwards.h
  5417. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/forwards.h 1970-01-01 02:00:00.000000000 +0200
  5418. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/forwards.h 2017-12-03 19:05:22.000000000 +0300
  5419. @@ -0,0 +1,37 @@
  5420. +// Copyright 2007-2010 Baptiste Lepilleur
  5421. +// Distributed under MIT license, or public domain if desired and
  5422. +// recognized in your jurisdiction.
  5423. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5424. +
  5425. +#ifndef JSON_FORWARDS_H_INCLUDED
  5426. +#define JSON_FORWARDS_H_INCLUDED
  5427. +
  5428. +#if !defined(JSON_IS_AMALGAMATION)
  5429. +#include "config.h"
  5430. +#endif // if !defined(JSON_IS_AMALGAMATION)
  5431. +
  5432. +namespace Json {
  5433. +
  5434. +// writer.h
  5435. +class FastWriter;
  5436. +class StyledWriter;
  5437. +
  5438. +// reader.h
  5439. +class Reader;
  5440. +
  5441. +// features.h
  5442. +class Features;
  5443. +
  5444. +// value.h
  5445. +typedef unsigned int ArrayIndex;
  5446. +class StaticString;
  5447. +class Path;
  5448. +class PathArgument;
  5449. +class Value;
  5450. +class ValueIteratorBase;
  5451. +class ValueIterator;
  5452. +class ValueConstIterator;
  5453. +
  5454. +} // namespace Json
  5455. +
  5456. +#endif // JSON_FORWARDS_H_INCLUDED
  5457. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/json.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/json.h
  5458. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/json.h 1970-01-01 02:00:00.000000000 +0200
  5459. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/json.h 2017-12-03 19:05:22.000000000 +0300
  5460. @@ -0,0 +1,15 @@
  5461. +// Copyright 2007-2010 Baptiste Lepilleur
  5462. +// Distributed under MIT license, or public domain if desired and
  5463. +// recognized in your jurisdiction.
  5464. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5465. +
  5466. +#ifndef JSON_JSON_H_INCLUDED
  5467. +#define JSON_JSON_H_INCLUDED
  5468. +
  5469. +#include "autolink.h"
  5470. +#include "value.h"
  5471. +#include "reader.h"
  5472. +#include "writer.h"
  5473. +#include "features.h"
  5474. +
  5475. +#endif // JSON_JSON_H_INCLUDED
  5476. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/reader.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/reader.h
  5477. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/reader.h 1970-01-01 02:00:00.000000000 +0200
  5478. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/reader.h 2017-12-03 19:05:22.000000000 +0300
  5479. @@ -0,0 +1,404 @@
  5480. +// Copyright 2007-2010 Baptiste Lepilleur
  5481. +// Distributed under MIT license, or public domain if desired and
  5482. +// recognized in your jurisdiction.
  5483. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5484. +
  5485. +#ifndef CPPTL_JSON_READER_H_INCLUDED
  5486. +#define CPPTL_JSON_READER_H_INCLUDED
  5487. +
  5488. +#if !defined(JSON_IS_AMALGAMATION)
  5489. +#include "features.h"
  5490. +#include "value.h"
  5491. +#endif // if !defined(JSON_IS_AMALGAMATION)
  5492. +#include <deque>
  5493. +#include <iosfwd>
  5494. +#include <stack>
  5495. +#include <string>
  5496. +#include <istream>
  5497. +
  5498. +// Disable warning C4251: <data member>: <type> needs to have dll-interface to
  5499. +// be used by...
  5500. +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  5501. +#pragma warning(push)
  5502. +#pragma warning(disable : 4251)
  5503. +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  5504. +
  5505. +namespace Json {
  5506. +
  5507. +/** \brief Unserialize a <a HREF="http://www.json.org">JSON</a> document into a
  5508. + *Value.
  5509. + *
  5510. + * \deprecated Use CharReader and CharReaderBuilder.
  5511. + */
  5512. +class JSON_API Reader {
  5513. +public:
  5514. + typedef char Char;
  5515. + typedef const Char* Location;
  5516. +
  5517. + /** \brief An error tagged with where in the JSON text it was encountered.
  5518. + *
  5519. + * The offsets give the [start, limit) range of bytes within the text. Note
  5520. + * that this is bytes, not codepoints.
  5521. + *
  5522. + */
  5523. + struct StructuredError {
  5524. + ptrdiff_t offset_start;
  5525. + ptrdiff_t offset_limit;
  5526. + JSONCPP_STRING message;
  5527. + };
  5528. +
  5529. + /** \brief Constructs a Reader allowing all features
  5530. + * for parsing.
  5531. + */
  5532. + Reader();
  5533. +
  5534. + /** \brief Constructs a Reader allowing the specified feature set
  5535. + * for parsing.
  5536. + */
  5537. + Reader(const Features& features);
  5538. +
  5539. + /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
  5540. + * document.
  5541. + * \param document UTF-8 encoded string containing the document to read.
  5542. + * \param root [out] Contains the root value of the document if it was
  5543. + * successfully parsed.
  5544. + * \param collectComments \c true to collect comment and allow writing them
  5545. + * back during
  5546. + * serialization, \c false to discard comments.
  5547. + * This parameter is ignored if
  5548. + * Features::allowComments_
  5549. + * is \c false.
  5550. + * \return \c true if the document was successfully parsed, \c false if an
  5551. + * error occurred.
  5552. + */
  5553. + bool
  5554. + parse(const std::string& document, Value& root, bool collectComments = true);
  5555. +
  5556. + /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
  5557. + document.
  5558. + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the
  5559. + document to read.
  5560. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the
  5561. + document to read.
  5562. + * Must be >= beginDoc.
  5563. + * \param root [out] Contains the root value of the document if it was
  5564. + * successfully parsed.
  5565. + * \param collectComments \c true to collect comment and allow writing them
  5566. + back during
  5567. + * serialization, \c false to discard comments.
  5568. + * This parameter is ignored if
  5569. + Features::allowComments_
  5570. + * is \c false.
  5571. + * \return \c true if the document was successfully parsed, \c false if an
  5572. + error occurred.
  5573. + */
  5574. + bool parse(const char* beginDoc,
  5575. + const char* endDoc,
  5576. + Value& root,
  5577. + bool collectComments = true);
  5578. +
  5579. + /// \brief Parse from input stream.
  5580. + /// \see Json::operator>>(std::istream&, Json::Value&).
  5581. + bool parse(JSONCPP_ISTREAM& is, Value& root, bool collectComments = true);
  5582. +
  5583. + /** \brief Returns a user friendly string that list errors in the parsed
  5584. + * document.
  5585. + * \return Formatted error message with the list of errors with their location
  5586. + * in
  5587. + * the parsed document. An empty string is returned if no error
  5588. + * occurred
  5589. + * during parsing.
  5590. + * \deprecated Use getFormattedErrorMessages() instead (typo fix).
  5591. + */
  5592. + JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.")
  5593. + JSONCPP_STRING getFormatedErrorMessages() const;
  5594. +
  5595. + /** \brief Returns a user friendly string that list errors in the parsed
  5596. + * document.
  5597. + * \return Formatted error message with the list of errors with their location
  5598. + * in
  5599. + * the parsed document. An empty string is returned if no error
  5600. + * occurred
  5601. + * during parsing.
  5602. + */
  5603. + JSONCPP_STRING getFormattedErrorMessages() const;
  5604. +
  5605. + /** \brief Returns a vector of structured erros encounted while parsing.
  5606. + * \return A (possibly empty) vector of StructuredError objects. Currently
  5607. + * only one error can be returned, but the caller should tolerate
  5608. + * multiple
  5609. + * errors. This can occur if the parser recovers from a non-fatal
  5610. + * parse error and then encounters additional errors.
  5611. + */
  5612. + std::vector<StructuredError> getStructuredErrors() const;
  5613. +
  5614. + /** \brief Add a semantic error message.
  5615. + * \param value JSON Value location associated with the error
  5616. + * \param message The error message.
  5617. + * \return \c true if the error was successfully added, \c false if the
  5618. + * Value offset exceeds the document size.
  5619. + */
  5620. + bool pushError(const Value& value, const JSONCPP_STRING& message);
  5621. +
  5622. + /** \brief Add a semantic error message with extra context.
  5623. + * \param value JSON Value location associated with the error
  5624. + * \param message The error message.
  5625. + * \param extra Additional JSON Value location to contextualize the error
  5626. + * \return \c true if the error was successfully added, \c false if either
  5627. + * Value offset exceeds the document size.
  5628. + */
  5629. + bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra);
  5630. +
  5631. + /** \brief Return whether there are any errors.
  5632. + * \return \c true if there are no errors to report \c false if
  5633. + * errors have occurred.
  5634. + */
  5635. + bool good() const;
  5636. +
  5637. +private:
  5638. + enum TokenType {
  5639. + tokenEndOfStream = 0,
  5640. + tokenObjectBegin,
  5641. + tokenObjectEnd,
  5642. + tokenArrayBegin,
  5643. + tokenArrayEnd,
  5644. + tokenString,
  5645. + tokenNumber,
  5646. + tokenTrue,
  5647. + tokenFalse,
  5648. + tokenNull,
  5649. + tokenArraySeparator,
  5650. + tokenMemberSeparator,
  5651. + tokenComment,
  5652. + tokenError
  5653. + };
  5654. +
  5655. + class Token {
  5656. + public:
  5657. + TokenType type_;
  5658. + Location start_;
  5659. + Location end_;
  5660. + };
  5661. +
  5662. + class ErrorInfo {
  5663. + public:
  5664. + Token token_;
  5665. + JSONCPP_STRING message_;
  5666. + Location extra_;
  5667. + };
  5668. +
  5669. + typedef std::deque<ErrorInfo> Errors;
  5670. +
  5671. + bool readToken(Token& token);
  5672. + void skipSpaces();
  5673. + bool match(Location pattern, int patternLength);
  5674. + bool readComment();
  5675. + bool readCStyleComment();
  5676. + bool readCppStyleComment();
  5677. + bool readString();
  5678. + void readNumber();
  5679. + bool readValue();
  5680. + bool readObject(Token& token);
  5681. + bool readArray(Token& token);
  5682. + bool decodeNumber(Token& token);
  5683. + bool decodeNumber(Token& token, Value& decoded);
  5684. + bool decodeString(Token& token);
  5685. + bool decodeString(Token& token, JSONCPP_STRING& decoded);
  5686. + bool decodeDouble(Token& token);
  5687. + bool decodeDouble(Token& token, Value& decoded);
  5688. + bool decodeUnicodeCodePoint(Token& token,
  5689. + Location& current,
  5690. + Location end,
  5691. + unsigned int& unicode);
  5692. + bool decodeUnicodeEscapeSequence(Token& token,
  5693. + Location& current,
  5694. + Location end,
  5695. + unsigned int& unicode);
  5696. + bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
  5697. + bool recoverFromError(TokenType skipUntilToken);
  5698. + bool addErrorAndRecover(const JSONCPP_STRING& message,
  5699. + Token& token,
  5700. + TokenType skipUntilToken);
  5701. + void skipUntilSpace();
  5702. + Value& currentValue();
  5703. + Char getNextChar();
  5704. + void
  5705. + getLocationLineAndColumn(Location location, int& line, int& column) const;
  5706. + JSONCPP_STRING getLocationLineAndColumn(Location location) const;
  5707. + void addComment(Location begin, Location end, CommentPlacement placement);
  5708. + void skipCommentTokens(Token& token);
  5709. +
  5710. + typedef std::stack<Value*> Nodes;
  5711. + Nodes nodes_;
  5712. + Errors errors_;
  5713. + JSONCPP_STRING document_;
  5714. + Location begin_;
  5715. + Location end_;
  5716. + Location current_;
  5717. + Location lastValueEnd_;
  5718. + Value* lastValue_;
  5719. + JSONCPP_STRING commentsBefore_;
  5720. + Features features_;
  5721. + bool collectComments_;
  5722. +}; // Reader
  5723. +
  5724. +/** Interface for reading JSON from a char array.
  5725. + */
  5726. +class JSON_API CharReader {
  5727. +public:
  5728. + virtual ~CharReader() {}
  5729. + /** \brief Read a Value from a <a HREF="http://www.json.org">JSON</a>
  5730. + document.
  5731. + * The document must be a UTF-8 encoded string containing the document to read.
  5732. + *
  5733. + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the
  5734. + document to read.
  5735. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the
  5736. + document to read.
  5737. + * Must be >= beginDoc.
  5738. + * \param root [out] Contains the root value of the document if it was
  5739. + * successfully parsed.
  5740. + * \param errs [out] Formatted error messages (if not NULL)
  5741. + * a user friendly string that lists errors in the parsed
  5742. + * document.
  5743. + * \return \c true if the document was successfully parsed, \c false if an
  5744. + error occurred.
  5745. + */
  5746. + virtual bool parse(
  5747. + char const* beginDoc, char const* endDoc,
  5748. + Value* root, JSONCPP_STRING* errs) = 0;
  5749. +
  5750. + class JSON_API Factory {
  5751. + public:
  5752. + virtual ~Factory() {}
  5753. + /** \brief Allocate a CharReader via operator new().
  5754. + * \throw std::exception if something goes wrong (e.g. invalid settings)
  5755. + */
  5756. + virtual CharReader* newCharReader() const = 0;
  5757. + }; // Factory
  5758. +}; // CharReader
  5759. +
  5760. +/** \brief Build a CharReader implementation.
  5761. +
  5762. +Usage:
  5763. +\code
  5764. + using namespace Json;
  5765. + CharReaderBuilder builder;
  5766. + builder["collectComments"] = false;
  5767. + Value value;
  5768. + JSONCPP_STRING errs;
  5769. + bool ok = parseFromStream(builder, std::cin, &value, &errs);
  5770. +\endcode
  5771. +*/
  5772. +class JSON_API CharReaderBuilder : public CharReader::Factory {
  5773. +public:
  5774. + // Note: We use a Json::Value so that we can add data-members to this class
  5775. + // without a major version bump.
  5776. + /** Configuration of this builder.
  5777. + These are case-sensitive.
  5778. + Available settings (case-sensitive):
  5779. + - `"collectComments": false or true`
  5780. + - true to collect comment and allow writing them
  5781. + back during serialization, false to discard comments.
  5782. + This parameter is ignored if allowComments is false.
  5783. + - `"allowComments": false or true`
  5784. + - true if comments are allowed.
  5785. + - `"strictRoot": false or true`
  5786. + - true if root must be either an array or an object value
  5787. + - `"allowDroppedNullPlaceholders": false or true`
  5788. + - true if dropped null placeholders are allowed. (See StreamWriterBuilder.)
  5789. + - `"allowNumericKeys": false or true`
  5790. + - true if numeric object keys are allowed.
  5791. + - `"allowSingleQuotes": false or true`
  5792. + - true if '' are allowed for strings (both keys and values)
  5793. + - `"stackLimit": integer`
  5794. + - Exceeding stackLimit (recursive depth of `readValue()`) will
  5795. + cause an exception.
  5796. + - This is a security issue (seg-faults caused by deeply nested JSON),
  5797. + so the default is low.
  5798. + - `"failIfExtra": false or true`
  5799. + - If true, `parse()` returns false when extra non-whitespace trails
  5800. + the JSON value in the input string.
  5801. + - `"rejectDupKeys": false or true`
  5802. + - If true, `parse()` returns false when a key is duplicated within an object.
  5803. + - `"allowSpecialFloats": false or true`
  5804. + - If true, special float values (NaNs and infinities) are allowed
  5805. + and their values are lossfree restorable.
  5806. +
  5807. + You can examine 'settings_` yourself
  5808. + to see the defaults. You can also write and read them just like any
  5809. + JSON Value.
  5810. + \sa setDefaults()
  5811. + */
  5812. + Json::Value settings_;
  5813. +
  5814. + CharReaderBuilder();
  5815. + ~CharReaderBuilder() JSONCPP_OVERRIDE;
  5816. +
  5817. + CharReader* newCharReader() const JSONCPP_OVERRIDE;
  5818. +
  5819. + /** \return true if 'settings' are legal and consistent;
  5820. + * otherwise, indicate bad settings via 'invalid'.
  5821. + */
  5822. + bool validate(Json::Value* invalid) const;
  5823. +
  5824. + /** A simple way to update a specific setting.
  5825. + */
  5826. + Value& operator[](JSONCPP_STRING key);
  5827. +
  5828. + /** Called by ctor, but you can use this to reset settings_.
  5829. + * \pre 'settings' != NULL (but Json::null is fine)
  5830. + * \remark Defaults:
  5831. + * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults
  5832. + */
  5833. + static void setDefaults(Json::Value* settings);
  5834. + /** Same as old Features::strictMode().
  5835. + * \pre 'settings' != NULL (but Json::null is fine)
  5836. + * \remark Defaults:
  5837. + * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode
  5838. + */
  5839. + static void strictMode(Json::Value* settings);
  5840. +};
  5841. +
  5842. +/** Consume entire stream and use its begin/end.
  5843. + * Someday we might have a real StreamReader, but for now this
  5844. + * is convenient.
  5845. + */
  5846. +bool JSON_API parseFromStream(
  5847. + CharReader::Factory const&,
  5848. + JSONCPP_ISTREAM&,
  5849. + Value* root, std::string* errs);
  5850. +
  5851. +/** \brief Read from 'sin' into 'root'.
  5852. +
  5853. + Always keep comments from the input JSON.
  5854. +
  5855. + This can be used to read a file into a particular sub-object.
  5856. + For example:
  5857. + \code
  5858. + Json::Value root;
  5859. + cin >> root["dir"]["file"];
  5860. + cout << root;
  5861. + \endcode
  5862. + Result:
  5863. + \verbatim
  5864. + {
  5865. + "dir": {
  5866. + "file": {
  5867. + // The input stream JSON would be nested here.
  5868. + }
  5869. + }
  5870. + }
  5871. + \endverbatim
  5872. + \throw std::exception on parse error.
  5873. + \see Json::operator<<()
  5874. +*/
  5875. +JSON_API JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM&, Value&);
  5876. +
  5877. +} // namespace Json
  5878. +
  5879. +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  5880. +#pragma warning(pop)
  5881. +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  5882. +
  5883. +#endif // CPPTL_JSON_READER_H_INCLUDED
  5884. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/value.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/value.h
  5885. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/value.h 1970-01-01 02:00:00.000000000 +0200
  5886. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/value.h 2017-12-03 19:05:22.000000000 +0300
  5887. @@ -0,0 +1,867 @@
  5888. +// Copyright 2007-2010 Baptiste Lepilleur
  5889. +// Distributed under MIT license, or public domain if desired and
  5890. +// recognized in your jurisdiction.
  5891. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  5892. +
  5893. +#ifndef CPPTL_JSON_H_INCLUDED
  5894. +#define CPPTL_JSON_H_INCLUDED
  5895. +
  5896. +#if !defined(JSON_IS_AMALGAMATION)
  5897. +#include "forwards.h"
  5898. +#endif // if !defined(JSON_IS_AMALGAMATION)
  5899. +#include <string>
  5900. +#include <vector>
  5901. +#include <exception>
  5902. +
  5903. +#ifndef JSON_USE_CPPTL_SMALLMAP
  5904. +#include <map>
  5905. +#else
  5906. +#include <cpptl/smallmap.h>
  5907. +#endif
  5908. +#ifdef JSON_USE_CPPTL
  5909. +#include <cpptl/forwards.h>
  5910. +#endif
  5911. +
  5912. +//Conditional NORETURN attribute on the throw functions would:
  5913. +// a) suppress false positives from static code analysis
  5914. +// b) possibly improve optimization opportunities.
  5915. +#if !defined(JSONCPP_NORETURN)
  5916. +# if defined(_MSC_VER)
  5917. +# define JSONCPP_NORETURN __declspec(noreturn)
  5918. +# elif defined(__GNUC__)
  5919. +# define JSONCPP_NORETURN __attribute__ ((__noreturn__))
  5920. +# else
  5921. +# define JSONCPP_NORETURN
  5922. +# endif
  5923. +#endif
  5924. +
  5925. +// Disable warning C4251: <data member>: <type> needs to have dll-interface to
  5926. +// be used by...
  5927. +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  5928. +#pragma warning(push)
  5929. +#pragma warning(disable : 4251)
  5930. +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  5931. +
  5932. +/** \brief JSON (JavaScript Object Notation).
  5933. + */
  5934. +namespace Json {
  5935. +
  5936. +/** Base class for all exceptions we throw.
  5937. + *
  5938. + * We use nothing but these internally. Of course, STL can throw others.
  5939. + */
  5940. +class JSON_API Exception : public std::exception {
  5941. +public:
  5942. + Exception(JSONCPP_STRING const& msg);
  5943. + ~Exception() throw() JSONCPP_OVERRIDE;
  5944. + char const* what() const throw() JSONCPP_OVERRIDE;
  5945. +protected:
  5946. + JSONCPP_STRING msg_;
  5947. +};
  5948. +
  5949. +/** Exceptions which the user cannot easily avoid.
  5950. + *
  5951. + * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
  5952. + *
  5953. + * \remark derived from Json::Exception
  5954. + */
  5955. +class JSON_API RuntimeError : public Exception {
  5956. +public:
  5957. + RuntimeError(JSONCPP_STRING const& msg);
  5958. +};
  5959. +
  5960. +/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
  5961. + *
  5962. + * These are precondition-violations (user bugs) and internal errors (our bugs).
  5963. + *
  5964. + * \remark derived from Json::Exception
  5965. + */
  5966. +class JSON_API LogicError : public Exception {
  5967. +public:
  5968. + LogicError(JSONCPP_STRING const& msg);
  5969. +};
  5970. +
  5971. +/// used internally
  5972. +JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg);
  5973. +/// used internally
  5974. +JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg);
  5975. +
  5976. +/** \brief Type of the value held by a Value object.
  5977. + */
  5978. +enum ValueType {
  5979. + nullValue = 0, ///< 'null' value
  5980. + intValue, ///< signed integer value
  5981. + uintValue, ///< unsigned integer value
  5982. + realValue, ///< double value
  5983. + stringValue, ///< UTF-8 string value
  5984. + booleanValue, ///< bool value
  5985. + arrayValue, ///< array value (ordered list)
  5986. + objectValue ///< object value (collection of name/value pairs).
  5987. +};
  5988. +
  5989. +enum CommentPlacement {
  5990. + commentBefore = 0, ///< a comment placed on the line before a value
  5991. + commentAfterOnSameLine, ///< a comment just after a value on the same line
  5992. + commentAfter, ///< a comment on the line after a value (only make sense for
  5993. + /// root value)
  5994. + numberOfCommentPlacement
  5995. +};
  5996. +
  5997. +//# ifdef JSON_USE_CPPTL
  5998. +// typedef CppTL::AnyEnumerator<const char *> EnumMemberNames;
  5999. +// typedef CppTL::AnyEnumerator<const Value &> EnumValues;
  6000. +//# endif
  6001. +
  6002. +/** \brief Lightweight wrapper to tag static string.
  6003. + *
  6004. + * Value constructor and objectValue member assignement takes advantage of the
  6005. + * StaticString and avoid the cost of string duplication when storing the
  6006. + * string or the member name.
  6007. + *
  6008. + * Example of usage:
  6009. + * \code
  6010. + * Json::Value aValue( StaticString("some text") );
  6011. + * Json::Value object;
  6012. + * static const StaticString code("code");
  6013. + * object[code] = 1234;
  6014. + * \endcode
  6015. + */
  6016. +class JSON_API StaticString {
  6017. +public:
  6018. + explicit StaticString(const char* czstring) : c_str_(czstring) {}
  6019. +
  6020. + operator const char*() const { return c_str_; }
  6021. +
  6022. + const char* c_str() const { return c_str_; }
  6023. +
  6024. +private:
  6025. + const char* c_str_;
  6026. +};
  6027. +
  6028. +/** \brief Represents a <a HREF="http://www.json.org">JSON</a> value.
  6029. + *
  6030. + * This class is a discriminated union wrapper that can represents a:
  6031. + * - signed integer [range: Value::minInt - Value::maxInt]
  6032. + * - unsigned integer (range: 0 - Value::maxUInt)
  6033. + * - double
  6034. + * - UTF-8 string
  6035. + * - boolean
  6036. + * - 'null'
  6037. + * - an ordered list of Value
  6038. + * - collection of name/value pairs (javascript object)
  6039. + *
  6040. + * The type of the held value is represented by a #ValueType and
  6041. + * can be obtained using type().
  6042. + *
  6043. + * Values of an #objectValue or #arrayValue can be accessed using operator[]()
  6044. + * methods.
  6045. + * Non-const methods will automatically create the a #nullValue element
  6046. + * if it does not exist.
  6047. + * The sequence of an #arrayValue will be automatically resized and initialized
  6048. + * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue.
  6049. + *
  6050. + * The get() methods can be used to obtain default value in the case the
  6051. + * required element does not exist.
  6052. + *
  6053. + * It is possible to iterate over the list of a #objectValue values using
  6054. + * the getMemberNames() method.
  6055. + *
  6056. + * \note #Value string-length fit in size_t, but keys must be < 2^30.
  6057. + * (The reason is an implementation detail.) A #CharReader will raise an
  6058. + * exception if a bound is exceeded to avoid security holes in your app,
  6059. + * but the Value API does *not* check bounds. That is the responsibility
  6060. + * of the caller.
  6061. + */
  6062. +class JSON_API Value {
  6063. + friend class ValueIteratorBase;
  6064. +public:
  6065. + typedef std::vector<JSONCPP_STRING> Members;
  6066. + typedef ValueIterator iterator;
  6067. + typedef ValueConstIterator const_iterator;
  6068. + typedef Json::UInt UInt;
  6069. + typedef Json::Int Int;
  6070. +#if defined(JSON_HAS_INT64)
  6071. + typedef Json::UInt64 UInt64;
  6072. + typedef Json::Int64 Int64;
  6073. +#endif // defined(JSON_HAS_INT64)
  6074. + typedef Json::LargestInt LargestInt;
  6075. + typedef Json::LargestUInt LargestUInt;
  6076. + typedef Json::ArrayIndex ArrayIndex;
  6077. +
  6078. + static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value().
  6079. + static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null
  6080. + static Value const& nullSingleton(); ///< Prefer this to null or nullRef.
  6081. +
  6082. + /// Minimum signed integer value that can be stored in a Json::Value.
  6083. + static const LargestInt minLargestInt;
  6084. + /// Maximum signed integer value that can be stored in a Json::Value.
  6085. + static const LargestInt maxLargestInt;
  6086. + /// Maximum unsigned integer value that can be stored in a Json::Value.
  6087. + static const LargestUInt maxLargestUInt;
  6088. +
  6089. + /// Minimum signed int value that can be stored in a Json::Value.
  6090. + static const Int minInt;
  6091. + /// Maximum signed int value that can be stored in a Json::Value.
  6092. + static const Int maxInt;
  6093. + /// Maximum unsigned int value that can be stored in a Json::Value.
  6094. + static const UInt maxUInt;
  6095. +
  6096. +#if defined(JSON_HAS_INT64)
  6097. + /// Minimum signed 64 bits int value that can be stored in a Json::Value.
  6098. + static const Int64 minInt64;
  6099. + /// Maximum signed 64 bits int value that can be stored in a Json::Value.
  6100. + static const Int64 maxInt64;
  6101. + /// Maximum unsigned 64 bits int value that can be stored in a Json::Value.
  6102. + static const UInt64 maxUInt64;
  6103. +#endif // defined(JSON_HAS_INT64)
  6104. +
  6105. +private:
  6106. +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
  6107. + class CZString {
  6108. + public:
  6109. + enum DuplicationPolicy {
  6110. + noDuplication = 0,
  6111. + duplicate,
  6112. + duplicateOnCopy
  6113. + };
  6114. + CZString(ArrayIndex index);
  6115. + CZString(char const* str, unsigned length, DuplicationPolicy allocate);
  6116. + CZString(CZString const& other);
  6117. +#if JSON_HAS_RVALUE_REFERENCES
  6118. + CZString(CZString&& other);
  6119. +#endif
  6120. + ~CZString();
  6121. + CZString& operator=(CZString other);
  6122. + bool operator<(CZString const& other) const;
  6123. + bool operator==(CZString const& other) const;
  6124. + ArrayIndex index() const;
  6125. + //const char* c_str() const; ///< \deprecated
  6126. + char const* data() const;
  6127. + unsigned length() const;
  6128. + bool isStaticString() const;
  6129. +
  6130. + private:
  6131. + void swap(CZString& other);
  6132. +
  6133. + struct StringStorage {
  6134. + unsigned policy_: 2;
  6135. + unsigned length_: 30; // 1GB max
  6136. + };
  6137. +
  6138. + char const* cstr_; // actually, a prefixed string, unless policy is noDup
  6139. + union {
  6140. + ArrayIndex index_;
  6141. + StringStorage storage_;
  6142. + };
  6143. + };
  6144. +
  6145. +public:
  6146. +#ifndef JSON_USE_CPPTL_SMALLMAP
  6147. + typedef std::map<CZString, Value> ObjectValues;
  6148. +#else
  6149. + typedef CppTL::SmallMap<CZString, Value> ObjectValues;
  6150. +#endif // ifndef JSON_USE_CPPTL_SMALLMAP
  6151. +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION
  6152. +
  6153. +public:
  6154. + /** \brief Create a default Value of the given type.
  6155. +
  6156. + This is a very useful constructor.
  6157. + To create an empty array, pass arrayValue.
  6158. + To create an empty object, pass objectValue.
  6159. + Another Value can then be set to this one by assignment.
  6160. +This is useful since clear() and resize() will not alter types.
  6161. +
  6162. + Examples:
  6163. +\code
  6164. +Json::Value null_value; // null
  6165. +Json::Value arr_value(Json::arrayValue); // []
  6166. +Json::Value obj_value(Json::objectValue); // {}
  6167. +\endcode
  6168. + */
  6169. + Value(ValueType type = nullValue);
  6170. + Value(Int value);
  6171. + Value(UInt value);
  6172. +#if defined(JSON_HAS_INT64)
  6173. + Value(Int64 value);
  6174. + Value(UInt64 value);
  6175. +#endif // if defined(JSON_HAS_INT64)
  6176. + Value(double value);
  6177. + Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.)
  6178. + Value(const char* begin, const char* end); ///< Copy all, incl zeroes.
  6179. + /** \brief Constructs a value from a static string.
  6180. +
  6181. + * Like other value string constructor but do not duplicate the string for
  6182. + * internal storage. The given string must remain alive after the call to this
  6183. + * constructor.
  6184. + * \note This works only for null-terminated strings. (We cannot change the
  6185. + * size of this class, so we have nowhere to store the length,
  6186. + * which might be computed later for various operations.)
  6187. + *
  6188. + * Example of usage:
  6189. + * \code
  6190. + * static StaticString foo("some text");
  6191. + * Json::Value aValue(foo);
  6192. + * \endcode
  6193. + */
  6194. + Value(const StaticString& value);
  6195. + Value(const JSONCPP_STRING& value); ///< Copy data() til size(). Embedded zeroes too.
  6196. +#ifdef JSON_USE_CPPTL
  6197. + Value(const CppTL::ConstString& value);
  6198. +#endif
  6199. + Value(bool value);
  6200. + /// Deep copy.
  6201. + Value(const Value& other);
  6202. +#if JSON_HAS_RVALUE_REFERENCES
  6203. + /// Move constructor
  6204. + Value(Value&& other);
  6205. +#endif
  6206. + ~Value();
  6207. +
  6208. + /// Deep copy, then swap(other).
  6209. + /// \note Over-write existing comments. To preserve comments, use #swapPayload().
  6210. + Value& operator=(Value other);
  6211. + /// Swap everything.
  6212. + void swap(Value& other);
  6213. + /// Swap values but leave comments and source offsets in place.
  6214. + void swapPayload(Value& other);
  6215. +
  6216. + ValueType type() const;
  6217. +
  6218. + /// Compare payload only, not comments etc.
  6219. + bool operator<(const Value& other) const;
  6220. + bool operator<=(const Value& other) const;
  6221. + bool operator>=(const Value& other) const;
  6222. + bool operator>(const Value& other) const;
  6223. + bool operator==(const Value& other) const;
  6224. + bool operator!=(const Value& other) const;
  6225. + int compare(const Value& other) const;
  6226. +
  6227. + const char* asCString() const; ///< Embedded zeroes could cause you trouble!
  6228. +#if JSONCPP_USING_SECURE_MEMORY
  6229. + unsigned getCStringLength() const; //Allows you to understand the length of the CString
  6230. +#endif
  6231. + JSONCPP_STRING asString() const; ///< Embedded zeroes are possible.
  6232. + /** Get raw char* of string-value.
  6233. + * \return false if !string. (Seg-fault if str or end are NULL.)
  6234. + */
  6235. + bool getString(
  6236. + char const** begin, char const** end) const;
  6237. +#ifdef JSON_USE_CPPTL
  6238. + CppTL::ConstString asConstString() const;
  6239. +#endif
  6240. + Int asInt() const;
  6241. + UInt asUInt() const;
  6242. +#if defined(JSON_HAS_INT64)
  6243. + Int64 asInt64() const;
  6244. + UInt64 asUInt64() const;
  6245. +#endif // if defined(JSON_HAS_INT64)
  6246. + LargestInt asLargestInt() const;
  6247. + LargestUInt asLargestUInt() const;
  6248. + float asFloat() const;
  6249. + double asDouble() const;
  6250. + bool asBool() const;
  6251. +
  6252. + bool isNull() const;
  6253. + bool isBool() const;
  6254. + bool isInt() const;
  6255. + bool isInt64() const;
  6256. + bool isUInt() const;
  6257. + bool isUInt64() const;
  6258. + bool isIntegral() const;
  6259. + bool isDouble() const;
  6260. + bool isNumeric() const;
  6261. + bool isString() const;
  6262. + bool isArray() const;
  6263. + bool isObject() const;
  6264. +
  6265. + bool isConvertibleTo(ValueType other) const;
  6266. +
  6267. + /// Number of values in array or object
  6268. + ArrayIndex size() const;
  6269. +
  6270. + /// \brief Return true if empty array, empty object, or null;
  6271. + /// otherwise, false.
  6272. + bool empty() const;
  6273. +
  6274. + /// Return isNull()
  6275. + bool operator!() const;
  6276. +
  6277. + /// Remove all object members and array elements.
  6278. + /// \pre type() is arrayValue, objectValue, or nullValue
  6279. + /// \post type() is unchanged
  6280. + void clear();
  6281. +
  6282. + /// Resize the array to size elements.
  6283. + /// New elements are initialized to null.
  6284. + /// May only be called on nullValue or arrayValue.
  6285. + /// \pre type() is arrayValue or nullValue
  6286. + /// \post type() is arrayValue
  6287. + void resize(ArrayIndex size);
  6288. +
  6289. + /// Access an array element (zero based index ).
  6290. + /// If the array contains less than index element, then null value are
  6291. + /// inserted
  6292. + /// in the array so that its size is index+1.
  6293. + /// (You may need to say 'value[0u]' to get your compiler to distinguish
  6294. + /// this from the operator[] which takes a string.)
  6295. + Value& operator[](ArrayIndex index);
  6296. +
  6297. + /// Access an array element (zero based index ).
  6298. + /// If the array contains less than index element, then null value are
  6299. + /// inserted
  6300. + /// in the array so that its size is index+1.
  6301. + /// (You may need to say 'value[0u]' to get your compiler to distinguish
  6302. + /// this from the operator[] which takes a string.)
  6303. + Value& operator[](int index);
  6304. +
  6305. + /// Access an array element (zero based index )
  6306. + /// (You may need to say 'value[0u]' to get your compiler to distinguish
  6307. + /// this from the operator[] which takes a string.)
  6308. + const Value& operator[](ArrayIndex index) const;
  6309. +
  6310. + /// Access an array element (zero based index )
  6311. + /// (You may need to say 'value[0u]' to get your compiler to distinguish
  6312. + /// this from the operator[] which takes a string.)
  6313. + const Value& operator[](int index) const;
  6314. +
  6315. + /// If the array contains at least index+1 elements, returns the element
  6316. + /// value,
  6317. + /// otherwise returns defaultValue.
  6318. + Value get(ArrayIndex index, const Value& defaultValue) const;
  6319. + /// Return true if index < size().
  6320. + bool isValidIndex(ArrayIndex index) const;
  6321. + /// \brief Append value to array at the end.
  6322. + ///
  6323. + /// Equivalent to jsonvalue[jsonvalue.size()] = value;
  6324. + Value& append(const Value& value);
  6325. +
  6326. + /// Access an object value by name, create a null member if it does not exist.
  6327. + /// \note Because of our implementation, keys are limited to 2^30 -1 chars.
  6328. + /// Exceeding that will cause an exception.
  6329. + Value& operator[](const char* key);
  6330. + /// Access an object value by name, returns null if there is no member with
  6331. + /// that name.
  6332. + const Value& operator[](const char* key) const;
  6333. + /// Access an object value by name, create a null member if it does not exist.
  6334. + /// \param key may contain embedded nulls.
  6335. + Value& operator[](const JSONCPP_STRING& key);
  6336. + /// Access an object value by name, returns null if there is no member with
  6337. + /// that name.
  6338. + /// \param key may contain embedded nulls.
  6339. + const Value& operator[](const JSONCPP_STRING& key) const;
  6340. + /** \brief Access an object value by name, create a null member if it does not
  6341. + exist.
  6342. +
  6343. + * If the object has no entry for that name, then the member name used to store
  6344. + * the new entry is not duplicated.
  6345. + * Example of use:
  6346. + * \code
  6347. + * Json::Value object;
  6348. + * static const StaticString code("code");
  6349. + * object[code] = 1234;
  6350. + * \endcode
  6351. + */
  6352. + Value& operator[](const StaticString& key);
  6353. +#ifdef JSON_USE_CPPTL
  6354. + /// Access an object value by name, create a null member if it does not exist.
  6355. + Value& operator[](const CppTL::ConstString& key);
  6356. + /// Access an object value by name, returns null if there is no member with
  6357. + /// that name.
  6358. + const Value& operator[](const CppTL::ConstString& key) const;
  6359. +#endif
  6360. + /// Return the member named key if it exist, defaultValue otherwise.
  6361. + /// \note deep copy
  6362. + Value get(const char* key, const Value& defaultValue) const;
  6363. + /// Return the member named key if it exist, defaultValue otherwise.
  6364. + /// \note deep copy
  6365. + /// \note key may contain embedded nulls.
  6366. + Value get(const char* begin, const char* end, const Value& defaultValue) const;
  6367. + /// Return the member named key if it exist, defaultValue otherwise.
  6368. + /// \note deep copy
  6369. + /// \param key may contain embedded nulls.
  6370. + Value get(const JSONCPP_STRING& key, const Value& defaultValue) const;
  6371. +#ifdef JSON_USE_CPPTL
  6372. + /// Return the member named key if it exist, defaultValue otherwise.
  6373. + /// \note deep copy
  6374. + Value get(const CppTL::ConstString& key, const Value& defaultValue) const;
  6375. +#endif
  6376. + /// Most general and efficient version of isMember()const, get()const,
  6377. + /// and operator[]const
  6378. + /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
  6379. + Value const* find(char const* begin, char const* end) const;
  6380. + /// Most general and efficient version of object-mutators.
  6381. + /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30
  6382. + /// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue.
  6383. + Value const* demand(char const* begin, char const* end);
  6384. + /// \brief Remove and return the named member.
  6385. + ///
  6386. + /// Do nothing if it did not exist.
  6387. + /// \return the removed Value, or null.
  6388. + /// \pre type() is objectValue or nullValue
  6389. + /// \post type() is unchanged
  6390. + /// \deprecated
  6391. + Value removeMember(const char* key);
  6392. + /// Same as removeMember(const char*)
  6393. + /// \param key may contain embedded nulls.
  6394. + /// \deprecated
  6395. + Value removeMember(const JSONCPP_STRING& key);
  6396. + /// Same as removeMember(const char* begin, const char* end, Value* removed),
  6397. + /// but 'key' is null-terminated.
  6398. + bool removeMember(const char* key, Value* removed);
  6399. + /** \brief Remove the named map member.
  6400. +
  6401. + Update 'removed' iff removed.
  6402. + \param key may contain embedded nulls.
  6403. + \return true iff removed (no exceptions)
  6404. + */
  6405. + bool removeMember(JSONCPP_STRING const& key, Value* removed);
  6406. + /// Same as removeMember(JSONCPP_STRING const& key, Value* removed)
  6407. + bool removeMember(const char* begin, const char* end, Value* removed);
  6408. + /** \brief Remove the indexed array element.
  6409. +
  6410. + O(n) expensive operations.
  6411. + Update 'removed' iff removed.
  6412. + \return true iff removed (no exceptions)
  6413. + */
  6414. + bool removeIndex(ArrayIndex i, Value* removed);
  6415. +
  6416. + /// Return true if the object has a member named key.
  6417. + /// \note 'key' must be null-terminated.
  6418. + bool isMember(const char* key) const;
  6419. + /// Return true if the object has a member named key.
  6420. + /// \param key may contain embedded nulls.
  6421. + bool isMember(const JSONCPP_STRING& key) const;
  6422. + /// Same as isMember(JSONCPP_STRING const& key)const
  6423. + bool isMember(const char* begin, const char* end) const;
  6424. +#ifdef JSON_USE_CPPTL
  6425. + /// Return true if the object has a member named key.
  6426. + bool isMember(const CppTL::ConstString& key) const;
  6427. +#endif
  6428. +
  6429. + /// \brief Return a list of the member names.
  6430. + ///
  6431. + /// If null, return an empty list.
  6432. + /// \pre type() is objectValue or nullValue
  6433. + /// \post if type() was nullValue, it remains nullValue
  6434. + Members getMemberNames() const;
  6435. +
  6436. + //# ifdef JSON_USE_CPPTL
  6437. + // EnumMemberNames enumMemberNames() const;
  6438. + // EnumValues enumValues() const;
  6439. + //# endif
  6440. +
  6441. + /// \deprecated Always pass len.
  6442. + JSONCPP_DEPRECATED("Use setComment(JSONCPP_STRING const&) instead.")
  6443. + void setComment(const char* comment, CommentPlacement placement);
  6444. + /// Comments must be //... or /* ... */
  6445. + void setComment(const char* comment, size_t len, CommentPlacement placement);
  6446. + /// Comments must be //... or /* ... */
  6447. + void setComment(const JSONCPP_STRING& comment, CommentPlacement placement);
  6448. + bool hasComment(CommentPlacement placement) const;
  6449. + /// Include delimiters and embedded newlines.
  6450. + JSONCPP_STRING getComment(CommentPlacement placement) const;
  6451. +
  6452. + JSONCPP_STRING toStyledString() const;
  6453. +
  6454. + const_iterator begin() const;
  6455. + const_iterator end() const;
  6456. +
  6457. + iterator begin();
  6458. + iterator end();
  6459. +
  6460. + // Accessors for the [start, limit) range of bytes within the JSON text from
  6461. + // which this value was parsed, if any.
  6462. + void setOffsetStart(ptrdiff_t start);
  6463. + void setOffsetLimit(ptrdiff_t limit);
  6464. + ptrdiff_t getOffsetStart() const;
  6465. + ptrdiff_t getOffsetLimit() const;
  6466. +
  6467. +private:
  6468. + void initBasic(ValueType type, bool allocated = false);
  6469. +
  6470. + Value& resolveReference(const char* key);
  6471. + Value& resolveReference(const char* key, const char* end);
  6472. +
  6473. + struct CommentInfo {
  6474. + CommentInfo();
  6475. + ~CommentInfo();
  6476. +
  6477. + void setComment(const char* text, size_t len);
  6478. +
  6479. + char* comment_;
  6480. + };
  6481. +
  6482. + // struct MemberNamesTransform
  6483. + //{
  6484. + // typedef const char *result_type;
  6485. + // const char *operator()( const CZString &name ) const
  6486. + // {
  6487. + // return name.c_str();
  6488. + // }
  6489. + //};
  6490. +
  6491. + union ValueHolder {
  6492. + LargestInt int_;
  6493. + LargestUInt uint_;
  6494. + double real_;
  6495. + bool bool_;
  6496. + char* string_; // actually ptr to unsigned, followed by str, unless !allocated_
  6497. + ObjectValues* map_;
  6498. + } value_;
  6499. + ValueType type_ : 8;
  6500. + unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless.
  6501. + // If not allocated_, string_ must be null-terminated.
  6502. + CommentInfo* comments_;
  6503. +
  6504. + // [start, limit) byte offsets in the source JSON text from which this Value
  6505. + // was extracted.
  6506. + ptrdiff_t start_;
  6507. + ptrdiff_t limit_;
  6508. +};
  6509. +
  6510. +/** \brief Experimental and untested: represents an element of the "path" to
  6511. + * access a node.
  6512. + */
  6513. +class JSON_API PathArgument {
  6514. +public:
  6515. + friend class Path;
  6516. +
  6517. + PathArgument();
  6518. + PathArgument(ArrayIndex index);
  6519. + PathArgument(const char* key);
  6520. + PathArgument(const JSONCPP_STRING& key);
  6521. +
  6522. +private:
  6523. + enum Kind {
  6524. + kindNone = 0,
  6525. + kindIndex,
  6526. + kindKey
  6527. + };
  6528. + JSONCPP_STRING key_;
  6529. + ArrayIndex index_;
  6530. + Kind kind_;
  6531. +};
  6532. +
  6533. +/** \brief Experimental and untested: represents a "path" to access a node.
  6534. + *
  6535. + * Syntax:
  6536. + * - "." => root node
  6537. + * - ".[n]" => elements at index 'n' of root node (an array value)
  6538. + * - ".name" => member named 'name' of root node (an object value)
  6539. + * - ".name1.name2.name3"
  6540. + * - ".[0][1][2].name1[3]"
  6541. + * - ".%" => member name is provided as parameter
  6542. + * - ".[%]" => index is provied as parameter
  6543. + */
  6544. +class JSON_API Path {
  6545. +public:
  6546. + Path(const JSONCPP_STRING& path,
  6547. + const PathArgument& a1 = PathArgument(),
  6548. + const PathArgument& a2 = PathArgument(),
  6549. + const PathArgument& a3 = PathArgument(),
  6550. + const PathArgument& a4 = PathArgument(),
  6551. + const PathArgument& a5 = PathArgument());
  6552. +
  6553. + const Value& resolve(const Value& root) const;
  6554. + Value resolve(const Value& root, const Value& defaultValue) const;
  6555. + /// Creates the "path" to access the specified node and returns a reference on
  6556. + /// the node.
  6557. + Value& make(Value& root) const;
  6558. +
  6559. +private:
  6560. + typedef std::vector<const PathArgument*> InArgs;
  6561. + typedef std::vector<PathArgument> Args;
  6562. +
  6563. + void makePath(const JSONCPP_STRING& path, const InArgs& in);
  6564. + void addPathInArg(const JSONCPP_STRING& path,
  6565. + const InArgs& in,
  6566. + InArgs::const_iterator& itInArg,
  6567. + PathArgument::Kind kind);
  6568. + void invalidPath(const JSONCPP_STRING& path, int location);
  6569. +
  6570. + Args args_;
  6571. +};
  6572. +
  6573. +/** \brief base class for Value iterators.
  6574. + *
  6575. + */
  6576. +class JSON_API ValueIteratorBase {
  6577. +public:
  6578. + typedef std::bidirectional_iterator_tag iterator_category;
  6579. + typedef unsigned int size_t;
  6580. + typedef int difference_type;
  6581. + typedef ValueIteratorBase SelfType;
  6582. +
  6583. + bool operator==(const SelfType& other) const { return isEqual(other); }
  6584. +
  6585. + bool operator!=(const SelfType& other) const { return !isEqual(other); }
  6586. +
  6587. + difference_type operator-(const SelfType& other) const {
  6588. + return other.computeDistance(*this);
  6589. + }
  6590. +
  6591. + /// Return either the index or the member name of the referenced value as a
  6592. + /// Value.
  6593. + Value key() const;
  6594. +
  6595. + /// Return the index of the referenced Value, or -1 if it is not an arrayValue.
  6596. + UInt index() const;
  6597. +
  6598. + /// Return the member name of the referenced Value, or "" if it is not an
  6599. + /// objectValue.
  6600. + /// \note Avoid `c_str()` on result, as embedded zeroes are possible.
  6601. + JSONCPP_STRING name() const;
  6602. +
  6603. + /// Return the member name of the referenced Value. "" if it is not an
  6604. + /// objectValue.
  6605. + /// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls.
  6606. + JSONCPP_DEPRECATED("Use `key = name();` instead.")
  6607. + char const* memberName() const;
  6608. + /// Return the member name of the referenced Value, or NULL if it is not an
  6609. + /// objectValue.
  6610. + /// \note Better version than memberName(). Allows embedded nulls.
  6611. + char const* memberName(char const** end) const;
  6612. +
  6613. +protected:
  6614. + Value& deref() const;
  6615. +
  6616. + void increment();
  6617. +
  6618. + void decrement();
  6619. +
  6620. + difference_type computeDistance(const SelfType& other) const;
  6621. +
  6622. + bool isEqual(const SelfType& other) const;
  6623. +
  6624. + void copy(const SelfType& other);
  6625. +
  6626. +private:
  6627. + Value::ObjectValues::iterator current_;
  6628. + // Indicates that iterator is for a null value.
  6629. + bool isNull_;
  6630. +
  6631. +public:
  6632. + // For some reason, BORLAND needs these at the end, rather
  6633. + // than earlier. No idea why.
  6634. + ValueIteratorBase();
  6635. + explicit ValueIteratorBase(const Value::ObjectValues::iterator& current);
  6636. +};
  6637. +
  6638. +/** \brief const iterator for object and array value.
  6639. + *
  6640. + */
  6641. +class JSON_API ValueConstIterator : public ValueIteratorBase {
  6642. + friend class Value;
  6643. +
  6644. +public:
  6645. + typedef const Value value_type;
  6646. + //typedef unsigned int size_t;
  6647. + //typedef int difference_type;
  6648. + typedef const Value& reference;
  6649. + typedef const Value* pointer;
  6650. + typedef ValueConstIterator SelfType;
  6651. +
  6652. + ValueConstIterator();
  6653. + ValueConstIterator(ValueIterator const& other);
  6654. +
  6655. +private:
  6656. +/*! \internal Use by Value to create an iterator.
  6657. + */
  6658. + explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
  6659. +public:
  6660. + SelfType& operator=(const ValueIteratorBase& other);
  6661. +
  6662. + SelfType operator++(int) {
  6663. + SelfType temp(*this);
  6664. + ++*this;
  6665. + return temp;
  6666. + }
  6667. +
  6668. + SelfType operator--(int) {
  6669. + SelfType temp(*this);
  6670. + --*this;
  6671. + return temp;
  6672. + }
  6673. +
  6674. + SelfType& operator--() {
  6675. + decrement();
  6676. + return *this;
  6677. + }
  6678. +
  6679. + SelfType& operator++() {
  6680. + increment();
  6681. + return *this;
  6682. + }
  6683. +
  6684. + reference operator*() const { return deref(); }
  6685. +
  6686. + pointer operator->() const { return &deref(); }
  6687. +};
  6688. +
  6689. +/** \brief Iterator for object and array value.
  6690. + */
  6691. +class JSON_API ValueIterator : public ValueIteratorBase {
  6692. + friend class Value;
  6693. +
  6694. +public:
  6695. + typedef Value value_type;
  6696. + typedef unsigned int size_t;
  6697. + typedef int difference_type;
  6698. + typedef Value& reference;
  6699. + typedef Value* pointer;
  6700. + typedef ValueIterator SelfType;
  6701. +
  6702. + ValueIterator();
  6703. + explicit ValueIterator(const ValueConstIterator& other);
  6704. + ValueIterator(const ValueIterator& other);
  6705. +
  6706. +private:
  6707. +/*! \internal Use by Value to create an iterator.
  6708. + */
  6709. + explicit ValueIterator(const Value::ObjectValues::iterator& current);
  6710. +public:
  6711. + SelfType& operator=(const SelfType& other);
  6712. +
  6713. + SelfType operator++(int) {
  6714. + SelfType temp(*this);
  6715. + ++*this;
  6716. + return temp;
  6717. + }
  6718. +
  6719. + SelfType operator--(int) {
  6720. + SelfType temp(*this);
  6721. + --*this;
  6722. + return temp;
  6723. + }
  6724. +
  6725. + SelfType& operator--() {
  6726. + decrement();
  6727. + return *this;
  6728. + }
  6729. +
  6730. + SelfType& operator++() {
  6731. + increment();
  6732. + return *this;
  6733. + }
  6734. +
  6735. + reference operator*() const { return deref(); }
  6736. +
  6737. + pointer operator->() const { return &deref(); }
  6738. +};
  6739. +
  6740. +} // namespace Json
  6741. +
  6742. +
  6743. +namespace std {
  6744. +/// Specialize std::swap() for Json::Value.
  6745. +template<>
  6746. +inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); }
  6747. +}
  6748. +
  6749. +
  6750. +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  6751. +#pragma warning(pop)
  6752. +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  6753. +
  6754. +#endif // CPPTL_JSON_H_INCLUDED
  6755. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/version.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/version.h
  6756. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/version.h 1970-01-01 02:00:00.000000000 +0200
  6757. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/version.h 2017-12-03 19:05:22.000000000 +0300
  6758. @@ -0,0 +1,20 @@
  6759. +// DO NOT EDIT. This file (and "version") is generated by CMake.
  6760. +// Run CMake configure step to update it.
  6761. +#ifndef JSON_VERSION_H_INCLUDED
  6762. +# define JSON_VERSION_H_INCLUDED
  6763. +
  6764. +# define JSONCPP_VERSION_STRING "1.7.7"
  6765. +# define JSONCPP_VERSION_MAJOR 1
  6766. +# define JSONCPP_VERSION_MINOR 7
  6767. +# define JSONCPP_VERSION_PATCH 7
  6768. +# define JSONCPP_VERSION_QUALIFIER
  6769. +# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
  6770. +
  6771. +#ifdef JSONCPP_USING_SECURE_MEMORY
  6772. +#undef JSONCPP_USING_SECURE_MEMORY
  6773. +#endif
  6774. +#define JSONCPP_USING_SECURE_MEMORY 0
  6775. +// If non-zero, the library zeroes any memory that it has allocated before
  6776. +// it frees its memory.
  6777. +
  6778. +#endif // JSON_VERSION_H_INCLUDED
  6779. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/writer.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/writer.h
  6780. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/writer.h 1970-01-01 02:00:00.000000000 +0200
  6781. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/include/json/writer.h 2017-12-03 19:05:22.000000000 +0300
  6782. @@ -0,0 +1,331 @@
  6783. +// Copyright 2007-2010 Baptiste Lepilleur
  6784. +// Distributed under MIT license, or public domain if desired and
  6785. +// recognized in your jurisdiction.
  6786. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  6787. +
  6788. +#ifndef JSON_WRITER_H_INCLUDED
  6789. +#define JSON_WRITER_H_INCLUDED
  6790. +
  6791. +#if !defined(JSON_IS_AMALGAMATION)
  6792. +#include "value.h"
  6793. +#endif // if !defined(JSON_IS_AMALGAMATION)
  6794. +#include <vector>
  6795. +#include <string>
  6796. +#include <ostream>
  6797. +
  6798. +// Disable warning C4251: <data member>: <type> needs to have dll-interface to
  6799. +// be used by...
  6800. +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  6801. +#pragma warning(push)
  6802. +#pragma warning(disable : 4251)
  6803. +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  6804. +
  6805. +namespace Json {
  6806. +
  6807. +class Value;
  6808. +
  6809. +/**
  6810. +
  6811. +Usage:
  6812. +\code
  6813. + using namespace Json;
  6814. + void writeToStdout(StreamWriter::Factory const& factory, Value const& value) {
  6815. + std::unique_ptr<StreamWriter> const writer(
  6816. + factory.newStreamWriter());
  6817. + writer->write(value, &std::cout);
  6818. + std::cout << std::endl; // add lf and flush
  6819. + }
  6820. +\endcode
  6821. +*/
  6822. +class JSON_API StreamWriter {
  6823. +protected:
  6824. + JSONCPP_OSTREAM* sout_; // not owned; will not delete
  6825. +public:
  6826. + StreamWriter();
  6827. + virtual ~StreamWriter();
  6828. + /** Write Value into document as configured in sub-class.
  6829. + Do not take ownership of sout, but maintain a reference during function.
  6830. + \pre sout != NULL
  6831. + \return zero on success (For now, we always return zero, so check the stream instead.)
  6832. + \throw std::exception possibly, depending on configuration
  6833. + */
  6834. + virtual int write(Value const& root, JSONCPP_OSTREAM* sout) = 0;
  6835. +
  6836. + /** \brief A simple abstract factory.
  6837. + */
  6838. + class JSON_API Factory {
  6839. + public:
  6840. + virtual ~Factory();
  6841. + /** \brief Allocate a CharReader via operator new().
  6842. + * \throw std::exception if something goes wrong (e.g. invalid settings)
  6843. + */
  6844. + virtual StreamWriter* newStreamWriter() const = 0;
  6845. + }; // Factory
  6846. +}; // StreamWriter
  6847. +
  6848. +/** \brief Write into stringstream, then return string, for convenience.
  6849. + * A StreamWriter will be created from the factory, used, and then deleted.
  6850. + */
  6851. +JSONCPP_STRING JSON_API writeString(StreamWriter::Factory const& factory, Value const& root);
  6852. +
  6853. +
  6854. +/** \brief Build a StreamWriter implementation.
  6855. +
  6856. +Usage:
  6857. +\code
  6858. + using namespace Json;
  6859. + Value value = ...;
  6860. + StreamWriterBuilder builder;
  6861. + builder["commentStyle"] = "None";
  6862. + builder["indentation"] = " "; // or whatever you like
  6863. + std::unique_ptr<Json::StreamWriter> writer(
  6864. + builder.newStreamWriter());
  6865. + writer->write(value, &std::cout);
  6866. + std::cout << std::endl; // add lf and flush
  6867. +\endcode
  6868. +*/
  6869. +class JSON_API StreamWriterBuilder : public StreamWriter::Factory {
  6870. +public:
  6871. + // Note: We use a Json::Value so that we can add data-members to this class
  6872. + // without a major version bump.
  6873. + /** Configuration of this builder.
  6874. + Available settings (case-sensitive):
  6875. + - "commentStyle": "None" or "All"
  6876. + - "indentation": "<anything>"
  6877. + - "enableYAMLCompatibility": false or true
  6878. + - slightly change the whitespace around colons
  6879. + - "dropNullPlaceholders": false or true
  6880. + - Drop the "null" string from the writer's output for nullValues.
  6881. + Strictly speaking, this is not valid JSON. But when the output is being
  6882. + fed to a browser's Javascript, it makes for smaller output and the
  6883. + browser can handle the output just fine.
  6884. + - "useSpecialFloats": false or true
  6885. + - If true, outputs non-finite floating point values in the following way:
  6886. + NaN values as "NaN", positive infinity as "Infinity", and negative infinity
  6887. + as "-Infinity".
  6888. +
  6889. + You can examine 'settings_` yourself
  6890. + to see the defaults. You can also write and read them just like any
  6891. + JSON Value.
  6892. + \sa setDefaults()
  6893. + */
  6894. + Json::Value settings_;
  6895. +
  6896. + StreamWriterBuilder();
  6897. + ~StreamWriterBuilder() JSONCPP_OVERRIDE;
  6898. +
  6899. + /**
  6900. + * \throw std::exception if something goes wrong (e.g. invalid settings)
  6901. + */
  6902. + StreamWriter* newStreamWriter() const JSONCPP_OVERRIDE;
  6903. +
  6904. + /** \return true if 'settings' are legal and consistent;
  6905. + * otherwise, indicate bad settings via 'invalid'.
  6906. + */
  6907. + bool validate(Json::Value* invalid) const;
  6908. + /** A simple way to update a specific setting.
  6909. + */
  6910. + Value& operator[](JSONCPP_STRING key);
  6911. +
  6912. + /** Called by ctor, but you can use this to reset settings_.
  6913. + * \pre 'settings' != NULL (but Json::null is fine)
  6914. + * \remark Defaults:
  6915. + * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults
  6916. + */
  6917. + static void setDefaults(Json::Value* settings);
  6918. +};
  6919. +
  6920. +/** \brief Abstract class for writers.
  6921. + * \deprecated Use StreamWriter. (And really, this is an implementation detail.)
  6922. + */
  6923. +class JSON_API Writer {
  6924. +public:
  6925. + virtual ~Writer();
  6926. +
  6927. + virtual JSONCPP_STRING write(const Value& root) = 0;
  6928. +};
  6929. +
  6930. +/** \brief Outputs a Value in <a HREF="http://www.json.org">JSON</a> format
  6931. + *without formatting (not human friendly).
  6932. + *
  6933. + * The JSON document is written in a single line. It is not intended for 'human'
  6934. + *consumption,
  6935. + * but may be usefull to support feature such as RPC where bandwith is limited.
  6936. + * \sa Reader, Value
  6937. + * \deprecated Use StreamWriterBuilder.
  6938. + */
  6939. +class JSON_API FastWriter : public Writer {
  6940. +
  6941. +public:
  6942. + FastWriter();
  6943. + ~FastWriter() JSONCPP_OVERRIDE {}
  6944. +
  6945. + void enableYAMLCompatibility();
  6946. +
  6947. + /** \brief Drop the "null" string from the writer's output for nullValues.
  6948. + * Strictly speaking, this is not valid JSON. But when the output is being
  6949. + * fed to a browser's Javascript, it makes for smaller output and the
  6950. + * browser can handle the output just fine.
  6951. + */
  6952. + void dropNullPlaceholders();
  6953. +
  6954. + void omitEndingLineFeed();
  6955. +
  6956. +public: // overridden from Writer
  6957. + JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
  6958. +
  6959. +private:
  6960. + void writeValue(const Value& value);
  6961. +
  6962. + JSONCPP_STRING document_;
  6963. + bool yamlCompatiblityEnabled_;
  6964. + bool dropNullPlaceholders_;
  6965. + bool omitEndingLineFeed_;
  6966. +};
  6967. +
  6968. +/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
  6969. + *human friendly way.
  6970. + *
  6971. + * The rules for line break and indent are as follow:
  6972. + * - Object value:
  6973. + * - if empty then print {} without indent and line break
  6974. + * - if not empty the print '{', line break & indent, print one value per
  6975. + *line
  6976. + * and then unindent and line break and print '}'.
  6977. + * - Array value:
  6978. + * - if empty then print [] without indent and line break
  6979. + * - if the array contains no object value, empty array or some other value
  6980. + *types,
  6981. + * and all the values fit on one lines, then print the array on a single
  6982. + *line.
  6983. + * - otherwise, it the values do not fit on one line, or the array contains
  6984. + * object or non empty array, then print one value per line.
  6985. + *
  6986. + * If the Value have comments then they are outputed according to their
  6987. + *#CommentPlacement.
  6988. + *
  6989. + * \sa Reader, Value, Value::setComment()
  6990. + * \deprecated Use StreamWriterBuilder.
  6991. + */
  6992. +class JSON_API StyledWriter : public Writer {
  6993. +public:
  6994. + StyledWriter();
  6995. + ~StyledWriter() JSONCPP_OVERRIDE {}
  6996. +
  6997. +public: // overridden from Writer
  6998. + /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
  6999. + * \param root Value to serialize.
  7000. + * \return String containing the JSON document that represents the root value.
  7001. + */
  7002. + JSONCPP_STRING write(const Value& root) JSONCPP_OVERRIDE;
  7003. +
  7004. +private:
  7005. + void writeValue(const Value& value);
  7006. + void writeArrayValue(const Value& value);
  7007. + bool isMultineArray(const Value& value);
  7008. + void pushValue(const JSONCPP_STRING& value);
  7009. + void writeIndent();
  7010. + void writeWithIndent(const JSONCPP_STRING& value);
  7011. + void indent();
  7012. + void unindent();
  7013. + void writeCommentBeforeValue(const Value& root);
  7014. + void writeCommentAfterValueOnSameLine(const Value& root);
  7015. + bool hasCommentForValue(const Value& value);
  7016. + static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
  7017. +
  7018. + typedef std::vector<JSONCPP_STRING> ChildValues;
  7019. +
  7020. + ChildValues childValues_;
  7021. + JSONCPP_STRING document_;
  7022. + JSONCPP_STRING indentString_;
  7023. + unsigned int rightMargin_;
  7024. + unsigned int indentSize_;
  7025. + bool addChildValues_;
  7026. +};
  7027. +
  7028. +/** \brief Writes a Value in <a HREF="http://www.json.org">JSON</a> format in a
  7029. + human friendly way,
  7030. + to a stream rather than to a string.
  7031. + *
  7032. + * The rules for line break and indent are as follow:
  7033. + * - Object value:
  7034. + * - if empty then print {} without indent and line break
  7035. + * - if not empty the print '{', line break & indent, print one value per
  7036. + line
  7037. + * and then unindent and line break and print '}'.
  7038. + * - Array value:
  7039. + * - if empty then print [] without indent and line break
  7040. + * - if the array contains no object value, empty array or some other value
  7041. + types,
  7042. + * and all the values fit on one lines, then print the array on a single
  7043. + line.
  7044. + * - otherwise, it the values do not fit on one line, or the array contains
  7045. + * object or non empty array, then print one value per line.
  7046. + *
  7047. + * If the Value have comments then they are outputed according to their
  7048. + #CommentPlacement.
  7049. + *
  7050. + * \param indentation Each level will be indented by this amount extra.
  7051. + * \sa Reader, Value, Value::setComment()
  7052. + * \deprecated Use StreamWriterBuilder.
  7053. + */
  7054. +class JSON_API StyledStreamWriter {
  7055. +public:
  7056. + StyledStreamWriter(JSONCPP_STRING indentation = "\t");
  7057. + ~StyledStreamWriter() {}
  7058. +
  7059. +public:
  7060. + /** \brief Serialize a Value in <a HREF="http://www.json.org">JSON</a> format.
  7061. + * \param out Stream to write to. (Can be ostringstream, e.g.)
  7062. + * \param root Value to serialize.
  7063. + * \note There is no point in deriving from Writer, since write() should not
  7064. + * return a value.
  7065. + */
  7066. + void write(JSONCPP_OSTREAM& out, const Value& root);
  7067. +
  7068. +private:
  7069. + void writeValue(const Value& value);
  7070. + void writeArrayValue(const Value& value);
  7071. + bool isMultineArray(const Value& value);
  7072. + void pushValue(const JSONCPP_STRING& value);
  7073. + void writeIndent();
  7074. + void writeWithIndent(const JSONCPP_STRING& value);
  7075. + void indent();
  7076. + void unindent();
  7077. + void writeCommentBeforeValue(const Value& root);
  7078. + void writeCommentAfterValueOnSameLine(const Value& root);
  7079. + bool hasCommentForValue(const Value& value);
  7080. + static JSONCPP_STRING normalizeEOL(const JSONCPP_STRING& text);
  7081. +
  7082. + typedef std::vector<JSONCPP_STRING> ChildValues;
  7083. +
  7084. + ChildValues childValues_;
  7085. + JSONCPP_OSTREAM* document_;
  7086. + JSONCPP_STRING indentString_;
  7087. + unsigned int rightMargin_;
  7088. + JSONCPP_STRING indentation_;
  7089. + bool addChildValues_ : 1;
  7090. + bool indented_ : 1;
  7091. +};
  7092. +
  7093. +#if defined(JSON_HAS_INT64)
  7094. +JSONCPP_STRING JSON_API valueToString(Int value);
  7095. +JSONCPP_STRING JSON_API valueToString(UInt value);
  7096. +#endif // if defined(JSON_HAS_INT64)
  7097. +JSONCPP_STRING JSON_API valueToString(LargestInt value);
  7098. +JSONCPP_STRING JSON_API valueToString(LargestUInt value);
  7099. +JSONCPP_STRING JSON_API valueToString(double value);
  7100. +JSONCPP_STRING JSON_API valueToString(bool value);
  7101. +JSONCPP_STRING JSON_API valueToQuotedString(const char* value);
  7102. +
  7103. +/// \brief Output using the StyledStreamWriter.
  7104. +/// \see Json::operator>>()
  7105. +JSON_API JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM&, const Value& root);
  7106. +
  7107. +} // namespace Json
  7108. +
  7109. +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  7110. +#pragma warning(pop)
  7111. +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
  7112. +
  7113. +#endif // JSON_WRITER_H_INCLUDED
  7114. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/LICENSE polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/LICENSE
  7115. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/LICENSE 1970-01-01 02:00:00.000000000 +0200
  7116. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/LICENSE 2017-12-03 19:05:22.000000000 +0300
  7117. @@ -0,0 +1,55 @@
  7118. +The JsonCpp library's source code, including accompanying documentation,
  7119. +tests and demonstration applications, are licensed under the following
  7120. +conditions...
  7121. +
  7122. +The author (Baptiste Lepilleur) explicitly disclaims copyright in all
  7123. +jurisdictions which recognize such a disclaimer. In such jurisdictions,
  7124. +this software is released into the Public Domain.
  7125. +
  7126. +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
  7127. +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
  7128. +released under the terms of the MIT License (see below).
  7129. +
  7130. +In jurisdictions which recognize Public Domain property, the user of this
  7131. +software may choose to accept it either as 1) Public Domain, 2) under the
  7132. +conditions of the MIT License (see below), or 3) under the terms of dual
  7133. +Public Domain/MIT License conditions described here, as they choose.
  7134. +
  7135. +The MIT License is about as close to Public Domain as a license can get, and is
  7136. +described in clear, concise terms at:
  7137. +
  7138. + http://en.wikipedia.org/wiki/MIT_License
  7139. +
  7140. +The full text of the MIT License follows:
  7141. +
  7142. +========================================================================
  7143. +Copyright (c) 2007-2010 Baptiste Lepilleur
  7144. +
  7145. +Permission is hereby granted, free of charge, to any person
  7146. +obtaining a copy of this software and associated documentation
  7147. +files (the "Software"), to deal in the Software without
  7148. +restriction, including without limitation the rights to use, copy,
  7149. +modify, merge, publish, distribute, sublicense, and/or sell copies
  7150. +of the Software, and to permit persons to whom the Software is
  7151. +furnished to do so, subject to the following conditions:
  7152. +
  7153. +The above copyright notice and this permission notice shall be
  7154. +included in all copies or substantial portions of the Software.
  7155. +
  7156. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  7157. +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  7158. +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  7159. +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  7160. +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  7161. +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  7162. +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  7163. +SOFTWARE.
  7164. +========================================================================
  7165. +(END LICENSE TEXT)
  7166. +
  7167. +The MIT license is compatible with both the GPL and commercial
  7168. +software, affording one all of the rights of Public Domain with the
  7169. +minor nuisance of being required to keep the above copyright notice
  7170. +and license text in the source code. Note also that by accepting the
  7171. +Public Domain "license" you can re-license your copy using whatever
  7172. +license you like.
  7173. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/jsontest.vcproj polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/jsontest.vcproj
  7174. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/jsontest.vcproj 1970-01-01 02:00:00.000000000 +0200
  7175. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/jsontest.vcproj 2017-12-03 19:05:22.000000000 +0300
  7176. @@ -0,0 +1,119 @@
  7177. +<?xml version="1.0" encoding="Windows-1252"?>
  7178. +<VisualStudioProject
  7179. + ProjectType="Visual C++"
  7180. + Version="7.10"
  7181. + Name="jsontest"
  7182. + ProjectGUID="{25AF2DD2-D396-4668-B188-488C33B8E620}"
  7183. + Keyword="Win32Proj">
  7184. + <Platforms>
  7185. + <Platform
  7186. + Name="Win32"/>
  7187. + </Platforms>
  7188. + <Configurations>
  7189. + <Configuration
  7190. + Name="Debug|Win32"
  7191. + OutputDirectory="../../build/vs71/debug/jsontest"
  7192. + IntermediateDirectory="../../build/vs71/debug/jsontest"
  7193. + ConfigurationType="1"
  7194. + CharacterSet="2">
  7195. + <Tool
  7196. + Name="VCCLCompilerTool"
  7197. + Optimization="0"
  7198. + AdditionalIncludeDirectories="../../include"
  7199. + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
  7200. + MinimalRebuild="TRUE"
  7201. + BasicRuntimeChecks="3"
  7202. + RuntimeLibrary="1"
  7203. + UsePrecompiledHeader="0"
  7204. + WarningLevel="3"
  7205. + Detect64BitPortabilityProblems="TRUE"
  7206. + DebugInformationFormat="4"/>
  7207. + <Tool
  7208. + Name="VCCustomBuildTool"/>
  7209. + <Tool
  7210. + Name="VCLinkerTool"
  7211. + OutputFile="$(OutDir)/jsontest.exe"
  7212. + LinkIncremental="2"
  7213. + GenerateDebugInformation="TRUE"
  7214. + ProgramDatabaseFile="$(OutDir)/jsontest.pdb"
  7215. + SubSystem="1"
  7216. + TargetMachine="1"/>
  7217. + <Tool
  7218. + Name="VCMIDLTool"/>
  7219. + <Tool
  7220. + Name="VCPostBuildEventTool"/>
  7221. + <Tool
  7222. + Name="VCPreBuildEventTool"/>
  7223. + <Tool
  7224. + Name="VCPreLinkEventTool"/>
  7225. + <Tool
  7226. + Name="VCResourceCompilerTool"/>
  7227. + <Tool
  7228. + Name="VCWebServiceProxyGeneratorTool"/>
  7229. + <Tool
  7230. + Name="VCXMLDataGeneratorTool"/>
  7231. + <Tool
  7232. + Name="VCWebDeploymentTool"/>
  7233. + <Tool
  7234. + Name="VCManagedWrapperGeneratorTool"/>
  7235. + <Tool
  7236. + Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
  7237. + </Configuration>
  7238. + <Configuration
  7239. + Name="Release|Win32"
  7240. + OutputDirectory="../../build/vs71/release/jsontest"
  7241. + IntermediateDirectory="../../build/vs71/release/jsontest"
  7242. + ConfigurationType="1"
  7243. + CharacterSet="2">
  7244. + <Tool
  7245. + Name="VCCLCompilerTool"
  7246. + AdditionalIncludeDirectories="../../include"
  7247. + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
  7248. + RuntimeLibrary="0"
  7249. + UsePrecompiledHeader="0"
  7250. + WarningLevel="3"
  7251. + Detect64BitPortabilityProblems="TRUE"
  7252. + DebugInformationFormat="3"/>
  7253. + <Tool
  7254. + Name="VCCustomBuildTool"/>
  7255. + <Tool
  7256. + Name="VCLinkerTool"
  7257. + OutputFile="$(OutDir)/jsontest.exe"
  7258. + LinkIncremental="1"
  7259. + GenerateDebugInformation="TRUE"
  7260. + SubSystem="1"
  7261. + OptimizeReferences="2"
  7262. + EnableCOMDATFolding="2"
  7263. + TargetMachine="1"/>
  7264. + <Tool
  7265. + Name="VCMIDLTool"/>
  7266. + <Tool
  7267. + Name="VCPostBuildEventTool"/>
  7268. + <Tool
  7269. + Name="VCPreBuildEventTool"/>
  7270. + <Tool
  7271. + Name="VCPreLinkEventTool"/>
  7272. + <Tool
  7273. + Name="VCResourceCompilerTool"/>
  7274. + <Tool
  7275. + Name="VCWebServiceProxyGeneratorTool"/>
  7276. + <Tool
  7277. + Name="VCXMLDataGeneratorTool"/>
  7278. + <Tool
  7279. + Name="VCWebDeploymentTool"/>
  7280. + <Tool
  7281. + Name="VCManagedWrapperGeneratorTool"/>
  7282. + <Tool
  7283. + Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
  7284. + </Configuration>
  7285. + </Configurations>
  7286. + <References>
  7287. + </References>
  7288. + <Files>
  7289. + <File
  7290. + RelativePath="..\..\src\jsontestrunner\main.cpp">
  7291. + </File>
  7292. + </Files>
  7293. + <Globals>
  7294. + </Globals>
  7295. +</VisualStudioProject>
  7296. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/lib_json.vcproj polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/lib_json.vcproj
  7297. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/lib_json.vcproj 1970-01-01 02:00:00.000000000 +0200
  7298. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/lib_json.vcproj 2017-12-03 19:05:22.000000000 +0300
  7299. @@ -0,0 +1,205 @@
  7300. +<?xml version="1.0" encoding="Windows-1252"?>
  7301. +<VisualStudioProject
  7302. + ProjectType="Visual C++"
  7303. + Version="7.10"
  7304. + Name="lib_json"
  7305. + ProjectGUID="{B84F7231-16CE-41D8-8C08-7B523FF4225B}"
  7306. + Keyword="Win32Proj">
  7307. + <Platforms>
  7308. + <Platform
  7309. + Name="Win32"/>
  7310. + </Platforms>
  7311. + <Configurations>
  7312. + <Configuration
  7313. + Name="Debug|Win32"
  7314. + OutputDirectory="../../build/vs71/debug/lib_json"
  7315. + IntermediateDirectory="../../build/vs71/debug/lib_json"
  7316. + ConfigurationType="4"
  7317. + CharacterSet="2">
  7318. + <Tool
  7319. + Name="VCCLCompilerTool"
  7320. + Optimization="0"
  7321. + AdditionalIncludeDirectories="../../include"
  7322. + PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
  7323. + StringPooling="TRUE"
  7324. + MinimalRebuild="TRUE"
  7325. + BasicRuntimeChecks="3"
  7326. + RuntimeLibrary="1"
  7327. + EnableFunctionLevelLinking="TRUE"
  7328. + DisableLanguageExtensions="TRUE"
  7329. + ForceConformanceInForLoopScope="FALSE"
  7330. + RuntimeTypeInfo="TRUE"
  7331. + UsePrecompiledHeader="0"
  7332. + WarningLevel="3"
  7333. + Detect64BitPortabilityProblems="TRUE"
  7334. + DebugInformationFormat="4"/>
  7335. + <Tool
  7336. + Name="VCCustomBuildTool"/>
  7337. + <Tool
  7338. + Name="VCLibrarianTool"
  7339. + OutputFile="$(OutDir)/json_vc71_libmtd.lib"/>
  7340. + <Tool
  7341. + Name="VCMIDLTool"/>
  7342. + <Tool
  7343. + Name="VCPostBuildEventTool"/>
  7344. + <Tool
  7345. + Name="VCPreBuildEventTool"/>
  7346. + <Tool
  7347. + Name="VCPreLinkEventTool"/>
  7348. + <Tool
  7349. + Name="VCResourceCompilerTool"/>
  7350. + <Tool
  7351. + Name="VCWebServiceProxyGeneratorTool"/>
  7352. + <Tool
  7353. + Name="VCXMLDataGeneratorTool"/>
  7354. + <Tool
  7355. + Name="VCManagedWrapperGeneratorTool"/>
  7356. + <Tool
  7357. + Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
  7358. + </Configuration>
  7359. + <Configuration
  7360. + Name="Release|Win32"
  7361. + OutputDirectory="../../build/vs71/release/lib_json"
  7362. + IntermediateDirectory="../../build/vs71/release/lib_json"
  7363. + ConfigurationType="4"
  7364. + CharacterSet="2"
  7365. + WholeProgramOptimization="TRUE">
  7366. + <Tool
  7367. + Name="VCCLCompilerTool"
  7368. + GlobalOptimizations="TRUE"
  7369. + EnableIntrinsicFunctions="TRUE"
  7370. + AdditionalIncludeDirectories="../../include"
  7371. + PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
  7372. + StringPooling="TRUE"
  7373. + RuntimeLibrary="0"
  7374. + EnableFunctionLevelLinking="TRUE"
  7375. + DisableLanguageExtensions="TRUE"
  7376. + ForceConformanceInForLoopScope="FALSE"
  7377. + RuntimeTypeInfo="TRUE"
  7378. + UsePrecompiledHeader="0"
  7379. + AssemblerOutput="4"
  7380. + WarningLevel="3"
  7381. + Detect64BitPortabilityProblems="TRUE"
  7382. + DebugInformationFormat="3"/>
  7383. + <Tool
  7384. + Name="VCCustomBuildTool"/>
  7385. + <Tool
  7386. + Name="VCLibrarianTool"
  7387. + OutputFile="$(OutDir)/json_vc71_libmt.lib"/>
  7388. + <Tool
  7389. + Name="VCMIDLTool"/>
  7390. + <Tool
  7391. + Name="VCPostBuildEventTool"/>
  7392. + <Tool
  7393. + Name="VCPreBuildEventTool"/>
  7394. + <Tool
  7395. + Name="VCPreLinkEventTool"/>
  7396. + <Tool
  7397. + Name="VCResourceCompilerTool"/>
  7398. + <Tool
  7399. + Name="VCWebServiceProxyGeneratorTool"/>
  7400. + <Tool
  7401. + Name="VCXMLDataGeneratorTool"/>
  7402. + <Tool
  7403. + Name="VCManagedWrapperGeneratorTool"/>
  7404. + <Tool
  7405. + Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
  7406. + </Configuration>
  7407. + <Configuration
  7408. + Name="dummy|Win32"
  7409. + OutputDirectory="$(ConfigurationName)"
  7410. + IntermediateDirectory="$(ConfigurationName)"
  7411. + ConfigurationType="2"
  7412. + CharacterSet="2"
  7413. + WholeProgramOptimization="TRUE">
  7414. + <Tool
  7415. + Name="VCCLCompilerTool"
  7416. + GlobalOptimizations="TRUE"
  7417. + EnableIntrinsicFunctions="TRUE"
  7418. + AdditionalIncludeDirectories="../../include"
  7419. + PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
  7420. + StringPooling="TRUE"
  7421. + RuntimeLibrary="4"
  7422. + EnableFunctionLevelLinking="TRUE"
  7423. + DisableLanguageExtensions="TRUE"
  7424. + ForceConformanceInForLoopScope="FALSE"
  7425. + RuntimeTypeInfo="TRUE"
  7426. + UsePrecompiledHeader="0"
  7427. + AssemblerOutput="4"
  7428. + WarningLevel="3"
  7429. + Detect64BitPortabilityProblems="TRUE"
  7430. + DebugInformationFormat="3"/>
  7431. + <Tool
  7432. + Name="VCCustomBuildTool"/>
  7433. + <Tool
  7434. + Name="VCLinkerTool"
  7435. + GenerateDebugInformation="TRUE"
  7436. + SubSystem="2"
  7437. + OptimizeReferences="2"
  7438. + EnableCOMDATFolding="2"
  7439. + TargetMachine="1"/>
  7440. + <Tool
  7441. + Name="VCMIDLTool"/>
  7442. + <Tool
  7443. + Name="VCPostBuildEventTool"/>
  7444. + <Tool
  7445. + Name="VCPreBuildEventTool"/>
  7446. + <Tool
  7447. + Name="VCPreLinkEventTool"/>
  7448. + <Tool
  7449. + Name="VCResourceCompilerTool"/>
  7450. + <Tool
  7451. + Name="VCWebServiceProxyGeneratorTool"/>
  7452. + <Tool
  7453. + Name="VCXMLDataGeneratorTool"/>
  7454. + <Tool
  7455. + Name="VCWebDeploymentTool"/>
  7456. + <Tool
  7457. + Name="VCManagedWrapperGeneratorTool"/>
  7458. + <Tool
  7459. + Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
  7460. + </Configuration>
  7461. + </Configurations>
  7462. + <References>
  7463. + </References>
  7464. + <Files>
  7465. + <File
  7466. + RelativePath="..\..\include\json\autolink.h">
  7467. + </File>
  7468. + <File
  7469. + RelativePath="..\..\include\json\config.h">
  7470. + </File>
  7471. + <File
  7472. + RelativePath="..\..\include\json\features.h">
  7473. + </File>
  7474. + <File
  7475. + RelativePath="..\..\include\json\forwards.h">
  7476. + </File>
  7477. + <File
  7478. + RelativePath="..\..\include\json\json.h">
  7479. + </File>
  7480. + <File
  7481. + RelativePath="..\..\src\lib_json\json_reader.cpp">
  7482. + </File>
  7483. + <File
  7484. + RelativePath="..\..\src\lib_json\json_value.cpp">
  7485. + </File>
  7486. + <File
  7487. + RelativePath="..\..\src\lib_json\json_valueiterator.inl">
  7488. + </File>
  7489. + <File
  7490. + RelativePath="..\..\src\lib_json\json_writer.cpp">
  7491. + </File>
  7492. + <File
  7493. + RelativePath="..\..\include\json\reader.h">
  7494. + </File>
  7495. + <File
  7496. + RelativePath="..\..\include\json\value.h">
  7497. + </File>
  7498. + <File
  7499. + RelativePath="..\..\include\json\writer.h">
  7500. + </File>
  7501. + </Files>
  7502. + <Globals>
  7503. + </Globals>
  7504. +</VisualStudioProject>
  7505. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/test_lib_json.vcproj polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/test_lib_json.vcproj
  7506. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/test_lib_json.vcproj 1970-01-01 02:00:00.000000000 +0200
  7507. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makefiles/vs71/test_lib_json.vcproj 2017-12-03 19:05:22.000000000 +0300
  7508. @@ -0,0 +1,130 @@
  7509. +<?xml version="1.0" encoding="Windows-1252"?>
  7510. +<VisualStudioProject
  7511. + ProjectType="Visual C++"
  7512. + Version="7.10"
  7513. + Name="test_lib_json"
  7514. + ProjectGUID="{B7A96B78-2782-40D2-8F37-A2DEF2B9C26D}"
  7515. + RootNamespace="test_lib_json"
  7516. + Keyword="Win32Proj">
  7517. + <Platforms>
  7518. + <Platform
  7519. + Name="Win32"/>
  7520. + </Platforms>
  7521. + <Configurations>
  7522. + <Configuration
  7523. + Name="Debug|Win32"
  7524. + OutputDirectory="../../build/vs71/debug/test_lib_json"
  7525. + IntermediateDirectory="../../build/vs71/debug/test_lib_json"
  7526. + ConfigurationType="1"
  7527. + CharacterSet="2">
  7528. + <Tool
  7529. + Name="VCCLCompilerTool"
  7530. + Optimization="0"
  7531. + AdditionalIncludeDirectories="../../include"
  7532. + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
  7533. + MinimalRebuild="TRUE"
  7534. + BasicRuntimeChecks="3"
  7535. + RuntimeLibrary="1"
  7536. + UsePrecompiledHeader="0"
  7537. + WarningLevel="3"
  7538. + Detect64BitPortabilityProblems="TRUE"
  7539. + DebugInformationFormat="4"/>
  7540. + <Tool
  7541. + Name="VCCustomBuildTool"/>
  7542. + <Tool
  7543. + Name="VCLinkerTool"
  7544. + OutputFile="$(OutDir)/test_lib_json.exe"
  7545. + LinkIncremental="2"
  7546. + GenerateDebugInformation="TRUE"
  7547. + ProgramDatabaseFile="$(OutDir)/test_lib_json.pdb"
  7548. + SubSystem="1"
  7549. + TargetMachine="1"/>
  7550. + <Tool
  7551. + Name="VCMIDLTool"/>
  7552. + <Tool
  7553. + Name="VCPostBuildEventTool"
  7554. + Description="Running all unit tests"
  7555. + CommandLine="$(TargetPath)"/>
  7556. + <Tool
  7557. + Name="VCPreBuildEventTool"/>
  7558. + <Tool
  7559. + Name="VCPreLinkEventTool"/>
  7560. + <Tool
  7561. + Name="VCResourceCompilerTool"/>
  7562. + <Tool
  7563. + Name="VCWebServiceProxyGeneratorTool"/>
  7564. + <Tool
  7565. + Name="VCXMLDataGeneratorTool"/>
  7566. + <Tool
  7567. + Name="VCWebDeploymentTool"/>
  7568. + <Tool
  7569. + Name="VCManagedWrapperGeneratorTool"/>
  7570. + <Tool
  7571. + Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
  7572. + </Configuration>
  7573. + <Configuration
  7574. + Name="Release|Win32"
  7575. + OutputDirectory="../../build/vs71/release/test_lib_json"
  7576. + IntermediateDirectory="../../build/vs71/release/test_lib_json"
  7577. + ConfigurationType="1"
  7578. + CharacterSet="2">
  7579. + <Tool
  7580. + Name="VCCLCompilerTool"
  7581. + AdditionalIncludeDirectories="../../include"
  7582. + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
  7583. + RuntimeLibrary="0"
  7584. + UsePrecompiledHeader="0"
  7585. + WarningLevel="3"
  7586. + Detect64BitPortabilityProblems="TRUE"
  7587. + DebugInformationFormat="3"/>
  7588. + <Tool
  7589. + Name="VCCustomBuildTool"/>
  7590. + <Tool
  7591. + Name="VCLinkerTool"
  7592. + OutputFile="$(OutDir)/test_lib_json.exe"
  7593. + LinkIncremental="1"
  7594. + GenerateDebugInformation="TRUE"
  7595. + SubSystem="1"
  7596. + OptimizeReferences="2"
  7597. + EnableCOMDATFolding="2"
  7598. + TargetMachine="1"/>
  7599. + <Tool
  7600. + Name="VCMIDLTool"/>
  7601. + <Tool
  7602. + Name="VCPostBuildEventTool"
  7603. + Description="Running all unit tests"
  7604. + CommandLine="$(TargetPath)"/>
  7605. + <Tool
  7606. + Name="VCPreBuildEventTool"/>
  7607. + <Tool
  7608. + Name="VCPreLinkEventTool"/>
  7609. + <Tool
  7610. + Name="VCResourceCompilerTool"/>
  7611. + <Tool
  7612. + Name="VCWebServiceProxyGeneratorTool"/>
  7613. + <Tool
  7614. + Name="VCXMLDataGeneratorTool"/>
  7615. + <Tool
  7616. + Name="VCWebDeploymentTool"/>
  7617. + <Tool
  7618. + Name="VCManagedWrapperGeneratorTool"/>
  7619. + <Tool
  7620. + Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
  7621. + </Configuration>
  7622. + </Configurations>
  7623. + <References>
  7624. + </References>
  7625. + <Files>
  7626. + <File
  7627. + RelativePath="..\..\src\test_lib_json\jsontest.cpp">
  7628. + </File>
  7629. + <File
  7630. + RelativePath="..\..\src\test_lib_json\jsontest.h">
  7631. + </File>
  7632. + <File
  7633. + RelativePath="..\..\src\test_lib_json\main.cpp">
  7634. + </File>
  7635. + </Files>
  7636. + <Globals>
  7637. + </Globals>
  7638. +</VisualStudioProject>
  7639. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makerelease.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makerelease.py
  7640. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/makerelease.py 1970-01-01 02:00:00.000000000 +0200
  7641. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/makerelease.py 2017-12-03 19:05:22.000000000 +0300
  7642. @@ -0,0 +1,390 @@
  7643. +# Copyright 2010 Baptiste Lepilleur
  7644. +# Distributed under MIT license, or public domain if desired and
  7645. +# recognized in your jurisdiction.
  7646. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  7647. +
  7648. +"""Tag the sandbox for release, make source and doc tarballs.
  7649. +
  7650. +Requires Python 2.6
  7651. +
  7652. +Example of invocation (use to test the script):
  7653. +python makerelease.py --platform=msvc6,msvc71,msvc80,msvc90,mingw -ublep 0.6.0 0.7.0-dev
  7654. +
  7655. +When testing this script:
  7656. +python makerelease.py --force --retag --platform=msvc6,msvc71,msvc80,mingw -ublep test-0.6.0 test-0.6.1-dev
  7657. +
  7658. +Example of invocation when doing a release:
  7659. +python makerelease.py 0.5.0 0.6.0-dev
  7660. +
  7661. +Note: This was for Subversion. Now that we are in GitHub, we do not
  7662. +need to build versioned tarballs anymore, so makerelease.py is defunct.
  7663. +"""
  7664. +
  7665. +from __future__ import print_function
  7666. +import os.path
  7667. +import subprocess
  7668. +import sys
  7669. +import doxybuild
  7670. +import subprocess
  7671. +import xml.etree.ElementTree as ElementTree
  7672. +import shutil
  7673. +import urllib2
  7674. +import tempfile
  7675. +import os
  7676. +import time
  7677. +from devtools import antglob, fixeol, tarball
  7678. +import amalgamate
  7679. +
  7680. +SVN_ROOT = 'https://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/'
  7681. +SVN_TAG_ROOT = SVN_ROOT + 'tags/jsoncpp'
  7682. +SCONS_LOCAL_URL = 'http://sourceforge.net/projects/scons/files/scons-local/1.2.0/scons-local-1.2.0.tar.gz/download'
  7683. +SOURCEFORGE_PROJECT = 'jsoncpp'
  7684. +
  7685. +def set_version(version):
  7686. + with open('version','wb') as f:
  7687. + f.write(version.strip())
  7688. +
  7689. +def rmdir_if_exist(dir_path):
  7690. + if os.path.isdir(dir_path):
  7691. + shutil.rmtree(dir_path)
  7692. +
  7693. +class SVNError(Exception):
  7694. + pass
  7695. +
  7696. +def svn_command(command, *args):
  7697. + cmd = ['svn', '--non-interactive', command] + list(args)
  7698. + print('Running:', ' '.join(cmd))
  7699. + process = subprocess.Popen(cmd,
  7700. + stdout=subprocess.PIPE,
  7701. + stderr=subprocess.STDOUT)
  7702. + stdout = process.communicate()[0]
  7703. + if process.returncode:
  7704. + error = SVNError('SVN command failed:\n' + stdout)
  7705. + error.returncode = process.returncode
  7706. + raise error
  7707. + return stdout
  7708. +
  7709. +def check_no_pending_commit():
  7710. + """Checks that there is no pending commit in the sandbox."""
  7711. + stdout = svn_command('status', '--xml')
  7712. + etree = ElementTree.fromstring(stdout)
  7713. + msg = []
  7714. + for entry in etree.getiterator('entry'):
  7715. + path = entry.get('path')
  7716. + status = entry.find('wc-status').get('item')
  7717. + if status != 'unversioned' and path != 'version':
  7718. + msg.append('File "%s" has pending change (status="%s")' % (path, status))
  7719. + if msg:
  7720. + msg.insert(0, 'Pending change to commit found in sandbox. Commit them first!')
  7721. + return '\n'.join(msg)
  7722. +
  7723. +def svn_join_url(base_url, suffix):
  7724. + if not base_url.endswith('/'):
  7725. + base_url += '/'
  7726. + if suffix.startswith('/'):
  7727. + suffix = suffix[1:]
  7728. + return base_url + suffix
  7729. +
  7730. +def svn_check_if_tag_exist(tag_url):
  7731. + """Checks if a tag exist.
  7732. + Returns: True if the tag exist, False otherwise.
  7733. + """
  7734. + try:
  7735. + list_stdout = svn_command('list', tag_url)
  7736. + except SVNError as e:
  7737. + if e.returncode != 1 or not str(e).find('tag_url'):
  7738. + raise e
  7739. + # otherwise ignore error, meaning tag does not exist
  7740. + return False
  7741. + return True
  7742. +
  7743. +def svn_commit(message):
  7744. + """Commit the sandbox, providing the specified comment.
  7745. + """
  7746. + svn_command('ci', '-m', message)
  7747. +
  7748. +def svn_tag_sandbox(tag_url, message):
  7749. + """Makes a tag based on the sandbox revisions.
  7750. + """
  7751. + svn_command('copy', '-m', message, '.', tag_url)
  7752. +
  7753. +def svn_remove_tag(tag_url, message):
  7754. + """Removes an existing tag.
  7755. + """
  7756. + svn_command('delete', '-m', message, tag_url)
  7757. +
  7758. +def svn_export(tag_url, export_dir):
  7759. + """Exports the tag_url revision to export_dir.
  7760. + Target directory, including its parent is created if it does not exist.
  7761. + If the directory export_dir exist, it is deleted before export proceed.
  7762. + """
  7763. + rmdir_if_exist(export_dir)
  7764. + svn_command('export', tag_url, export_dir)
  7765. +
  7766. +def fix_sources_eol(dist_dir):
  7767. + """Set file EOL for tarball distribution.
  7768. + """
  7769. + print('Preparing exported source file EOL for distribution...')
  7770. + prune_dirs = antglob.prune_dirs + 'scons-local* ./build* ./libs ./dist'
  7771. + win_sources = antglob.glob(dist_dir,
  7772. + includes = '**/*.sln **/*.vcproj',
  7773. + prune_dirs = prune_dirs)
  7774. + unix_sources = antglob.glob(dist_dir,
  7775. + includes = '''**/*.h **/*.cpp **/*.inl **/*.txt **/*.dox **/*.py **/*.html **/*.in
  7776. + sconscript *.json *.expected AUTHORS LICENSE''',
  7777. + excludes = antglob.default_excludes + 'scons.py sconsign.py scons-*',
  7778. + prune_dirs = prune_dirs)
  7779. + for path in win_sources:
  7780. + fixeol.fix_source_eol(path, is_dry_run = False, verbose = True, eol = '\r\n')
  7781. + for path in unix_sources:
  7782. + fixeol.fix_source_eol(path, is_dry_run = False, verbose = True, eol = '\n')
  7783. +
  7784. +def download(url, target_path):
  7785. + """Download file represented by url to target_path.
  7786. + """
  7787. + f = urllib2.urlopen(url)
  7788. + try:
  7789. + data = f.read()
  7790. + finally:
  7791. + f.close()
  7792. + fout = open(target_path, 'wb')
  7793. + try:
  7794. + fout.write(data)
  7795. + finally:
  7796. + fout.close()
  7797. +
  7798. +def check_compile(distcheck_top_dir, platform):
  7799. + cmd = [sys.executable, 'scons.py', 'platform=%s' % platform, 'check']
  7800. + print('Running:', ' '.join(cmd))
  7801. + log_path = os.path.join(distcheck_top_dir, 'build-%s.log' % platform)
  7802. + flog = open(log_path, 'wb')
  7803. + try:
  7804. + process = subprocess.Popen(cmd,
  7805. + stdout=flog,
  7806. + stderr=subprocess.STDOUT,
  7807. + cwd=distcheck_top_dir)
  7808. + stdout = process.communicate()[0]
  7809. + status = (process.returncode == 0)
  7810. + finally:
  7811. + flog.close()
  7812. + return (status, log_path)
  7813. +
  7814. +def write_tempfile(content, **kwargs):
  7815. + fd, path = tempfile.mkstemp(**kwargs)
  7816. + f = os.fdopen(fd, 'wt')
  7817. + try:
  7818. + f.write(content)
  7819. + finally:
  7820. + f.close()
  7821. + return path
  7822. +
  7823. +class SFTPError(Exception):
  7824. + pass
  7825. +
  7826. +def run_sftp_batch(userhost, sftp, batch, retry=0):
  7827. + path = write_tempfile(batch, suffix='.sftp', text=True)
  7828. + # psftp -agent -C blep,jsoncpp@web.sourceforge.net -batch -b batch.sftp -bc
  7829. + cmd = [sftp, '-agent', '-C', '-batch', '-b', path, '-bc', userhost]
  7830. + error = None
  7831. + for retry_index in range(0, max(1,retry)):
  7832. + heading = retry_index == 0 and 'Running:' or 'Retrying:'
  7833. + print(heading, ' '.join(cmd))
  7834. + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  7835. + stdout = process.communicate()[0]
  7836. + if process.returncode != 0:
  7837. + error = SFTPError('SFTP batch failed:\n' + stdout)
  7838. + else:
  7839. + break
  7840. + if error:
  7841. + raise error
  7842. + return stdout
  7843. +
  7844. +def sourceforge_web_synchro(sourceforge_project, doc_dir,
  7845. + user=None, sftp='sftp'):
  7846. + """Notes: does not synchronize sub-directory of doc-dir.
  7847. + """
  7848. + userhost = '%s,%s@web.sourceforge.net' % (user, sourceforge_project)
  7849. + stdout = run_sftp_batch(userhost, sftp, """
  7850. +cd htdocs
  7851. +dir
  7852. +exit
  7853. +""")
  7854. + existing_paths = set()
  7855. + collect = 0
  7856. + for line in stdout.split('\n'):
  7857. + line = line.strip()
  7858. + if not collect and line.endswith('> dir'):
  7859. + collect = True
  7860. + elif collect and line.endswith('> exit'):
  7861. + break
  7862. + elif collect == 1:
  7863. + collect = 2
  7864. + elif collect == 2:
  7865. + path = line.strip().split()[-1:]
  7866. + if path and path[0] not in ('.', '..'):
  7867. + existing_paths.add(path[0])
  7868. + upload_paths = set([os.path.basename(p) for p in antglob.glob(doc_dir)])
  7869. + paths_to_remove = existing_paths - upload_paths
  7870. + if paths_to_remove:
  7871. + print('Removing the following file from web:')
  7872. + print('\n'.join(paths_to_remove))
  7873. + stdout = run_sftp_batch(userhost, sftp, """cd htdocs
  7874. +rm %s
  7875. +exit""" % ' '.join(paths_to_remove))
  7876. + print('Uploading %d files:' % len(upload_paths))
  7877. + batch_size = 10
  7878. + upload_paths = list(upload_paths)
  7879. + start_time = time.time()
  7880. + for index in range(0,len(upload_paths),batch_size):
  7881. + paths = upload_paths[index:index+batch_size]
  7882. + file_per_sec = (time.time() - start_time) / (index+1)
  7883. + remaining_files = len(upload_paths) - index
  7884. + remaining_sec = file_per_sec * remaining_files
  7885. + print('%d/%d, ETA=%.1fs' % (index+1, len(upload_paths), remaining_sec))
  7886. + run_sftp_batch(userhost, sftp, """cd htdocs
  7887. +lcd %s
  7888. +mput %s
  7889. +exit""" % (doc_dir, ' '.join(paths)), retry=3)
  7890. +
  7891. +def sourceforge_release_tarball(sourceforge_project, paths, user=None, sftp='sftp'):
  7892. + userhost = '%s,%s@frs.sourceforge.net' % (user, sourceforge_project)
  7893. + run_sftp_batch(userhost, sftp, """
  7894. +mput %s
  7895. +exit
  7896. +""" % (' '.join(paths),))
  7897. +
  7898. +
  7899. +def main():
  7900. + usage = """%prog release_version next_dev_version
  7901. +Update 'version' file to release_version and commit.
  7902. +Generates the document tarball.
  7903. +Tags the sandbox revision with release_version.
  7904. +Update 'version' file to next_dev_version and commit.
  7905. +
  7906. +Performs an svn export of tag release version, and build a source tarball.
  7907. +
  7908. +Must be started in the project top directory.
  7909. +
  7910. +Warning: --force should only be used when developping/testing the release script.
  7911. +"""
  7912. + from optparse import OptionParser
  7913. + parser = OptionParser(usage=usage)
  7914. + parser.allow_interspersed_args = False
  7915. + parser.add_option('--dot', dest="dot_path", action='store', default=doxybuild.find_program('dot'),
  7916. + help="""Path to GraphViz dot tool. Must be full qualified path. [Default: %default]""")
  7917. + parser.add_option('--doxygen', dest="doxygen_path", action='store', default=doxybuild.find_program('doxygen'),
  7918. + help="""Path to Doxygen tool. [Default: %default]""")
  7919. + parser.add_option('--force', dest="ignore_pending_commit", action='store_true', default=False,
  7920. + help="""Ignore pending commit. [Default: %default]""")
  7921. + parser.add_option('--retag', dest="retag_release", action='store_true', default=False,
  7922. + help="""Overwrite release existing tag if it exist. [Default: %default]""")
  7923. + parser.add_option('-p', '--platforms', dest="platforms", action='store', default='',
  7924. + help="""Comma separated list of platform passed to scons for build check.""")
  7925. + parser.add_option('--no-test', dest="no_test", action='store_true', default=False,
  7926. + help="""Skips build check.""")
  7927. + parser.add_option('--no-web', dest="no_web", action='store_true', default=False,
  7928. + help="""Do not update web site.""")
  7929. + parser.add_option('-u', '--upload-user', dest="user", action='store',
  7930. + help="""Sourceforge user for SFTP documentation upload.""")
  7931. + parser.add_option('--sftp', dest='sftp', action='store', default=doxybuild.find_program('psftp', 'sftp'),
  7932. + help="""Path of the SFTP compatible binary used to upload the documentation.""")
  7933. + parser.enable_interspersed_args()
  7934. + options, args = parser.parse_args()
  7935. +
  7936. + if len(args) != 2:
  7937. + parser.error('release_version missing on command-line.')
  7938. + release_version = args[0]
  7939. + next_version = args[1]
  7940. +
  7941. + if not options.platforms and not options.no_test:
  7942. + parser.error('You must specify either --platform or --no-test option.')
  7943. +
  7944. + if options.ignore_pending_commit:
  7945. + msg = ''
  7946. + else:
  7947. + msg = check_no_pending_commit()
  7948. + if not msg:
  7949. + print('Setting version to', release_version)
  7950. + set_version(release_version)
  7951. + svn_commit('Release ' + release_version)
  7952. + tag_url = svn_join_url(SVN_TAG_ROOT, release_version)
  7953. + if svn_check_if_tag_exist(tag_url):
  7954. + if options.retag_release:
  7955. + svn_remove_tag(tag_url, 'Overwriting previous tag')
  7956. + else:
  7957. + print('Aborting, tag %s already exist. Use --retag to overwrite it!' % tag_url)
  7958. + sys.exit(1)
  7959. + svn_tag_sandbox(tag_url, 'Release ' + release_version)
  7960. +
  7961. + print('Generated doxygen document...')
  7962. +## doc_dirname = r'jsoncpp-api-html-0.5.0'
  7963. +## doc_tarball_path = r'e:\prg\vc\Lib\jsoncpp-trunk\dist\jsoncpp-api-html-0.5.0.tar.gz'
  7964. + doc_tarball_path, doc_dirname = doxybuild.build_doc(options, make_release=True)
  7965. + doc_distcheck_dir = 'dist/doccheck'
  7966. + tarball.decompress(doc_tarball_path, doc_distcheck_dir)
  7967. + doc_distcheck_top_dir = os.path.join(doc_distcheck_dir, doc_dirname)
  7968. +
  7969. + export_dir = 'dist/export'
  7970. + svn_export(tag_url, export_dir)
  7971. + fix_sources_eol(export_dir)
  7972. +
  7973. + source_dir = 'jsoncpp-src-' + release_version
  7974. + source_tarball_path = 'dist/%s.tar.gz' % source_dir
  7975. + print('Generating source tarball to', source_tarball_path)
  7976. + tarball.make_tarball(source_tarball_path, [export_dir], export_dir, prefix_dir=source_dir)
  7977. +
  7978. + amalgamation_tarball_path = 'dist/%s-amalgamation.tar.gz' % source_dir
  7979. + print('Generating amalgamation source tarball to', amalgamation_tarball_path)
  7980. + amalgamation_dir = 'dist/amalgamation'
  7981. + amalgamate.amalgamate_source(export_dir, '%s/jsoncpp.cpp' % amalgamation_dir, 'json/json.h')
  7982. + amalgamation_source_dir = 'jsoncpp-src-amalgamation' + release_version
  7983. + tarball.make_tarball(amalgamation_tarball_path, [amalgamation_dir],
  7984. + amalgamation_dir, prefix_dir=amalgamation_source_dir)
  7985. +
  7986. + # Decompress source tarball, download and install scons-local
  7987. + distcheck_dir = 'dist/distcheck'
  7988. + distcheck_top_dir = distcheck_dir + '/' + source_dir
  7989. + print('Decompressing source tarball to', distcheck_dir)
  7990. + rmdir_if_exist(distcheck_dir)
  7991. + tarball.decompress(source_tarball_path, distcheck_dir)
  7992. + scons_local_path = 'dist/scons-local.tar.gz'
  7993. + print('Downloading scons-local to', scons_local_path)
  7994. + download(SCONS_LOCAL_URL, scons_local_path)
  7995. + print('Decompressing scons-local to', distcheck_top_dir)
  7996. + tarball.decompress(scons_local_path, distcheck_top_dir)
  7997. +
  7998. + # Run compilation
  7999. + print('Compiling decompressed tarball')
  8000. + all_build_status = True
  8001. + for platform in options.platforms.split(','):
  8002. + print('Testing platform:', platform)
  8003. + build_status, log_path = check_compile(distcheck_top_dir, platform)
  8004. + print('see build log:', log_path)
  8005. + print(build_status and '=> ok' or '=> FAILED')
  8006. + all_build_status = all_build_status and build_status
  8007. + if not build_status:
  8008. + print('Testing failed on at least one platform, aborting...')
  8009. + svn_remove_tag(tag_url, 'Removing tag due to failed testing')
  8010. + sys.exit(1)
  8011. + if options.user:
  8012. + if not options.no_web:
  8013. + print('Uploading documentation using user', options.user)
  8014. + sourceforge_web_synchro(SOURCEFORGE_PROJECT, doc_distcheck_top_dir, user=options.user, sftp=options.sftp)
  8015. + print('Completed documentation upload')
  8016. + print('Uploading source and documentation tarballs for release using user', options.user)
  8017. + sourceforge_release_tarball(SOURCEFORGE_PROJECT,
  8018. + [source_tarball_path, doc_tarball_path],
  8019. + user=options.user, sftp=options.sftp)
  8020. + print('Source and doc release tarballs uploaded')
  8021. + else:
  8022. + print('No upload user specified. Web site and download tarbal were not uploaded.')
  8023. + print('Tarball can be found at:', doc_tarball_path)
  8024. +
  8025. + # Set next version number and commit
  8026. + set_version(next_version)
  8027. + svn_commit('Released ' + release_version)
  8028. + else:
  8029. + sys.stderr.write(msg + '\n')
  8030. +
  8031. +if __name__ == '__main__':
  8032. + main()
  8033. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/NEWS.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/NEWS.txt
  8034. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/NEWS.txt 1970-01-01 02:00:00.000000000 +0200
  8035. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/NEWS.txt 2017-12-03 19:05:22.000000000 +0300
  8036. @@ -0,0 +1,175 @@
  8037. +New in SVN
  8038. +----------
  8039. +
  8040. + * Updated the type system's behavior, in order to better support backwards
  8041. + compatibility with code that was written before 64-bit integer support was
  8042. + introduced. Here's how it works now:
  8043. +
  8044. + * isInt, isInt64, isUInt, and isUInt64 return true if and only if the
  8045. + value can be exactly represented as that type. In particular, a value
  8046. + constructed with a double like 17.0 will now return true for all of
  8047. + these methods.
  8048. +
  8049. + * isDouble and isFloat now return true for all numeric values, since all
  8050. + numeric values can be converted to a double or float without
  8051. + truncation. Note however that the conversion may not be exact -- for
  8052. + example, doubles cannot exactly represent all integers above 2^53 + 1.
  8053. +
  8054. + * isBool, isNull, isString, isArray, and isObject now return true if and
  8055. + only if the value is of that type.
  8056. +
  8057. + * isConvertibleTo(fooValue) indicates that it is safe to call asFoo.
  8058. + (For each type foo, isFoo always implies isConvertibleTo(fooValue).)
  8059. + asFoo returns an approximate or exact representation as appropriate.
  8060. + For example, a double value may be truncated when asInt is called.
  8061. +
  8062. + * For backwards compatibility with old code, isConvertibleTo(intValue)
  8063. + may return false even if type() == intValue. This is because the value
  8064. + may have been constructed with a 64-bit integer larger than maxInt,
  8065. + and calling asInt() would cause an exception. If you're writing new
  8066. + code, use isInt64 to find out whether the value is exactly
  8067. + representable using an Int64, or asDouble() combined with minInt64 and
  8068. + maxInt64 to figure out whether it is approximately representable.
  8069. +
  8070. +* Value
  8071. + - Patch #10: BOOST_FOREACH compatibility. Made Json::iterator more
  8072. + standard compliant, added missing iterator_category and value_type
  8073. + typedefs (contribued by Robert A. Iannucci).
  8074. +
  8075. +* Compilation
  8076. +
  8077. + - New CMake based build system. Based in part on contribution from
  8078. + Igor Okulist and Damien Buhl (Patch #14).
  8079. +
  8080. + - New header json/version.h now contains version number macros
  8081. + (JSONCPP_VERSION_MAJOR, JSONCPP_VERSION_MINOR, JSONCPP_VERSION_PATCH
  8082. + and JSONCPP_VERSION_HEXA).
  8083. +
  8084. + - Patch #11: added missing JSON_API on some classes causing link issues
  8085. + when building as a dynamic library on Windows
  8086. + (contributed by Francis Bolduc).
  8087. +
  8088. + - Visual Studio DLL: suppressed warning "C4251: <data member>: <type>
  8089. + needs to have dll-interface to be used by..." via pragma push/pop
  8090. + in json-cpp headers.
  8091. +
  8092. + - Added Travis CI intregration: https://travis-ci.org/blep/jsoncpp-mirror
  8093. +
  8094. +* Bug fixes
  8095. + - Patch #15: Copy constructor does not initialize allocated_ for stringValue
  8096. + (contributed by rmongia).
  8097. +
  8098. + - Patch #16: Missing field copy in Json::Value::iterator causing infinite
  8099. + loop when using experimental internal map (#define JSON_VALUE_USE_INTERNAL_MAP)
  8100. + (contributed by Ming-Lin Kao).
  8101. +
  8102. +
  8103. + New in JsonCpp 0.6.0:
  8104. + ---------------------
  8105. +
  8106. +* Compilation
  8107. +
  8108. + - LD_LIBRARY_PATH and LIBRARY_PATH environment variables are now
  8109. + propagated to the build environment as this is required for some
  8110. + compiler installation.
  8111. +
  8112. + - Added support for Microsoft Visual Studio 2008 (bug #2930462):
  8113. + The platform "msvc90" has been added.
  8114. +
  8115. + Notes: you need to setup the environment by running vcvars32.bat
  8116. + (e.g. MSVC 2008 command prompt in start menu) before running scons.
  8117. +
  8118. + - Added support for amalgamated source and header generation (a la sqlite).
  8119. + Refer to README.md section "Generating amalgamated source and header"
  8120. + for detail.
  8121. +
  8122. +* Value
  8123. +
  8124. + - Removed experimental ValueAllocator, it caused static
  8125. + initialization/destruction order issues (bug #2934500).
  8126. + The DefaultValueAllocator has been inlined in code.
  8127. +
  8128. + - Added support for 64 bits integer:
  8129. +
  8130. + Types Json::Int64 and Json::UInt64 have been added. They are aliased
  8131. + to 64 bits integers on system that support them (based on __int64 on
  8132. + Microsoft Visual Studio platform, and long long on other platforms).
  8133. +
  8134. + Types Json::LargestInt and Json::LargestUInt have been added. They are
  8135. + aliased to the largest integer type supported:
  8136. + either Json::Int/Json::UInt or Json::Int64/Json::UInt64 respectively.
  8137. +
  8138. + Json::Value::asInt() and Json::Value::asUInt() still returns plain
  8139. + "int" based types, but asserts if an attempt is made to retrieve
  8140. + a 64 bits value that can not represented as the return type.
  8141. +
  8142. + Json::Value::asInt64() and Json::Value::asUInt64() have been added
  8143. + to obtain the 64 bits integer value.
  8144. +
  8145. + Json::Value::asLargestInt() and Json::Value::asLargestUInt() returns
  8146. + the integer as a LargestInt/LargestUInt respectively. Those functions
  8147. + functions are typically used when implementing writer.
  8148. +
  8149. + The reader attempts to read number as 64 bits integer, and fall back
  8150. + to reading a double if the number is not in the range of 64 bits
  8151. + integer.
  8152. +
  8153. + Warning: Json::Value::asInt() and Json::Value::asUInt() now returns
  8154. + long long. This changes break code that was passing the return value
  8155. + to *printf() function.
  8156. +
  8157. + Support for 64 bits integer can be disabled by defining the macro
  8158. + JSON_NO_INT64 (uncomment it in json/config.h for example), though
  8159. + it should have no impact on existing usage.
  8160. +
  8161. + - The type Json::ArrayIndex is used for indexes of a JSON value array. It
  8162. + is an unsigned int (typically 32 bits).
  8163. +
  8164. + - Array index can be passed as int to operator[], allowing use of literal:
  8165. + Json::Value array;
  8166. + array.append( 1234 );
  8167. + int value = array[0].asInt(); // did not compile previously
  8168. +
  8169. + - Added float Json::Value::asFloat() to obtain a floating point value as a
  8170. + float (avoid lost of precision warning caused by used of asDouble()
  8171. + to initialize a float).
  8172. +
  8173. +* Reader
  8174. +
  8175. + - Renamed Reader::getFormatedErrorMessages() to getFormattedErrorMessages.
  8176. + Bug #3023708 (Formatted has 2 't'). The old member function is deprecated
  8177. + but still present for backward compatibility.
  8178. +
  8179. +* Tests
  8180. +
  8181. + - Added test to ensure that the escape sequence "\/" is corrected handled
  8182. + by the parser.
  8183. +
  8184. +* Bug fixes
  8185. +
  8186. + - Bug #3139677: JSON [1 2 3] was incorrectly parsed as [1, 3]. Error is now
  8187. + correctly detected.
  8188. +
  8189. + - Bug #3139678: stack buffer overflow when parsing a double with a
  8190. + length of 32 characters.
  8191. +
  8192. + - Fixed Value::operator <= implementation (had the semantic of operator >=).
  8193. + Found when adding unit tests for comparison operators.
  8194. +
  8195. + - Value::compare() is now const and has an actual implementation with
  8196. + unit tests.
  8197. +
  8198. + - Bug #2407932: strpbrk() can fail for NULL pointer.
  8199. +
  8200. + - Bug #3306345: Fixed minor typo in Path::resolve().
  8201. +
  8202. + - Bug #3314841/#3306896: errors in amalgamate.py
  8203. +
  8204. + - Fixed some Coverity warnings and line-endings.
  8205. +
  8206. +* License
  8207. +
  8208. + - See file LICENSE for details. Basically JsonCpp is now licensed under
  8209. + MIT license, or public domain if desired and recognized in your jurisdiction.
  8210. + Thanks to Stephan G. Beal [http://wanderinghorse.net/home/stephan/]) who
  8211. + helped figuring out the solution to the public domain issue.
  8212. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/pkg-config/jsoncpp.pc.in polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/pkg-config/jsoncpp.pc.in
  8213. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/pkg-config/jsoncpp.pc.in 1970-01-01 02:00:00.000000000 +0200
  8214. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/pkg-config/jsoncpp.pc.in 2017-12-03 19:05:22.000000000 +0300
  8215. @@ -0,0 +1,11 @@
  8216. +prefix=@CMAKE_INSTALL_PREFIX@
  8217. +exec_prefix=${prefix}
  8218. +libdir=${exec_prefix}/@LIBRARY_INSTALL_DIR@
  8219. +includedir=${prefix}/@INCLUDE_INSTALL_DIR@
  8220. +
  8221. +Name: jsoncpp
  8222. +Description: A C++ library for interacting with JSON
  8223. +Version: @JSONCPP_VERSION@
  8224. +URL: https://github.com/open-source-parsers/jsoncpp
  8225. +Libs: -L${libdir} -ljsoncpp
  8226. +Cflags: -I${includedir}
  8227. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/README.md polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/README.md
  8228. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/README.md 1970-01-01 02:00:00.000000000 +0200
  8229. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/README.md 2017-12-03 19:05:22.000000000 +0300
  8230. @@ -0,0 +1,214 @@
  8231. +Introduction
  8232. +------------
  8233. +
  8234. +[JSON][json-org] is a lightweight data-interchange format. It can represent
  8235. +numbers, strings, ordered sequences of values, and collections of name/value
  8236. +pairs.
  8237. +
  8238. +[json-org]: http://json.org/
  8239. +
  8240. +[JsonCpp][] is a C++ library that allows manipulating JSON values, including
  8241. +serialization and deserialization to and from strings. It can also preserve
  8242. +existing comment in unserialization/serialization steps, making it a convenient
  8243. +format to store user input files.
  8244. +
  8245. +[JsonCpp]: http://open-source-parsers.github.io/jsoncpp-docs/doxygen/index.html
  8246. +
  8247. +## A note on backward-compatibility
  8248. +* `1.y.z` is built with C++11.
  8249. +* `0.y.z` can be used with older compilers.
  8250. +* Major versions maintain binary-compatibility.
  8251. +
  8252. +# Using JsonCpp in your project
  8253. +-----------------------------
  8254. +The recommended approach to integrating JsonCpp in your project is to include
  8255. +the [amalgamated source](#generating-amalgamated-source-and-header) (a single
  8256. +`.cpp` file and two `.h` files) in your project, and compile and build as you
  8257. +would any other source file. This ensures consistency of compilation flags and
  8258. +ABI compatibility, issues which arise when building shared or static
  8259. +libraries. See the next section for instructions.
  8260. +
  8261. +The `include/` should be added to your compiler include path. Jsoncpp headers
  8262. +should be included as follow:
  8263. +
  8264. + #include <json/json.h>
  8265. +
  8266. +If JsonCpp was built as a dynamic library on Windows, then your project needs to
  8267. +define the macro `JSON_DLL`.
  8268. +
  8269. +Generating amalgamated source and header
  8270. +----------------------------------------
  8271. +JsonCpp is provided with a script to generate a single header and a single
  8272. +source file to ease inclusion into an existing project. The amalgamated source
  8273. +can be generated at any time by running the following command from the
  8274. +top-directory (this requires Python 2.6):
  8275. +
  8276. + python amalgamate.py
  8277. +
  8278. +It is possible to specify header name. See the `-h` option for detail.
  8279. +
  8280. +By default, the following files are generated:
  8281. +* `dist/jsoncpp.cpp`: source file that needs to be added to your project.
  8282. +* `dist/json/json.h`: corresponding header file for use in your project. It is
  8283. + equivalent to including `json/json.h` in non-amalgamated source. This header
  8284. + only depends on standard headers.
  8285. +* `dist/json/json-forwards.h`: header that provides forward declaration of all
  8286. + JsonCpp types.
  8287. +
  8288. +The amalgamated sources are generated by concatenating JsonCpp source in the
  8289. +correct order and defining the macro `JSON_IS_AMALGAMATION` to prevent inclusion
  8290. +of other headers.
  8291. +
  8292. +# Contributing to JsonCpp
  8293. +
  8294. +Building and testing with CMake
  8295. +-------------------------------
  8296. +[CMake][] is a C++ Makefiles/Solution generator. It is usually available on most
  8297. +Linux system as package. On Ubuntu:
  8298. +
  8299. + sudo apt-get install cmake
  8300. +
  8301. +[CMake]: http://www.cmake.org
  8302. +
  8303. +Note that Python is also required to run the JSON reader/writer tests. If
  8304. +missing, the build will skip running those tests.
  8305. +
  8306. +When running CMake, a few parameters are required:
  8307. +
  8308. +* a build directory where the makefiles/solution are generated. It is also used
  8309. + to store objects, libraries and executables files.
  8310. +* the generator to use: makefiles or Visual Studio solution? What version or
  8311. + Visual Studio, 32 or 64 bits solution?
  8312. +
  8313. +Steps for generating solution/makefiles using `cmake-gui`:
  8314. +
  8315. +* Make "source code" point to the source directory.
  8316. +* Make "where to build the binary" point to the directory to use for the build.
  8317. +* Click on the "Grouped" check box.
  8318. +* Review JsonCpp build options (tick `BUILD_SHARED_LIBS` to build as a
  8319. + dynamic library).
  8320. +* Click the configure button at the bottom, then the generate button.
  8321. +* The generated solution/makefiles can be found in the binary directory.
  8322. +
  8323. +Alternatively, from the command-line on Unix in the source directory:
  8324. +
  8325. + mkdir -p build/debug
  8326. + cd build/debug
  8327. + cmake -DCMAKE_BUILD_TYPE=debug -DBUILD_STATIC_LIBS=ON -DBUILD_SHARED_LIBS=OFF -DARCHIVE_INSTALL_DIR=. -G "Unix Makefiles" ../..
  8328. + make
  8329. +
  8330. +Running `cmake -h` will display the list of available generators (passed using
  8331. +the `-G` option).
  8332. +
  8333. +By default CMake hides compilation commands. This can be modified by specifying
  8334. +`-DCMAKE_VERBOSE_MAKEFILE=true` when generating makefiles.
  8335. +
  8336. +Building and testing with SCons
  8337. +-------------------------------
  8338. +**Note:** The SCons-based build system is deprecated. Please use CMake; see the
  8339. +section above.
  8340. +
  8341. +JsonCpp can use [Scons][] as a build system. Note that SCons requires Python to
  8342. +be installed.
  8343. +
  8344. +[SCons]: http://www.scons.org/
  8345. +
  8346. +Invoke SCons as follows:
  8347. +
  8348. + scons platform=$PLATFORM [TARGET]
  8349. +
  8350. +where `$PLATFORM` may be one of:
  8351. +
  8352. +* `suncc`: Sun C++ (Solaris)
  8353. +* `vacpp`: Visual Age C++ (AIX)
  8354. +* `mingw`
  8355. +* `msvc6`: Microsoft Visual Studio 6 service pack 5-6
  8356. +* `msvc70`: Microsoft Visual Studio 2002
  8357. +* `msvc71`: Microsoft Visual Studio 2003
  8358. +* `msvc80`: Microsoft Visual Studio 2005
  8359. +* `msvc90`: Microsoft Visual Studio 2008
  8360. +* `linux-gcc`: Gnu C++ (linux, also reported to work for Mac OS X)
  8361. +
  8362. +If you are building with Microsoft Visual Studio 2008, you need to set up the
  8363. +environment by running `vcvars32.bat` (e.g. MSVC 2008 command prompt) before
  8364. +running SCons.
  8365. +
  8366. +## Running the tests manually
  8367. +You need to run tests manually only if you are troubleshooting an issue.
  8368. +
  8369. +In the instructions below, replace `path/to/jsontest` with the path of the
  8370. +`jsontest` executable that was compiled on your platform.
  8371. +
  8372. + cd test
  8373. + # This will run the Reader/Writer tests
  8374. + python runjsontests.py path/to/jsontest
  8375. +
  8376. + # This will run the Reader/Writer tests, using JSONChecker test suite
  8377. + # (http://www.json.org/JSON_checker/).
  8378. + # Notes: not all tests pass: JsonCpp is too lenient (for example,
  8379. + # it allows an integer to start with '0'). The goal is to improve
  8380. + # strict mode parsing to get all tests to pass.
  8381. + python runjsontests.py --with-json-checker path/to/jsontest
  8382. +
  8383. + # This will run the unit tests (mostly Value)
  8384. + python rununittests.py path/to/test_lib_json
  8385. +
  8386. + # You can run the tests using valgrind:
  8387. + python rununittests.py --valgrind path/to/test_lib_json
  8388. +
  8389. +## Running the tests using scons
  8390. +Note that tests can be run using SCons using the `check` target:
  8391. +
  8392. + scons platform=$PLATFORM check
  8393. +
  8394. +Building the documentation
  8395. +--------------------------
  8396. +Run the Python script `doxybuild.py` from the top directory:
  8397. +
  8398. + python doxybuild.py --doxygen=$(which doxygen) --open --with-dot
  8399. +
  8400. +See `doxybuild.py --help` for options.
  8401. +
  8402. +Adding a reader/writer test
  8403. +---------------------------
  8404. +To add a test, you need to create two files in test/data:
  8405. +
  8406. +* a `TESTNAME.json` file, that contains the input document in JSON format.
  8407. +* a `TESTNAME.expected` file, that contains a flatened representation of the
  8408. + input document.
  8409. +
  8410. +The `TESTNAME.expected` file format is as follows:
  8411. +
  8412. +* each line represents a JSON element of the element tree represented by the
  8413. + input document.
  8414. +* each line has two parts: the path to access the element separated from the
  8415. + element value by `=`. Array and object values are always empty (i.e.
  8416. + represented by either `[]` or `{}`).
  8417. +* element path: `.` represents the root element, and is used to separate object
  8418. + members. `[N]` is used to specify the value of an array element at index `N`.
  8419. +
  8420. +See the examples `test_complex_01.json` and `test_complex_01.expected` to better
  8421. +understand element paths.
  8422. +
  8423. +Understanding reader/writer test output
  8424. +---------------------------------------
  8425. +When a test is run, output files are generated beside the input test files.
  8426. +Below is a short description of the content of each file:
  8427. +
  8428. +* `test_complex_01.json`: input JSON document.
  8429. +* `test_complex_01.expected`: flattened JSON element tree used to check if
  8430. + parsing was corrected.
  8431. +* `test_complex_01.actual`: flattened JSON element tree produced by `jsontest`
  8432. + from reading `test_complex_01.json`.
  8433. +* `test_complex_01.rewrite`: JSON document written by `jsontest` using the
  8434. + `Json::Value` parsed from `test_complex_01.json` and serialized using
  8435. + `Json::StyledWritter`.
  8436. +* `test_complex_01.actual-rewrite`: flattened JSON element tree produced by
  8437. + `jsontest` from reading `test_complex_01.rewrite`.
  8438. +* `test_complex_01.process-output`: `jsontest` output, typically useful for
  8439. + understanding parsing errors.
  8440. +
  8441. +License
  8442. +-------
  8443. +See the `LICENSE` file for details. In summary, JsonCpp is licensed under the
  8444. +MIT license, or public domain if desired and recognized in your jurisdiction.
  8445. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/globtool.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/globtool.py
  8446. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/globtool.py 1970-01-01 02:00:00.000000000 +0200
  8447. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/globtool.py 2017-12-03 19:05:22.000000000 +0300
  8448. @@ -0,0 +1,58 @@
  8449. +# Copyright 2009 Baptiste Lepilleur
  8450. +# Distributed under MIT license, or public domain if desired and
  8451. +# recognized in your jurisdiction.
  8452. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  8453. +
  8454. +import fnmatch
  8455. +import os
  8456. +
  8457. +def generate(env):
  8458. + def Glob(env, includes = None, excludes = None, dir = '.'):
  8459. + """Adds Glob(includes = Split('*'), excludes = None, dir = '.')
  8460. + helper function to environment.
  8461. +
  8462. + Glob both the file-system files.
  8463. +
  8464. + includes: list of file name pattern included in the return list when matched.
  8465. + excludes: list of file name pattern exluced from the return list.
  8466. +
  8467. + Example:
  8468. + sources = env.Glob(("*.cpp", '*.h'), "~*.cpp", "#src")
  8469. + """
  8470. + def filterFilename(path):
  8471. + abs_path = os.path.join(dir, path)
  8472. + if not os.path.isfile(abs_path):
  8473. + return 0
  8474. + fn = os.path.basename(path)
  8475. + match = 0
  8476. + for include in includes:
  8477. + if fnmatch.fnmatchcase(fn, include):
  8478. + match = 1
  8479. + break
  8480. + if match == 1 and not excludes is None:
  8481. + for exclude in excludes:
  8482. + if fnmatch.fnmatchcase(fn, exclude):
  8483. + match = 0
  8484. + break
  8485. + return match
  8486. + if includes is None:
  8487. + includes = ('*',)
  8488. + elif type(includes) in (type(''), type(u'')):
  8489. + includes = (includes,)
  8490. + if type(excludes) in (type(''), type(u'')):
  8491. + excludes = (excludes,)
  8492. + dir = env.Dir(dir).abspath
  8493. + paths = os.listdir(dir)
  8494. + def makeAbsFileNode(path):
  8495. + return env.File(os.path.join(dir, path))
  8496. + nodes = filter(filterFilename, paths)
  8497. + return map(makeAbsFileNode, nodes)
  8498. +
  8499. + from SCons.Script import Environment
  8500. + Environment.Glob = Glob
  8501. +
  8502. +def exists(env):
  8503. + """
  8504. + Tool always exists.
  8505. + """
  8506. + return True
  8507. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/srcdist.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/srcdist.py
  8508. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/srcdist.py 1970-01-01 02:00:00.000000000 +0200
  8509. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/srcdist.py 2017-12-03 19:05:22.000000000 +0300
  8510. @@ -0,0 +1,183 @@
  8511. +# Copyright 2007 Baptiste Lepilleur
  8512. +# Distributed under MIT license, or public domain if desired and
  8513. +# recognized in your jurisdiction.
  8514. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  8515. +
  8516. +import os
  8517. +import os.path
  8518. +from fnmatch import fnmatch
  8519. +import targz
  8520. +
  8521. +##def DoxyfileParse(file_contents):
  8522. +## """
  8523. +## Parse a Doxygen source file and return a dictionary of all the values.
  8524. +## Values will be strings and lists of strings.
  8525. +## """
  8526. +## data = {}
  8527. +##
  8528. +## import shlex
  8529. +## lex = shlex.shlex(instream = file_contents, posix = True)
  8530. +## lex.wordchars += "*+./-:"
  8531. +## lex.whitespace = lex.whitespace.replace("\n", "")
  8532. +## lex.escape = ""
  8533. +##
  8534. +## lineno = lex.lineno
  8535. +## last_backslash_lineno = lineno
  8536. +## token = lex.get_token()
  8537. +## key = token # the first token should be a key
  8538. +## last_token = ""
  8539. +## key_token = False
  8540. +## next_key = False
  8541. +## new_data = True
  8542. +##
  8543. +## def append_data(data, key, new_data, token):
  8544. +## if new_data or len(data[key]) == 0:
  8545. +## data[key].append(token)
  8546. +## else:
  8547. +## data[key][-1] += token
  8548. +##
  8549. +## while token:
  8550. +## if token in ['\n']:
  8551. +## if last_token not in ['\\']:
  8552. +## key_token = True
  8553. +## elif token in ['\\']:
  8554. +## pass
  8555. +## elif key_token:
  8556. +## key = token
  8557. +## key_token = False
  8558. +## else:
  8559. +## if token == "+=":
  8560. +## if not data.has_key(key):
  8561. +## data[key] = list()
  8562. +## elif token == "=":
  8563. +## data[key] = list()
  8564. +## else:
  8565. +## append_data(data, key, new_data, token)
  8566. +## new_data = True
  8567. +##
  8568. +## last_token = token
  8569. +## token = lex.get_token()
  8570. +##
  8571. +## if last_token == '\\' and token != '\n':
  8572. +## new_data = False
  8573. +## append_data(data, key, new_data, '\\')
  8574. +##
  8575. +## # compress lists of len 1 into single strings
  8576. +## for (k, v) in data.items():
  8577. +## if len(v) == 0:
  8578. +## data.pop(k)
  8579. +##
  8580. +## # items in the following list will be kept as lists and not converted to strings
  8581. +## if k in ["INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS"]:
  8582. +## continue
  8583. +##
  8584. +## if len(v) == 1:
  8585. +## data[k] = v[0]
  8586. +##
  8587. +## return data
  8588. +##
  8589. +##def DoxySourceScan(node, env, path):
  8590. +## """
  8591. +## Doxygen Doxyfile source scanner. This should scan the Doxygen file and add
  8592. +## any files used to generate docs to the list of source files.
  8593. +## """
  8594. +## default_file_patterns = [
  8595. +## '*.c', '*.cc', '*.cxx', '*.cpp', '*.c++', '*.java', '*.ii', '*.ixx',
  8596. +## '*.ipp', '*.i++', '*.inl', '*.h', '*.hh ', '*.hxx', '*.hpp', '*.h++',
  8597. +## '*.idl', '*.odl', '*.cs', '*.php', '*.php3', '*.inc', '*.m', '*.mm',
  8598. +## '*.py',
  8599. +## ]
  8600. +##
  8601. +## default_exclude_patterns = [
  8602. +## '*~',
  8603. +## ]
  8604. +##
  8605. +## sources = []
  8606. +##
  8607. +## data = DoxyfileParse(node.get_contents())
  8608. +##
  8609. +## if data.get("RECURSIVE", "NO") == "YES":
  8610. +## recursive = True
  8611. +## else:
  8612. +## recursive = False
  8613. +##
  8614. +## file_patterns = data.get("FILE_PATTERNS", default_file_patterns)
  8615. +## exclude_patterns = data.get("EXCLUDE_PATTERNS", default_exclude_patterns)
  8616. +##
  8617. +## for node in data.get("INPUT", []):
  8618. +## if os.path.isfile(node):
  8619. +## sources.add(node)
  8620. +## elif os.path.isdir(node):
  8621. +## if recursive:
  8622. +## for root, dirs, files in os.walk(node):
  8623. +## for f in files:
  8624. +## filename = os.path.join(root, f)
  8625. +##
  8626. +## pattern_check = reduce(lambda x, y: x or bool(fnmatch(filename, y)), file_patterns, False)
  8627. +## exclude_check = reduce(lambda x, y: x and fnmatch(filename, y), exclude_patterns, True)
  8628. +##
  8629. +## if pattern_check and not exclude_check:
  8630. +## sources.append(filename)
  8631. +## else:
  8632. +## for pattern in file_patterns:
  8633. +## sources.extend(glob.glob("/".join([node, pattern])))
  8634. +## sources = map(lambda path: env.File(path), sources)
  8635. +## return sources
  8636. +##
  8637. +##
  8638. +##def DoxySourceScanCheck(node, env):
  8639. +## """Check if we should scan this file"""
  8640. +## return os.path.isfile(node.path)
  8641. +
  8642. +def srcDistEmitter(source, target, env):
  8643. +## """Doxygen Doxyfile emitter"""
  8644. +## # possible output formats and their default values and output locations
  8645. +## output_formats = {
  8646. +## "HTML": ("YES", "html"),
  8647. +## "LATEX": ("YES", "latex"),
  8648. +## "RTF": ("NO", "rtf"),
  8649. +## "MAN": ("YES", "man"),
  8650. +## "XML": ("NO", "xml"),
  8651. +## }
  8652. +##
  8653. +## data = DoxyfileParse(source[0].get_contents())
  8654. +##
  8655. +## targets = []
  8656. +## out_dir = data.get("OUTPUT_DIRECTORY", ".")
  8657. +##
  8658. +## # add our output locations
  8659. +## for (k, v) in output_formats.items():
  8660. +## if data.get("GENERATE_" + k, v[0]) == "YES":
  8661. +## targets.append(env.Dir(os.path.join(out_dir, data.get(k + "_OUTPUT", v[1]))))
  8662. +##
  8663. +## # don't clobber targets
  8664. +## for node in targets:
  8665. +## env.Precious(node)
  8666. +##
  8667. +## # set up cleaning stuff
  8668. +## for node in targets:
  8669. +## env.Clean(node, node)
  8670. +##
  8671. +## return (targets, source)
  8672. + return (target,source)
  8673. +
  8674. +def generate(env):
  8675. + """
  8676. + Add builders and construction variables for the
  8677. + SrcDist tool.
  8678. + """
  8679. +## doxyfile_scanner = env.Scanner(## DoxySourceScan,
  8680. +## "DoxySourceScan",
  8681. +## scan_check = DoxySourceScanCheck,
  8682. +##)
  8683. +
  8684. + if targz.exists(env):
  8685. + srcdist_builder = targz.makeBuilder(srcDistEmitter)
  8686. +
  8687. + env['BUILDERS']['SrcDist'] = srcdist_builder
  8688. +
  8689. +def exists(env):
  8690. + """
  8691. + Make sure srcdist exists.
  8692. + """
  8693. + return targz.exists(env)
  8694. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/substinfile.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/substinfile.py
  8695. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/substinfile.py 1970-01-01 02:00:00.000000000 +0200
  8696. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/substinfile.py 2017-12-03 19:05:22.000000000 +0300
  8697. @@ -0,0 +1,85 @@
  8698. +# Copyright 2010 Baptiste Lepilleur
  8699. +# Distributed under MIT license, or public domain if desired and
  8700. +# recognized in your jurisdiction.
  8701. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  8702. +
  8703. +import re
  8704. +from SCons.Script import * # the usual scons stuff you get in a SConscript
  8705. +import collections
  8706. +
  8707. +def generate(env):
  8708. + """
  8709. + Add builders and construction variables for the
  8710. + SubstInFile tool.
  8711. +
  8712. + Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT
  8713. + from the source to the target.
  8714. + The values of SUBST_DICT first have any construction variables expanded
  8715. + (its keys are not expanded).
  8716. + If a value of SUBST_DICT is a python callable function, it is called and
  8717. + the result is expanded as the value.
  8718. + If there's more than one source and more than one target, each target gets
  8719. + substituted from the corresponding source.
  8720. + """
  8721. + def do_subst_in_file(targetfile, sourcefile, dict):
  8722. + """Replace all instances of the keys of dict with their values.
  8723. + For example, if dict is {'%VERSION%': '1.2345', '%BASE%': 'MyProg'},
  8724. + then all instances of %VERSION% in the file will be replaced with 1.2345 etc.
  8725. + """
  8726. + try:
  8727. + f = open(sourcefile, 'rb')
  8728. + contents = f.read()
  8729. + f.close()
  8730. + except:
  8731. + raise SCons.Errors.UserError("Can't read source file %s"%sourcefile)
  8732. + for (k,v) in list(dict.items()):
  8733. + contents = re.sub(k, v, contents)
  8734. + try:
  8735. + f = open(targetfile, 'wb')
  8736. + f.write(contents)
  8737. + f.close()
  8738. + except:
  8739. + raise SCons.Errors.UserError("Can't write target file %s"%targetfile)
  8740. + return 0 # success
  8741. +
  8742. + def subst_in_file(target, source, env):
  8743. + if 'SUBST_DICT' not in env:
  8744. + raise SCons.Errors.UserError("SubstInFile requires SUBST_DICT to be set.")
  8745. + d = dict(env['SUBST_DICT']) # copy it
  8746. + for (k,v) in list(d.items()):
  8747. + if isinstance(v, collections.Callable):
  8748. + d[k] = env.subst(v()).replace('\\','\\\\')
  8749. + elif SCons.Util.is_String(v):
  8750. + d[k] = env.subst(v).replace('\\','\\\\')
  8751. + else:
  8752. + raise SCons.Errors.UserError("SubstInFile: key %s: %s must be a string or callable"%(k, repr(v)))
  8753. + for (t,s) in zip(target, source):
  8754. + return do_subst_in_file(str(t), str(s), d)
  8755. +
  8756. + def subst_in_file_string(target, source, env):
  8757. + """This is what gets printed on the console."""
  8758. + return '\n'.join(['Substituting vars from %s into %s'%(str(s), str(t))
  8759. + for (t,s) in zip(target, source)])
  8760. +
  8761. + def subst_emitter(target, source, env):
  8762. + """Add dependency from substituted SUBST_DICT to target.
  8763. + Returns original target, source tuple unchanged.
  8764. + """
  8765. + d = env['SUBST_DICT'].copy() # copy it
  8766. + for (k,v) in list(d.items()):
  8767. + if isinstance(v, collections.Callable):
  8768. + d[k] = env.subst(v())
  8769. + elif SCons.Util.is_String(v):
  8770. + d[k]=env.subst(v)
  8771. + Depends(target, SCons.Node.Python.Value(d))
  8772. + return target, source
  8773. +
  8774. +## env.Append(TOOLS = 'substinfile') # this should be automaticaly done by Scons ?!?
  8775. + subst_action = SCons.Action.Action(subst_in_file, subst_in_file_string)
  8776. + env['BUILDERS']['SubstInFile'] = Builder(action=subst_action, emitter=subst_emitter)
  8777. +
  8778. +def exists(env):
  8779. + """
  8780. + Make sure tool exists.
  8781. + """
  8782. + return True
  8783. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/targz.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/targz.py
  8784. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/targz.py 1970-01-01 02:00:00.000000000 +0200
  8785. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/scons-tools/targz.py 2017-12-03 19:05:22.000000000 +0300
  8786. @@ -0,0 +1,87 @@
  8787. +# Copyright 2007 Baptiste Lepilleur
  8788. +# Distributed under MIT license, or public domain if desired and
  8789. +# recognized in your jurisdiction.
  8790. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  8791. +
  8792. +"""tarball
  8793. +
  8794. +Tool-specific initialization for tarball.
  8795. +
  8796. +"""
  8797. +
  8798. +## Commands to tackle a command based implementation:
  8799. +##to unpack on the fly...
  8800. +##gunzip < FILE.tar.gz | tar xvf -
  8801. +##to pack on the fly...
  8802. +##tar cvf - FILE-LIST | gzip -c > FILE.tar.gz
  8803. +
  8804. +import os.path
  8805. +
  8806. +import SCons.Builder
  8807. +import SCons.Node.FS
  8808. +import SCons.Util
  8809. +
  8810. +try:
  8811. + import gzip
  8812. + import tarfile
  8813. + internal_targz = 1
  8814. +except ImportError:
  8815. + internal_targz = 0
  8816. +
  8817. +TARGZ_DEFAULT_COMPRESSION_LEVEL = 9
  8818. +
  8819. +if internal_targz:
  8820. + def targz(target, source, env):
  8821. + def archive_name(path):
  8822. + path = os.path.normpath(os.path.abspath(path))
  8823. + common_path = os.path.commonprefix((base_dir, path))
  8824. + archive_name = path[len(common_path):]
  8825. + return archive_name
  8826. +
  8827. + def visit(tar, dirname, names):
  8828. + for name in names:
  8829. + path = os.path.join(dirname, name)
  8830. + if os.path.isfile(path):
  8831. + tar.add(path, archive_name(path))
  8832. + compression = env.get('TARGZ_COMPRESSION_LEVEL',TARGZ_DEFAULT_COMPRESSION_LEVEL)
  8833. + base_dir = os.path.normpath(env.get('TARGZ_BASEDIR', env.Dir('.')).abspath)
  8834. + target_path = str(target[0])
  8835. + fileobj = gzip.GzipFile(target_path, 'wb', compression)
  8836. + tar = tarfile.TarFile(os.path.splitext(target_path)[0], 'w', fileobj)
  8837. + for source in source:
  8838. + source_path = str(source)
  8839. + if source.isdir():
  8840. + os.path.walk(source_path, visit, tar)
  8841. + else:
  8842. + tar.add(source_path, archive_name(source_path)) # filename, arcname
  8843. + tar.close()
  8844. +
  8845. + targzAction = SCons.Action.Action(targz, varlist=['TARGZ_COMPRESSION_LEVEL','TARGZ_BASEDIR'])
  8846. +
  8847. + def makeBuilder(emitter = None):
  8848. + return SCons.Builder.Builder(action = SCons.Action.Action('$TARGZ_COM', '$TARGZ_COMSTR'),
  8849. + source_factory = SCons.Node.FS.Entry,
  8850. + source_scanner = SCons.Defaults.DirScanner,
  8851. + suffix = '$TARGZ_SUFFIX',
  8852. + multi = 1)
  8853. + TarGzBuilder = makeBuilder()
  8854. +
  8855. + def generate(env):
  8856. + """Add Builders and construction variables for zip to an Environment.
  8857. + The following environnement variables may be set:
  8858. + TARGZ_COMPRESSION_LEVEL: integer, [0-9]. 0: no compression, 9: best compression (same as gzip compression level).
  8859. + TARGZ_BASEDIR: base-directory used to determine archive name (this allow archive name to be relative
  8860. + to something other than top-dir).
  8861. + """
  8862. + env['BUILDERS']['TarGz'] = TarGzBuilder
  8863. + env['TARGZ_COM'] = targzAction
  8864. + env['TARGZ_COMPRESSION_LEVEL'] = TARGZ_DEFAULT_COMPRESSION_LEVEL # range 0-9
  8865. + env['TARGZ_SUFFIX'] = '.tar.gz'
  8866. + env['TARGZ_BASEDIR'] = env.Dir('.') # Sources archive name are made relative to that directory.
  8867. +else:
  8868. + def generate(env):
  8869. + pass
  8870. +
  8871. +
  8872. +def exists(env):
  8873. + return internal_targz
  8874. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/SConstruct polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/SConstruct
  8875. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/SConstruct 1970-01-01 02:00:00.000000000 +0200
  8876. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/SConstruct 2017-12-03 19:05:22.000000000 +0300
  8877. @@ -0,0 +1,248 @@
  8878. +"""
  8879. +Notes:
  8880. +- shared library support is buggy: it assumes that a static and dynamic library can be build from the same object files. This is not true on many platforms. For this reason it is only enabled on linux-gcc at the current time.
  8881. +
  8882. +To add a platform:
  8883. +- add its name in options allowed_values below
  8884. +- add tool initialization for this platform. Search for "if platform == 'suncc'" as an example.
  8885. +"""
  8886. +
  8887. +import os
  8888. +import os.path
  8889. +import sys
  8890. +
  8891. +JSONCPP_VERSION = open(File('#version').abspath,'rt').read().strip()
  8892. +DIST_DIR = '#dist'
  8893. +
  8894. +options = Variables()
  8895. +options.Add( EnumVariable('platform',
  8896. + 'Platform (compiler/stl) used to build the project',
  8897. + 'msvc71',
  8898. + allowed_values='suncc vacpp mingw msvc6 msvc7 msvc71 msvc80 msvc90 linux-gcc'.split(),
  8899. + ignorecase=2) )
  8900. +
  8901. +try:
  8902. + platform = ARGUMENTS['platform']
  8903. + if platform == 'linux-gcc':
  8904. + CXX = 'g++' # not quite right, but env is not yet available.
  8905. + import commands
  8906. + version = commands.getoutput('%s -dumpversion' %CXX)
  8907. + platform = 'linux-gcc-%s' %version
  8908. + print "Using platform '%s'" %platform
  8909. + LD_LIBRARY_PATH = os.environ.get('LD_LIBRARY_PATH', '')
  8910. + LD_LIBRARY_PATH = "%s:libs/%s" %(LD_LIBRARY_PATH, platform)
  8911. + os.environ['LD_LIBRARY_PATH'] = LD_LIBRARY_PATH
  8912. + print "LD_LIBRARY_PATH =", LD_LIBRARY_PATH
  8913. +except KeyError:
  8914. + print 'You must specify a "platform"'
  8915. + sys.exit(2)
  8916. +
  8917. +print "Building using PLATFORM =", platform
  8918. +
  8919. +rootbuild_dir = Dir('#buildscons')
  8920. +build_dir = os.path.join( '#buildscons', platform )
  8921. +bin_dir = os.path.join( '#bin', platform )
  8922. +lib_dir = os.path.join( '#libs', platform )
  8923. +sconsign_dir_path = Dir(build_dir).abspath
  8924. +sconsign_path = os.path.join( sconsign_dir_path, '.sconsign.dbm' )
  8925. +
  8926. +# Ensure build directory exist (SConsignFile fail otherwise!)
  8927. +if not os.path.exists( sconsign_dir_path ):
  8928. + os.makedirs( sconsign_dir_path )
  8929. +
  8930. +# Store all dependencies signature in a database
  8931. +SConsignFile( sconsign_path )
  8932. +
  8933. +def make_environ_vars():
  8934. + """Returns a dictionnary with environment variable to use when compiling."""
  8935. + # PATH is required to find the compiler
  8936. + # TEMP is required for at least mingw
  8937. + # LD_LIBRARY_PATH & co is required on some system for the compiler
  8938. + vars = {}
  8939. + for name in ('PATH', 'TEMP', 'TMP', 'LD_LIBRARY_PATH', 'LIBRARY_PATH'):
  8940. + if name in os.environ:
  8941. + vars[name] = os.environ[name]
  8942. + return vars
  8943. +
  8944. +
  8945. +env = Environment( ENV = make_environ_vars(),
  8946. + toolpath = ['scons-tools'],
  8947. + tools=[] ) #, tools=['default'] )
  8948. +
  8949. +if platform == 'suncc':
  8950. + env.Tool( 'sunc++' )
  8951. + env.Tool( 'sunlink' )
  8952. + env.Tool( 'sunar' )
  8953. + env.Append( CCFLAGS = ['-mt'] )
  8954. +elif platform == 'vacpp':
  8955. + env.Tool( 'default' )
  8956. + env.Tool( 'aixcc' )
  8957. + env['CXX'] = 'xlC_r' #scons does not pick-up the correct one !
  8958. + # using xlC_r ensure multi-threading is enabled:
  8959. + # http://publib.boulder.ibm.com/infocenter/pseries/index.jsp?topic=/com.ibm.vacpp7a.doc/compiler/ref/cuselect.htm
  8960. + env.Append( CCFLAGS = '-qrtti=all',
  8961. + LINKFLAGS='-bh:5' ) # -bh:5 remove duplicate symbol warning
  8962. +elif platform == 'msvc6':
  8963. + env['MSVS_VERSION']='6.0'
  8964. + for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
  8965. + env.Tool( tool )
  8966. + env['CXXFLAGS']='-GR -GX /nologo /MT'
  8967. +elif platform == 'msvc70':
  8968. + env['MSVS_VERSION']='7.0'
  8969. + for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
  8970. + env.Tool( tool )
  8971. + env['CXXFLAGS']='-GR -GX /nologo /MT'
  8972. +elif platform == 'msvc71':
  8973. + env['MSVS_VERSION']='7.1'
  8974. + for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
  8975. + env.Tool( tool )
  8976. + env['CXXFLAGS']='-GR -GX /nologo /MT'
  8977. +elif platform == 'msvc80':
  8978. + env['MSVS_VERSION']='8.0'
  8979. + for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
  8980. + env.Tool( tool )
  8981. + env['CXXFLAGS']='-GR -EHsc /nologo /MT'
  8982. +elif platform == 'msvc90':
  8983. + env['MSVS_VERSION']='9.0'
  8984. + # Scons 1.2 fails to detect the correct location of the platform SDK.
  8985. + # So we propagate those from the environment. This requires that the
  8986. + # user run vcvars32.bat before compiling.
  8987. + if 'INCLUDE' in os.environ:
  8988. + env['ENV']['INCLUDE'] = os.environ['INCLUDE']
  8989. + if 'LIB' in os.environ:
  8990. + env['ENV']['LIB'] = os.environ['LIB']
  8991. + for tool in ['msvc', 'msvs', 'mslink', 'masm', 'mslib']:
  8992. + env.Tool( tool )
  8993. + env['CXXFLAGS']='-GR -EHsc /nologo /MT'
  8994. +elif platform == 'mingw':
  8995. + env.Tool( 'mingw' )
  8996. + env.Append( CPPDEFINES=[ "WIN32", "NDEBUG", "_MT" ] )
  8997. +elif platform.startswith('linux-gcc'):
  8998. + env.Tool( 'default' )
  8999. + env.Append( LIBS = ['pthread'], CCFLAGS = os.environ.get("CXXFLAGS", "-Wall"), LINKFLAGS=os.environ.get("LDFLAGS", "") )
  9000. + env['SHARED_LIB_ENABLED'] = True
  9001. +else:
  9002. + print "UNSUPPORTED PLATFORM."
  9003. + env.Exit(1)
  9004. +
  9005. +env.Tool('targz')
  9006. +env.Tool('srcdist')
  9007. +env.Tool('globtool')
  9008. +
  9009. +env.Append( CPPPATH = ['#include'],
  9010. + LIBPATH = lib_dir )
  9011. +short_platform = platform
  9012. +if short_platform.startswith('msvc'):
  9013. + short_platform = short_platform[2:]
  9014. +# Notes: on Windows you need to rebuild the source for each variant
  9015. +# Build script does not support that yet so we only build static libraries.
  9016. +# This also fails on AIX because both dynamic and static library ends with
  9017. +# extension .a.
  9018. +env['SHARED_LIB_ENABLED'] = env.get('SHARED_LIB_ENABLED', False)
  9019. +env['LIB_PLATFORM'] = short_platform
  9020. +env['LIB_LINK_TYPE'] = 'lib' # static
  9021. +env['LIB_CRUNTIME'] = 'mt'
  9022. +env['LIB_NAME_SUFFIX'] = '${LIB_PLATFORM}_${LIB_LINK_TYPE}${LIB_CRUNTIME}' # must match autolink naming convention
  9023. +env['JSONCPP_VERSION'] = JSONCPP_VERSION
  9024. +env['BUILD_DIR'] = env.Dir(build_dir)
  9025. +env['ROOTBUILD_DIR'] = env.Dir(rootbuild_dir)
  9026. +env['DIST_DIR'] = DIST_DIR
  9027. +if 'TarGz' in env['BUILDERS']:
  9028. + class SrcDistAdder:
  9029. + def __init__( self, env ):
  9030. + self.env = env
  9031. + def __call__( self, *args, **kw ):
  9032. + apply( self.env.SrcDist, (self.env['SRCDIST_TARGET'],) + args, kw )
  9033. + env['SRCDIST_BUILDER'] = env.TarGz
  9034. +else: # If tarfile module is missing
  9035. + class SrcDistAdder:
  9036. + def __init__( self, env ):
  9037. + pass
  9038. + def __call__( self, *args, **kw ):
  9039. + pass
  9040. +env['SRCDIST_ADD'] = SrcDistAdder( env )
  9041. +env['SRCDIST_TARGET'] = os.path.join( DIST_DIR, 'jsoncpp-src-%s.tar.gz' % env['JSONCPP_VERSION'] )
  9042. +
  9043. +env_testing = env.Clone( )
  9044. +env_testing.Append( LIBS = ['json_${LIB_NAME_SUFFIX}'] )
  9045. +
  9046. +def buildJSONExample( env, target_sources, target_name ):
  9047. + env = env.Clone()
  9048. + env.Append( CPPPATH = ['#'] )
  9049. + exe = env.Program( target=target_name,
  9050. + source=target_sources )
  9051. + env['SRCDIST_ADD']( source=[target_sources] )
  9052. + global bin_dir
  9053. + return env.Install( bin_dir, exe )
  9054. +
  9055. +def buildJSONTests( env, target_sources, target_name ):
  9056. + jsontests_node = buildJSONExample( env, target_sources, target_name )
  9057. + check_alias_target = env.Alias( 'check', jsontests_node, RunJSONTests( jsontests_node, jsontests_node ) )
  9058. + env.AlwaysBuild( check_alias_target )
  9059. +
  9060. +def buildUnitTests( env, target_sources, target_name ):
  9061. + jsontests_node = buildJSONExample( env, target_sources, target_name )
  9062. + check_alias_target = env.Alias( 'check', jsontests_node,
  9063. + RunUnitTests( jsontests_node, jsontests_node ) )
  9064. + env.AlwaysBuild( check_alias_target )
  9065. +
  9066. +def buildLibrary( env, target_sources, target_name ):
  9067. + static_lib = env.StaticLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
  9068. + source=target_sources )
  9069. + global lib_dir
  9070. + env.Install( lib_dir, static_lib )
  9071. + if env['SHARED_LIB_ENABLED']:
  9072. + shared_lib = env.SharedLibrary( target=target_name + '_${LIB_NAME_SUFFIX}',
  9073. + source=target_sources )
  9074. + env.Install( lib_dir, shared_lib )
  9075. + env['SRCDIST_ADD']( source=[target_sources] )
  9076. +
  9077. +Export( 'env env_testing buildJSONExample buildLibrary buildJSONTests buildUnitTests' )
  9078. +
  9079. +def buildProjectInDirectory( target_directory ):
  9080. + global build_dir
  9081. + target_build_dir = os.path.join( build_dir, target_directory )
  9082. + target = os.path.join( target_directory, 'sconscript' )
  9083. + SConscript( target, build_dir=target_build_dir, duplicate=0 )
  9084. + env['SRCDIST_ADD']( source=[target] )
  9085. +
  9086. +
  9087. +def runJSONTests_action( target, source = None, env = None ):
  9088. + # Add test scripts to python path
  9089. + jsontest_path = Dir( '#test' ).abspath
  9090. + sys.path.insert( 0, jsontest_path )
  9091. + data_path = os.path.join( jsontest_path, 'data' )
  9092. + import runjsontests
  9093. + return runjsontests.runAllTests( os.path.abspath(source[0].path), data_path )
  9094. +
  9095. +def runJSONTests_string( target, source = None, env = None ):
  9096. + return 'RunJSONTests("%s")' % source[0]
  9097. +
  9098. +import SCons.Action
  9099. +ActionFactory = SCons.Action.ActionFactory
  9100. +RunJSONTests = ActionFactory(runJSONTests_action, runJSONTests_string )
  9101. +
  9102. +def runUnitTests_action( target, source = None, env = None ):
  9103. + # Add test scripts to python path
  9104. + jsontest_path = Dir( '#test' ).abspath
  9105. + sys.path.insert( 0, jsontest_path )
  9106. + import rununittests
  9107. + return rununittests.runAllTests( os.path.abspath(source[0].path) )
  9108. +
  9109. +def runUnitTests_string( target, source = None, env = None ):
  9110. + return 'RunUnitTests("%s")' % source[0]
  9111. +
  9112. +RunUnitTests = ActionFactory(runUnitTests_action, runUnitTests_string )
  9113. +
  9114. +env.Alias( 'check' )
  9115. +
  9116. +srcdist_cmd = env['SRCDIST_ADD']( source = """
  9117. + AUTHORS README.md SConstruct
  9118. + """.split() )
  9119. +env.Alias( 'src-dist', srcdist_cmd )
  9120. +
  9121. +buildProjectInDirectory( 'src/jsontestrunner' )
  9122. +buildProjectInDirectory( 'src/lib_json' )
  9123. +buildProjectInDirectory( 'src/test_lib_json' )
  9124. +#print env.Dump()
  9125. +
  9126. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/CMakeLists.txt
  9127. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  9128. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  9129. @@ -0,0 +1,5 @@
  9130. +ADD_SUBDIRECTORY(lib_json)
  9131. +IF(JSONCPP_WITH_TESTS)
  9132. + ADD_SUBDIRECTORY(jsontestrunner)
  9133. + ADD_SUBDIRECTORY(test_lib_json)
  9134. +ENDIF()
  9135. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/CMakeLists.txt
  9136. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  9137. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  9138. @@ -0,0 +1,25 @@
  9139. +FIND_PACKAGE(PythonInterp 2.6)
  9140. +
  9141. +ADD_EXECUTABLE(jsontestrunner_exe
  9142. + main.cpp
  9143. + )
  9144. +
  9145. +IF(BUILD_SHARED_LIBS)
  9146. + ADD_DEFINITIONS( -DJSON_DLL )
  9147. + TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib)
  9148. +ELSE(BUILD_SHARED_LIBS)
  9149. + TARGET_LINK_LIBRARIES(jsontestrunner_exe jsoncpp_lib_static)
  9150. +ENDIF()
  9151. +
  9152. +SET_TARGET_PROPERTIES(jsontestrunner_exe PROPERTIES OUTPUT_NAME jsontestrunner_exe)
  9153. +
  9154. +IF(PYTHONINTERP_FOUND)
  9155. + # Run end to end parser/writer tests
  9156. + SET(TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../test)
  9157. + SET(RUNJSONTESTS_PATH ${TEST_DIR}/runjsontests.py)
  9158. + ADD_CUSTOM_TARGET(jsoncpp_readerwriter_tests
  9159. + "${PYTHON_EXECUTABLE}" -B "${RUNJSONTESTS_PATH}" $<TARGET_FILE:jsontestrunner_exe> "${TEST_DIR}/data"
  9160. + DEPENDS jsontestrunner_exe jsoncpp_test
  9161. + )
  9162. + ADD_CUSTOM_TARGET(jsoncpp_check DEPENDS jsoncpp_readerwriter_tests)
  9163. +ENDIF()
  9164. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/main.cpp polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/main.cpp
  9165. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/main.cpp 1970-01-01 02:00:00.000000000 +0200
  9166. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/main.cpp 2017-12-03 19:05:22.000000000 +0300
  9167. @@ -0,0 +1,326 @@
  9168. +// Copyright 2007-2010 Baptiste Lepilleur
  9169. +// Distributed under MIT license, or public domain if desired and
  9170. +// recognized in your jurisdiction.
  9171. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  9172. +
  9173. +/* This executable is used for testing parser/writer using real JSON files.
  9174. + */
  9175. +
  9176. +#include <json/json.h>
  9177. +#include <algorithm> // sort
  9178. +#include <sstream>
  9179. +#include <stdio.h>
  9180. +
  9181. +#if defined(_MSC_VER) && _MSC_VER >= 1310
  9182. +#pragma warning(disable : 4996) // disable fopen deprecation warning
  9183. +#endif
  9184. +
  9185. +struct Options
  9186. +{
  9187. + JSONCPP_STRING path;
  9188. + Json::Features features;
  9189. + bool parseOnly;
  9190. + typedef JSONCPP_STRING (*writeFuncType)(Json::Value const&);
  9191. + writeFuncType write;
  9192. +};
  9193. +
  9194. +static JSONCPP_STRING normalizeFloatingPointStr(double value) {
  9195. + char buffer[32];
  9196. +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
  9197. + sprintf_s(buffer, sizeof(buffer), "%.16g", value);
  9198. +#else
  9199. + snprintf(buffer, sizeof(buffer), "%.16g", value);
  9200. +#endif
  9201. + buffer[sizeof(buffer) - 1] = 0;
  9202. + JSONCPP_STRING s(buffer);
  9203. + JSONCPP_STRING::size_type index = s.find_last_of("eE");
  9204. + if (index != JSONCPP_STRING::npos) {
  9205. + JSONCPP_STRING::size_type hasSign =
  9206. + (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
  9207. + JSONCPP_STRING::size_type exponentStartIndex = index + 1 + hasSign;
  9208. + JSONCPP_STRING normalized = s.substr(0, exponentStartIndex);
  9209. + JSONCPP_STRING::size_type indexDigit =
  9210. + s.find_first_not_of('0', exponentStartIndex);
  9211. + JSONCPP_STRING exponent = "0";
  9212. + if (indexDigit !=
  9213. + JSONCPP_STRING::npos) // There is an exponent different from 0
  9214. + {
  9215. + exponent = s.substr(indexDigit);
  9216. + }
  9217. + return normalized + exponent;
  9218. + }
  9219. + return s;
  9220. +}
  9221. +
  9222. +static JSONCPP_STRING readInputTestFile(const char* path) {
  9223. + FILE* file = fopen(path, "rb");
  9224. + if (!file)
  9225. + return JSONCPP_STRING("");
  9226. + fseek(file, 0, SEEK_END);
  9227. + long const size = ftell(file);
  9228. + unsigned long const usize = static_cast<unsigned long>(size);
  9229. + fseek(file, 0, SEEK_SET);
  9230. + JSONCPP_STRING text;
  9231. + char* buffer = new char[size + 1];
  9232. + buffer[size] = 0;
  9233. + if (fread(buffer, 1, usize, file) == usize)
  9234. + text = buffer;
  9235. + fclose(file);
  9236. + delete[] buffer;
  9237. + return text;
  9238. +}
  9239. +
  9240. +static void
  9241. +printValueTree(FILE* fout, Json::Value& value, const JSONCPP_STRING& path = ".") {
  9242. + if (value.hasComment(Json::commentBefore)) {
  9243. + fprintf(fout, "%s\n", value.getComment(Json::commentBefore).c_str());
  9244. + }
  9245. + switch (value.type()) {
  9246. + case Json::nullValue:
  9247. + fprintf(fout, "%s=null\n", path.c_str());
  9248. + break;
  9249. + case Json::intValue:
  9250. + fprintf(fout,
  9251. + "%s=%s\n",
  9252. + path.c_str(),
  9253. + Json::valueToString(value.asLargestInt()).c_str());
  9254. + break;
  9255. + case Json::uintValue:
  9256. + fprintf(fout,
  9257. + "%s=%s\n",
  9258. + path.c_str(),
  9259. + Json::valueToString(value.asLargestUInt()).c_str());
  9260. + break;
  9261. + case Json::realValue:
  9262. + fprintf(fout,
  9263. + "%s=%s\n",
  9264. + path.c_str(),
  9265. + normalizeFloatingPointStr(value.asDouble()).c_str());
  9266. + break;
  9267. + case Json::stringValue:
  9268. + fprintf(fout, "%s=\"%s\"\n", path.c_str(), value.asString().c_str());
  9269. + break;
  9270. + case Json::booleanValue:
  9271. + fprintf(fout, "%s=%s\n", path.c_str(), value.asBool() ? "true" : "false");
  9272. + break;
  9273. + case Json::arrayValue: {
  9274. + fprintf(fout, "%s=[]\n", path.c_str());
  9275. + Json::ArrayIndex size = value.size();
  9276. + for (Json::ArrayIndex index = 0; index < size; ++index) {
  9277. + static char buffer[16];
  9278. +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__)
  9279. + sprintf_s(buffer, sizeof(buffer), "[%d]", index);
  9280. +#else
  9281. + snprintf(buffer, sizeof(buffer), "[%d]", index);
  9282. +#endif
  9283. + printValueTree(fout, value[index], path + buffer);
  9284. + }
  9285. + } break;
  9286. + case Json::objectValue: {
  9287. + fprintf(fout, "%s={}\n", path.c_str());
  9288. + Json::Value::Members members(value.getMemberNames());
  9289. + std::sort(members.begin(), members.end());
  9290. + JSONCPP_STRING suffix = *(path.end() - 1) == '.' ? "" : ".";
  9291. + for (Json::Value::Members::iterator it = members.begin();
  9292. + it != members.end();
  9293. + ++it) {
  9294. + const JSONCPP_STRING name = *it;
  9295. + printValueTree(fout, value[name], path + suffix + name);
  9296. + }
  9297. + } break;
  9298. + default:
  9299. + break;
  9300. + }
  9301. +
  9302. + if (value.hasComment(Json::commentAfter)) {
  9303. + fprintf(fout, "%s\n", value.getComment(Json::commentAfter).c_str());
  9304. + }
  9305. +}
  9306. +
  9307. +static int parseAndSaveValueTree(const JSONCPP_STRING& input,
  9308. + const JSONCPP_STRING& actual,
  9309. + const JSONCPP_STRING& kind,
  9310. + const Json::Features& features,
  9311. + bool parseOnly,
  9312. + Json::Value* root)
  9313. +{
  9314. + Json::Reader reader(features);
  9315. + bool parsingSuccessful = reader.parse(input.data(), input.data() + input.size(), *root);
  9316. + if (!parsingSuccessful) {
  9317. + printf("Failed to parse %s file: \n%s\n",
  9318. + kind.c_str(),
  9319. + reader.getFormattedErrorMessages().c_str());
  9320. + return 1;
  9321. + }
  9322. + if (!parseOnly) {
  9323. + FILE* factual = fopen(actual.c_str(), "wt");
  9324. + if (!factual) {
  9325. + printf("Failed to create %s actual file.\n", kind.c_str());
  9326. + return 2;
  9327. + }
  9328. + printValueTree(factual, *root);
  9329. + fclose(factual);
  9330. + }
  9331. + return 0;
  9332. +}
  9333. +// static JSONCPP_STRING useFastWriter(Json::Value const& root) {
  9334. +// Json::FastWriter writer;
  9335. +// writer.enableYAMLCompatibility();
  9336. +// return writer.write(root);
  9337. +// }
  9338. +static JSONCPP_STRING useStyledWriter(
  9339. + Json::Value const& root)
  9340. +{
  9341. + Json::StyledWriter writer;
  9342. + return writer.write(root);
  9343. +}
  9344. +static JSONCPP_STRING useStyledStreamWriter(
  9345. + Json::Value const& root)
  9346. +{
  9347. + Json::StyledStreamWriter writer;
  9348. + JSONCPP_OSTRINGSTREAM sout;
  9349. + writer.write(sout, root);
  9350. + return sout.str();
  9351. +}
  9352. +static JSONCPP_STRING useBuiltStyledStreamWriter(
  9353. + Json::Value const& root)
  9354. +{
  9355. + Json::StreamWriterBuilder builder;
  9356. + return Json::writeString(builder, root);
  9357. +}
  9358. +static int rewriteValueTree(
  9359. + const JSONCPP_STRING& rewritePath,
  9360. + const Json::Value& root,
  9361. + Options::writeFuncType write,
  9362. + JSONCPP_STRING* rewrite)
  9363. +{
  9364. + *rewrite = write(root);
  9365. + FILE* fout = fopen(rewritePath.c_str(), "wt");
  9366. + if (!fout) {
  9367. + printf("Failed to create rewrite file: %s\n", rewritePath.c_str());
  9368. + return 2;
  9369. + }
  9370. + fprintf(fout, "%s\n", rewrite->c_str());
  9371. + fclose(fout);
  9372. + return 0;
  9373. +}
  9374. +
  9375. +static JSONCPP_STRING removeSuffix(const JSONCPP_STRING& path,
  9376. + const JSONCPP_STRING& extension) {
  9377. + if (extension.length() >= path.length())
  9378. + return JSONCPP_STRING("");
  9379. + JSONCPP_STRING suffix = path.substr(path.length() - extension.length());
  9380. + if (suffix != extension)
  9381. + return JSONCPP_STRING("");
  9382. + return path.substr(0, path.length() - extension.length());
  9383. +}
  9384. +
  9385. +static void printConfig() {
  9386. +// Print the configuration used to compile JsonCpp
  9387. +#if defined(JSON_NO_INT64)
  9388. + printf("JSON_NO_INT64=1\n");
  9389. +#else
  9390. + printf("JSON_NO_INT64=0\n");
  9391. +#endif
  9392. +}
  9393. +
  9394. +static int printUsage(const char* argv[]) {
  9395. + printf("Usage: %s [--strict] input-json-file", argv[0]);
  9396. + return 3;
  9397. +}
  9398. +
  9399. +static int parseCommandLine(
  9400. + int argc, const char* argv[], Options* opts)
  9401. +{
  9402. + opts->parseOnly = false;
  9403. + opts->write = &useStyledWriter;
  9404. + if (argc < 2) {
  9405. + return printUsage(argv);
  9406. + }
  9407. + int index = 1;
  9408. + if (JSONCPP_STRING(argv[index]) == "--json-checker") {
  9409. + opts->features = Json::Features::strictMode();
  9410. + opts->parseOnly = true;
  9411. + ++index;
  9412. + }
  9413. + if (JSONCPP_STRING(argv[index]) == "--json-config") {
  9414. + printConfig();
  9415. + return 3;
  9416. + }
  9417. + if (JSONCPP_STRING(argv[index]) == "--json-writer") {
  9418. + ++index;
  9419. + JSONCPP_STRING const writerName(argv[index++]);
  9420. + if (writerName == "StyledWriter") {
  9421. + opts->write = &useStyledWriter;
  9422. + } else if (writerName == "StyledStreamWriter") {
  9423. + opts->write = &useStyledStreamWriter;
  9424. + } else if (writerName == "BuiltStyledStreamWriter") {
  9425. + opts->write = &useBuiltStyledStreamWriter;
  9426. + } else {
  9427. + printf("Unknown '--json-writer %s'\n", writerName.c_str());
  9428. + return 4;
  9429. + }
  9430. + }
  9431. + if (index == argc || index + 1 < argc) {
  9432. + return printUsage(argv);
  9433. + }
  9434. + opts->path = argv[index];
  9435. + return 0;
  9436. +}
  9437. +static int runTest(Options const& opts)
  9438. +{
  9439. + int exitCode = 0;
  9440. +
  9441. + JSONCPP_STRING input = readInputTestFile(opts.path.c_str());
  9442. + if (input.empty()) {
  9443. + printf("Failed to read input or empty input: %s\n", opts.path.c_str());
  9444. + return 3;
  9445. + }
  9446. +
  9447. + JSONCPP_STRING basePath = removeSuffix(opts.path, ".json");
  9448. + if (!opts.parseOnly && basePath.empty()) {
  9449. + printf("Bad input path. Path does not end with '.expected':\n%s\n",
  9450. + opts.path.c_str());
  9451. + return 3;
  9452. + }
  9453. +
  9454. + JSONCPP_STRING const actualPath = basePath + ".actual";
  9455. + JSONCPP_STRING const rewritePath = basePath + ".rewrite";
  9456. + JSONCPP_STRING const rewriteActualPath = basePath + ".actual-rewrite";
  9457. +
  9458. + Json::Value root;
  9459. + exitCode = parseAndSaveValueTree(
  9460. + input, actualPath, "input",
  9461. + opts.features, opts.parseOnly, &root);
  9462. + if (exitCode || opts.parseOnly) {
  9463. + return exitCode;
  9464. + }
  9465. + JSONCPP_STRING rewrite;
  9466. + exitCode = rewriteValueTree(rewritePath, root, opts.write, &rewrite);
  9467. + if (exitCode) {
  9468. + return exitCode;
  9469. + }
  9470. + Json::Value rewriteRoot;
  9471. + exitCode = parseAndSaveValueTree(
  9472. + rewrite, rewriteActualPath, "rewrite",
  9473. + opts.features, opts.parseOnly, &rewriteRoot);
  9474. + if (exitCode) {
  9475. + return exitCode;
  9476. + }
  9477. + return 0;
  9478. +}
  9479. +int main(int argc, const char* argv[]) {
  9480. + Options opts;
  9481. + try {
  9482. + int exitCode = parseCommandLine(argc, argv, &opts);
  9483. + if (exitCode != 0) {
  9484. + printf("Failed to parse command-line.");
  9485. + return exitCode;
  9486. + }
  9487. + return runTest(opts);
  9488. + }
  9489. + catch (const std::exception& e) {
  9490. + printf("Unhandled exception:\n%s\n", e.what());
  9491. + return 1;
  9492. + }
  9493. +}
  9494. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/sconscript polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/sconscript
  9495. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/sconscript 1970-01-01 02:00:00.000000000 +0200
  9496. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/jsontestrunner/sconscript 2017-12-03 19:05:22.000000000 +0300
  9497. @@ -0,0 +1,9 @@
  9498. +Import( 'env_testing buildJSONTests' )
  9499. +
  9500. +buildJSONTests( env_testing, Split( """
  9501. + main.cpp
  9502. + """ ),
  9503. + 'jsontestrunner' )
  9504. +
  9505. +# For 'check' to work, 'libs' must be built first.
  9506. +env_testing.Depends('jsontestrunner', '#libs')
  9507. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/CMakeLists.txt
  9508. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  9509. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  9510. @@ -0,0 +1,85 @@
  9511. +if( CMAKE_COMPILER_IS_GNUCXX )
  9512. + #Get compiler version.
  9513. + execute_process( COMMAND ${CMAKE_CXX_COMPILER} -dumpversion
  9514. + OUTPUT_VARIABLE GNUCXX_VERSION )
  9515. +
  9516. + #-Werror=* was introduced -after- GCC 4.1.2
  9517. + if( GNUCXX_VERSION VERSION_GREATER 4.1.2 )
  9518. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=strict-aliasing")
  9519. + endif()
  9520. +endif( CMAKE_COMPILER_IS_GNUCXX )
  9521. +
  9522. +SET( JSONCPP_INCLUDE_DIR ../../include )
  9523. +
  9524. +SET( PUBLIC_HEADERS
  9525. + ${JSONCPP_INCLUDE_DIR}/json/config.h
  9526. + ${JSONCPP_INCLUDE_DIR}/json/forwards.h
  9527. + ${JSONCPP_INCLUDE_DIR}/json/features.h
  9528. + ${JSONCPP_INCLUDE_DIR}/json/value.h
  9529. + ${JSONCPP_INCLUDE_DIR}/json/reader.h
  9530. + ${JSONCPP_INCLUDE_DIR}/json/writer.h
  9531. + ${JSONCPP_INCLUDE_DIR}/json/assertions.h
  9532. + ${JSONCPP_INCLUDE_DIR}/json/version.h
  9533. + )
  9534. +
  9535. +SOURCE_GROUP( "Public API" FILES ${PUBLIC_HEADERS} )
  9536. +
  9537. +SET(jsoncpp_sources
  9538. + json_tool.h
  9539. + json_reader.cpp
  9540. + json_valueiterator.inl
  9541. + json_value.cpp
  9542. + json_writer.cpp
  9543. + version.h.in)
  9544. +
  9545. +# Install instructions for this target
  9546. +IF(JSONCPP_WITH_CMAKE_PACKAGE)
  9547. + SET(INSTALL_EXPORT EXPORT jsoncpp)
  9548. +ELSE(JSONCPP_WITH_CMAKE_PACKAGE)
  9549. + SET(INSTALL_EXPORT)
  9550. +ENDIF()
  9551. +
  9552. +IF(BUILD_SHARED_LIBS)
  9553. + ADD_DEFINITIONS( -DJSON_DLL_BUILD )
  9554. + ADD_LIBRARY(jsoncpp_lib SHARED ${PUBLIC_HEADERS} ${jsoncpp_sources})
  9555. + SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
  9556. + SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp
  9557. + DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
  9558. +
  9559. + # Set library's runtime search path on OSX
  9560. + IF(APPLE)
  9561. + SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES INSTALL_RPATH "@loader_path/." )
  9562. + ENDIF()
  9563. +
  9564. + INSTALL( TARGETS jsoncpp_lib ${INSTALL_EXPORT}
  9565. + RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
  9566. + LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
  9567. + ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
  9568. +
  9569. + IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
  9570. + TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib PUBLIC
  9571. + $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
  9572. + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>)
  9573. + ENDIF()
  9574. +
  9575. +ENDIF()
  9576. +
  9577. +IF(BUILD_STATIC_LIBS)
  9578. + ADD_LIBRARY(jsoncpp_lib_static STATIC ${PUBLIC_HEADERS} ${jsoncpp_sources})
  9579. + SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES VERSION ${JSONCPP_VERSION} SOVERSION ${JSONCPP_SOVERSION})
  9580. + SET_TARGET_PROPERTIES( jsoncpp_lib_static PROPERTIES OUTPUT_NAME jsoncpp
  9581. + DEBUG_OUTPUT_NAME jsoncpp${DEBUG_LIBNAME_SUFFIX} )
  9582. +
  9583. + INSTALL( TARGETS jsoncpp_lib_static ${INSTALL_EXPORT}
  9584. + RUNTIME DESTINATION ${RUNTIME_INSTALL_DIR}
  9585. + LIBRARY DESTINATION ${LIBRARY_INSTALL_DIR}
  9586. + ARCHIVE DESTINATION ${ARCHIVE_INSTALL_DIR})
  9587. +
  9588. + IF(NOT CMAKE_VERSION VERSION_LESS 2.8.11)
  9589. + TARGET_INCLUDE_DIRECTORIES( jsoncpp_lib_static PUBLIC
  9590. + $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
  9591. + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
  9592. + )
  9593. + ENDIF()
  9594. +
  9595. +ENDIF()
  9596. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_reader.cpp polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_reader.cpp
  9597. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_reader.cpp 1970-01-01 02:00:00.000000000 +0200
  9598. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_reader.cpp 2017-12-03 19:05:22.000000000 +0300
  9599. @@ -0,0 +1,2040 @@
  9600. +// Copyright 2007-2011 Baptiste Lepilleur
  9601. +// Distributed under MIT license, or public domain if desired and
  9602. +// recognized in your jurisdiction.
  9603. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  9604. +
  9605. +#if !defined(JSON_IS_AMALGAMATION)
  9606. +#include <json/assertions.h>
  9607. +#include <json/reader.h>
  9608. +#include <json/value.h>
  9609. +#include "json_tool.h"
  9610. +#endif // if !defined(JSON_IS_AMALGAMATION)
  9611. +#include <utility>
  9612. +#include <cstdio>
  9613. +#include <cassert>
  9614. +#include <cstring>
  9615. +#include <istream>
  9616. +#include <sstream>
  9617. +#include <memory>
  9618. +#include <set>
  9619. +#include <limits>
  9620. +
  9621. +#if defined(_MSC_VER)
  9622. +#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
  9623. +#define snprintf sprintf_s
  9624. +#elif _MSC_VER >= 1900 // VC++ 14.0 and above
  9625. +#define snprintf std::snprintf
  9626. +#else
  9627. +#define snprintf _snprintf
  9628. +#endif
  9629. +#elif defined(__ANDROID__) || defined(__QNXNTO__)
  9630. +#define snprintf snprintf
  9631. +#elif __cplusplus >= 201103L
  9632. +#if !defined(__MINGW32__) && !defined(__CYGWIN__)
  9633. +#define snprintf std::snprintf
  9634. +#endif
  9635. +#endif
  9636. +
  9637. +#if defined(__QNXNTO__)
  9638. +#define sscanf std::sscanf
  9639. +#endif
  9640. +
  9641. +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
  9642. +// Disable warning about strdup being deprecated.
  9643. +#pragma warning(disable : 4996)
  9644. +#endif
  9645. +
  9646. +static int const stackLimit_g = 1000;
  9647. +static int stackDepth_g = 0; // see readValue()
  9648. +
  9649. +namespace Json {
  9650. +
  9651. +#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
  9652. +typedef std::unique_ptr<CharReader> CharReaderPtr;
  9653. +#else
  9654. +typedef std::auto_ptr<CharReader> CharReaderPtr;
  9655. +#endif
  9656. +
  9657. +// Implementation of class Features
  9658. +// ////////////////////////////////
  9659. +
  9660. +Features::Features()
  9661. + : allowComments_(true), strictRoot_(false),
  9662. + allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {}
  9663. +
  9664. +Features Features::all() { return Features(); }
  9665. +
  9666. +Features Features::strictMode() {
  9667. + Features features;
  9668. + features.allowComments_ = false;
  9669. + features.strictRoot_ = true;
  9670. + features.allowDroppedNullPlaceholders_ = false;
  9671. + features.allowNumericKeys_ = false;
  9672. + return features;
  9673. +}
  9674. +
  9675. +// Implementation of class Reader
  9676. +// ////////////////////////////////
  9677. +
  9678. +static bool containsNewLine(Reader::Location begin, Reader::Location end) {
  9679. + for (; begin < end; ++begin)
  9680. + if (*begin == '\n' || *begin == '\r')
  9681. + return true;
  9682. + return false;
  9683. +}
  9684. +
  9685. +// Class Reader
  9686. +// //////////////////////////////////////////////////////////////////
  9687. +
  9688. +Reader::Reader()
  9689. + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
  9690. + lastValue_(), commentsBefore_(), features_(Features::all()),
  9691. + collectComments_() {}
  9692. +
  9693. +Reader::Reader(const Features& features)
  9694. + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
  9695. + lastValue_(), commentsBefore_(), features_(features), collectComments_() {
  9696. +}
  9697. +
  9698. +bool
  9699. +Reader::parse(const std::string& document, Value& root, bool collectComments) {
  9700. + JSONCPP_STRING documentCopy(document.data(), document.data() + document.capacity());
  9701. + std::swap(documentCopy, document_);
  9702. + const char* begin = document_.c_str();
  9703. + const char* end = begin + document_.length();
  9704. + return parse(begin, end, root, collectComments);
  9705. +}
  9706. +
  9707. +bool Reader::parse(std::istream& sin, Value& root, bool collectComments) {
  9708. + // std::istream_iterator<char> begin(sin);
  9709. + // std::istream_iterator<char> end;
  9710. + // Those would allow streamed input from a file, if parse() were a
  9711. + // template function.
  9712. +
  9713. + // Since JSONCPP_STRING is reference-counted, this at least does not
  9714. + // create an extra copy.
  9715. + JSONCPP_STRING doc;
  9716. + std::getline(sin, doc, (char)EOF);
  9717. + return parse(doc.data(), doc.data() + doc.size(), root, collectComments);
  9718. +}
  9719. +
  9720. +bool Reader::parse(const char* beginDoc,
  9721. + const char* endDoc,
  9722. + Value& root,
  9723. + bool collectComments) {
  9724. + if (!features_.allowComments_) {
  9725. + collectComments = false;
  9726. + }
  9727. +
  9728. + begin_ = beginDoc;
  9729. + end_ = endDoc;
  9730. + collectComments_ = collectComments;
  9731. + current_ = begin_;
  9732. + lastValueEnd_ = 0;
  9733. + lastValue_ = 0;
  9734. + commentsBefore_ = "";
  9735. + errors_.clear();
  9736. + while (!nodes_.empty())
  9737. + nodes_.pop();
  9738. + nodes_.push(&root);
  9739. +
  9740. + stackDepth_g = 0; // Yes, this is bad coding, but options are limited.
  9741. + bool successful = readValue();
  9742. + Token token;
  9743. + skipCommentTokens(token);
  9744. + if (collectComments_ && !commentsBefore_.empty())
  9745. + root.setComment(commentsBefore_, commentAfter);
  9746. + if (features_.strictRoot_) {
  9747. + if (!root.isArray() && !root.isObject()) {
  9748. + // Set error location to start of doc, ideally should be first token found
  9749. + // in doc
  9750. + token.type_ = tokenError;
  9751. + token.start_ = beginDoc;
  9752. + token.end_ = endDoc;
  9753. + addError(
  9754. + "A valid JSON document must be either an array or an object value.",
  9755. + token);
  9756. + return false;
  9757. + }
  9758. + }
  9759. + return successful;
  9760. +}
  9761. +
  9762. +bool Reader::readValue() {
  9763. + // This is a non-reentrant way to support a stackLimit. Terrible!
  9764. + // But this deprecated class has a security problem: Bad input can
  9765. + // cause a seg-fault. This seems like a fair, binary-compatible way
  9766. + // to prevent the problem.
  9767. + if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue().");
  9768. + ++stackDepth_g;
  9769. +
  9770. + Token token;
  9771. + skipCommentTokens(token);
  9772. + bool successful = true;
  9773. +
  9774. + if (collectComments_ && !commentsBefore_.empty()) {
  9775. + currentValue().setComment(commentsBefore_, commentBefore);
  9776. + commentsBefore_ = "";
  9777. + }
  9778. +
  9779. + switch (token.type_) {
  9780. + case tokenObjectBegin:
  9781. + successful = readObject(token);
  9782. + currentValue().setOffsetLimit(current_ - begin_);
  9783. + break;
  9784. + case tokenArrayBegin:
  9785. + successful = readArray(token);
  9786. + currentValue().setOffsetLimit(current_ - begin_);
  9787. + break;
  9788. + case tokenNumber:
  9789. + successful = decodeNumber(token);
  9790. + break;
  9791. + case tokenString:
  9792. + successful = decodeString(token);
  9793. + break;
  9794. + case tokenTrue:
  9795. + {
  9796. + Value v(true);
  9797. + currentValue().swapPayload(v);
  9798. + currentValue().setOffsetStart(token.start_ - begin_);
  9799. + currentValue().setOffsetLimit(token.end_ - begin_);
  9800. + }
  9801. + break;
  9802. + case tokenFalse:
  9803. + {
  9804. + Value v(false);
  9805. + currentValue().swapPayload(v);
  9806. + currentValue().setOffsetStart(token.start_ - begin_);
  9807. + currentValue().setOffsetLimit(token.end_ - begin_);
  9808. + }
  9809. + break;
  9810. + case tokenNull:
  9811. + {
  9812. + Value v;
  9813. + currentValue().swapPayload(v);
  9814. + currentValue().setOffsetStart(token.start_ - begin_);
  9815. + currentValue().setOffsetLimit(token.end_ - begin_);
  9816. + }
  9817. + break;
  9818. + case tokenArraySeparator:
  9819. + case tokenObjectEnd:
  9820. + case tokenArrayEnd:
  9821. + if (features_.allowDroppedNullPlaceholders_) {
  9822. + // "Un-read" the current token and mark the current value as a null
  9823. + // token.
  9824. + current_--;
  9825. + Value v;
  9826. + currentValue().swapPayload(v);
  9827. + currentValue().setOffsetStart(current_ - begin_ - 1);
  9828. + currentValue().setOffsetLimit(current_ - begin_);
  9829. + break;
  9830. + } // Else, fall through...
  9831. + default:
  9832. + currentValue().setOffsetStart(token.start_ - begin_);
  9833. + currentValue().setOffsetLimit(token.end_ - begin_);
  9834. + return addError("Syntax error: value, object or array expected.", token);
  9835. + }
  9836. +
  9837. + if (collectComments_) {
  9838. + lastValueEnd_ = current_;
  9839. + lastValue_ = &currentValue();
  9840. + }
  9841. +
  9842. + --stackDepth_g;
  9843. + return successful;
  9844. +}
  9845. +
  9846. +void Reader::skipCommentTokens(Token& token) {
  9847. + if (features_.allowComments_) {
  9848. + do {
  9849. + readToken(token);
  9850. + } while (token.type_ == tokenComment);
  9851. + } else {
  9852. + readToken(token);
  9853. + }
  9854. +}
  9855. +
  9856. +bool Reader::readToken(Token& token) {
  9857. + skipSpaces();
  9858. + token.start_ = current_;
  9859. + Char c = getNextChar();
  9860. + bool ok = true;
  9861. + switch (c) {
  9862. + case '{':
  9863. + token.type_ = tokenObjectBegin;
  9864. + break;
  9865. + case '}':
  9866. + token.type_ = tokenObjectEnd;
  9867. + break;
  9868. + case '[':
  9869. + token.type_ = tokenArrayBegin;
  9870. + break;
  9871. + case ']':
  9872. + token.type_ = tokenArrayEnd;
  9873. + break;
  9874. + case '"':
  9875. + token.type_ = tokenString;
  9876. + ok = readString();
  9877. + break;
  9878. + case '/':
  9879. + token.type_ = tokenComment;
  9880. + ok = readComment();
  9881. + break;
  9882. + case '0':
  9883. + case '1':
  9884. + case '2':
  9885. + case '3':
  9886. + case '4':
  9887. + case '5':
  9888. + case '6':
  9889. + case '7':
  9890. + case '8':
  9891. + case '9':
  9892. + case '-':
  9893. + token.type_ = tokenNumber;
  9894. + readNumber();
  9895. + break;
  9896. + case 't':
  9897. + token.type_ = tokenTrue;
  9898. + ok = match("rue", 3);
  9899. + break;
  9900. + case 'f':
  9901. + token.type_ = tokenFalse;
  9902. + ok = match("alse", 4);
  9903. + break;
  9904. + case 'n':
  9905. + token.type_ = tokenNull;
  9906. + ok = match("ull", 3);
  9907. + break;
  9908. + case ',':
  9909. + token.type_ = tokenArraySeparator;
  9910. + break;
  9911. + case ':':
  9912. + token.type_ = tokenMemberSeparator;
  9913. + break;
  9914. + case 0:
  9915. + token.type_ = tokenEndOfStream;
  9916. + break;
  9917. + default:
  9918. + ok = false;
  9919. + break;
  9920. + }
  9921. + if (!ok)
  9922. + token.type_ = tokenError;
  9923. + token.end_ = current_;
  9924. + return true;
  9925. +}
  9926. +
  9927. +void Reader::skipSpaces() {
  9928. + while (current_ != end_) {
  9929. + Char c = *current_;
  9930. + if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
  9931. + ++current_;
  9932. + else
  9933. + break;
  9934. + }
  9935. +}
  9936. +
  9937. +bool Reader::match(Location pattern, int patternLength) {
  9938. + if (end_ - current_ < patternLength)
  9939. + return false;
  9940. + int index = patternLength;
  9941. + while (index--)
  9942. + if (current_[index] != pattern[index])
  9943. + return false;
  9944. + current_ += patternLength;
  9945. + return true;
  9946. +}
  9947. +
  9948. +bool Reader::readComment() {
  9949. + Location commentBegin = current_ - 1;
  9950. + Char c = getNextChar();
  9951. + bool successful = false;
  9952. + if (c == '*')
  9953. + successful = readCStyleComment();
  9954. + else if (c == '/')
  9955. + successful = readCppStyleComment();
  9956. + if (!successful)
  9957. + return false;
  9958. +
  9959. + if (collectComments_) {
  9960. + CommentPlacement placement = commentBefore;
  9961. + if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) {
  9962. + if (c != '*' || !containsNewLine(commentBegin, current_))
  9963. + placement = commentAfterOnSameLine;
  9964. + }
  9965. +
  9966. + addComment(commentBegin, current_, placement);
  9967. + }
  9968. + return true;
  9969. +}
  9970. +
  9971. +static JSONCPP_STRING normalizeEOL(Reader::Location begin, Reader::Location end) {
  9972. + JSONCPP_STRING normalized;
  9973. + normalized.reserve(static_cast<size_t>(end - begin));
  9974. + Reader::Location current = begin;
  9975. + while (current != end) {
  9976. + char c = *current++;
  9977. + if (c == '\r') {
  9978. + if (current != end && *current == '\n')
  9979. + // convert dos EOL
  9980. + ++current;
  9981. + // convert Mac EOL
  9982. + normalized += '\n';
  9983. + } else {
  9984. + normalized += c;
  9985. + }
  9986. + }
  9987. + return normalized;
  9988. +}
  9989. +
  9990. +void
  9991. +Reader::addComment(Location begin, Location end, CommentPlacement placement) {
  9992. + assert(collectComments_);
  9993. + const JSONCPP_STRING& normalized = normalizeEOL(begin, end);
  9994. + if (placement == commentAfterOnSameLine) {
  9995. + assert(lastValue_ != 0);
  9996. + lastValue_->setComment(normalized, placement);
  9997. + } else {
  9998. + commentsBefore_ += normalized;
  9999. + }
  10000. +}
  10001. +
  10002. +bool Reader::readCStyleComment() {
  10003. + while ((current_ + 1) < end_) {
  10004. + Char c = getNextChar();
  10005. + if (c == '*' && *current_ == '/')
  10006. + break;
  10007. + }
  10008. + return getNextChar() == '/';
  10009. +}
  10010. +
  10011. +bool Reader::readCppStyleComment() {
  10012. + while (current_ != end_) {
  10013. + Char c = getNextChar();
  10014. + if (c == '\n')
  10015. + break;
  10016. + if (c == '\r') {
  10017. + // Consume DOS EOL. It will be normalized in addComment.
  10018. + if (current_ != end_ && *current_ == '\n')
  10019. + getNextChar();
  10020. + // Break on Moc OS 9 EOL.
  10021. + break;
  10022. + }
  10023. + }
  10024. + return true;
  10025. +}
  10026. +
  10027. +void Reader::readNumber() {
  10028. + const char *p = current_;
  10029. + char c = '0'; // stopgap for already consumed character
  10030. + // integral part
  10031. + while (c >= '0' && c <= '9')
  10032. + c = (current_ = p) < end_ ? *p++ : '\0';
  10033. + // fractional part
  10034. + if (c == '.') {
  10035. + c = (current_ = p) < end_ ? *p++ : '\0';
  10036. + while (c >= '0' && c <= '9')
  10037. + c = (current_ = p) < end_ ? *p++ : '\0';
  10038. + }
  10039. + // exponential part
  10040. + if (c == 'e' || c == 'E') {
  10041. + c = (current_ = p) < end_ ? *p++ : '\0';
  10042. + if (c == '+' || c == '-')
  10043. + c = (current_ = p) < end_ ? *p++ : '\0';
  10044. + while (c >= '0' && c <= '9')
  10045. + c = (current_ = p) < end_ ? *p++ : '\0';
  10046. + }
  10047. +}
  10048. +
  10049. +bool Reader::readString() {
  10050. + Char c = '\0';
  10051. + while (current_ != end_) {
  10052. + c = getNextChar();
  10053. + if (c == '\\')
  10054. + getNextChar();
  10055. + else if (c == '"')
  10056. + break;
  10057. + }
  10058. + return c == '"';
  10059. +}
  10060. +
  10061. +bool Reader::readObject(Token& tokenStart) {
  10062. + Token tokenName;
  10063. + JSONCPP_STRING name;
  10064. + Value init(objectValue);
  10065. + currentValue().swapPayload(init);
  10066. + currentValue().setOffsetStart(tokenStart.start_ - begin_);
  10067. + while (readToken(tokenName)) {
  10068. + bool initialTokenOk = true;
  10069. + while (tokenName.type_ == tokenComment && initialTokenOk)
  10070. + initialTokenOk = readToken(tokenName);
  10071. + if (!initialTokenOk)
  10072. + break;
  10073. + if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
  10074. + return true;
  10075. + name = "";
  10076. + if (tokenName.type_ == tokenString) {
  10077. + if (!decodeString(tokenName, name))
  10078. + return recoverFromError(tokenObjectEnd);
  10079. + } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
  10080. + Value numberName;
  10081. + if (!decodeNumber(tokenName, numberName))
  10082. + return recoverFromError(tokenObjectEnd);
  10083. + name = JSONCPP_STRING(numberName.asCString());
  10084. + } else {
  10085. + break;
  10086. + }
  10087. +
  10088. + Token colon;
  10089. + if (!readToken(colon) || colon.type_ != tokenMemberSeparator) {
  10090. + return addErrorAndRecover(
  10091. + "Missing ':' after object member name", colon, tokenObjectEnd);
  10092. + }
  10093. + Value& value = currentValue()[name];
  10094. + nodes_.push(&value);
  10095. + bool ok = readValue();
  10096. + nodes_.pop();
  10097. + if (!ok) // error already set
  10098. + return recoverFromError(tokenObjectEnd);
  10099. +
  10100. + Token comma;
  10101. + if (!readToken(comma) ||
  10102. + (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
  10103. + comma.type_ != tokenComment)) {
  10104. + return addErrorAndRecover(
  10105. + "Missing ',' or '}' in object declaration", comma, tokenObjectEnd);
  10106. + }
  10107. + bool finalizeTokenOk = true;
  10108. + while (comma.type_ == tokenComment && finalizeTokenOk)
  10109. + finalizeTokenOk = readToken(comma);
  10110. + if (comma.type_ == tokenObjectEnd)
  10111. + return true;
  10112. + }
  10113. + return addErrorAndRecover(
  10114. + "Missing '}' or object member name", tokenName, tokenObjectEnd);
  10115. +}
  10116. +
  10117. +bool Reader::readArray(Token& tokenStart) {
  10118. + Value init(arrayValue);
  10119. + currentValue().swapPayload(init);
  10120. + currentValue().setOffsetStart(tokenStart.start_ - begin_);
  10121. + skipSpaces();
  10122. + if (current_ != end_ && *current_ == ']') // empty array
  10123. + {
  10124. + Token endArray;
  10125. + readToken(endArray);
  10126. + return true;
  10127. + }
  10128. + int index = 0;
  10129. + for (;;) {
  10130. + Value& value = currentValue()[index++];
  10131. + nodes_.push(&value);
  10132. + bool ok = readValue();
  10133. + nodes_.pop();
  10134. + if (!ok) // error already set
  10135. + return recoverFromError(tokenArrayEnd);
  10136. +
  10137. + Token token;
  10138. + // Accept Comment after last item in the array.
  10139. + ok = readToken(token);
  10140. + while (token.type_ == tokenComment && ok) {
  10141. + ok = readToken(token);
  10142. + }
  10143. + bool badTokenType =
  10144. + (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
  10145. + if (!ok || badTokenType) {
  10146. + return addErrorAndRecover(
  10147. + "Missing ',' or ']' in array declaration", token, tokenArrayEnd);
  10148. + }
  10149. + if (token.type_ == tokenArrayEnd)
  10150. + break;
  10151. + }
  10152. + return true;
  10153. +}
  10154. +
  10155. +bool Reader::decodeNumber(Token& token) {
  10156. + Value decoded;
  10157. + if (!decodeNumber(token, decoded))
  10158. + return false;
  10159. + currentValue().swapPayload(decoded);
  10160. + currentValue().setOffsetStart(token.start_ - begin_);
  10161. + currentValue().setOffsetLimit(token.end_ - begin_);
  10162. + return true;
  10163. +}
  10164. +
  10165. +bool Reader::decodeNumber(Token& token, Value& decoded) {
  10166. + // Attempts to parse the number as an integer. If the number is
  10167. + // larger than the maximum supported value of an integer then
  10168. + // we decode the number as a double.
  10169. + Location current = token.start_;
  10170. + bool isNegative = *current == '-';
  10171. + if (isNegative)
  10172. + ++current;
  10173. + // TODO: Help the compiler do the div and mod at compile time or get rid of them.
  10174. + Value::LargestUInt maxIntegerValue =
  10175. + isNegative ? Value::LargestUInt(Value::maxLargestInt) + 1
  10176. + : Value::maxLargestUInt;
  10177. + Value::LargestUInt threshold = maxIntegerValue / 10;
  10178. + Value::LargestUInt value = 0;
  10179. + while (current < token.end_) {
  10180. + Char c = *current++;
  10181. + if (c < '0' || c > '9')
  10182. + return decodeDouble(token, decoded);
  10183. + Value::UInt digit(static_cast<Value::UInt>(c - '0'));
  10184. + if (value >= threshold) {
  10185. + // We've hit or exceeded the max value divided by 10 (rounded down). If
  10186. + // a) we've only just touched the limit, b) this is the last digit, and
  10187. + // c) it's small enough to fit in that rounding delta, we're okay.
  10188. + // Otherwise treat this number as a double to avoid overflow.
  10189. + if (value > threshold || current != token.end_ ||
  10190. + digit > maxIntegerValue % 10) {
  10191. + return decodeDouble(token, decoded);
  10192. + }
  10193. + }
  10194. + value = value * 10 + digit;
  10195. + }
  10196. + if (isNegative && value == maxIntegerValue)
  10197. + decoded = Value::minLargestInt;
  10198. + else if (isNegative)
  10199. + decoded = -Value::LargestInt(value);
  10200. + else if (value <= Value::LargestUInt(Value::maxInt))
  10201. + decoded = Value::LargestInt(value);
  10202. + else
  10203. + decoded = value;
  10204. + return true;
  10205. +}
  10206. +
  10207. +bool Reader::decodeDouble(Token& token) {
  10208. + Value decoded;
  10209. + if (!decodeDouble(token, decoded))
  10210. + return false;
  10211. + currentValue().swapPayload(decoded);
  10212. + currentValue().setOffsetStart(token.start_ - begin_);
  10213. + currentValue().setOffsetLimit(token.end_ - begin_);
  10214. + return true;
  10215. +}
  10216. +
  10217. +bool Reader::decodeDouble(Token& token, Value& decoded) {
  10218. + double value = 0;
  10219. + JSONCPP_STRING buffer(token.start_, token.end_);
  10220. + JSONCPP_ISTRINGSTREAM is(buffer);
  10221. + if (!(is >> value))
  10222. + return addError("'" + JSONCPP_STRING(token.start_, token.end_) +
  10223. + "' is not a number.",
  10224. + token);
  10225. + decoded = value;
  10226. + return true;
  10227. +}
  10228. +
  10229. +bool Reader::decodeString(Token& token) {
  10230. + JSONCPP_STRING decoded_string;
  10231. + if (!decodeString(token, decoded_string))
  10232. + return false;
  10233. + Value decoded(decoded_string);
  10234. + currentValue().swapPayload(decoded);
  10235. + currentValue().setOffsetStart(token.start_ - begin_);
  10236. + currentValue().setOffsetLimit(token.end_ - begin_);
  10237. + return true;
  10238. +}
  10239. +
  10240. +bool Reader::decodeString(Token& token, JSONCPP_STRING& decoded) {
  10241. + decoded.reserve(static_cast<size_t>(token.end_ - token.start_ - 2));
  10242. + Location current = token.start_ + 1; // skip '"'
  10243. + Location end = token.end_ - 1; // do not include '"'
  10244. + while (current != end) {
  10245. + Char c = *current++;
  10246. + if (c == '"')
  10247. + break;
  10248. + else if (c == '\\') {
  10249. + if (current == end)
  10250. + return addError("Empty escape sequence in string", token, current);
  10251. + Char escape = *current++;
  10252. + switch (escape) {
  10253. + case '"':
  10254. + decoded += '"';
  10255. + break;
  10256. + case '/':
  10257. + decoded += '/';
  10258. + break;
  10259. + case '\\':
  10260. + decoded += '\\';
  10261. + break;
  10262. + case 'b':
  10263. + decoded += '\b';
  10264. + break;
  10265. + case 'f':
  10266. + decoded += '\f';
  10267. + break;
  10268. + case 'n':
  10269. + decoded += '\n';
  10270. + break;
  10271. + case 'r':
  10272. + decoded += '\r';
  10273. + break;
  10274. + case 't':
  10275. + decoded += '\t';
  10276. + break;
  10277. + case 'u': {
  10278. + unsigned int unicode;
  10279. + if (!decodeUnicodeCodePoint(token, current, end, unicode))
  10280. + return false;
  10281. + decoded += codePointToUTF8(unicode);
  10282. + } break;
  10283. + default:
  10284. + return addError("Bad escape sequence in string", token, current);
  10285. + }
  10286. + } else {
  10287. + decoded += c;
  10288. + }
  10289. + }
  10290. + return true;
  10291. +}
  10292. +
  10293. +bool Reader::decodeUnicodeCodePoint(Token& token,
  10294. + Location& current,
  10295. + Location end,
  10296. + unsigned int& unicode) {
  10297. +
  10298. + if (!decodeUnicodeEscapeSequence(token, current, end, unicode))
  10299. + return false;
  10300. + if (unicode >= 0xD800 && unicode <= 0xDBFF) {
  10301. + // surrogate pairs
  10302. + if (end - current < 6)
  10303. + return addError(
  10304. + "additional six characters expected to parse unicode surrogate pair.",
  10305. + token,
  10306. + current);
  10307. + unsigned int surrogatePair;
  10308. + if (*(current++) == '\\' && *(current++) == 'u') {
  10309. + if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) {
  10310. + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
  10311. + } else
  10312. + return false;
  10313. + } else
  10314. + return addError("expecting another \\u token to begin the second half of "
  10315. + "a unicode surrogate pair",
  10316. + token,
  10317. + current);
  10318. + }
  10319. + return true;
  10320. +}
  10321. +
  10322. +bool Reader::decodeUnicodeEscapeSequence(Token& token,
  10323. + Location& current,
  10324. + Location end,
  10325. + unsigned int& ret_unicode) {
  10326. + if (end - current < 4)
  10327. + return addError(
  10328. + "Bad unicode escape sequence in string: four digits expected.",
  10329. + token,
  10330. + current);
  10331. + int unicode = 0;
  10332. + for (int index = 0; index < 4; ++index) {
  10333. + Char c = *current++;
  10334. + unicode *= 16;
  10335. + if (c >= '0' && c <= '9')
  10336. + unicode += c - '0';
  10337. + else if (c >= 'a' && c <= 'f')
  10338. + unicode += c - 'a' + 10;
  10339. + else if (c >= 'A' && c <= 'F')
  10340. + unicode += c - 'A' + 10;
  10341. + else
  10342. + return addError(
  10343. + "Bad unicode escape sequence in string: hexadecimal digit expected.",
  10344. + token,
  10345. + current);
  10346. + }
  10347. + ret_unicode = static_cast<unsigned int>(unicode);
  10348. + return true;
  10349. +}
  10350. +
  10351. +bool
  10352. +Reader::addError(const JSONCPP_STRING& message, Token& token, Location extra) {
  10353. + ErrorInfo info;
  10354. + info.token_ = token;
  10355. + info.message_ = message;
  10356. + info.extra_ = extra;
  10357. + errors_.push_back(info);
  10358. + return false;
  10359. +}
  10360. +
  10361. +bool Reader::recoverFromError(TokenType skipUntilToken) {
  10362. + size_t const errorCount = errors_.size();
  10363. + Token skip;
  10364. + for (;;) {
  10365. + if (!readToken(skip))
  10366. + errors_.resize(errorCount); // discard errors caused by recovery
  10367. + if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream)
  10368. + break;
  10369. + }
  10370. + errors_.resize(errorCount);
  10371. + return false;
  10372. +}
  10373. +
  10374. +bool Reader::addErrorAndRecover(const JSONCPP_STRING& message,
  10375. + Token& token,
  10376. + TokenType skipUntilToken) {
  10377. + addError(message, token);
  10378. + return recoverFromError(skipUntilToken);
  10379. +}
  10380. +
  10381. +Value& Reader::currentValue() { return *(nodes_.top()); }
  10382. +
  10383. +Reader::Char Reader::getNextChar() {
  10384. + if (current_ == end_)
  10385. + return 0;
  10386. + return *current_++;
  10387. +}
  10388. +
  10389. +void Reader::getLocationLineAndColumn(Location location,
  10390. + int& line,
  10391. + int& column) const {
  10392. + Location current = begin_;
  10393. + Location lastLineStart = current;
  10394. + line = 0;
  10395. + while (current < location && current != end_) {
  10396. + Char c = *current++;
  10397. + if (c == '\r') {
  10398. + if (*current == '\n')
  10399. + ++current;
  10400. + lastLineStart = current;
  10401. + ++line;
  10402. + } else if (c == '\n') {
  10403. + lastLineStart = current;
  10404. + ++line;
  10405. + }
  10406. + }
  10407. + // column & line start at 1
  10408. + column = int(location - lastLineStart) + 1;
  10409. + ++line;
  10410. +}
  10411. +
  10412. +JSONCPP_STRING Reader::getLocationLineAndColumn(Location location) const {
  10413. + int line, column;
  10414. + getLocationLineAndColumn(location, line, column);
  10415. + char buffer[18 + 16 + 16 + 1];
  10416. + snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
  10417. + return buffer;
  10418. +}
  10419. +
  10420. +// Deprecated. Preserved for backward compatibility
  10421. +JSONCPP_STRING Reader::getFormatedErrorMessages() const {
  10422. + return getFormattedErrorMessages();
  10423. +}
  10424. +
  10425. +JSONCPP_STRING Reader::getFormattedErrorMessages() const {
  10426. + JSONCPP_STRING formattedMessage;
  10427. + for (Errors::const_iterator itError = errors_.begin();
  10428. + itError != errors_.end();
  10429. + ++itError) {
  10430. + const ErrorInfo& error = *itError;
  10431. + formattedMessage +=
  10432. + "* " + getLocationLineAndColumn(error.token_.start_) + "\n";
  10433. + formattedMessage += " " + error.message_ + "\n";
  10434. + if (error.extra_)
  10435. + formattedMessage +=
  10436. + "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n";
  10437. + }
  10438. + return formattedMessage;
  10439. +}
  10440. +
  10441. +std::vector<Reader::StructuredError> Reader::getStructuredErrors() const {
  10442. + std::vector<Reader::StructuredError> allErrors;
  10443. + for (Errors::const_iterator itError = errors_.begin();
  10444. + itError != errors_.end();
  10445. + ++itError) {
  10446. + const ErrorInfo& error = *itError;
  10447. + Reader::StructuredError structured;
  10448. + structured.offset_start = error.token_.start_ - begin_;
  10449. + structured.offset_limit = error.token_.end_ - begin_;
  10450. + structured.message = error.message_;
  10451. + allErrors.push_back(structured);
  10452. + }
  10453. + return allErrors;
  10454. +}
  10455. +
  10456. +bool Reader::pushError(const Value& value, const JSONCPP_STRING& message) {
  10457. + ptrdiff_t const length = end_ - begin_;
  10458. + if(value.getOffsetStart() > length
  10459. + || value.getOffsetLimit() > length)
  10460. + return false;
  10461. + Token token;
  10462. + token.type_ = tokenError;
  10463. + token.start_ = begin_ + value.getOffsetStart();
  10464. + token.end_ = end_ + value.getOffsetLimit();
  10465. + ErrorInfo info;
  10466. + info.token_ = token;
  10467. + info.message_ = message;
  10468. + info.extra_ = 0;
  10469. + errors_.push_back(info);
  10470. + return true;
  10471. +}
  10472. +
  10473. +bool Reader::pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra) {
  10474. + ptrdiff_t const length = end_ - begin_;
  10475. + if(value.getOffsetStart() > length
  10476. + || value.getOffsetLimit() > length
  10477. + || extra.getOffsetLimit() > length)
  10478. + return false;
  10479. + Token token;
  10480. + token.type_ = tokenError;
  10481. + token.start_ = begin_ + value.getOffsetStart();
  10482. + token.end_ = begin_ + value.getOffsetLimit();
  10483. + ErrorInfo info;
  10484. + info.token_ = token;
  10485. + info.message_ = message;
  10486. + info.extra_ = begin_ + extra.getOffsetStart();
  10487. + errors_.push_back(info);
  10488. + return true;
  10489. +}
  10490. +
  10491. +bool Reader::good() const {
  10492. + return !errors_.size();
  10493. +}
  10494. +
  10495. +// exact copy of Features
  10496. +class OurFeatures {
  10497. +public:
  10498. + static OurFeatures all();
  10499. + bool allowComments_;
  10500. + bool strictRoot_;
  10501. + bool allowDroppedNullPlaceholders_;
  10502. + bool allowNumericKeys_;
  10503. + bool allowSingleQuotes_;
  10504. + bool failIfExtra_;
  10505. + bool rejectDupKeys_;
  10506. + bool allowSpecialFloats_;
  10507. + int stackLimit_;
  10508. +}; // OurFeatures
  10509. +
  10510. +// exact copy of Implementation of class Features
  10511. +// ////////////////////////////////
  10512. +
  10513. +OurFeatures OurFeatures::all() { return OurFeatures(); }
  10514. +
  10515. +// Implementation of class Reader
  10516. +// ////////////////////////////////
  10517. +
  10518. +// exact copy of Reader, renamed to OurReader
  10519. +class OurReader {
  10520. +public:
  10521. + typedef char Char;
  10522. + typedef const Char* Location;
  10523. + struct StructuredError {
  10524. + ptrdiff_t offset_start;
  10525. + ptrdiff_t offset_limit;
  10526. + JSONCPP_STRING message;
  10527. + };
  10528. +
  10529. + OurReader(OurFeatures const& features);
  10530. + bool parse(const char* beginDoc,
  10531. + const char* endDoc,
  10532. + Value& root,
  10533. + bool collectComments = true);
  10534. + JSONCPP_STRING getFormattedErrorMessages() const;
  10535. + std::vector<StructuredError> getStructuredErrors() const;
  10536. + bool pushError(const Value& value, const JSONCPP_STRING& message);
  10537. + bool pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra);
  10538. + bool good() const;
  10539. +
  10540. +private:
  10541. + OurReader(OurReader const&); // no impl
  10542. + void operator=(OurReader const&); // no impl
  10543. +
  10544. + enum TokenType {
  10545. + tokenEndOfStream = 0,
  10546. + tokenObjectBegin,
  10547. + tokenObjectEnd,
  10548. + tokenArrayBegin,
  10549. + tokenArrayEnd,
  10550. + tokenString,
  10551. + tokenNumber,
  10552. + tokenTrue,
  10553. + tokenFalse,
  10554. + tokenNull,
  10555. + tokenNaN,
  10556. + tokenPosInf,
  10557. + tokenNegInf,
  10558. + tokenArraySeparator,
  10559. + tokenMemberSeparator,
  10560. + tokenComment,
  10561. + tokenError
  10562. + };
  10563. +
  10564. + class Token {
  10565. + public:
  10566. + TokenType type_;
  10567. + Location start_;
  10568. + Location end_;
  10569. + };
  10570. +
  10571. + class ErrorInfo {
  10572. + public:
  10573. + Token token_;
  10574. + JSONCPP_STRING message_;
  10575. + Location extra_;
  10576. + };
  10577. +
  10578. + typedef std::deque<ErrorInfo> Errors;
  10579. +
  10580. + bool readToken(Token& token);
  10581. + void skipSpaces();
  10582. + bool match(Location pattern, int patternLength);
  10583. + bool readComment();
  10584. + bool readCStyleComment();
  10585. + bool readCppStyleComment();
  10586. + bool readString();
  10587. + bool readStringSingleQuote();
  10588. + bool readNumber(bool checkInf);
  10589. + bool readValue();
  10590. + bool readObject(Token& token);
  10591. + bool readArray(Token& token);
  10592. + bool decodeNumber(Token& token);
  10593. + bool decodeNumber(Token& token, Value& decoded);
  10594. + bool decodeString(Token& token);
  10595. + bool decodeString(Token& token, JSONCPP_STRING& decoded);
  10596. + bool decodeDouble(Token& token);
  10597. + bool decodeDouble(Token& token, Value& decoded);
  10598. + bool decodeUnicodeCodePoint(Token& token,
  10599. + Location& current,
  10600. + Location end,
  10601. + unsigned int& unicode);
  10602. + bool decodeUnicodeEscapeSequence(Token& token,
  10603. + Location& current,
  10604. + Location end,
  10605. + unsigned int& unicode);
  10606. + bool addError(const JSONCPP_STRING& message, Token& token, Location extra = 0);
  10607. + bool recoverFromError(TokenType skipUntilToken);
  10608. + bool addErrorAndRecover(const JSONCPP_STRING& message,
  10609. + Token& token,
  10610. + TokenType skipUntilToken);
  10611. + void skipUntilSpace();
  10612. + Value& currentValue();
  10613. + Char getNextChar();
  10614. + void
  10615. + getLocationLineAndColumn(Location location, int& line, int& column) const;
  10616. + JSONCPP_STRING getLocationLineAndColumn(Location location) const;
  10617. + void addComment(Location begin, Location end, CommentPlacement placement);
  10618. + void skipCommentTokens(Token& token);
  10619. +
  10620. + typedef std::stack<Value*> Nodes;
  10621. + Nodes nodes_;
  10622. + Errors errors_;
  10623. + JSONCPP_STRING document_;
  10624. + Location begin_;
  10625. + Location end_;
  10626. + Location current_;
  10627. + Location lastValueEnd_;
  10628. + Value* lastValue_;
  10629. + JSONCPP_STRING commentsBefore_;
  10630. + int stackDepth_;
  10631. +
  10632. + OurFeatures const features_;
  10633. + bool collectComments_;
  10634. +}; // OurReader
  10635. +
  10636. +// complete copy of Read impl, for OurReader
  10637. +
  10638. +OurReader::OurReader(OurFeatures const& features)
  10639. + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(),
  10640. + lastValue_(), commentsBefore_(),
  10641. + stackDepth_(0),
  10642. + features_(features), collectComments_() {
  10643. +}
  10644. +
  10645. +bool OurReader::parse(const char* beginDoc,
  10646. + const char* endDoc,
  10647. + Value& root,
  10648. + bool collectComments) {
  10649. + if (!features_.allowComments_) {
  10650. + collectComments = false;
  10651. + }
  10652. +
  10653. + begin_ = beginDoc;
  10654. + end_ = endDoc;
  10655. + collectComments_ = collectComments;
  10656. + current_ = begin_;
  10657. + lastValueEnd_ = 0;
  10658. + lastValue_ = 0;
  10659. + commentsBefore_ = "";
  10660. + errors_.clear();
  10661. + while (!nodes_.empty())
  10662. + nodes_.pop();
  10663. + nodes_.push(&root);
  10664. +
  10665. + stackDepth_ = 0;
  10666. + bool successful = readValue();
  10667. + Token token;
  10668. + skipCommentTokens(token);
  10669. + if (features_.failIfExtra_) {
  10670. + if ((features_.strictRoot_ || token.type_ != tokenError) && token.type_ != tokenEndOfStream) {
  10671. + addError("Extra non-whitespace after JSON value.", token);
  10672. + return false;
  10673. + }
  10674. + }
  10675. + if (collectComments_ && !commentsBefore_.empty())
  10676. + root.setComment(commentsBefore_, commentAfter);
  10677. + if (features_.strictRoot_) {
  10678. + if (!root.isArray() && !root.isObject()) {
  10679. + // Set error location to start of doc, ideally should be first token found
  10680. + // in doc
  10681. + token.type_ = tokenError;
  10682. + token.start_ = beginDoc;
  10683. + token.end_ = endDoc;
  10684. + addError(
  10685. + "A valid JSON document must be either an array or an object value.",
  10686. + token);
  10687. + return false;
  10688. + }
  10689. + }
  10690. + return successful;
  10691. +}
  10692. +
  10693. +bool OurReader::readValue() {
  10694. + if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue().");
  10695. + ++stackDepth_;
  10696. + Token token;
  10697. + skipCommentTokens(token);
  10698. + bool successful = true;
  10699. +
  10700. + if (collectComments_ && !commentsBefore_.empty()) {
  10701. + currentValue().setComment(commentsBefore_, commentBefore);
  10702. + commentsBefore_ = "";
  10703. + }
  10704. +
  10705. + switch (token.type_) {
  10706. + case tokenObjectBegin:
  10707. + successful = readObject(token);
  10708. + currentValue().setOffsetLimit(current_ - begin_);
  10709. + break;
  10710. + case tokenArrayBegin:
  10711. + successful = readArray(token);
  10712. + currentValue().setOffsetLimit(current_ - begin_);
  10713. + break;
  10714. + case tokenNumber:
  10715. + successful = decodeNumber(token);
  10716. + break;
  10717. + case tokenString:
  10718. + successful = decodeString(token);
  10719. + break;
  10720. + case tokenTrue:
  10721. + {
  10722. + Value v(true);
  10723. + currentValue().swapPayload(v);
  10724. + currentValue().setOffsetStart(token.start_ - begin_);
  10725. + currentValue().setOffsetLimit(token.end_ - begin_);
  10726. + }
  10727. + break;
  10728. + case tokenFalse:
  10729. + {
  10730. + Value v(false);
  10731. + currentValue().swapPayload(v);
  10732. + currentValue().setOffsetStart(token.start_ - begin_);
  10733. + currentValue().setOffsetLimit(token.end_ - begin_);
  10734. + }
  10735. + break;
  10736. + case tokenNull:
  10737. + {
  10738. + Value v;
  10739. + currentValue().swapPayload(v);
  10740. + currentValue().setOffsetStart(token.start_ - begin_);
  10741. + currentValue().setOffsetLimit(token.end_ - begin_);
  10742. + }
  10743. + break;
  10744. + case tokenNaN:
  10745. + {
  10746. + Value v(std::numeric_limits<double>::quiet_NaN());
  10747. + currentValue().swapPayload(v);
  10748. + currentValue().setOffsetStart(token.start_ - begin_);
  10749. + currentValue().setOffsetLimit(token.end_ - begin_);
  10750. + }
  10751. + break;
  10752. + case tokenPosInf:
  10753. + {
  10754. + Value v(std::numeric_limits<double>::infinity());
  10755. + currentValue().swapPayload(v);
  10756. + currentValue().setOffsetStart(token.start_ - begin_);
  10757. + currentValue().setOffsetLimit(token.end_ - begin_);
  10758. + }
  10759. + break;
  10760. + case tokenNegInf:
  10761. + {
  10762. + Value v(-std::numeric_limits<double>::infinity());
  10763. + currentValue().swapPayload(v);
  10764. + currentValue().setOffsetStart(token.start_ - begin_);
  10765. + currentValue().setOffsetLimit(token.end_ - begin_);
  10766. + }
  10767. + break;
  10768. + case tokenArraySeparator:
  10769. + case tokenObjectEnd:
  10770. + case tokenArrayEnd:
  10771. + if (features_.allowDroppedNullPlaceholders_) {
  10772. + // "Un-read" the current token and mark the current value as a null
  10773. + // token.
  10774. + current_--;
  10775. + Value v;
  10776. + currentValue().swapPayload(v);
  10777. + currentValue().setOffsetStart(current_ - begin_ - 1);
  10778. + currentValue().setOffsetLimit(current_ - begin_);
  10779. + break;
  10780. + } // else, fall through ...
  10781. + default:
  10782. + currentValue().setOffsetStart(token.start_ - begin_);
  10783. + currentValue().setOffsetLimit(token.end_ - begin_);
  10784. + return addError("Syntax error: value, object or array expected.", token);
  10785. + }
  10786. +
  10787. + if (collectComments_) {
  10788. + lastValueEnd_ = current_;
  10789. + lastValue_ = &currentValue();
  10790. + }
  10791. +
  10792. + --stackDepth_;
  10793. + return successful;
  10794. +}
  10795. +
  10796. +void OurReader::skipCommentTokens(Token& token) {
  10797. + if (features_.allowComments_) {
  10798. + do {
  10799. + readToken(token);
  10800. + } while (token.type_ == tokenComment);
  10801. + } else {
  10802. + readToken(token);
  10803. + }
  10804. +}
  10805. +
  10806. +bool OurReader::readToken(Token& token) {
  10807. + skipSpaces();
  10808. + token.start_ = current_;
  10809. + Char c = getNextChar();
  10810. + bool ok = true;
  10811. + switch (c) {
  10812. + case '{':
  10813. + token.type_ = tokenObjectBegin;
  10814. + break;
  10815. + case '}':
  10816. + token.type_ = tokenObjectEnd;
  10817. + break;
  10818. + case '[':
  10819. + token.type_ = tokenArrayBegin;
  10820. + break;
  10821. + case ']':
  10822. + token.type_ = tokenArrayEnd;
  10823. + break;
  10824. + case '"':
  10825. + token.type_ = tokenString;
  10826. + ok = readString();
  10827. + break;
  10828. + case '\'':
  10829. + if (features_.allowSingleQuotes_) {
  10830. + token.type_ = tokenString;
  10831. + ok = readStringSingleQuote();
  10832. + break;
  10833. + } // else continue
  10834. + // FALLTHRU
  10835. + case '/':
  10836. + token.type_ = tokenComment;
  10837. + ok = readComment();
  10838. + break;
  10839. + case '0':
  10840. + case '1':
  10841. + case '2':
  10842. + case '3':
  10843. + case '4':
  10844. + case '5':
  10845. + case '6':
  10846. + case '7':
  10847. + case '8':
  10848. + case '9':
  10849. + token.type_ = tokenNumber;
  10850. + readNumber(false);
  10851. + break;
  10852. + case '-':
  10853. + if (readNumber(true)) {
  10854. + token.type_ = tokenNumber;
  10855. + } else {
  10856. + token.type_ = tokenNegInf;
  10857. + ok = features_.allowSpecialFloats_ && match("nfinity", 7);
  10858. + }
  10859. + break;
  10860. + case 't':
  10861. + token.type_ = tokenTrue;
  10862. + ok = match("rue", 3);
  10863. + break;
  10864. + case 'f':
  10865. + token.type_ = tokenFalse;
  10866. + ok = match("alse", 4);
  10867. + break;
  10868. + case 'n':
  10869. + token.type_ = tokenNull;
  10870. + ok = match("ull", 3);
  10871. + break;
  10872. + case 'N':
  10873. + if (features_.allowSpecialFloats_) {
  10874. + token.type_ = tokenNaN;
  10875. + ok = match("aN", 2);
  10876. + } else {
  10877. + ok = false;
  10878. + }
  10879. + break;
  10880. + case 'I':
  10881. + if (features_.allowSpecialFloats_) {
  10882. + token.type_ = tokenPosInf;
  10883. + ok = match("nfinity", 7);
  10884. + } else {
  10885. + ok = false;
  10886. + }
  10887. + break;
  10888. + case ',':
  10889. + token.type_ = tokenArraySeparator;
  10890. + break;
  10891. + case ':':
  10892. + token.type_ = tokenMemberSeparator;
  10893. + break;
  10894. + case 0:
  10895. + token.type_ = tokenEndOfStream;
  10896. + break;
  10897. + default:
  10898. + ok = false;
  10899. + break;
  10900. + }
  10901. + if (!ok)
  10902. + token.type_ = tokenError;
  10903. + token.end_ = current_;
  10904. + return true;
  10905. +}
  10906. +
  10907. +void OurReader::skipSpaces() {
  10908. + while (current_ != end_) {
  10909. + Char c = *current_;
  10910. + if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
  10911. + ++current_;
  10912. + else
  10913. + break;
  10914. + }
  10915. +}
  10916. +
  10917. +bool OurReader::match(Location pattern, int patternLength) {
  10918. + if (end_ - current_ < patternLength)
  10919. + return false;
  10920. + int index = patternLength;
  10921. + while (index--)
  10922. + if (current_[index] != pattern[index])
  10923. + return false;
  10924. + current_ += patternLength;
  10925. + return true;
  10926. +}
  10927. +
  10928. +bool OurReader::readComment() {
  10929. + Location commentBegin = current_ - 1;
  10930. + Char c = getNextChar();
  10931. + bool successful = false;
  10932. + if (c == '*')
  10933. + successful = readCStyleComment();
  10934. + else if (c == '/')
  10935. + successful = readCppStyleComment();
  10936. + if (!successful)
  10937. + return false;
  10938. +
  10939. + if (collectComments_) {
  10940. + CommentPlacement placement = commentBefore;
  10941. + if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) {
  10942. + if (c != '*' || !containsNewLine(commentBegin, current_))
  10943. + placement = commentAfterOnSameLine;
  10944. + }
  10945. +
  10946. + addComment(commentBegin, current_, placement);
  10947. + }
  10948. + return true;
  10949. +}
  10950. +
  10951. +void
  10952. +OurReader::addComment(Location begin, Location end, CommentPlacement placement) {
  10953. + assert(collectComments_);
  10954. + const JSONCPP_STRING& normalized = normalizeEOL(begin, end);
  10955. + if (placement == commentAfterOnSameLine) {
  10956. + assert(lastValue_ != 0);
  10957. + lastValue_->setComment(normalized, placement);
  10958. + } else {
  10959. + commentsBefore_ += normalized;
  10960. + }
  10961. +}
  10962. +
  10963. +bool OurReader::readCStyleComment() {
  10964. + while ((current_ + 1) < end_) {
  10965. + Char c = getNextChar();
  10966. + if (c == '*' && *current_ == '/')
  10967. + break;
  10968. + }
  10969. + return getNextChar() == '/';
  10970. +}
  10971. +
  10972. +bool OurReader::readCppStyleComment() {
  10973. + while (current_ != end_) {
  10974. + Char c = getNextChar();
  10975. + if (c == '\n')
  10976. + break;
  10977. + if (c == '\r') {
  10978. + // Consume DOS EOL. It will be normalized in addComment.
  10979. + if (current_ != end_ && *current_ == '\n')
  10980. + getNextChar();
  10981. + // Break on Moc OS 9 EOL.
  10982. + break;
  10983. + }
  10984. + }
  10985. + return true;
  10986. +}
  10987. +
  10988. +bool OurReader::readNumber(bool checkInf) {
  10989. + const char *p = current_;
  10990. + if (checkInf && p != end_ && *p == 'I') {
  10991. + current_ = ++p;
  10992. + return false;
  10993. + }
  10994. + char c = '0'; // stopgap for already consumed character
  10995. + // integral part
  10996. + while (c >= '0' && c <= '9')
  10997. + c = (current_ = p) < end_ ? *p++ : '\0';
  10998. + // fractional part
  10999. + if (c == '.') {
  11000. + c = (current_ = p) < end_ ? *p++ : '\0';
  11001. + while (c >= '0' && c <= '9')
  11002. + c = (current_ = p) < end_ ? *p++ : '\0';
  11003. + }
  11004. + // exponential part
  11005. + if (c == 'e' || c == 'E') {
  11006. + c = (current_ = p) < end_ ? *p++ : '\0';
  11007. + if (c == '+' || c == '-')
  11008. + c = (current_ = p) < end_ ? *p++ : '\0';
  11009. + while (c >= '0' && c <= '9')
  11010. + c = (current_ = p) < end_ ? *p++ : '\0';
  11011. + }
  11012. + return true;
  11013. +}
  11014. +bool OurReader::readString() {
  11015. + Char c = 0;
  11016. + while (current_ != end_) {
  11017. + c = getNextChar();
  11018. + if (c == '\\')
  11019. + getNextChar();
  11020. + else if (c == '"')
  11021. + break;
  11022. + }
  11023. + return c == '"';
  11024. +}
  11025. +
  11026. +
  11027. +bool OurReader::readStringSingleQuote() {
  11028. + Char c = 0;
  11029. + while (current_ != end_) {
  11030. + c = getNextChar();
  11031. + if (c == '\\')
  11032. + getNextChar();
  11033. + else if (c == '\'')
  11034. + break;
  11035. + }
  11036. + return c == '\'';
  11037. +}
  11038. +
  11039. +bool OurReader::readObject(Token& tokenStart) {
  11040. + Token tokenName;
  11041. + JSONCPP_STRING name;
  11042. + Value init(objectValue);
  11043. + currentValue().swapPayload(init);
  11044. + currentValue().setOffsetStart(tokenStart.start_ - begin_);
  11045. + while (readToken(tokenName)) {
  11046. + bool initialTokenOk = true;
  11047. + while (tokenName.type_ == tokenComment && initialTokenOk)
  11048. + initialTokenOk = readToken(tokenName);
  11049. + if (!initialTokenOk)
  11050. + break;
  11051. + if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object
  11052. + return true;
  11053. + name = "";
  11054. + if (tokenName.type_ == tokenString) {
  11055. + if (!decodeString(tokenName, name))
  11056. + return recoverFromError(tokenObjectEnd);
  11057. + } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) {
  11058. + Value numberName;
  11059. + if (!decodeNumber(tokenName, numberName))
  11060. + return recoverFromError(tokenObjectEnd);
  11061. + name = numberName.asString();
  11062. + } else {
  11063. + break;
  11064. + }
  11065. +
  11066. + Token colon;
  11067. + if (!readToken(colon) || colon.type_ != tokenMemberSeparator) {
  11068. + return addErrorAndRecover(
  11069. + "Missing ':' after object member name", colon, tokenObjectEnd);
  11070. + }
  11071. + if (name.length() >= (1U<<30)) throwRuntimeError("keylength >= 2^30");
  11072. + if (features_.rejectDupKeys_ && currentValue().isMember(name)) {
  11073. + JSONCPP_STRING msg = "Duplicate key: '" + name + "'";
  11074. + return addErrorAndRecover(
  11075. + msg, tokenName, tokenObjectEnd);
  11076. + }
  11077. + Value& value = currentValue()[name];
  11078. + nodes_.push(&value);
  11079. + bool ok = readValue();
  11080. + nodes_.pop();
  11081. + if (!ok) // error already set
  11082. + return recoverFromError(tokenObjectEnd);
  11083. +
  11084. + Token comma;
  11085. + if (!readToken(comma) ||
  11086. + (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator &&
  11087. + comma.type_ != tokenComment)) {
  11088. + return addErrorAndRecover(
  11089. + "Missing ',' or '}' in object declaration", comma, tokenObjectEnd);
  11090. + }
  11091. + bool finalizeTokenOk = true;
  11092. + while (comma.type_ == tokenComment && finalizeTokenOk)
  11093. + finalizeTokenOk = readToken(comma);
  11094. + if (comma.type_ == tokenObjectEnd)
  11095. + return true;
  11096. + }
  11097. + return addErrorAndRecover(
  11098. + "Missing '}' or object member name", tokenName, tokenObjectEnd);
  11099. +}
  11100. +
  11101. +bool OurReader::readArray(Token& tokenStart) {
  11102. + Value init(arrayValue);
  11103. + currentValue().swapPayload(init);
  11104. + currentValue().setOffsetStart(tokenStart.start_ - begin_);
  11105. + skipSpaces();
  11106. + if (current_ != end_ && *current_ == ']') // empty array
  11107. + {
  11108. + Token endArray;
  11109. + readToken(endArray);
  11110. + return true;
  11111. + }
  11112. + int index = 0;
  11113. + for (;;) {
  11114. + Value& value = currentValue()[index++];
  11115. + nodes_.push(&value);
  11116. + bool ok = readValue();
  11117. + nodes_.pop();
  11118. + if (!ok) // error already set
  11119. + return recoverFromError(tokenArrayEnd);
  11120. +
  11121. + Token token;
  11122. + // Accept Comment after last item in the array.
  11123. + ok = readToken(token);
  11124. + while (token.type_ == tokenComment && ok) {
  11125. + ok = readToken(token);
  11126. + }
  11127. + bool badTokenType =
  11128. + (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd);
  11129. + if (!ok || badTokenType) {
  11130. + return addErrorAndRecover(
  11131. + "Missing ',' or ']' in array declaration", token, tokenArrayEnd);
  11132. + }
  11133. + if (token.type_ == tokenArrayEnd)
  11134. + break;
  11135. + }
  11136. + return true;
  11137. +}
  11138. +
  11139. +bool OurReader::decodeNumber(Token& token) {
  11140. + Value decoded;
  11141. + if (!decodeNumber(token, decoded))
  11142. + return false;
  11143. + currentValue().swapPayload(decoded);
  11144. + currentValue().setOffsetStart(token.start_ - begin_);
  11145. + currentValue().setOffsetLimit(token.end_ - begin_);
  11146. + return true;
  11147. +}
  11148. +
  11149. +bool OurReader::decodeNumber(Token& token, Value& decoded) {
  11150. + // Attempts to parse the number as an integer. If the number is
  11151. + // larger than the maximum supported value of an integer then
  11152. + // we decode the number as a double.
  11153. + Location current = token.start_;
  11154. + bool isNegative = *current == '-';
  11155. + if (isNegative)
  11156. + ++current;
  11157. + // TODO: Help the compiler do the div and mod at compile time or get rid of them.
  11158. + Value::LargestUInt maxIntegerValue =
  11159. + isNegative ? Value::LargestUInt(-Value::minLargestInt)
  11160. + : Value::maxLargestUInt;
  11161. + Value::LargestUInt threshold = maxIntegerValue / 10;
  11162. + Value::LargestUInt value = 0;
  11163. + while (current < token.end_) {
  11164. + Char c = *current++;
  11165. + if (c < '0' || c > '9')
  11166. + return decodeDouble(token, decoded);
  11167. + Value::UInt digit(static_cast<Value::UInt>(c - '0'));
  11168. + if (value >= threshold) {
  11169. + // We've hit or exceeded the max value divided by 10 (rounded down). If
  11170. + // a) we've only just touched the limit, b) this is the last digit, and
  11171. + // c) it's small enough to fit in that rounding delta, we're okay.
  11172. + // Otherwise treat this number as a double to avoid overflow.
  11173. + if (value > threshold || current != token.end_ ||
  11174. + digit > maxIntegerValue % 10) {
  11175. + return decodeDouble(token, decoded);
  11176. + }
  11177. + }
  11178. + value = value * 10 + digit;
  11179. + }
  11180. + if (isNegative)
  11181. + decoded = -Value::LargestInt(value);
  11182. + else if (value <= Value::LargestUInt(Value::maxInt))
  11183. + decoded = Value::LargestInt(value);
  11184. + else
  11185. + decoded = value;
  11186. + return true;
  11187. +}
  11188. +
  11189. +bool OurReader::decodeDouble(Token& token) {
  11190. + Value decoded;
  11191. + if (!decodeDouble(token, decoded))
  11192. + return false;
  11193. + currentValue().swapPayload(decoded);
  11194. + currentValue().setOffsetStart(token.start_ - begin_);
  11195. + currentValue().setOffsetLimit(token.end_ - begin_);
  11196. + return true;
  11197. +}
  11198. +
  11199. +bool OurReader::decodeDouble(Token& token, Value& decoded) {
  11200. + double value = 0;
  11201. + const int bufferSize = 32;
  11202. + int count;
  11203. + ptrdiff_t const length = token.end_ - token.start_;
  11204. +
  11205. + // Sanity check to avoid buffer overflow exploits.
  11206. + if (length < 0) {
  11207. + return addError("Unable to parse token length", token);
  11208. + }
  11209. + size_t const ulength = static_cast<size_t>(length);
  11210. +
  11211. + // Avoid using a string constant for the format control string given to
  11212. + // sscanf, as this can cause hard to debug crashes on OS X. See here for more
  11213. + // info:
  11214. + //
  11215. + // http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html
  11216. + char format[] = "%lf";
  11217. +
  11218. + if (length <= bufferSize) {
  11219. + Char buffer[bufferSize + 1];
  11220. + memcpy(buffer, token.start_, ulength);
  11221. + buffer[length] = 0;
  11222. + fixNumericLocaleInput(buffer, buffer + length);
  11223. + count = sscanf(buffer, format, &value);
  11224. + } else {
  11225. + JSONCPP_STRING buffer(token.start_, token.end_);
  11226. + count = sscanf(buffer.c_str(), format, &value);
  11227. + }
  11228. +
  11229. + if (count != 1)
  11230. + return addError("'" + JSONCPP_STRING(token.start_, token.end_) +
  11231. + "' is not a number.",
  11232. + token);
  11233. + decoded = value;
  11234. + return true;
  11235. +}
  11236. +
  11237. +bool OurReader::decodeString(Token& token) {
  11238. + JSONCPP_STRING decoded_string;
  11239. + if (!decodeString(token, decoded_string))
  11240. + return false;
  11241. + Value decoded(decoded_string);
  11242. + currentValue().swapPayload(decoded);
  11243. + currentValue().setOffsetStart(token.start_ - begin_);
  11244. + currentValue().setOffsetLimit(token.end_ - begin_);
  11245. + return true;
  11246. +}
  11247. +
  11248. +bool OurReader::decodeString(Token& token, JSONCPP_STRING& decoded) {
  11249. + decoded.reserve(static_cast<size_t>(token.end_ - token.start_ - 2));
  11250. + Location current = token.start_ + 1; // skip '"'
  11251. + Location end = token.end_ - 1; // do not include '"'
  11252. + while (current != end) {
  11253. + Char c = *current++;
  11254. + if (c == '"')
  11255. + break;
  11256. + else if (c == '\\') {
  11257. + if (current == end)
  11258. + return addError("Empty escape sequence in string", token, current);
  11259. + Char escape = *current++;
  11260. + switch (escape) {
  11261. + case '"':
  11262. + decoded += '"';
  11263. + break;
  11264. + case '/':
  11265. + decoded += '/';
  11266. + break;
  11267. + case '\\':
  11268. + decoded += '\\';
  11269. + break;
  11270. + case 'b':
  11271. + decoded += '\b';
  11272. + break;
  11273. + case 'f':
  11274. + decoded += '\f';
  11275. + break;
  11276. + case 'n':
  11277. + decoded += '\n';
  11278. + break;
  11279. + case 'r':
  11280. + decoded += '\r';
  11281. + break;
  11282. + case 't':
  11283. + decoded += '\t';
  11284. + break;
  11285. + case 'u': {
  11286. + unsigned int unicode;
  11287. + if (!decodeUnicodeCodePoint(token, current, end, unicode))
  11288. + return false;
  11289. + decoded += codePointToUTF8(unicode);
  11290. + } break;
  11291. + default:
  11292. + return addError("Bad escape sequence in string", token, current);
  11293. + }
  11294. + } else {
  11295. + decoded += c;
  11296. + }
  11297. + }
  11298. + return true;
  11299. +}
  11300. +
  11301. +bool OurReader::decodeUnicodeCodePoint(Token& token,
  11302. + Location& current,
  11303. + Location end,
  11304. + unsigned int& unicode) {
  11305. +
  11306. + if (!decodeUnicodeEscapeSequence(token, current, end, unicode))
  11307. + return false;
  11308. + if (unicode >= 0xD800 && unicode <= 0xDBFF) {
  11309. + // surrogate pairs
  11310. + if (end - current < 6)
  11311. + return addError(
  11312. + "additional six characters expected to parse unicode surrogate pair.",
  11313. + token,
  11314. + current);
  11315. + unsigned int surrogatePair;
  11316. + if (*(current++) == '\\' && *(current++) == 'u') {
  11317. + if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) {
  11318. + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF);
  11319. + } else
  11320. + return false;
  11321. + } else
  11322. + return addError("expecting another \\u token to begin the second half of "
  11323. + "a unicode surrogate pair",
  11324. + token,
  11325. + current);
  11326. + }
  11327. + return true;
  11328. +}
  11329. +
  11330. +bool OurReader::decodeUnicodeEscapeSequence(Token& token,
  11331. + Location& current,
  11332. + Location end,
  11333. + unsigned int& ret_unicode) {
  11334. + if (end - current < 4)
  11335. + return addError(
  11336. + "Bad unicode escape sequence in string: four digits expected.",
  11337. + token,
  11338. + current);
  11339. + int unicode = 0;
  11340. + for (int index = 0; index < 4; ++index) {
  11341. + Char c = *current++;
  11342. + unicode *= 16;
  11343. + if (c >= '0' && c <= '9')
  11344. + unicode += c - '0';
  11345. + else if (c >= 'a' && c <= 'f')
  11346. + unicode += c - 'a' + 10;
  11347. + else if (c >= 'A' && c <= 'F')
  11348. + unicode += c - 'A' + 10;
  11349. + else
  11350. + return addError(
  11351. + "Bad unicode escape sequence in string: hexadecimal digit expected.",
  11352. + token,
  11353. + current);
  11354. + }
  11355. + ret_unicode = static_cast<unsigned int>(unicode);
  11356. + return true;
  11357. +}
  11358. +
  11359. +bool
  11360. +OurReader::addError(const JSONCPP_STRING& message, Token& token, Location extra) {
  11361. + ErrorInfo info;
  11362. + info.token_ = token;
  11363. + info.message_ = message;
  11364. + info.extra_ = extra;
  11365. + errors_.push_back(info);
  11366. + return false;
  11367. +}
  11368. +
  11369. +bool OurReader::recoverFromError(TokenType skipUntilToken) {
  11370. + size_t errorCount = errors_.size();
  11371. + Token skip;
  11372. + for (;;) {
  11373. + if (!readToken(skip))
  11374. + errors_.resize(errorCount); // discard errors caused by recovery
  11375. + if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream)
  11376. + break;
  11377. + }
  11378. + errors_.resize(errorCount);
  11379. + return false;
  11380. +}
  11381. +
  11382. +bool OurReader::addErrorAndRecover(const JSONCPP_STRING& message,
  11383. + Token& token,
  11384. + TokenType skipUntilToken) {
  11385. + addError(message, token);
  11386. + return recoverFromError(skipUntilToken);
  11387. +}
  11388. +
  11389. +Value& OurReader::currentValue() { return *(nodes_.top()); }
  11390. +
  11391. +OurReader::Char OurReader::getNextChar() {
  11392. + if (current_ == end_)
  11393. + return 0;
  11394. + return *current_++;
  11395. +}
  11396. +
  11397. +void OurReader::getLocationLineAndColumn(Location location,
  11398. + int& line,
  11399. + int& column) const {
  11400. + Location current = begin_;
  11401. + Location lastLineStart = current;
  11402. + line = 0;
  11403. + while (current < location && current != end_) {
  11404. + Char c = *current++;
  11405. + if (c == '\r') {
  11406. + if (*current == '\n')
  11407. + ++current;
  11408. + lastLineStart = current;
  11409. + ++line;
  11410. + } else if (c == '\n') {
  11411. + lastLineStart = current;
  11412. + ++line;
  11413. + }
  11414. + }
  11415. + // column & line start at 1
  11416. + column = int(location - lastLineStart) + 1;
  11417. + ++line;
  11418. +}
  11419. +
  11420. +JSONCPP_STRING OurReader::getLocationLineAndColumn(Location location) const {
  11421. + int line, column;
  11422. + getLocationLineAndColumn(location, line, column);
  11423. + char buffer[18 + 16 + 16 + 1];
  11424. + snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column);
  11425. + return buffer;
  11426. +}
  11427. +
  11428. +JSONCPP_STRING OurReader::getFormattedErrorMessages() const {
  11429. + JSONCPP_STRING formattedMessage;
  11430. + for (Errors::const_iterator itError = errors_.begin();
  11431. + itError != errors_.end();
  11432. + ++itError) {
  11433. + const ErrorInfo& error = *itError;
  11434. + formattedMessage +=
  11435. + "* " + getLocationLineAndColumn(error.token_.start_) + "\n";
  11436. + formattedMessage += " " + error.message_ + "\n";
  11437. + if (error.extra_)
  11438. + formattedMessage +=
  11439. + "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n";
  11440. + }
  11441. + return formattedMessage;
  11442. +}
  11443. +
  11444. +std::vector<OurReader::StructuredError> OurReader::getStructuredErrors() const {
  11445. + std::vector<OurReader::StructuredError> allErrors;
  11446. + for (Errors::const_iterator itError = errors_.begin();
  11447. + itError != errors_.end();
  11448. + ++itError) {
  11449. + const ErrorInfo& error = *itError;
  11450. + OurReader::StructuredError structured;
  11451. + structured.offset_start = error.token_.start_ - begin_;
  11452. + structured.offset_limit = error.token_.end_ - begin_;
  11453. + structured.message = error.message_;
  11454. + allErrors.push_back(structured);
  11455. + }
  11456. + return allErrors;
  11457. +}
  11458. +
  11459. +bool OurReader::pushError(const Value& value, const JSONCPP_STRING& message) {
  11460. + ptrdiff_t length = end_ - begin_;
  11461. + if(value.getOffsetStart() > length
  11462. + || value.getOffsetLimit() > length)
  11463. + return false;
  11464. + Token token;
  11465. + token.type_ = tokenError;
  11466. + token.start_ = begin_ + value.getOffsetStart();
  11467. + token.end_ = end_ + value.getOffsetLimit();
  11468. + ErrorInfo info;
  11469. + info.token_ = token;
  11470. + info.message_ = message;
  11471. + info.extra_ = 0;
  11472. + errors_.push_back(info);
  11473. + return true;
  11474. +}
  11475. +
  11476. +bool OurReader::pushError(const Value& value, const JSONCPP_STRING& message, const Value& extra) {
  11477. + ptrdiff_t length = end_ - begin_;
  11478. + if(value.getOffsetStart() > length
  11479. + || value.getOffsetLimit() > length
  11480. + || extra.getOffsetLimit() > length)
  11481. + return false;
  11482. + Token token;
  11483. + token.type_ = tokenError;
  11484. + token.start_ = begin_ + value.getOffsetStart();
  11485. + token.end_ = begin_ + value.getOffsetLimit();
  11486. + ErrorInfo info;
  11487. + info.token_ = token;
  11488. + info.message_ = message;
  11489. + info.extra_ = begin_ + extra.getOffsetStart();
  11490. + errors_.push_back(info);
  11491. + return true;
  11492. +}
  11493. +
  11494. +bool OurReader::good() const {
  11495. + return !errors_.size();
  11496. +}
  11497. +
  11498. +
  11499. +class OurCharReader : public CharReader {
  11500. + bool const collectComments_;
  11501. + OurReader reader_;
  11502. +public:
  11503. + OurCharReader(
  11504. + bool collectComments,
  11505. + OurFeatures const& features)
  11506. + : collectComments_(collectComments)
  11507. + , reader_(features)
  11508. + {}
  11509. + bool parse(
  11510. + char const* beginDoc, char const* endDoc,
  11511. + Value* root, JSONCPP_STRING* errs) JSONCPP_OVERRIDE {
  11512. + bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_);
  11513. + if (errs) {
  11514. + *errs = reader_.getFormattedErrorMessages();
  11515. + }
  11516. + return ok;
  11517. + }
  11518. +};
  11519. +
  11520. +CharReaderBuilder::CharReaderBuilder()
  11521. +{
  11522. + setDefaults(&settings_);
  11523. +}
  11524. +CharReaderBuilder::~CharReaderBuilder()
  11525. +{}
  11526. +CharReader* CharReaderBuilder::newCharReader() const
  11527. +{
  11528. + bool collectComments = settings_["collectComments"].asBool();
  11529. + OurFeatures features = OurFeatures::all();
  11530. + features.allowComments_ = settings_["allowComments"].asBool();
  11531. + features.strictRoot_ = settings_["strictRoot"].asBool();
  11532. + features.allowDroppedNullPlaceholders_ = settings_["allowDroppedNullPlaceholders"].asBool();
  11533. + features.allowNumericKeys_ = settings_["allowNumericKeys"].asBool();
  11534. + features.allowSingleQuotes_ = settings_["allowSingleQuotes"].asBool();
  11535. + features.stackLimit_ = settings_["stackLimit"].asInt();
  11536. + features.failIfExtra_ = settings_["failIfExtra"].asBool();
  11537. + features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool();
  11538. + features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool();
  11539. + return new OurCharReader(collectComments, features);
  11540. +}
  11541. +static void getValidReaderKeys(std::set<JSONCPP_STRING>* valid_keys)
  11542. +{
  11543. + valid_keys->clear();
  11544. + valid_keys->insert("collectComments");
  11545. + valid_keys->insert("allowComments");
  11546. + valid_keys->insert("strictRoot");
  11547. + valid_keys->insert("allowDroppedNullPlaceholders");
  11548. + valid_keys->insert("allowNumericKeys");
  11549. + valid_keys->insert("allowSingleQuotes");
  11550. + valid_keys->insert("stackLimit");
  11551. + valid_keys->insert("failIfExtra");
  11552. + valid_keys->insert("rejectDupKeys");
  11553. + valid_keys->insert("allowSpecialFloats");
  11554. +}
  11555. +bool CharReaderBuilder::validate(Json::Value* invalid) const
  11556. +{
  11557. + Json::Value my_invalid;
  11558. + if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL
  11559. + Json::Value& inv = *invalid;
  11560. + std::set<JSONCPP_STRING> valid_keys;
  11561. + getValidReaderKeys(&valid_keys);
  11562. + Value::Members keys = settings_.getMemberNames();
  11563. + size_t n = keys.size();
  11564. + for (size_t i = 0; i < n; ++i) {
  11565. + JSONCPP_STRING const& key = keys[i];
  11566. + if (valid_keys.find(key) == valid_keys.end()) {
  11567. + inv[key] = settings_[key];
  11568. + }
  11569. + }
  11570. + return 0u == inv.size();
  11571. +}
  11572. +Value& CharReaderBuilder::operator[](JSONCPP_STRING key)
  11573. +{
  11574. + return settings_[key];
  11575. +}
  11576. +// static
  11577. +void CharReaderBuilder::strictMode(Json::Value* settings)
  11578. +{
  11579. +//! [CharReaderBuilderStrictMode]
  11580. + (*settings)["allowComments"] = false;
  11581. + (*settings)["strictRoot"] = true;
  11582. + (*settings)["allowDroppedNullPlaceholders"] = false;
  11583. + (*settings)["allowNumericKeys"] = false;
  11584. + (*settings)["allowSingleQuotes"] = false;
  11585. + (*settings)["stackLimit"] = 1000;
  11586. + (*settings)["failIfExtra"] = true;
  11587. + (*settings)["rejectDupKeys"] = true;
  11588. + (*settings)["allowSpecialFloats"] = false;
  11589. +//! [CharReaderBuilderStrictMode]
  11590. +}
  11591. +// static
  11592. +void CharReaderBuilder::setDefaults(Json::Value* settings)
  11593. +{
  11594. +//! [CharReaderBuilderDefaults]
  11595. + (*settings)["collectComments"] = true;
  11596. + (*settings)["allowComments"] = true;
  11597. + (*settings)["strictRoot"] = false;
  11598. + (*settings)["allowDroppedNullPlaceholders"] = false;
  11599. + (*settings)["allowNumericKeys"] = false;
  11600. + (*settings)["allowSingleQuotes"] = false;
  11601. + (*settings)["stackLimit"] = 1000;
  11602. + (*settings)["failIfExtra"] = false;
  11603. + (*settings)["rejectDupKeys"] = false;
  11604. + (*settings)["allowSpecialFloats"] = false;
  11605. +//! [CharReaderBuilderDefaults]
  11606. +}
  11607. +
  11608. +//////////////////////////////////
  11609. +// global functions
  11610. +
  11611. +bool parseFromStream(
  11612. + CharReader::Factory const& fact, JSONCPP_ISTREAM& sin,
  11613. + Value* root, JSONCPP_STRING* errs)
  11614. +{
  11615. + JSONCPP_OSTRINGSTREAM ssin;
  11616. + ssin << sin.rdbuf();
  11617. + JSONCPP_STRING doc = ssin.str();
  11618. + char const* begin = doc.data();
  11619. + char const* end = begin + doc.size();
  11620. + // Note that we do not actually need a null-terminator.
  11621. + CharReaderPtr const reader(fact.newCharReader());
  11622. + return reader->parse(begin, end, root, errs);
  11623. +}
  11624. +
  11625. +JSONCPP_ISTREAM& operator>>(JSONCPP_ISTREAM& sin, Value& root) {
  11626. + CharReaderBuilder b;
  11627. + JSONCPP_STRING errs;
  11628. + bool ok = parseFromStream(b, sin, &root, &errs);
  11629. + if (!ok) {
  11630. + fprintf(stderr,
  11631. + "Error from reader: %s",
  11632. + errs.c_str());
  11633. +
  11634. + throwRuntimeError(errs);
  11635. + }
  11636. + return sin;
  11637. +}
  11638. +
  11639. +} // namespace Json
  11640. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_tool.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_tool.h
  11641. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_tool.h 1970-01-01 02:00:00.000000000 +0200
  11642. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_tool.h 2017-12-03 19:05:22.000000000 +0300
  11643. @@ -0,0 +1,111 @@
  11644. +// Copyright 2007-2010 Baptiste Lepilleur
  11645. +// Distributed under MIT license, or public domain if desired and
  11646. +// recognized in your jurisdiction.
  11647. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  11648. +
  11649. +#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED
  11650. +#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED
  11651. +
  11652. +#ifndef NO_LOCALE_SUPPORT
  11653. +#include <clocale>
  11654. +#endif
  11655. +
  11656. +/* This header provides common string manipulation support, such as UTF-8,
  11657. + * portable conversion from/to string...
  11658. + *
  11659. + * It is an internal header that must not be exposed.
  11660. + */
  11661. +
  11662. +namespace Json {
  11663. +static char getDecimalPoint() {
  11664. +#ifdef NO_LOCALE_SUPPORT
  11665. + return '\0';
  11666. +#else
  11667. + struct lconv* lc = localeconv();
  11668. + return lc ? *(lc->decimal_point) : '\0';
  11669. +#endif
  11670. +}
  11671. +
  11672. +/// Converts a unicode code-point to UTF-8.
  11673. +static inline JSONCPP_STRING codePointToUTF8(unsigned int cp) {
  11674. + JSONCPP_STRING result;
  11675. +
  11676. + // based on description from http://en.wikipedia.org/wiki/UTF-8
  11677. +
  11678. + if (cp <= 0x7f) {
  11679. + result.resize(1);
  11680. + result[0] = static_cast<char>(cp);
  11681. + } else if (cp <= 0x7FF) {
  11682. + result.resize(2);
  11683. + result[1] = static_cast<char>(0x80 | (0x3f & cp));
  11684. + result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6)));
  11685. + } else if (cp <= 0xFFFF) {
  11686. + result.resize(3);
  11687. + result[2] = static_cast<char>(0x80 | (0x3f & cp));
  11688. + result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
  11689. + result[0] = static_cast<char>(0xE0 | (0xf & (cp >> 12)));
  11690. + } else if (cp <= 0x10FFFF) {
  11691. + result.resize(4);
  11692. + result[3] = static_cast<char>(0x80 | (0x3f & cp));
  11693. + result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6)));
  11694. + result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12)));
  11695. + result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18)));
  11696. + }
  11697. +
  11698. + return result;
  11699. +}
  11700. +
  11701. +/// Returns true if ch is a control character (in range [1,31]).
  11702. +static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; }
  11703. +
  11704. +enum {
  11705. + /// Constant that specify the size of the buffer that must be passed to
  11706. + /// uintToString.
  11707. + uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1
  11708. +};
  11709. +
  11710. +// Defines a char buffer for use with uintToString().
  11711. +typedef char UIntToStringBuffer[uintToStringBufferSize];
  11712. +
  11713. +/** Converts an unsigned integer to string.
  11714. + * @param value Unsigned interger to convert to string
  11715. + * @param current Input/Output string buffer.
  11716. + * Must have at least uintToStringBufferSize chars free.
  11717. + */
  11718. +static inline void uintToString(LargestUInt value, char*& current) {
  11719. + *--current = 0;
  11720. + do {
  11721. + *--current = static_cast<char>(value % 10U + static_cast<unsigned>('0'));
  11722. + value /= 10;
  11723. + } while (value != 0);
  11724. +}
  11725. +
  11726. +/** Change ',' to '.' everywhere in buffer.
  11727. + *
  11728. + * We had a sophisticated way, but it did not work in WinCE.
  11729. + * @see https://github.com/open-source-parsers/jsoncpp/pull/9
  11730. + */
  11731. +static inline void fixNumericLocale(char* begin, char* end) {
  11732. + while (begin < end) {
  11733. + if (*begin == ',') {
  11734. + *begin = '.';
  11735. + }
  11736. + ++begin;
  11737. + }
  11738. +}
  11739. +
  11740. +static inline void fixNumericLocaleInput(char* begin, char* end) {
  11741. + char decimalPoint = getDecimalPoint();
  11742. + if (decimalPoint != '\0' && decimalPoint != '.') {
  11743. + while (begin < end) {
  11744. + if (*begin == '.') {
  11745. + *begin = decimalPoint;
  11746. + }
  11747. + ++begin;
  11748. + }
  11749. + }
  11750. +}
  11751. +
  11752. +} // namespace Json {
  11753. +
  11754. +#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED
  11755. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_value.cpp polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_value.cpp
  11756. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_value.cpp 1970-01-01 02:00:00.000000000 +0200
  11757. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_value.cpp 2017-12-03 19:05:22.000000000 +0300
  11758. @@ -0,0 +1,1604 @@
  11759. +// Copyright 2011 Baptiste Lepilleur
  11760. +// Distributed under MIT license, or public domain if desired and
  11761. +// recognized in your jurisdiction.
  11762. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  11763. +
  11764. +#if !defined(JSON_IS_AMALGAMATION)
  11765. +#include <json/assertions.h>
  11766. +#include <json/value.h>
  11767. +#include <json/writer.h>
  11768. +#endif // if !defined(JSON_IS_AMALGAMATION)
  11769. +#include <math.h>
  11770. +#include <sstream>
  11771. +#include <utility>
  11772. +#include <cstring>
  11773. +#include <cassert>
  11774. +#ifdef JSON_USE_CPPTL
  11775. +#include <cpptl/conststring.h>
  11776. +#endif
  11777. +#include <cstddef> // size_t
  11778. +#include <algorithm> // min()
  11779. +
  11780. +#define JSON_ASSERT_UNREACHABLE assert(false)
  11781. +
  11782. +namespace Json {
  11783. +
  11784. +// This is a walkaround to avoid the static initialization of Value::null.
  11785. +// kNull must be word-aligned to avoid crashing on ARM. We use an alignment of
  11786. +// 8 (instead of 4) as a bit of future-proofing.
  11787. +#if defined(__ARMEL__)
  11788. +#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
  11789. +#else
  11790. +#define ALIGNAS(byte_alignment)
  11791. +#endif
  11792. +//static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 };
  11793. +//const unsigned char& kNullRef = kNull[0];
  11794. +//const Value& Value::null = reinterpret_cast<const Value&>(kNullRef);
  11795. +//const Value& Value::nullRef = null;
  11796. +
  11797. +// static
  11798. +Value const& Value::nullSingleton()
  11799. +{
  11800. + static Value const nullStatic;
  11801. + return nullStatic;
  11802. +}
  11803. +
  11804. +// for backwards compatibility, we'll leave these global references around, but DO NOT
  11805. +// use them in JSONCPP library code any more!
  11806. +Value const& Value::null = Value::nullSingleton();
  11807. +Value const& Value::nullRef = Value::nullSingleton();
  11808. +
  11809. +const Int Value::minInt = Int(~(UInt(-1) / 2));
  11810. +const Int Value::maxInt = Int(UInt(-1) / 2);
  11811. +const UInt Value::maxUInt = UInt(-1);
  11812. +#if defined(JSON_HAS_INT64)
  11813. +const Int64 Value::minInt64 = Int64(~(UInt64(-1) / 2));
  11814. +const Int64 Value::maxInt64 = Int64(UInt64(-1) / 2);
  11815. +const UInt64 Value::maxUInt64 = UInt64(-1);
  11816. +// The constant is hard-coded because some compiler have trouble
  11817. +// converting Value::maxUInt64 to a double correctly (AIX/xlC).
  11818. +// Assumes that UInt64 is a 64 bits integer.
  11819. +static const double maxUInt64AsDouble = 18446744073709551615.0;
  11820. +#endif // defined(JSON_HAS_INT64)
  11821. +const LargestInt Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2));
  11822. +const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2);
  11823. +const LargestUInt Value::maxLargestUInt = LargestUInt(-1);
  11824. +
  11825. +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  11826. +template <typename T, typename U>
  11827. +static inline bool InRange(double d, T min, U max) {
  11828. + // The casts can lose precision, but we are looking only for
  11829. + // an approximate range. Might fail on edge cases though. ~cdunn
  11830. + //return d >= static_cast<double>(min) && d <= static_cast<double>(max);
  11831. + return d >= min && d <= max;
  11832. +}
  11833. +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  11834. +static inline double integerToDouble(Json::UInt64 value) {
  11835. + return static_cast<double>(Int64(value / 2)) * 2.0 + static_cast<double>(Int64(value & 1));
  11836. +}
  11837. +
  11838. +template <typename T> static inline double integerToDouble(T value) {
  11839. + return static_cast<double>(value);
  11840. +}
  11841. +
  11842. +template <typename T, typename U>
  11843. +static inline bool InRange(double d, T min, U max) {
  11844. + return d >= integerToDouble(min) && d <= integerToDouble(max);
  11845. +}
  11846. +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  11847. +
  11848. +/** Duplicates the specified string value.
  11849. + * @param value Pointer to the string to duplicate. Must be zero-terminated if
  11850. + * length is "unknown".
  11851. + * @param length Length of the value. if equals to unknown, then it will be
  11852. + * computed using strlen(value).
  11853. + * @return Pointer on the duplicate instance of string.
  11854. + */
  11855. +static inline char* duplicateStringValue(const char* value,
  11856. + size_t length)
  11857. +{
  11858. + // Avoid an integer overflow in the call to malloc below by limiting length
  11859. + // to a sane value.
  11860. + if (length >= static_cast<size_t>(Value::maxInt))
  11861. + length = Value::maxInt - 1;
  11862. +
  11863. + char* newString = static_cast<char*>(malloc(length + 1));
  11864. + if (newString == NULL) {
  11865. + throwRuntimeError(
  11866. + "in Json::Value::duplicateStringValue(): "
  11867. + "Failed to allocate string value buffer");
  11868. + }
  11869. + memcpy(newString, value, length);
  11870. + newString[length] = 0;
  11871. + return newString;
  11872. +}
  11873. +
  11874. +/* Record the length as a prefix.
  11875. + */
  11876. +static inline char* duplicateAndPrefixStringValue(
  11877. + const char* value,
  11878. + unsigned int length)
  11879. +{
  11880. + // Avoid an integer overflow in the call to malloc below by limiting length
  11881. + // to a sane value.
  11882. + JSON_ASSERT_MESSAGE(length <= static_cast<unsigned>(Value::maxInt) - sizeof(unsigned) - 1U,
  11883. + "in Json::Value::duplicateAndPrefixStringValue(): "
  11884. + "length too big for prefixing");
  11885. + unsigned actualLength = length + static_cast<unsigned>(sizeof(unsigned)) + 1U;
  11886. + char* newString = static_cast<char*>(malloc(actualLength));
  11887. + if (newString == 0) {
  11888. + throwRuntimeError(
  11889. + "in Json::Value::duplicateAndPrefixStringValue(): "
  11890. + "Failed to allocate string value buffer");
  11891. + }
  11892. + *reinterpret_cast<unsigned*>(newString) = length;
  11893. + memcpy(newString + sizeof(unsigned), value, length);
  11894. + newString[actualLength - 1U] = 0; // to avoid buffer over-run accidents by users later
  11895. + return newString;
  11896. +}
  11897. +inline static void decodePrefixedString(
  11898. + bool isPrefixed, char const* prefixed,
  11899. + unsigned* length, char const** value)
  11900. +{
  11901. + if (!isPrefixed) {
  11902. + *length = static_cast<unsigned>(strlen(prefixed));
  11903. + *value = prefixed;
  11904. + } else {
  11905. + *length = *reinterpret_cast<unsigned const*>(prefixed);
  11906. + *value = prefixed + sizeof(unsigned);
  11907. + }
  11908. +}
  11909. +/** Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue().
  11910. + */
  11911. +#if JSONCPP_USING_SECURE_MEMORY
  11912. +static inline void releasePrefixedStringValue(char* value) {
  11913. + unsigned length = 0;
  11914. + char const* valueDecoded;
  11915. + decodePrefixedString(true, value, &length, &valueDecoded);
  11916. + size_t const size = sizeof(unsigned) + length + 1U;
  11917. + memset(value, 0, size);
  11918. + free(value);
  11919. +}
  11920. +static inline void releaseStringValue(char* value, unsigned length) {
  11921. + // length==0 => we allocated the strings memory
  11922. + size_t size = (length==0) ? strlen(value) : length;
  11923. + memset(value, 0, size);
  11924. + free(value);
  11925. +}
  11926. +#else // !JSONCPP_USING_SECURE_MEMORY
  11927. +static inline void releasePrefixedStringValue(char* value) {
  11928. + free(value);
  11929. +}
  11930. +static inline void releaseStringValue(char* value, unsigned) {
  11931. + free(value);
  11932. +}
  11933. +#endif // JSONCPP_USING_SECURE_MEMORY
  11934. +
  11935. +} // namespace Json
  11936. +
  11937. +// //////////////////////////////////////////////////////////////////
  11938. +// //////////////////////////////////////////////////////////////////
  11939. +// //////////////////////////////////////////////////////////////////
  11940. +// ValueInternals...
  11941. +// //////////////////////////////////////////////////////////////////
  11942. +// //////////////////////////////////////////////////////////////////
  11943. +// //////////////////////////////////////////////////////////////////
  11944. +#if !defined(JSON_IS_AMALGAMATION)
  11945. +
  11946. +#include "json_valueiterator.inl"
  11947. +#endif // if !defined(JSON_IS_AMALGAMATION)
  11948. +
  11949. +namespace Json {
  11950. +
  11951. +Exception::Exception(JSONCPP_STRING const& msg)
  11952. + : msg_(msg)
  11953. +{}
  11954. +Exception::~Exception() throw()
  11955. +{}
  11956. +char const* Exception::what() const throw()
  11957. +{
  11958. + return msg_.c_str();
  11959. +}
  11960. +RuntimeError::RuntimeError(JSONCPP_STRING const& msg)
  11961. + : Exception(msg)
  11962. +{}
  11963. +LogicError::LogicError(JSONCPP_STRING const& msg)
  11964. + : Exception(msg)
  11965. +{}
  11966. +JSONCPP_NORETURN void throwRuntimeError(JSONCPP_STRING const& msg)
  11967. +{
  11968. + throw RuntimeError(msg);
  11969. +}
  11970. +JSONCPP_NORETURN void throwLogicError(JSONCPP_STRING const& msg)
  11971. +{
  11972. + throw LogicError(msg);
  11973. +}
  11974. +
  11975. +// //////////////////////////////////////////////////////////////////
  11976. +// //////////////////////////////////////////////////////////////////
  11977. +// //////////////////////////////////////////////////////////////////
  11978. +// class Value::CommentInfo
  11979. +// //////////////////////////////////////////////////////////////////
  11980. +// //////////////////////////////////////////////////////////////////
  11981. +// //////////////////////////////////////////////////////////////////
  11982. +
  11983. +Value::CommentInfo::CommentInfo() : comment_(0)
  11984. +{}
  11985. +
  11986. +Value::CommentInfo::~CommentInfo() {
  11987. + if (comment_)
  11988. + releaseStringValue(comment_, 0u);
  11989. +}
  11990. +
  11991. +void Value::CommentInfo::setComment(const char* text, size_t len) {
  11992. + if (comment_) {
  11993. + releaseStringValue(comment_, 0u);
  11994. + comment_ = 0;
  11995. + }
  11996. + JSON_ASSERT(text != 0);
  11997. + JSON_ASSERT_MESSAGE(
  11998. + text[0] == '\0' || text[0] == '/',
  11999. + "in Json::Value::setComment(): Comments must start with /");
  12000. + // It seems that /**/ style comments are acceptable as well.
  12001. + comment_ = duplicateStringValue(text, len);
  12002. +}
  12003. +
  12004. +// //////////////////////////////////////////////////////////////////
  12005. +// //////////////////////////////////////////////////////////////////
  12006. +// //////////////////////////////////////////////////////////////////
  12007. +// class Value::CZString
  12008. +// //////////////////////////////////////////////////////////////////
  12009. +// //////////////////////////////////////////////////////////////////
  12010. +// //////////////////////////////////////////////////////////////////
  12011. +
  12012. +// Notes: policy_ indicates if the string was allocated when
  12013. +// a string is stored.
  12014. +
  12015. +Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {}
  12016. +
  12017. +Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate)
  12018. + : cstr_(str) {
  12019. + // allocate != duplicate
  12020. + storage_.policy_ = allocate & 0x3;
  12021. + storage_.length_ = ulength & 0x3FFFFFFF;
  12022. +}
  12023. +
  12024. +Value::CZString::CZString(const CZString& other) {
  12025. + cstr_ = (other.storage_.policy_ != noDuplication && other.cstr_ != 0
  12026. + ? duplicateStringValue(other.cstr_, other.storage_.length_)
  12027. + : other.cstr_);
  12028. + storage_.policy_ = static_cast<unsigned>(other.cstr_
  12029. + ? (static_cast<DuplicationPolicy>(other.storage_.policy_) == noDuplication
  12030. + ? noDuplication : duplicate)
  12031. + : static_cast<DuplicationPolicy>(other.storage_.policy_)) & 3U;
  12032. + storage_.length_ = other.storage_.length_;
  12033. +}
  12034. +
  12035. +#if JSON_HAS_RVALUE_REFERENCES
  12036. +Value::CZString::CZString(CZString&& other)
  12037. + : cstr_(other.cstr_), index_(other.index_) {
  12038. + other.cstr_ = nullptr;
  12039. +}
  12040. +#endif
  12041. +
  12042. +Value::CZString::~CZString() {
  12043. + if (cstr_ && storage_.policy_ == duplicate) {
  12044. + releaseStringValue(const_cast<char*>(cstr_), storage_.length_ + 1u); //+1 for null terminating character for sake of completeness but not actually necessary
  12045. + }
  12046. +}
  12047. +
  12048. +void Value::CZString::swap(CZString& other) {
  12049. + std::swap(cstr_, other.cstr_);
  12050. + std::swap(index_, other.index_);
  12051. +}
  12052. +
  12053. +Value::CZString& Value::CZString::operator=(CZString other) {
  12054. + swap(other);
  12055. + return *this;
  12056. +}
  12057. +
  12058. +bool Value::CZString::operator<(const CZString& other) const {
  12059. + if (!cstr_) return index_ < other.index_;
  12060. + //return strcmp(cstr_, other.cstr_) < 0;
  12061. + // Assume both are strings.
  12062. + unsigned this_len = this->storage_.length_;
  12063. + unsigned other_len = other.storage_.length_;
  12064. + unsigned min_len = std::min(this_len, other_len);
  12065. + JSON_ASSERT(this->cstr_ && other.cstr_);
  12066. + int comp = memcmp(this->cstr_, other.cstr_, min_len);
  12067. + if (comp < 0) return true;
  12068. + if (comp > 0) return false;
  12069. + return (this_len < other_len);
  12070. +}
  12071. +
  12072. +bool Value::CZString::operator==(const CZString& other) const {
  12073. + if (!cstr_) return index_ == other.index_;
  12074. + //return strcmp(cstr_, other.cstr_) == 0;
  12075. + // Assume both are strings.
  12076. + unsigned this_len = this->storage_.length_;
  12077. + unsigned other_len = other.storage_.length_;
  12078. + if (this_len != other_len) return false;
  12079. + JSON_ASSERT(this->cstr_ && other.cstr_);
  12080. + int comp = memcmp(this->cstr_, other.cstr_, this_len);
  12081. + return comp == 0;
  12082. +}
  12083. +
  12084. +ArrayIndex Value::CZString::index() const { return index_; }
  12085. +
  12086. +//const char* Value::CZString::c_str() const { return cstr_; }
  12087. +const char* Value::CZString::data() const { return cstr_; }
  12088. +unsigned Value::CZString::length() const { return storage_.length_; }
  12089. +bool Value::CZString::isStaticString() const { return storage_.policy_ == noDuplication; }
  12090. +
  12091. +// //////////////////////////////////////////////////////////////////
  12092. +// //////////////////////////////////////////////////////////////////
  12093. +// //////////////////////////////////////////////////////////////////
  12094. +// class Value::Value
  12095. +// //////////////////////////////////////////////////////////////////
  12096. +// //////////////////////////////////////////////////////////////////
  12097. +// //////////////////////////////////////////////////////////////////
  12098. +
  12099. +/*! \internal Default constructor initialization must be equivalent to:
  12100. + * memset( this, 0, sizeof(Value) )
  12101. + * This optimization is used in ValueInternalMap fast allocator.
  12102. + */
  12103. +Value::Value(ValueType vtype) {
  12104. + static char const empty[] = "";
  12105. + initBasic(vtype);
  12106. + switch (vtype) {
  12107. + case nullValue:
  12108. + break;
  12109. + case intValue:
  12110. + case uintValue:
  12111. + value_.int_ = 0;
  12112. + break;
  12113. + case realValue:
  12114. + value_.real_ = 0.0;
  12115. + break;
  12116. + case stringValue:
  12117. + // allocated_ == false, so this is safe.
  12118. + value_.string_ = const_cast<char*>(static_cast<char const*>(empty));
  12119. + break;
  12120. + case arrayValue:
  12121. + case objectValue:
  12122. + value_.map_ = new ObjectValues();
  12123. + break;
  12124. + case booleanValue:
  12125. + value_.bool_ = false;
  12126. + break;
  12127. + default:
  12128. + JSON_ASSERT_UNREACHABLE;
  12129. + }
  12130. +}
  12131. +
  12132. +Value::Value(Int value) {
  12133. + initBasic(intValue);
  12134. + value_.int_ = value;
  12135. +}
  12136. +
  12137. +Value::Value(UInt value) {
  12138. + initBasic(uintValue);
  12139. + value_.uint_ = value;
  12140. +}
  12141. +#if defined(JSON_HAS_INT64)
  12142. +Value::Value(Int64 value) {
  12143. + initBasic(intValue);
  12144. + value_.int_ = value;
  12145. +}
  12146. +Value::Value(UInt64 value) {
  12147. + initBasic(uintValue);
  12148. + value_.uint_ = value;
  12149. +}
  12150. +#endif // defined(JSON_HAS_INT64)
  12151. +
  12152. +Value::Value(double value) {
  12153. + initBasic(realValue);
  12154. + value_.real_ = value;
  12155. +}
  12156. +
  12157. +Value::Value(const char* value) {
  12158. + initBasic(stringValue, true);
  12159. + value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(strlen(value)));
  12160. +}
  12161. +
  12162. +Value::Value(const char* beginValue, const char* endValue) {
  12163. + initBasic(stringValue, true);
  12164. + value_.string_ =
  12165. + duplicateAndPrefixStringValue(beginValue, static_cast<unsigned>(endValue - beginValue));
  12166. +}
  12167. +
  12168. +Value::Value(const JSONCPP_STRING& value) {
  12169. + initBasic(stringValue, true);
  12170. + value_.string_ =
  12171. + duplicateAndPrefixStringValue(value.data(), static_cast<unsigned>(value.length()));
  12172. +}
  12173. +
  12174. +Value::Value(const StaticString& value) {
  12175. + initBasic(stringValue);
  12176. + value_.string_ = const_cast<char*>(value.c_str());
  12177. +}
  12178. +
  12179. +#ifdef JSON_USE_CPPTL
  12180. +Value::Value(const CppTL::ConstString& value) {
  12181. + initBasic(stringValue, true);
  12182. + value_.string_ = duplicateAndPrefixStringValue(value, static_cast<unsigned>(value.length()));
  12183. +}
  12184. +#endif
  12185. +
  12186. +Value::Value(bool value) {
  12187. + initBasic(booleanValue);
  12188. + value_.bool_ = value;
  12189. +}
  12190. +
  12191. +Value::Value(Value const& other)
  12192. + : type_(other.type_), allocated_(false)
  12193. + ,
  12194. + comments_(0), start_(other.start_), limit_(other.limit_)
  12195. +{
  12196. + switch (type_) {
  12197. + case nullValue:
  12198. + case intValue:
  12199. + case uintValue:
  12200. + case realValue:
  12201. + case booleanValue:
  12202. + value_ = other.value_;
  12203. + break;
  12204. + case stringValue:
  12205. + if (other.value_.string_ && other.allocated_) {
  12206. + unsigned len;
  12207. + char const* str;
  12208. + decodePrefixedString(other.allocated_, other.value_.string_,
  12209. + &len, &str);
  12210. + value_.string_ = duplicateAndPrefixStringValue(str, len);
  12211. + allocated_ = true;
  12212. + } else {
  12213. + value_.string_ = other.value_.string_;
  12214. + allocated_ = false;
  12215. + }
  12216. + break;
  12217. + case arrayValue:
  12218. + case objectValue:
  12219. + value_.map_ = new ObjectValues(*other.value_.map_);
  12220. + break;
  12221. + default:
  12222. + JSON_ASSERT_UNREACHABLE;
  12223. + }
  12224. + if (other.comments_) {
  12225. + comments_ = new CommentInfo[numberOfCommentPlacement];
  12226. + for (int comment = 0; comment < numberOfCommentPlacement; ++comment) {
  12227. + const CommentInfo& otherComment = other.comments_[comment];
  12228. + if (otherComment.comment_)
  12229. + comments_[comment].setComment(
  12230. + otherComment.comment_, strlen(otherComment.comment_));
  12231. + }
  12232. + }
  12233. +}
  12234. +
  12235. +#if JSON_HAS_RVALUE_REFERENCES
  12236. +// Move constructor
  12237. +Value::Value(Value&& other) {
  12238. + initBasic(nullValue);
  12239. + swap(other);
  12240. +}
  12241. +#endif
  12242. +
  12243. +Value::~Value() {
  12244. + switch (type_) {
  12245. + case nullValue:
  12246. + case intValue:
  12247. + case uintValue:
  12248. + case realValue:
  12249. + case booleanValue:
  12250. + break;
  12251. + case stringValue:
  12252. + if (allocated_)
  12253. + releasePrefixedStringValue(value_.string_);
  12254. + break;
  12255. + case arrayValue:
  12256. + case objectValue:
  12257. + delete value_.map_;
  12258. + break;
  12259. + default:
  12260. + JSON_ASSERT_UNREACHABLE;
  12261. + }
  12262. +
  12263. + delete[] comments_;
  12264. +
  12265. + value_.uint_ = 0;
  12266. +}
  12267. +
  12268. +Value& Value::operator=(Value other) {
  12269. + swap(other);
  12270. + return *this;
  12271. +}
  12272. +
  12273. +void Value::swapPayload(Value& other) {
  12274. + ValueType temp = type_;
  12275. + type_ = other.type_;
  12276. + other.type_ = temp;
  12277. + std::swap(value_, other.value_);
  12278. + int temp2 = allocated_;
  12279. + allocated_ = other.allocated_;
  12280. + other.allocated_ = temp2 & 0x1;
  12281. +}
  12282. +
  12283. +void Value::swap(Value& other) {
  12284. + swapPayload(other);
  12285. + std::swap(comments_, other.comments_);
  12286. + std::swap(start_, other.start_);
  12287. + std::swap(limit_, other.limit_);
  12288. +}
  12289. +
  12290. +ValueType Value::type() const { return type_; }
  12291. +
  12292. +int Value::compare(const Value& other) const {
  12293. + if (*this < other)
  12294. + return -1;
  12295. + if (*this > other)
  12296. + return 1;
  12297. + return 0;
  12298. +}
  12299. +
  12300. +bool Value::operator<(const Value& other) const {
  12301. + int typeDelta = type_ - other.type_;
  12302. + if (typeDelta)
  12303. + return typeDelta < 0 ? true : false;
  12304. + switch (type_) {
  12305. + case nullValue:
  12306. + return false;
  12307. + case intValue:
  12308. + return value_.int_ < other.value_.int_;
  12309. + case uintValue:
  12310. + return value_.uint_ < other.value_.uint_;
  12311. + case realValue:
  12312. + return value_.real_ < other.value_.real_;
  12313. + case booleanValue:
  12314. + return value_.bool_ < other.value_.bool_;
  12315. + case stringValue:
  12316. + {
  12317. + if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
  12318. + if (other.value_.string_) return true;
  12319. + else return false;
  12320. + }
  12321. + unsigned this_len;
  12322. + unsigned other_len;
  12323. + char const* this_str;
  12324. + char const* other_str;
  12325. + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
  12326. + decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
  12327. + unsigned min_len = std::min(this_len, other_len);
  12328. + JSON_ASSERT(this_str && other_str);
  12329. + int comp = memcmp(this_str, other_str, min_len);
  12330. + if (comp < 0) return true;
  12331. + if (comp > 0) return false;
  12332. + return (this_len < other_len);
  12333. + }
  12334. + case arrayValue:
  12335. + case objectValue: {
  12336. + int delta = int(value_.map_->size() - other.value_.map_->size());
  12337. + if (delta)
  12338. + return delta < 0;
  12339. + return (*value_.map_) < (*other.value_.map_);
  12340. + }
  12341. + default:
  12342. + JSON_ASSERT_UNREACHABLE;
  12343. + }
  12344. + return false; // unreachable
  12345. +}
  12346. +
  12347. +bool Value::operator<=(const Value& other) const { return !(other < *this); }
  12348. +
  12349. +bool Value::operator>=(const Value& other) const { return !(*this < other); }
  12350. +
  12351. +bool Value::operator>(const Value& other) const { return other < *this; }
  12352. +
  12353. +bool Value::operator==(const Value& other) const {
  12354. + // if ( type_ != other.type_ )
  12355. + // GCC 2.95.3 says:
  12356. + // attempt to take address of bit-field structure member `Json::Value::type_'
  12357. + // Beats me, but a temp solves the problem.
  12358. + int temp = other.type_;
  12359. + if (type_ != temp)
  12360. + return false;
  12361. + switch (type_) {
  12362. + case nullValue:
  12363. + return true;
  12364. + case intValue:
  12365. + return value_.int_ == other.value_.int_;
  12366. + case uintValue:
  12367. + return value_.uint_ == other.value_.uint_;
  12368. + case realValue:
  12369. + return value_.real_ == other.value_.real_;
  12370. + case booleanValue:
  12371. + return value_.bool_ == other.value_.bool_;
  12372. + case stringValue:
  12373. + {
  12374. + if ((value_.string_ == 0) || (other.value_.string_ == 0)) {
  12375. + return (value_.string_ == other.value_.string_);
  12376. + }
  12377. + unsigned this_len;
  12378. + unsigned other_len;
  12379. + char const* this_str;
  12380. + char const* other_str;
  12381. + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
  12382. + decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str);
  12383. + if (this_len != other_len) return false;
  12384. + JSON_ASSERT(this_str && other_str);
  12385. + int comp = memcmp(this_str, other_str, this_len);
  12386. + return comp == 0;
  12387. + }
  12388. + case arrayValue:
  12389. + case objectValue:
  12390. + return value_.map_->size() == other.value_.map_->size() &&
  12391. + (*value_.map_) == (*other.value_.map_);
  12392. + default:
  12393. + JSON_ASSERT_UNREACHABLE;
  12394. + }
  12395. + return false; // unreachable
  12396. +}
  12397. +
  12398. +bool Value::operator!=(const Value& other) const { return !(*this == other); }
  12399. +
  12400. +const char* Value::asCString() const {
  12401. + JSON_ASSERT_MESSAGE(type_ == stringValue,
  12402. + "in Json::Value::asCString(): requires stringValue");
  12403. + if (value_.string_ == 0) return 0;
  12404. + unsigned this_len;
  12405. + char const* this_str;
  12406. + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
  12407. + return this_str;
  12408. +}
  12409. +
  12410. +#if JSONCPP_USING_SECURE_MEMORY
  12411. +unsigned Value::getCStringLength() const {
  12412. + JSON_ASSERT_MESSAGE(type_ == stringValue,
  12413. + "in Json::Value::asCString(): requires stringValue");
  12414. + if (value_.string_ == 0) return 0;
  12415. + unsigned this_len;
  12416. + char const* this_str;
  12417. + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
  12418. + return this_len;
  12419. +}
  12420. +#endif
  12421. +
  12422. +bool Value::getString(char const** str, char const** cend) const {
  12423. + if (type_ != stringValue) return false;
  12424. + if (value_.string_ == 0) return false;
  12425. + unsigned length;
  12426. + decodePrefixedString(this->allocated_, this->value_.string_, &length, str);
  12427. + *cend = *str + length;
  12428. + return true;
  12429. +}
  12430. +
  12431. +JSONCPP_STRING Value::asString() const {
  12432. + switch (type_) {
  12433. + case nullValue:
  12434. + return "";
  12435. + case stringValue:
  12436. + {
  12437. + if (value_.string_ == 0) return "";
  12438. + unsigned this_len;
  12439. + char const* this_str;
  12440. + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str);
  12441. + return JSONCPP_STRING(this_str, this_len);
  12442. + }
  12443. + case booleanValue:
  12444. + return value_.bool_ ? "true" : "false";
  12445. + case intValue:
  12446. + return valueToString(value_.int_);
  12447. + case uintValue:
  12448. + return valueToString(value_.uint_);
  12449. + case realValue:
  12450. + return valueToString(value_.real_);
  12451. + default:
  12452. + JSON_FAIL_MESSAGE("Type is not convertible to string");
  12453. + }
  12454. +}
  12455. +
  12456. +#ifdef JSON_USE_CPPTL
  12457. +CppTL::ConstString Value::asConstString() const {
  12458. + unsigned len;
  12459. + char const* str;
  12460. + decodePrefixedString(allocated_, value_.string_,
  12461. + &len, &str);
  12462. + return CppTL::ConstString(str, len);
  12463. +}
  12464. +#endif
  12465. +
  12466. +Value::Int Value::asInt() const {
  12467. + switch (type_) {
  12468. + case intValue:
  12469. + JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range");
  12470. + return Int(value_.int_);
  12471. + case uintValue:
  12472. + JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range");
  12473. + return Int(value_.uint_);
  12474. + case realValue:
  12475. + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt),
  12476. + "double out of Int range");
  12477. + return Int(value_.real_);
  12478. + case nullValue:
  12479. + return 0;
  12480. + case booleanValue:
  12481. + return value_.bool_ ? 1 : 0;
  12482. + default:
  12483. + break;
  12484. + }
  12485. + JSON_FAIL_MESSAGE("Value is not convertible to Int.");
  12486. +}
  12487. +
  12488. +Value::UInt Value::asUInt() const {
  12489. + switch (type_) {
  12490. + case intValue:
  12491. + JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range");
  12492. + return UInt(value_.int_);
  12493. + case uintValue:
  12494. + JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range");
  12495. + return UInt(value_.uint_);
  12496. + case realValue:
  12497. + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt),
  12498. + "double out of UInt range");
  12499. + return UInt(value_.real_);
  12500. + case nullValue:
  12501. + return 0;
  12502. + case booleanValue:
  12503. + return value_.bool_ ? 1 : 0;
  12504. + default:
  12505. + break;
  12506. + }
  12507. + JSON_FAIL_MESSAGE("Value is not convertible to UInt.");
  12508. +}
  12509. +
  12510. +#if defined(JSON_HAS_INT64)
  12511. +
  12512. +Value::Int64 Value::asInt64() const {
  12513. + switch (type_) {
  12514. + case intValue:
  12515. + return Int64(value_.int_);
  12516. + case uintValue:
  12517. + JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range");
  12518. + return Int64(value_.uint_);
  12519. + case realValue:
  12520. + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64),
  12521. + "double out of Int64 range");
  12522. + return Int64(value_.real_);
  12523. + case nullValue:
  12524. + return 0;
  12525. + case booleanValue:
  12526. + return value_.bool_ ? 1 : 0;
  12527. + default:
  12528. + break;
  12529. + }
  12530. + JSON_FAIL_MESSAGE("Value is not convertible to Int64.");
  12531. +}
  12532. +
  12533. +Value::UInt64 Value::asUInt64() const {
  12534. + switch (type_) {
  12535. + case intValue:
  12536. + JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range");
  12537. + return UInt64(value_.int_);
  12538. + case uintValue:
  12539. + return UInt64(value_.uint_);
  12540. + case realValue:
  12541. + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64),
  12542. + "double out of UInt64 range");
  12543. + return UInt64(value_.real_);
  12544. + case nullValue:
  12545. + return 0;
  12546. + case booleanValue:
  12547. + return value_.bool_ ? 1 : 0;
  12548. + default:
  12549. + break;
  12550. + }
  12551. + JSON_FAIL_MESSAGE("Value is not convertible to UInt64.");
  12552. +}
  12553. +#endif // if defined(JSON_HAS_INT64)
  12554. +
  12555. +LargestInt Value::asLargestInt() const {
  12556. +#if defined(JSON_NO_INT64)
  12557. + return asInt();
  12558. +#else
  12559. + return asInt64();
  12560. +#endif
  12561. +}
  12562. +
  12563. +LargestUInt Value::asLargestUInt() const {
  12564. +#if defined(JSON_NO_INT64)
  12565. + return asUInt();
  12566. +#else
  12567. + return asUInt64();
  12568. +#endif
  12569. +}
  12570. +
  12571. +double Value::asDouble() const {
  12572. + switch (type_) {
  12573. + case intValue:
  12574. + return static_cast<double>(value_.int_);
  12575. + case uintValue:
  12576. +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  12577. + return static_cast<double>(value_.uint_);
  12578. +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  12579. + return integerToDouble(value_.uint_);
  12580. +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  12581. + case realValue:
  12582. + return value_.real_;
  12583. + case nullValue:
  12584. + return 0.0;
  12585. + case booleanValue:
  12586. + return value_.bool_ ? 1.0 : 0.0;
  12587. + default:
  12588. + break;
  12589. + }
  12590. + JSON_FAIL_MESSAGE("Value is not convertible to double.");
  12591. +}
  12592. +
  12593. +float Value::asFloat() const {
  12594. + switch (type_) {
  12595. + case intValue:
  12596. + return static_cast<float>(value_.int_);
  12597. + case uintValue:
  12598. +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  12599. + return static_cast<float>(value_.uint_);
  12600. +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  12601. + // This can fail (silently?) if the value is bigger than MAX_FLOAT.
  12602. + return static_cast<float>(integerToDouble(value_.uint_));
  12603. +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  12604. + case realValue:
  12605. + return static_cast<float>(value_.real_);
  12606. + case nullValue:
  12607. + return 0.0;
  12608. + case booleanValue:
  12609. + return value_.bool_ ? 1.0f : 0.0f;
  12610. + default:
  12611. + break;
  12612. + }
  12613. + JSON_FAIL_MESSAGE("Value is not convertible to float.");
  12614. +}
  12615. +
  12616. +bool Value::asBool() const {
  12617. + switch (type_) {
  12618. + case booleanValue:
  12619. + return value_.bool_;
  12620. + case nullValue:
  12621. + return false;
  12622. + case intValue:
  12623. + return value_.int_ ? true : false;
  12624. + case uintValue:
  12625. + return value_.uint_ ? true : false;
  12626. + case realValue:
  12627. + // This is kind of strange. Not recommended.
  12628. + return (value_.real_ != 0.0) ? true : false;
  12629. + default:
  12630. + break;
  12631. + }
  12632. + JSON_FAIL_MESSAGE("Value is not convertible to bool.");
  12633. +}
  12634. +
  12635. +bool Value::isConvertibleTo(ValueType other) const {
  12636. + switch (other) {
  12637. + case nullValue:
  12638. + return (isNumeric() && asDouble() == 0.0) ||
  12639. + (type_ == booleanValue && value_.bool_ == false) ||
  12640. + (type_ == stringValue && asString() == "") ||
  12641. + (type_ == arrayValue && value_.map_->size() == 0) ||
  12642. + (type_ == objectValue && value_.map_->size() == 0) ||
  12643. + type_ == nullValue;
  12644. + case intValue:
  12645. + return isInt() ||
  12646. + (type_ == realValue && InRange(value_.real_, minInt, maxInt)) ||
  12647. + type_ == booleanValue || type_ == nullValue;
  12648. + case uintValue:
  12649. + return isUInt() ||
  12650. + (type_ == realValue && InRange(value_.real_, 0, maxUInt)) ||
  12651. + type_ == booleanValue || type_ == nullValue;
  12652. + case realValue:
  12653. + return isNumeric() || type_ == booleanValue || type_ == nullValue;
  12654. + case booleanValue:
  12655. + return isNumeric() || type_ == booleanValue || type_ == nullValue;
  12656. + case stringValue:
  12657. + return isNumeric() || type_ == booleanValue || type_ == stringValue ||
  12658. + type_ == nullValue;
  12659. + case arrayValue:
  12660. + return type_ == arrayValue || type_ == nullValue;
  12661. + case objectValue:
  12662. + return type_ == objectValue || type_ == nullValue;
  12663. + }
  12664. + JSON_ASSERT_UNREACHABLE;
  12665. + return false;
  12666. +}
  12667. +
  12668. +/// Number of values in array or object
  12669. +ArrayIndex Value::size() const {
  12670. + switch (type_) {
  12671. + case nullValue:
  12672. + case intValue:
  12673. + case uintValue:
  12674. + case realValue:
  12675. + case booleanValue:
  12676. + case stringValue:
  12677. + return 0;
  12678. + case arrayValue: // size of the array is highest index + 1
  12679. + if (!value_.map_->empty()) {
  12680. + ObjectValues::const_iterator itLast = value_.map_->end();
  12681. + --itLast;
  12682. + return (*itLast).first.index() + 1;
  12683. + }
  12684. + return 0;
  12685. + case objectValue:
  12686. + return ArrayIndex(value_.map_->size());
  12687. + }
  12688. + JSON_ASSERT_UNREACHABLE;
  12689. + return 0; // unreachable;
  12690. +}
  12691. +
  12692. +bool Value::empty() const {
  12693. + if (isNull() || isArray() || isObject())
  12694. + return size() == 0u;
  12695. + else
  12696. + return false;
  12697. +}
  12698. +
  12699. +bool Value::operator!() const { return isNull(); }
  12700. +
  12701. +void Value::clear() {
  12702. + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue ||
  12703. + type_ == objectValue,
  12704. + "in Json::Value::clear(): requires complex value");
  12705. + start_ = 0;
  12706. + limit_ = 0;
  12707. + switch (type_) {
  12708. + case arrayValue:
  12709. + case objectValue:
  12710. + value_.map_->clear();
  12711. + break;
  12712. + default:
  12713. + break;
  12714. + }
  12715. +}
  12716. +
  12717. +void Value::resize(ArrayIndex newSize) {
  12718. + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue,
  12719. + "in Json::Value::resize(): requires arrayValue");
  12720. + if (type_ == nullValue)
  12721. + *this = Value(arrayValue);
  12722. + ArrayIndex oldSize = size();
  12723. + if (newSize == 0)
  12724. + clear();
  12725. + else if (newSize > oldSize)
  12726. + (*this)[newSize - 1];
  12727. + else {
  12728. + for (ArrayIndex index = newSize; index < oldSize; ++index) {
  12729. + value_.map_->erase(index);
  12730. + }
  12731. + JSON_ASSERT(size() == newSize);
  12732. + }
  12733. +}
  12734. +
  12735. +Value& Value::operator[](ArrayIndex index) {
  12736. + JSON_ASSERT_MESSAGE(
  12737. + type_ == nullValue || type_ == arrayValue,
  12738. + "in Json::Value::operator[](ArrayIndex): requires arrayValue");
  12739. + if (type_ == nullValue)
  12740. + *this = Value(arrayValue);
  12741. + CZString key(index);
  12742. + ObjectValues::iterator it = value_.map_->lower_bound(key);
  12743. + if (it != value_.map_->end() && (*it).first == key)
  12744. + return (*it).second;
  12745. +
  12746. + ObjectValues::value_type defaultValue(key, nullSingleton());
  12747. + it = value_.map_->insert(it, defaultValue);
  12748. + return (*it).second;
  12749. +}
  12750. +
  12751. +Value& Value::operator[](int index) {
  12752. + JSON_ASSERT_MESSAGE(
  12753. + index >= 0,
  12754. + "in Json::Value::operator[](int index): index cannot be negative");
  12755. + return (*this)[ArrayIndex(index)];
  12756. +}
  12757. +
  12758. +const Value& Value::operator[](ArrayIndex index) const {
  12759. + JSON_ASSERT_MESSAGE(
  12760. + type_ == nullValue || type_ == arrayValue,
  12761. + "in Json::Value::operator[](ArrayIndex)const: requires arrayValue");
  12762. + if (type_ == nullValue)
  12763. + return nullSingleton();
  12764. + CZString key(index);
  12765. + ObjectValues::const_iterator it = value_.map_->find(key);
  12766. + if (it == value_.map_->end())
  12767. + return nullSingleton();
  12768. + return (*it).second;
  12769. +}
  12770. +
  12771. +const Value& Value::operator[](int index) const {
  12772. + JSON_ASSERT_MESSAGE(
  12773. + index >= 0,
  12774. + "in Json::Value::operator[](int index) const: index cannot be negative");
  12775. + return (*this)[ArrayIndex(index)];
  12776. +}
  12777. +
  12778. +void Value::initBasic(ValueType vtype, bool allocated) {
  12779. + type_ = vtype;
  12780. + allocated_ = allocated;
  12781. + comments_ = 0;
  12782. + start_ = 0;
  12783. + limit_ = 0;
  12784. +}
  12785. +
  12786. +// Access an object value by name, create a null member if it does not exist.
  12787. +// @pre Type of '*this' is object or null.
  12788. +// @param key is null-terminated.
  12789. +Value& Value::resolveReference(const char* key) {
  12790. + JSON_ASSERT_MESSAGE(
  12791. + type_ == nullValue || type_ == objectValue,
  12792. + "in Json::Value::resolveReference(): requires objectValue");
  12793. + if (type_ == nullValue)
  12794. + *this = Value(objectValue);
  12795. + CZString actualKey(
  12796. + key, static_cast<unsigned>(strlen(key)), CZString::noDuplication); // NOTE!
  12797. + ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
  12798. + if (it != value_.map_->end() && (*it).first == actualKey)
  12799. + return (*it).second;
  12800. +
  12801. + ObjectValues::value_type defaultValue(actualKey, nullSingleton());
  12802. + it = value_.map_->insert(it, defaultValue);
  12803. + Value& value = (*it).second;
  12804. + return value;
  12805. +}
  12806. +
  12807. +// @param key is not null-terminated.
  12808. +Value& Value::resolveReference(char const* key, char const* cend)
  12809. +{
  12810. + JSON_ASSERT_MESSAGE(
  12811. + type_ == nullValue || type_ == objectValue,
  12812. + "in Json::Value::resolveReference(key, end): requires objectValue");
  12813. + if (type_ == nullValue)
  12814. + *this = Value(objectValue);
  12815. + CZString actualKey(
  12816. + key, static_cast<unsigned>(cend-key), CZString::duplicateOnCopy);
  12817. + ObjectValues::iterator it = value_.map_->lower_bound(actualKey);
  12818. + if (it != value_.map_->end() && (*it).first == actualKey)
  12819. + return (*it).second;
  12820. +
  12821. + ObjectValues::value_type defaultValue(actualKey, nullSingleton());
  12822. + it = value_.map_->insert(it, defaultValue);
  12823. + Value& value = (*it).second;
  12824. + return value;
  12825. +}
  12826. +
  12827. +Value Value::get(ArrayIndex index, const Value& defaultValue) const {
  12828. + const Value* value = &((*this)[index]);
  12829. + return value == &nullSingleton() ? defaultValue : *value;
  12830. +}
  12831. +
  12832. +bool Value::isValidIndex(ArrayIndex index) const { return index < size(); }
  12833. +
  12834. +Value const* Value::find(char const* key, char const* cend) const
  12835. +{
  12836. + JSON_ASSERT_MESSAGE(
  12837. + type_ == nullValue || type_ == objectValue,
  12838. + "in Json::Value::find(key, end, found): requires objectValue or nullValue");
  12839. + if (type_ == nullValue) return NULL;
  12840. + CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
  12841. + ObjectValues::const_iterator it = value_.map_->find(actualKey);
  12842. + if (it == value_.map_->end()) return NULL;
  12843. + return &(*it).second;
  12844. +}
  12845. +const Value& Value::operator[](const char* key) const
  12846. +{
  12847. + Value const* found = find(key, key + strlen(key));
  12848. + if (!found) return nullSingleton();
  12849. + return *found;
  12850. +}
  12851. +Value const& Value::operator[](JSONCPP_STRING const& key) const
  12852. +{
  12853. + Value const* found = find(key.data(), key.data() + key.length());
  12854. + if (!found) return nullSingleton();
  12855. + return *found;
  12856. +}
  12857. +
  12858. +Value& Value::operator[](const char* key) {
  12859. + return resolveReference(key, key + strlen(key));
  12860. +}
  12861. +
  12862. +Value& Value::operator[](const JSONCPP_STRING& key) {
  12863. + return resolveReference(key.data(), key.data() + key.length());
  12864. +}
  12865. +
  12866. +Value& Value::operator[](const StaticString& key) {
  12867. + return resolveReference(key.c_str());
  12868. +}
  12869. +
  12870. +#ifdef JSON_USE_CPPTL
  12871. +Value& Value::operator[](const CppTL::ConstString& key) {
  12872. + return resolveReference(key.c_str(), key.end_c_str());
  12873. +}
  12874. +Value const& Value::operator[](CppTL::ConstString const& key) const
  12875. +{
  12876. + Value const* found = find(key.c_str(), key.end_c_str());
  12877. + if (!found) return nullSingleton();
  12878. + return *found;
  12879. +}
  12880. +#endif
  12881. +
  12882. +Value& Value::append(const Value& value) { return (*this)[size()] = value; }
  12883. +
  12884. +Value Value::get(char const* key, char const* cend, Value const& defaultValue) const
  12885. +{
  12886. + Value const* found = find(key, cend);
  12887. + return !found ? defaultValue : *found;
  12888. +}
  12889. +Value Value::get(char const* key, Value const& defaultValue) const
  12890. +{
  12891. + return get(key, key + strlen(key), defaultValue);
  12892. +}
  12893. +Value Value::get(JSONCPP_STRING const& key, Value const& defaultValue) const
  12894. +{
  12895. + return get(key.data(), key.data() + key.length(), defaultValue);
  12896. +}
  12897. +
  12898. +
  12899. +bool Value::removeMember(const char* key, const char* cend, Value* removed)
  12900. +{
  12901. + if (type_ != objectValue) {
  12902. + return false;
  12903. + }
  12904. + CZString actualKey(key, static_cast<unsigned>(cend-key), CZString::noDuplication);
  12905. + ObjectValues::iterator it = value_.map_->find(actualKey);
  12906. + if (it == value_.map_->end())
  12907. + return false;
  12908. + *removed = it->second;
  12909. + value_.map_->erase(it);
  12910. + return true;
  12911. +}
  12912. +bool Value::removeMember(const char* key, Value* removed)
  12913. +{
  12914. + return removeMember(key, key + strlen(key), removed);
  12915. +}
  12916. +bool Value::removeMember(JSONCPP_STRING const& key, Value* removed)
  12917. +{
  12918. + return removeMember(key.data(), key.data() + key.length(), removed);
  12919. +}
  12920. +Value Value::removeMember(const char* key)
  12921. +{
  12922. + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue,
  12923. + "in Json::Value::removeMember(): requires objectValue");
  12924. + if (type_ == nullValue)
  12925. + return nullSingleton();
  12926. +
  12927. + Value removed; // null
  12928. + removeMember(key, key + strlen(key), &removed);
  12929. + return removed; // still null if removeMember() did nothing
  12930. +}
  12931. +Value Value::removeMember(const JSONCPP_STRING& key)
  12932. +{
  12933. + return removeMember(key.c_str());
  12934. +}
  12935. +
  12936. +bool Value::removeIndex(ArrayIndex index, Value* removed) {
  12937. + if (type_ != arrayValue) {
  12938. + return false;
  12939. + }
  12940. + CZString key(index);
  12941. + ObjectValues::iterator it = value_.map_->find(key);
  12942. + if (it == value_.map_->end()) {
  12943. + return false;
  12944. + }
  12945. + *removed = it->second;
  12946. + ArrayIndex oldSize = size();
  12947. + // shift left all items left, into the place of the "removed"
  12948. + for (ArrayIndex i = index; i < (oldSize - 1); ++i){
  12949. + CZString keey(i);
  12950. + (*value_.map_)[keey] = (*this)[i + 1];
  12951. + }
  12952. + // erase the last one ("leftover")
  12953. + CZString keyLast(oldSize - 1);
  12954. + ObjectValues::iterator itLast = value_.map_->find(keyLast);
  12955. + value_.map_->erase(itLast);
  12956. + return true;
  12957. +}
  12958. +
  12959. +#ifdef JSON_USE_CPPTL
  12960. +Value Value::get(const CppTL::ConstString& key,
  12961. + const Value& defaultValue) const {
  12962. + return get(key.c_str(), key.end_c_str(), defaultValue);
  12963. +}
  12964. +#endif
  12965. +
  12966. +bool Value::isMember(char const* key, char const* cend) const
  12967. +{
  12968. + Value const* value = find(key, cend);
  12969. + return NULL != value;
  12970. +}
  12971. +bool Value::isMember(char const* key) const
  12972. +{
  12973. + return isMember(key, key + strlen(key));
  12974. +}
  12975. +bool Value::isMember(JSONCPP_STRING const& key) const
  12976. +{
  12977. + return isMember(key.data(), key.data() + key.length());
  12978. +}
  12979. +
  12980. +#ifdef JSON_USE_CPPTL
  12981. +bool Value::isMember(const CppTL::ConstString& key) const {
  12982. + return isMember(key.c_str(), key.end_c_str());
  12983. +}
  12984. +#endif
  12985. +
  12986. +Value::Members Value::getMemberNames() const {
  12987. + JSON_ASSERT_MESSAGE(
  12988. + type_ == nullValue || type_ == objectValue,
  12989. + "in Json::Value::getMemberNames(), value must be objectValue");
  12990. + if (type_ == nullValue)
  12991. + return Value::Members();
  12992. + Members members;
  12993. + members.reserve(value_.map_->size());
  12994. + ObjectValues::const_iterator it = value_.map_->begin();
  12995. + ObjectValues::const_iterator itEnd = value_.map_->end();
  12996. + for (; it != itEnd; ++it) {
  12997. + members.push_back(JSONCPP_STRING((*it).first.data(),
  12998. + (*it).first.length()));
  12999. + }
  13000. + return members;
  13001. +}
  13002. +//
  13003. +//# ifdef JSON_USE_CPPTL
  13004. +// EnumMemberNames
  13005. +// Value::enumMemberNames() const
  13006. +//{
  13007. +// if ( type_ == objectValue )
  13008. +// {
  13009. +// return CppTL::Enum::any( CppTL::Enum::transform(
  13010. +// CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ),
  13011. +// MemberNamesTransform() ) );
  13012. +// }
  13013. +// return EnumMemberNames();
  13014. +//}
  13015. +//
  13016. +//
  13017. +// EnumValues
  13018. +// Value::enumValues() const
  13019. +//{
  13020. +// if ( type_ == objectValue || type_ == arrayValue )
  13021. +// return CppTL::Enum::anyValues( *(value_.map_),
  13022. +// CppTL::Type<const Value &>() );
  13023. +// return EnumValues();
  13024. +//}
  13025. +//
  13026. +//# endif
  13027. +
  13028. +static bool IsIntegral(double d) {
  13029. + double integral_part;
  13030. + return modf(d, &integral_part) == 0.0;
  13031. +}
  13032. +
  13033. +bool Value::isNull() const { return type_ == nullValue; }
  13034. +
  13035. +bool Value::isBool() const { return type_ == booleanValue; }
  13036. +
  13037. +bool Value::isInt() const {
  13038. + switch (type_) {
  13039. + case intValue:
  13040. + return value_.int_ >= minInt && value_.int_ <= maxInt;
  13041. + case uintValue:
  13042. + return value_.uint_ <= UInt(maxInt);
  13043. + case realValue:
  13044. + return value_.real_ >= minInt && value_.real_ <= maxInt &&
  13045. + IsIntegral(value_.real_);
  13046. + default:
  13047. + break;
  13048. + }
  13049. + return false;
  13050. +}
  13051. +
  13052. +bool Value::isUInt() const {
  13053. + switch (type_) {
  13054. + case intValue:
  13055. + return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt);
  13056. + case uintValue:
  13057. + return value_.uint_ <= maxUInt;
  13058. + case realValue:
  13059. + return value_.real_ >= 0 && value_.real_ <= maxUInt &&
  13060. + IsIntegral(value_.real_);
  13061. + default:
  13062. + break;
  13063. + }
  13064. + return false;
  13065. +}
  13066. +
  13067. +bool Value::isInt64() const {
  13068. +#if defined(JSON_HAS_INT64)
  13069. + switch (type_) {
  13070. + case intValue:
  13071. + return true;
  13072. + case uintValue:
  13073. + return value_.uint_ <= UInt64(maxInt64);
  13074. + case realValue:
  13075. + // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a
  13076. + // double, so double(maxInt64) will be rounded up to 2^63. Therefore we
  13077. + // require the value to be strictly less than the limit.
  13078. + return value_.real_ >= double(minInt64) &&
  13079. + value_.real_ < double(maxInt64) && IsIntegral(value_.real_);
  13080. + default:
  13081. + break;
  13082. + }
  13083. +#endif // JSON_HAS_INT64
  13084. + return false;
  13085. +}
  13086. +
  13087. +bool Value::isUInt64() const {
  13088. +#if defined(JSON_HAS_INT64)
  13089. + switch (type_) {
  13090. + case intValue:
  13091. + return value_.int_ >= 0;
  13092. + case uintValue:
  13093. + return true;
  13094. + case realValue:
  13095. + // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a
  13096. + // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we
  13097. + // require the value to be strictly less than the limit.
  13098. + return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble &&
  13099. + IsIntegral(value_.real_);
  13100. + default:
  13101. + break;
  13102. + }
  13103. +#endif // JSON_HAS_INT64
  13104. + return false;
  13105. +}
  13106. +
  13107. +bool Value::isIntegral() const {
  13108. +#if defined(JSON_HAS_INT64)
  13109. + return isInt64() || isUInt64();
  13110. +#else
  13111. + return isInt() || isUInt();
  13112. +#endif
  13113. +}
  13114. +
  13115. +bool Value::isDouble() const { return type_ == realValue || isIntegral(); }
  13116. +
  13117. +bool Value::isNumeric() const { return isIntegral() || isDouble(); }
  13118. +
  13119. +bool Value::isString() const { return type_ == stringValue; }
  13120. +
  13121. +bool Value::isArray() const { return type_ == arrayValue; }
  13122. +
  13123. +bool Value::isObject() const { return type_ == objectValue; }
  13124. +
  13125. +void Value::setComment(const char* comment, size_t len, CommentPlacement placement) {
  13126. + if (!comments_)
  13127. + comments_ = new CommentInfo[numberOfCommentPlacement];
  13128. + if ((len > 0) && (comment[len-1] == '\n')) {
  13129. + // Always discard trailing newline, to aid indentation.
  13130. + len -= 1;
  13131. + }
  13132. + comments_[placement].setComment(comment, len);
  13133. +}
  13134. +
  13135. +void Value::setComment(const char* comment, CommentPlacement placement) {
  13136. + setComment(comment, strlen(comment), placement);
  13137. +}
  13138. +
  13139. +void Value::setComment(const JSONCPP_STRING& comment, CommentPlacement placement) {
  13140. + setComment(comment.c_str(), comment.length(), placement);
  13141. +}
  13142. +
  13143. +bool Value::hasComment(CommentPlacement placement) const {
  13144. + return comments_ != 0 && comments_[placement].comment_ != 0;
  13145. +}
  13146. +
  13147. +JSONCPP_STRING Value::getComment(CommentPlacement placement) const {
  13148. + if (hasComment(placement))
  13149. + return comments_[placement].comment_;
  13150. + return "";
  13151. +}
  13152. +
  13153. +void Value::setOffsetStart(ptrdiff_t start) { start_ = start; }
  13154. +
  13155. +void Value::setOffsetLimit(ptrdiff_t limit) { limit_ = limit; }
  13156. +
  13157. +ptrdiff_t Value::getOffsetStart() const { return start_; }
  13158. +
  13159. +ptrdiff_t Value::getOffsetLimit() const { return limit_; }
  13160. +
  13161. +JSONCPP_STRING Value::toStyledString() const {
  13162. + StyledWriter writer;
  13163. + return writer.write(*this);
  13164. +}
  13165. +
  13166. +Value::const_iterator Value::begin() const {
  13167. + switch (type_) {
  13168. + case arrayValue:
  13169. + case objectValue:
  13170. + if (value_.map_)
  13171. + return const_iterator(value_.map_->begin());
  13172. + break;
  13173. + default:
  13174. + break;
  13175. + }
  13176. + return const_iterator();
  13177. +}
  13178. +
  13179. +Value::const_iterator Value::end() const {
  13180. + switch (type_) {
  13181. + case arrayValue:
  13182. + case objectValue:
  13183. + if (value_.map_)
  13184. + return const_iterator(value_.map_->end());
  13185. + break;
  13186. + default:
  13187. + break;
  13188. + }
  13189. + return const_iterator();
  13190. +}
  13191. +
  13192. +Value::iterator Value::begin() {
  13193. + switch (type_) {
  13194. + case arrayValue:
  13195. + case objectValue:
  13196. + if (value_.map_)
  13197. + return iterator(value_.map_->begin());
  13198. + break;
  13199. + default:
  13200. + break;
  13201. + }
  13202. + return iterator();
  13203. +}
  13204. +
  13205. +Value::iterator Value::end() {
  13206. + switch (type_) {
  13207. + case arrayValue:
  13208. + case objectValue:
  13209. + if (value_.map_)
  13210. + return iterator(value_.map_->end());
  13211. + break;
  13212. + default:
  13213. + break;
  13214. + }
  13215. + return iterator();
  13216. +}
  13217. +
  13218. +// class PathArgument
  13219. +// //////////////////////////////////////////////////////////////////
  13220. +
  13221. +PathArgument::PathArgument() : key_(), index_(), kind_(kindNone) {}
  13222. +
  13223. +PathArgument::PathArgument(ArrayIndex index)
  13224. + : key_(), index_(index), kind_(kindIndex) {}
  13225. +
  13226. +PathArgument::PathArgument(const char* key)
  13227. + : key_(key), index_(), kind_(kindKey) {}
  13228. +
  13229. +PathArgument::PathArgument(const JSONCPP_STRING& key)
  13230. + : key_(key.c_str()), index_(), kind_(kindKey) {}
  13231. +
  13232. +// class Path
  13233. +// //////////////////////////////////////////////////////////////////
  13234. +
  13235. +Path::Path(const JSONCPP_STRING& path,
  13236. + const PathArgument& a1,
  13237. + const PathArgument& a2,
  13238. + const PathArgument& a3,
  13239. + const PathArgument& a4,
  13240. + const PathArgument& a5) {
  13241. + InArgs in;
  13242. + in.push_back(&a1);
  13243. + in.push_back(&a2);
  13244. + in.push_back(&a3);
  13245. + in.push_back(&a4);
  13246. + in.push_back(&a5);
  13247. + makePath(path, in);
  13248. +}
  13249. +
  13250. +void Path::makePath(const JSONCPP_STRING& path, const InArgs& in) {
  13251. + const char* current = path.c_str();
  13252. + const char* end = current + path.length();
  13253. + InArgs::const_iterator itInArg = in.begin();
  13254. + while (current != end) {
  13255. + if (*current == '[') {
  13256. + ++current;
  13257. + if (*current == '%')
  13258. + addPathInArg(path, in, itInArg, PathArgument::kindIndex);
  13259. + else {
  13260. + ArrayIndex index = 0;
  13261. + for (; current != end && *current >= '0' && *current <= '9'; ++current)
  13262. + index = index * 10 + ArrayIndex(*current - '0');
  13263. + args_.push_back(index);
  13264. + }
  13265. + if (current == end || *++current != ']')
  13266. + invalidPath(path, int(current - path.c_str()));
  13267. + } else if (*current == '%') {
  13268. + addPathInArg(path, in, itInArg, PathArgument::kindKey);
  13269. + ++current;
  13270. + } else if (*current == '.' || *current == ']') {
  13271. + ++current;
  13272. + } else {
  13273. + const char* beginName = current;
  13274. + while (current != end && !strchr("[.", *current))
  13275. + ++current;
  13276. + args_.push_back(JSONCPP_STRING(beginName, current));
  13277. + }
  13278. + }
  13279. +}
  13280. +
  13281. +void Path::addPathInArg(const JSONCPP_STRING& /*path*/,
  13282. + const InArgs& in,
  13283. + InArgs::const_iterator& itInArg,
  13284. + PathArgument::Kind kind) {
  13285. + if (itInArg == in.end()) {
  13286. + // Error: missing argument %d
  13287. + } else if ((*itInArg)->kind_ != kind) {
  13288. + // Error: bad argument type
  13289. + } else {
  13290. + args_.push_back(**itInArg++);
  13291. + }
  13292. +}
  13293. +
  13294. +void Path::invalidPath(const JSONCPP_STRING& /*path*/, int /*location*/) {
  13295. + // Error: invalid path.
  13296. +}
  13297. +
  13298. +const Value& Path::resolve(const Value& root) const {
  13299. + const Value* node = &root;
  13300. + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
  13301. + const PathArgument& arg = *it;
  13302. + if (arg.kind_ == PathArgument::kindIndex) {
  13303. + if (!node->isArray() || !node->isValidIndex(arg.index_)) {
  13304. + // Error: unable to resolve path (array value expected at position...
  13305. + return Value::null;
  13306. + }
  13307. + node = &((*node)[arg.index_]);
  13308. + } else if (arg.kind_ == PathArgument::kindKey) {
  13309. + if (!node->isObject()) {
  13310. + // Error: unable to resolve path (object value expected at position...)
  13311. + return Value::null;
  13312. + }
  13313. + node = &((*node)[arg.key_]);
  13314. + if (node == &Value::nullSingleton()) {
  13315. + // Error: unable to resolve path (object has no member named '' at
  13316. + // position...)
  13317. + return Value::null;
  13318. + }
  13319. + }
  13320. + }
  13321. + return *node;
  13322. +}
  13323. +
  13324. +Value Path::resolve(const Value& root, const Value& defaultValue) const {
  13325. + const Value* node = &root;
  13326. + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
  13327. + const PathArgument& arg = *it;
  13328. + if (arg.kind_ == PathArgument::kindIndex) {
  13329. + if (!node->isArray() || !node->isValidIndex(arg.index_))
  13330. + return defaultValue;
  13331. + node = &((*node)[arg.index_]);
  13332. + } else if (arg.kind_ == PathArgument::kindKey) {
  13333. + if (!node->isObject())
  13334. + return defaultValue;
  13335. + node = &((*node)[arg.key_]);
  13336. + if (node == &Value::nullSingleton())
  13337. + return defaultValue;
  13338. + }
  13339. + }
  13340. + return *node;
  13341. +}
  13342. +
  13343. +Value& Path::make(Value& root) const {
  13344. + Value* node = &root;
  13345. + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) {
  13346. + const PathArgument& arg = *it;
  13347. + if (arg.kind_ == PathArgument::kindIndex) {
  13348. + if (!node->isArray()) {
  13349. + // Error: node is not an array at position ...
  13350. + }
  13351. + node = &((*node)[arg.index_]);
  13352. + } else if (arg.kind_ == PathArgument::kindKey) {
  13353. + if (!node->isObject()) {
  13354. + // Error: node is not an object at position...
  13355. + }
  13356. + node = &((*node)[arg.key_]);
  13357. + }
  13358. + }
  13359. + return *node;
  13360. +}
  13361. +
  13362. +} // namespace Json
  13363. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_valueiterator.inl polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_valueiterator.inl
  13364. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_valueiterator.inl 1970-01-01 02:00:00.000000000 +0200
  13365. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_valueiterator.inl 2017-12-03 19:05:22.000000000 +0300
  13366. @@ -0,0 +1,167 @@
  13367. +// Copyright 2007-2010 Baptiste Lepilleur
  13368. +// Distributed under MIT license, or public domain if desired and
  13369. +// recognized in your jurisdiction.
  13370. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  13371. +
  13372. +// included by json_value.cpp
  13373. +
  13374. +namespace Json {
  13375. +
  13376. +// //////////////////////////////////////////////////////////////////
  13377. +// //////////////////////////////////////////////////////////////////
  13378. +// //////////////////////////////////////////////////////////////////
  13379. +// class ValueIteratorBase
  13380. +// //////////////////////////////////////////////////////////////////
  13381. +// //////////////////////////////////////////////////////////////////
  13382. +// //////////////////////////////////////////////////////////////////
  13383. +
  13384. +ValueIteratorBase::ValueIteratorBase()
  13385. + : current_(), isNull_(true) {
  13386. +}
  13387. +
  13388. +ValueIteratorBase::ValueIteratorBase(
  13389. + const Value::ObjectValues::iterator& current)
  13390. + : current_(current), isNull_(false) {}
  13391. +
  13392. +Value& ValueIteratorBase::deref() const {
  13393. + return current_->second;
  13394. +}
  13395. +
  13396. +void ValueIteratorBase::increment() {
  13397. + ++current_;
  13398. +}
  13399. +
  13400. +void ValueIteratorBase::decrement() {
  13401. + --current_;
  13402. +}
  13403. +
  13404. +ValueIteratorBase::difference_type
  13405. +ValueIteratorBase::computeDistance(const SelfType& other) const {
  13406. +#ifdef JSON_USE_CPPTL_SMALLMAP
  13407. + return other.current_ - current_;
  13408. +#else
  13409. + // Iterator for null value are initialized using the default
  13410. + // constructor, which initialize current_ to the default
  13411. + // std::map::iterator. As begin() and end() are two instance
  13412. + // of the default std::map::iterator, they can not be compared.
  13413. + // To allow this, we handle this comparison specifically.
  13414. + if (isNull_ && other.isNull_) {
  13415. + return 0;
  13416. + }
  13417. +
  13418. + // Usage of std::distance is not portable (does not compile with Sun Studio 12
  13419. + // RogueWave STL,
  13420. + // which is the one used by default).
  13421. + // Using a portable hand-made version for non random iterator instead:
  13422. + // return difference_type( std::distance( current_, other.current_ ) );
  13423. + difference_type myDistance = 0;
  13424. + for (Value::ObjectValues::iterator it = current_; it != other.current_;
  13425. + ++it) {
  13426. + ++myDistance;
  13427. + }
  13428. + return myDistance;
  13429. +#endif
  13430. +}
  13431. +
  13432. +bool ValueIteratorBase::isEqual(const SelfType& other) const {
  13433. + if (isNull_) {
  13434. + return other.isNull_;
  13435. + }
  13436. + return current_ == other.current_;
  13437. +}
  13438. +
  13439. +void ValueIteratorBase::copy(const SelfType& other) {
  13440. + current_ = other.current_;
  13441. + isNull_ = other.isNull_;
  13442. +}
  13443. +
  13444. +Value ValueIteratorBase::key() const {
  13445. + const Value::CZString czstring = (*current_).first;
  13446. + if (czstring.data()) {
  13447. + if (czstring.isStaticString())
  13448. + return Value(StaticString(czstring.data()));
  13449. + return Value(czstring.data(), czstring.data() + czstring.length());
  13450. + }
  13451. + return Value(czstring.index());
  13452. +}
  13453. +
  13454. +UInt ValueIteratorBase::index() const {
  13455. + const Value::CZString czstring = (*current_).first;
  13456. + if (!czstring.data())
  13457. + return czstring.index();
  13458. + return Value::UInt(-1);
  13459. +}
  13460. +
  13461. +JSONCPP_STRING ValueIteratorBase::name() const {
  13462. + char const* keey;
  13463. + char const* end;
  13464. + keey = memberName(&end);
  13465. + if (!keey) return JSONCPP_STRING();
  13466. + return JSONCPP_STRING(keey, end);
  13467. +}
  13468. +
  13469. +char const* ValueIteratorBase::memberName() const {
  13470. + const char* cname = (*current_).first.data();
  13471. + return cname ? cname : "";
  13472. +}
  13473. +
  13474. +char const* ValueIteratorBase::memberName(char const** end) const {
  13475. + const char* cname = (*current_).first.data();
  13476. + if (!cname) {
  13477. + *end = NULL;
  13478. + return NULL;
  13479. + }
  13480. + *end = cname + (*current_).first.length();
  13481. + return cname;
  13482. +}
  13483. +
  13484. +// //////////////////////////////////////////////////////////////////
  13485. +// //////////////////////////////////////////////////////////////////
  13486. +// //////////////////////////////////////////////////////////////////
  13487. +// class ValueConstIterator
  13488. +// //////////////////////////////////////////////////////////////////
  13489. +// //////////////////////////////////////////////////////////////////
  13490. +// //////////////////////////////////////////////////////////////////
  13491. +
  13492. +ValueConstIterator::ValueConstIterator() {}
  13493. +
  13494. +ValueConstIterator::ValueConstIterator(
  13495. + const Value::ObjectValues::iterator& current)
  13496. + : ValueIteratorBase(current) {}
  13497. +
  13498. +ValueConstIterator::ValueConstIterator(ValueIterator const& other)
  13499. + : ValueIteratorBase(other) {}
  13500. +
  13501. +ValueConstIterator& ValueConstIterator::
  13502. +operator=(const ValueIteratorBase& other) {
  13503. + copy(other);
  13504. + return *this;
  13505. +}
  13506. +
  13507. +// //////////////////////////////////////////////////////////////////
  13508. +// //////////////////////////////////////////////////////////////////
  13509. +// //////////////////////////////////////////////////////////////////
  13510. +// class ValueIterator
  13511. +// //////////////////////////////////////////////////////////////////
  13512. +// //////////////////////////////////////////////////////////////////
  13513. +// //////////////////////////////////////////////////////////////////
  13514. +
  13515. +ValueIterator::ValueIterator() {}
  13516. +
  13517. +ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current)
  13518. + : ValueIteratorBase(current) {}
  13519. +
  13520. +ValueIterator::ValueIterator(const ValueConstIterator& other)
  13521. + : ValueIteratorBase(other) {
  13522. + throwRuntimeError("ConstIterator to Iterator should never be allowed.");
  13523. +}
  13524. +
  13525. +ValueIterator::ValueIterator(const ValueIterator& other)
  13526. + : ValueIteratorBase(other) {}
  13527. +
  13528. +ValueIterator& ValueIterator::operator=(const SelfType& other) {
  13529. + copy(other);
  13530. + return *this;
  13531. +}
  13532. +
  13533. +} // namespace Json
  13534. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_writer.cpp polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_writer.cpp
  13535. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_writer.cpp 1970-01-01 02:00:00.000000000 +0200
  13536. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/json_writer.cpp 2017-12-03 19:05:22.000000000 +0300
  13537. @@ -0,0 +1,1218 @@
  13538. +// Copyright 2011 Baptiste Lepilleur
  13539. +// Distributed under MIT license, or public domain if desired and
  13540. +// recognized in your jurisdiction.
  13541. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  13542. +
  13543. +#if !defined(JSON_IS_AMALGAMATION)
  13544. +#include <json/writer.h>
  13545. +#include "json_tool.h"
  13546. +#endif // if !defined(JSON_IS_AMALGAMATION)
  13547. +#include <iomanip>
  13548. +#include <memory>
  13549. +#include <sstream>
  13550. +#include <utility>
  13551. +#include <set>
  13552. +#include <cassert>
  13553. +#include <cstring>
  13554. +#include <cstdio>
  13555. +
  13556. +#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0
  13557. +#include <float.h>
  13558. +#define isfinite _finite
  13559. +#elif defined(__sun) && defined(__SVR4) //Solaris
  13560. +#if !defined(isfinite)
  13561. +#include <ieeefp.h>
  13562. +#define isfinite finite
  13563. +#endif
  13564. +#elif defined(_AIX)
  13565. +#if !defined(isfinite)
  13566. +#include <math.h>
  13567. +#define isfinite finite
  13568. +#endif
  13569. +#elif defined(__hpux)
  13570. +#if !defined(isfinite)
  13571. +#if defined(__ia64) && !defined(finite)
  13572. +#define isfinite(x) ((sizeof(x) == sizeof(float) ? \
  13573. + _Isfinitef(x) : _IsFinite(x)))
  13574. +#else
  13575. +#include <math.h>
  13576. +#define isfinite finite
  13577. +#endif
  13578. +#endif
  13579. +#else
  13580. +#include <cmath>
  13581. +#if !(defined(__QNXNTO__)) // QNX already defines isfinite
  13582. +#define isfinite std::isfinite
  13583. +#endif
  13584. +#endif
  13585. +
  13586. +#if defined(_MSC_VER)
  13587. +#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
  13588. +#define snprintf sprintf_s
  13589. +#elif _MSC_VER >= 1900 // VC++ 14.0 and above
  13590. +#define snprintf std::snprintf
  13591. +#else
  13592. +#define snprintf _snprintf
  13593. +#endif
  13594. +#elif defined(__ANDROID__) || defined(__QNXNTO__)
  13595. +#define snprintf snprintf
  13596. +#elif __cplusplus >= 201103L
  13597. +#if !defined(__MINGW32__) && !defined(__CYGWIN__)
  13598. +#define snprintf std::snprintf
  13599. +#endif
  13600. +#endif
  13601. +
  13602. +#if defined(__BORLANDC__)
  13603. +#include <float.h>
  13604. +#define isfinite _finite
  13605. +#define snprintf _snprintf
  13606. +#endif
  13607. +
  13608. +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0
  13609. +// Disable warning about strdup being deprecated.
  13610. +#pragma warning(disable : 4996)
  13611. +#endif
  13612. +
  13613. +namespace Json {
  13614. +
  13615. +#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
  13616. +typedef std::unique_ptr<StreamWriter> StreamWriterPtr;
  13617. +#else
  13618. +typedef std::auto_ptr<StreamWriter> StreamWriterPtr;
  13619. +#endif
  13620. +
  13621. +static bool containsControlCharacter(const char* str) {
  13622. + while (*str) {
  13623. + if (isControlCharacter(*(str++)))
  13624. + return true;
  13625. + }
  13626. + return false;
  13627. +}
  13628. +
  13629. +static bool containsControlCharacter0(const char* str, unsigned len) {
  13630. + char const* end = str + len;
  13631. + while (end != str) {
  13632. + if (isControlCharacter(*str) || 0==*str)
  13633. + return true;
  13634. + ++str;
  13635. + }
  13636. + return false;
  13637. +}
  13638. +
  13639. +JSONCPP_STRING valueToString(LargestInt value) {
  13640. + UIntToStringBuffer buffer;
  13641. + char* current = buffer + sizeof(buffer);
  13642. + if (value == Value::minLargestInt) {
  13643. + uintToString(LargestUInt(Value::maxLargestInt) + 1, current);
  13644. + *--current = '-';
  13645. + } else if (value < 0) {
  13646. + uintToString(LargestUInt(-value), current);
  13647. + *--current = '-';
  13648. + } else {
  13649. + uintToString(LargestUInt(value), current);
  13650. + }
  13651. + assert(current >= buffer);
  13652. + return current;
  13653. +}
  13654. +
  13655. +JSONCPP_STRING valueToString(LargestUInt value) {
  13656. + UIntToStringBuffer buffer;
  13657. + char* current = buffer + sizeof(buffer);
  13658. + uintToString(value, current);
  13659. + assert(current >= buffer);
  13660. + return current;
  13661. +}
  13662. +
  13663. +#if defined(JSON_HAS_INT64)
  13664. +
  13665. +JSONCPP_STRING valueToString(Int value) {
  13666. + return valueToString(LargestInt(value));
  13667. +}
  13668. +
  13669. +JSONCPP_STRING valueToString(UInt value) {
  13670. + return valueToString(LargestUInt(value));
  13671. +}
  13672. +
  13673. +#endif // # if defined(JSON_HAS_INT64)
  13674. +
  13675. +namespace {
  13676. +JSONCPP_STRING valueToString(double value, bool useSpecialFloats, unsigned int precision) {
  13677. + // Allocate a buffer that is more than large enough to store the 16 digits of
  13678. + // precision requested below.
  13679. + char buffer[32];
  13680. + int len = -1;
  13681. +
  13682. + char formatString[6];
  13683. + sprintf(formatString, "%%.%dg", precision);
  13684. +
  13685. + // Print into the buffer. We need not request the alternative representation
  13686. + // that always has a decimal point because JSON doesn't distingish the
  13687. + // concepts of reals and integers.
  13688. + if (isfinite(value)) {
  13689. + len = snprintf(buffer, sizeof(buffer), formatString, value);
  13690. + } else {
  13691. + // IEEE standard states that NaN values will not compare to themselves
  13692. + if (value != value) {
  13693. + len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null");
  13694. + } else if (value < 0) {
  13695. + len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999");
  13696. + } else {
  13697. + len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999");
  13698. + }
  13699. + // For those, we do not need to call fixNumLoc, but it is fast.
  13700. + }
  13701. + assert(len >= 0);
  13702. + fixNumericLocale(buffer, buffer + len);
  13703. + return buffer;
  13704. +}
  13705. +}
  13706. +
  13707. +JSONCPP_STRING valueToString(double value) { return valueToString(value, false, 17); }
  13708. +
  13709. +JSONCPP_STRING valueToString(bool value) { return value ? "true" : "false"; }
  13710. +
  13711. +JSONCPP_STRING valueToQuotedString(const char* value) {
  13712. + if (value == NULL)
  13713. + return "";
  13714. + // Not sure how to handle unicode...
  13715. + if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL &&
  13716. + !containsControlCharacter(value))
  13717. + return JSONCPP_STRING("\"") + value + "\"";
  13718. + // We have to walk value and escape any special characters.
  13719. + // Appending to JSONCPP_STRING is not efficient, but this should be rare.
  13720. + // (Note: forward slashes are *not* rare, but I am not escaping them.)
  13721. + JSONCPP_STRING::size_type maxsize =
  13722. + strlen(value) * 2 + 3; // allescaped+quotes+NULL
  13723. + JSONCPP_STRING result;
  13724. + result.reserve(maxsize); // to avoid lots of mallocs
  13725. + result += "\"";
  13726. + for (const char* c = value; *c != 0; ++c) {
  13727. + switch (*c) {
  13728. + case '\"':
  13729. + result += "\\\"";
  13730. + break;
  13731. + case '\\':
  13732. + result += "\\\\";
  13733. + break;
  13734. + case '\b':
  13735. + result += "\\b";
  13736. + break;
  13737. + case '\f':
  13738. + result += "\\f";
  13739. + break;
  13740. + case '\n':
  13741. + result += "\\n";
  13742. + break;
  13743. + case '\r':
  13744. + result += "\\r";
  13745. + break;
  13746. + case '\t':
  13747. + result += "\\t";
  13748. + break;
  13749. + // case '/':
  13750. + // Even though \/ is considered a legal escape in JSON, a bare
  13751. + // slash is also legal, so I see no reason to escape it.
  13752. + // (I hope I am not misunderstanding something.
  13753. + // blep notes: actually escaping \/ may be useful in javascript to avoid </
  13754. + // sequence.
  13755. + // Should add a flag to allow this compatibility mode and prevent this
  13756. + // sequence from occurring.
  13757. + default:
  13758. + if (isControlCharacter(*c)) {
  13759. + JSONCPP_OSTRINGSTREAM oss;
  13760. + oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
  13761. + << std::setw(4) << static_cast<int>(*c);
  13762. + result += oss.str();
  13763. + } else {
  13764. + result += *c;
  13765. + }
  13766. + break;
  13767. + }
  13768. + }
  13769. + result += "\"";
  13770. + return result;
  13771. +}
  13772. +
  13773. +// https://github.com/upcaste/upcaste/blob/master/src/upcore/src/cstring/strnpbrk.cpp
  13774. +static char const* strnpbrk(char const* s, char const* accept, size_t n) {
  13775. + assert((s || !n) && accept);
  13776. +
  13777. + char const* const end = s + n;
  13778. + for (char const* cur = s; cur < end; ++cur) {
  13779. + int const c = *cur;
  13780. + for (char const* a = accept; *a; ++a) {
  13781. + if (*a == c) {
  13782. + return cur;
  13783. + }
  13784. + }
  13785. + }
  13786. + return NULL;
  13787. +}
  13788. +static JSONCPP_STRING valueToQuotedStringN(const char* value, unsigned length) {
  13789. + if (value == NULL)
  13790. + return "";
  13791. + // Not sure how to handle unicode...
  13792. + if (strnpbrk(value, "\"\\\b\f\n\r\t", length) == NULL &&
  13793. + !containsControlCharacter0(value, length))
  13794. + return JSONCPP_STRING("\"") + value + "\"";
  13795. + // We have to walk value and escape any special characters.
  13796. + // Appending to JSONCPP_STRING is not efficient, but this should be rare.
  13797. + // (Note: forward slashes are *not* rare, but I am not escaping them.)
  13798. + JSONCPP_STRING::size_type maxsize =
  13799. + length * 2 + 3; // allescaped+quotes+NULL
  13800. + JSONCPP_STRING result;
  13801. + result.reserve(maxsize); // to avoid lots of mallocs
  13802. + result += "\"";
  13803. + char const* end = value + length;
  13804. + for (const char* c = value; c != end; ++c) {
  13805. + switch (*c) {
  13806. + case '\"':
  13807. + result += "\\\"";
  13808. + break;
  13809. + case '\\':
  13810. + result += "\\\\";
  13811. + break;
  13812. + case '\b':
  13813. + result += "\\b";
  13814. + break;
  13815. + case '\f':
  13816. + result += "\\f";
  13817. + break;
  13818. + case '\n':
  13819. + result += "\\n";
  13820. + break;
  13821. + case '\r':
  13822. + result += "\\r";
  13823. + break;
  13824. + case '\t':
  13825. + result += "\\t";
  13826. + break;
  13827. + // case '/':
  13828. + // Even though \/ is considered a legal escape in JSON, a bare
  13829. + // slash is also legal, so I see no reason to escape it.
  13830. + // (I hope I am not misunderstanding something.)
  13831. + // blep notes: actually escaping \/ may be useful in javascript to avoid </
  13832. + // sequence.
  13833. + // Should add a flag to allow this compatibility mode and prevent this
  13834. + // sequence from occurring.
  13835. + default:
  13836. + if ((isControlCharacter(*c)) || (*c == 0)) {
  13837. + JSONCPP_OSTRINGSTREAM oss;
  13838. + oss << "\\u" << std::hex << std::uppercase << std::setfill('0')
  13839. + << std::setw(4) << static_cast<int>(*c);
  13840. + result += oss.str();
  13841. + } else {
  13842. + result += *c;
  13843. + }
  13844. + break;
  13845. + }
  13846. + }
  13847. + result += "\"";
  13848. + return result;
  13849. +}
  13850. +
  13851. +// Class Writer
  13852. +// //////////////////////////////////////////////////////////////////
  13853. +Writer::~Writer() {}
  13854. +
  13855. +// Class FastWriter
  13856. +// //////////////////////////////////////////////////////////////////
  13857. +
  13858. +FastWriter::FastWriter()
  13859. + : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false),
  13860. + omitEndingLineFeed_(false) {}
  13861. +
  13862. +void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; }
  13863. +
  13864. +void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; }
  13865. +
  13866. +void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; }
  13867. +
  13868. +JSONCPP_STRING FastWriter::write(const Value& root) {
  13869. + document_ = "";
  13870. + writeValue(root);
  13871. + if (!omitEndingLineFeed_)
  13872. + document_ += "\n";
  13873. + return document_;
  13874. +}
  13875. +
  13876. +void FastWriter::writeValue(const Value& value) {
  13877. + switch (value.type()) {
  13878. + case nullValue:
  13879. + if (!dropNullPlaceholders_)
  13880. + document_ += "null";
  13881. + break;
  13882. + case intValue:
  13883. + document_ += valueToString(value.asLargestInt());
  13884. + break;
  13885. + case uintValue:
  13886. + document_ += valueToString(value.asLargestUInt());
  13887. + break;
  13888. + case realValue:
  13889. + document_ += valueToString(value.asDouble());
  13890. + break;
  13891. + case stringValue:
  13892. + {
  13893. + // Is NULL possible for value.string_? No.
  13894. + char const* str;
  13895. + char const* end;
  13896. + bool ok = value.getString(&str, &end);
  13897. + if (ok) document_ += valueToQuotedStringN(str, static_cast<unsigned>(end-str));
  13898. + break;
  13899. + }
  13900. + case booleanValue:
  13901. + document_ += valueToString(value.asBool());
  13902. + break;
  13903. + case arrayValue: {
  13904. + document_ += '[';
  13905. + ArrayIndex size = value.size();
  13906. + for (ArrayIndex index = 0; index < size; ++index) {
  13907. + if (index > 0)
  13908. + document_ += ',';
  13909. + writeValue(value[index]);
  13910. + }
  13911. + document_ += ']';
  13912. + } break;
  13913. + case objectValue: {
  13914. + Value::Members members(value.getMemberNames());
  13915. + document_ += '{';
  13916. + for (Value::Members::iterator it = members.begin(); it != members.end();
  13917. + ++it) {
  13918. + const JSONCPP_STRING& name = *it;
  13919. + if (it != members.begin())
  13920. + document_ += ',';
  13921. + document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
  13922. + document_ += yamlCompatiblityEnabled_ ? ": " : ":";
  13923. + writeValue(value[name]);
  13924. + }
  13925. + document_ += '}';
  13926. + } break;
  13927. + }
  13928. +}
  13929. +
  13930. +// Class StyledWriter
  13931. +// //////////////////////////////////////////////////////////////////
  13932. +
  13933. +StyledWriter::StyledWriter()
  13934. + : rightMargin_(74), indentSize_(3), addChildValues_() {}
  13935. +
  13936. +JSONCPP_STRING StyledWriter::write(const Value& root) {
  13937. + document_ = "";
  13938. + addChildValues_ = false;
  13939. + indentString_ = "";
  13940. + writeCommentBeforeValue(root);
  13941. + writeValue(root);
  13942. + writeCommentAfterValueOnSameLine(root);
  13943. + document_ += "\n";
  13944. + return document_;
  13945. +}
  13946. +
  13947. +void StyledWriter::writeValue(const Value& value) {
  13948. + switch (value.type()) {
  13949. + case nullValue:
  13950. + pushValue("null");
  13951. + break;
  13952. + case intValue:
  13953. + pushValue(valueToString(value.asLargestInt()));
  13954. + break;
  13955. + case uintValue:
  13956. + pushValue(valueToString(value.asLargestUInt()));
  13957. + break;
  13958. + case realValue:
  13959. + pushValue(valueToString(value.asDouble()));
  13960. + break;
  13961. + case stringValue:
  13962. + {
  13963. + // Is NULL possible for value.string_? No.
  13964. + char const* str;
  13965. + char const* end;
  13966. + bool ok = value.getString(&str, &end);
  13967. + if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
  13968. + else pushValue("");
  13969. + break;
  13970. + }
  13971. + case booleanValue:
  13972. + pushValue(valueToString(value.asBool()));
  13973. + break;
  13974. + case arrayValue:
  13975. + writeArrayValue(value);
  13976. + break;
  13977. + case objectValue: {
  13978. + Value::Members members(value.getMemberNames());
  13979. + if (members.empty())
  13980. + pushValue("{}");
  13981. + else {
  13982. + writeWithIndent("{");
  13983. + indent();
  13984. + Value::Members::iterator it = members.begin();
  13985. + for (;;) {
  13986. + const JSONCPP_STRING& name = *it;
  13987. + const Value& childValue = value[name];
  13988. + writeCommentBeforeValue(childValue);
  13989. + writeWithIndent(valueToQuotedString(name.c_str()));
  13990. + document_ += " : ";
  13991. + writeValue(childValue);
  13992. + if (++it == members.end()) {
  13993. + writeCommentAfterValueOnSameLine(childValue);
  13994. + break;
  13995. + }
  13996. + document_ += ',';
  13997. + writeCommentAfterValueOnSameLine(childValue);
  13998. + }
  13999. + unindent();
  14000. + writeWithIndent("}");
  14001. + }
  14002. + } break;
  14003. + }
  14004. +}
  14005. +
  14006. +void StyledWriter::writeArrayValue(const Value& value) {
  14007. + unsigned size = value.size();
  14008. + if (size == 0)
  14009. + pushValue("[]");
  14010. + else {
  14011. + bool isArrayMultiLine = isMultineArray(value);
  14012. + if (isArrayMultiLine) {
  14013. + writeWithIndent("[");
  14014. + indent();
  14015. + bool hasChildValue = !childValues_.empty();
  14016. + unsigned index = 0;
  14017. + for (;;) {
  14018. + const Value& childValue = value[index];
  14019. + writeCommentBeforeValue(childValue);
  14020. + if (hasChildValue)
  14021. + writeWithIndent(childValues_[index]);
  14022. + else {
  14023. + writeIndent();
  14024. + writeValue(childValue);
  14025. + }
  14026. + if (++index == size) {
  14027. + writeCommentAfterValueOnSameLine(childValue);
  14028. + break;
  14029. + }
  14030. + document_ += ',';
  14031. + writeCommentAfterValueOnSameLine(childValue);
  14032. + }
  14033. + unindent();
  14034. + writeWithIndent("]");
  14035. + } else // output on a single line
  14036. + {
  14037. + assert(childValues_.size() == size);
  14038. + document_ += "[ ";
  14039. + for (unsigned index = 0; index < size; ++index) {
  14040. + if (index > 0)
  14041. + document_ += ", ";
  14042. + document_ += childValues_[index];
  14043. + }
  14044. + document_ += " ]";
  14045. + }
  14046. + }
  14047. +}
  14048. +
  14049. +bool StyledWriter::isMultineArray(const Value& value) {
  14050. + ArrayIndex const size = value.size();
  14051. + bool isMultiLine = size * 3 >= rightMargin_;
  14052. + childValues_.clear();
  14053. + for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
  14054. + const Value& childValue = value[index];
  14055. + isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
  14056. + childValue.size() > 0);
  14057. + }
  14058. + if (!isMultiLine) // check if line length > max line length
  14059. + {
  14060. + childValues_.reserve(size);
  14061. + addChildValues_ = true;
  14062. + ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
  14063. + for (ArrayIndex index = 0; index < size; ++index) {
  14064. + if (hasCommentForValue(value[index])) {
  14065. + isMultiLine = true;
  14066. + }
  14067. + writeValue(value[index]);
  14068. + lineLength += static_cast<ArrayIndex>(childValues_[index].length());
  14069. + }
  14070. + addChildValues_ = false;
  14071. + isMultiLine = isMultiLine || lineLength >= rightMargin_;
  14072. + }
  14073. + return isMultiLine;
  14074. +}
  14075. +
  14076. +void StyledWriter::pushValue(const JSONCPP_STRING& value) {
  14077. + if (addChildValues_)
  14078. + childValues_.push_back(value);
  14079. + else
  14080. + document_ += value;
  14081. +}
  14082. +
  14083. +void StyledWriter::writeIndent() {
  14084. + if (!document_.empty()) {
  14085. + char last = document_[document_.length() - 1];
  14086. + if (last == ' ') // already indented
  14087. + return;
  14088. + if (last != '\n') // Comments may add new-line
  14089. + document_ += '\n';
  14090. + }
  14091. + document_ += indentString_;
  14092. +}
  14093. +
  14094. +void StyledWriter::writeWithIndent(const JSONCPP_STRING& value) {
  14095. + writeIndent();
  14096. + document_ += value;
  14097. +}
  14098. +
  14099. +void StyledWriter::indent() { indentString_ += JSONCPP_STRING(indentSize_, ' '); }
  14100. +
  14101. +void StyledWriter::unindent() {
  14102. + assert(indentString_.size() >= indentSize_);
  14103. + indentString_.resize(indentString_.size() - indentSize_);
  14104. +}
  14105. +
  14106. +void StyledWriter::writeCommentBeforeValue(const Value& root) {
  14107. + if (!root.hasComment(commentBefore))
  14108. + return;
  14109. +
  14110. + document_ += "\n";
  14111. + writeIndent();
  14112. + const JSONCPP_STRING& comment = root.getComment(commentBefore);
  14113. + JSONCPP_STRING::const_iterator iter = comment.begin();
  14114. + while (iter != comment.end()) {
  14115. + document_ += *iter;
  14116. + if (*iter == '\n' &&
  14117. + (iter != comment.end() && *(iter + 1) == '/'))
  14118. + writeIndent();
  14119. + ++iter;
  14120. + }
  14121. +
  14122. + // Comments are stripped of trailing newlines, so add one here
  14123. + document_ += "\n";
  14124. +}
  14125. +
  14126. +void StyledWriter::writeCommentAfterValueOnSameLine(const Value& root) {
  14127. + if (root.hasComment(commentAfterOnSameLine))
  14128. + document_ += " " + root.getComment(commentAfterOnSameLine);
  14129. +
  14130. + if (root.hasComment(commentAfter)) {
  14131. + document_ += "\n";
  14132. + document_ += root.getComment(commentAfter);
  14133. + document_ += "\n";
  14134. + }
  14135. +}
  14136. +
  14137. +bool StyledWriter::hasCommentForValue(const Value& value) {
  14138. + return value.hasComment(commentBefore) ||
  14139. + value.hasComment(commentAfterOnSameLine) ||
  14140. + value.hasComment(commentAfter);
  14141. +}
  14142. +
  14143. +// Class StyledStreamWriter
  14144. +// //////////////////////////////////////////////////////////////////
  14145. +
  14146. +StyledStreamWriter::StyledStreamWriter(JSONCPP_STRING indentation)
  14147. + : document_(NULL), rightMargin_(74), indentation_(indentation),
  14148. + addChildValues_() {}
  14149. +
  14150. +void StyledStreamWriter::write(JSONCPP_OSTREAM& out, const Value& root) {
  14151. + document_ = &out;
  14152. + addChildValues_ = false;
  14153. + indentString_ = "";
  14154. + indented_ = true;
  14155. + writeCommentBeforeValue(root);
  14156. + if (!indented_) writeIndent();
  14157. + indented_ = true;
  14158. + writeValue(root);
  14159. + writeCommentAfterValueOnSameLine(root);
  14160. + *document_ << "\n";
  14161. + document_ = NULL; // Forget the stream, for safety.
  14162. +}
  14163. +
  14164. +void StyledStreamWriter::writeValue(const Value& value) {
  14165. + switch (value.type()) {
  14166. + case nullValue:
  14167. + pushValue("null");
  14168. + break;
  14169. + case intValue:
  14170. + pushValue(valueToString(value.asLargestInt()));
  14171. + break;
  14172. + case uintValue:
  14173. + pushValue(valueToString(value.asLargestUInt()));
  14174. + break;
  14175. + case realValue:
  14176. + pushValue(valueToString(value.asDouble()));
  14177. + break;
  14178. + case stringValue:
  14179. + {
  14180. + // Is NULL possible for value.string_? No.
  14181. + char const* str;
  14182. + char const* end;
  14183. + bool ok = value.getString(&str, &end);
  14184. + if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
  14185. + else pushValue("");
  14186. + break;
  14187. + }
  14188. + case booleanValue:
  14189. + pushValue(valueToString(value.asBool()));
  14190. + break;
  14191. + case arrayValue:
  14192. + writeArrayValue(value);
  14193. + break;
  14194. + case objectValue: {
  14195. + Value::Members members(value.getMemberNames());
  14196. + if (members.empty())
  14197. + pushValue("{}");
  14198. + else {
  14199. + writeWithIndent("{");
  14200. + indent();
  14201. + Value::Members::iterator it = members.begin();
  14202. + for (;;) {
  14203. + const JSONCPP_STRING& name = *it;
  14204. + const Value& childValue = value[name];
  14205. + writeCommentBeforeValue(childValue);
  14206. + writeWithIndent(valueToQuotedString(name.c_str()));
  14207. + *document_ << " : ";
  14208. + writeValue(childValue);
  14209. + if (++it == members.end()) {
  14210. + writeCommentAfterValueOnSameLine(childValue);
  14211. + break;
  14212. + }
  14213. + *document_ << ",";
  14214. + writeCommentAfterValueOnSameLine(childValue);
  14215. + }
  14216. + unindent();
  14217. + writeWithIndent("}");
  14218. + }
  14219. + } break;
  14220. + }
  14221. +}
  14222. +
  14223. +void StyledStreamWriter::writeArrayValue(const Value& value) {
  14224. + unsigned size = value.size();
  14225. + if (size == 0)
  14226. + pushValue("[]");
  14227. + else {
  14228. + bool isArrayMultiLine = isMultineArray(value);
  14229. + if (isArrayMultiLine) {
  14230. + writeWithIndent("[");
  14231. + indent();
  14232. + bool hasChildValue = !childValues_.empty();
  14233. + unsigned index = 0;
  14234. + for (;;) {
  14235. + const Value& childValue = value[index];
  14236. + writeCommentBeforeValue(childValue);
  14237. + if (hasChildValue)
  14238. + writeWithIndent(childValues_[index]);
  14239. + else {
  14240. + if (!indented_) writeIndent();
  14241. + indented_ = true;
  14242. + writeValue(childValue);
  14243. + indented_ = false;
  14244. + }
  14245. + if (++index == size) {
  14246. + writeCommentAfterValueOnSameLine(childValue);
  14247. + break;
  14248. + }
  14249. + *document_ << ",";
  14250. + writeCommentAfterValueOnSameLine(childValue);
  14251. + }
  14252. + unindent();
  14253. + writeWithIndent("]");
  14254. + } else // output on a single line
  14255. + {
  14256. + assert(childValues_.size() == size);
  14257. + *document_ << "[ ";
  14258. + for (unsigned index = 0; index < size; ++index) {
  14259. + if (index > 0)
  14260. + *document_ << ", ";
  14261. + *document_ << childValues_[index];
  14262. + }
  14263. + *document_ << " ]";
  14264. + }
  14265. + }
  14266. +}
  14267. +
  14268. +bool StyledStreamWriter::isMultineArray(const Value& value) {
  14269. + ArrayIndex const size = value.size();
  14270. + bool isMultiLine = size * 3 >= rightMargin_;
  14271. + childValues_.clear();
  14272. + for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
  14273. + const Value& childValue = value[index];
  14274. + isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
  14275. + childValue.size() > 0);
  14276. + }
  14277. + if (!isMultiLine) // check if line length > max line length
  14278. + {
  14279. + childValues_.reserve(size);
  14280. + addChildValues_ = true;
  14281. + ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
  14282. + for (ArrayIndex index = 0; index < size; ++index) {
  14283. + if (hasCommentForValue(value[index])) {
  14284. + isMultiLine = true;
  14285. + }
  14286. + writeValue(value[index]);
  14287. + lineLength += static_cast<ArrayIndex>(childValues_[index].length());
  14288. + }
  14289. + addChildValues_ = false;
  14290. + isMultiLine = isMultiLine || lineLength >= rightMargin_;
  14291. + }
  14292. + return isMultiLine;
  14293. +}
  14294. +
  14295. +void StyledStreamWriter::pushValue(const JSONCPP_STRING& value) {
  14296. + if (addChildValues_)
  14297. + childValues_.push_back(value);
  14298. + else
  14299. + *document_ << value;
  14300. +}
  14301. +
  14302. +void StyledStreamWriter::writeIndent() {
  14303. + // blep intended this to look at the so-far-written string
  14304. + // to determine whether we are already indented, but
  14305. + // with a stream we cannot do that. So we rely on some saved state.
  14306. + // The caller checks indented_.
  14307. + *document_ << '\n' << indentString_;
  14308. +}
  14309. +
  14310. +void StyledStreamWriter::writeWithIndent(const JSONCPP_STRING& value) {
  14311. + if (!indented_) writeIndent();
  14312. + *document_ << value;
  14313. + indented_ = false;
  14314. +}
  14315. +
  14316. +void StyledStreamWriter::indent() { indentString_ += indentation_; }
  14317. +
  14318. +void StyledStreamWriter::unindent() {
  14319. + assert(indentString_.size() >= indentation_.size());
  14320. + indentString_.resize(indentString_.size() - indentation_.size());
  14321. +}
  14322. +
  14323. +void StyledStreamWriter::writeCommentBeforeValue(const Value& root) {
  14324. + if (!root.hasComment(commentBefore))
  14325. + return;
  14326. +
  14327. + if (!indented_) writeIndent();
  14328. + const JSONCPP_STRING& comment = root.getComment(commentBefore);
  14329. + JSONCPP_STRING::const_iterator iter = comment.begin();
  14330. + while (iter != comment.end()) {
  14331. + *document_ << *iter;
  14332. + if (*iter == '\n' &&
  14333. + (iter != comment.end() && *(iter + 1) == '/'))
  14334. + // writeIndent(); // would include newline
  14335. + *document_ << indentString_;
  14336. + ++iter;
  14337. + }
  14338. + indented_ = false;
  14339. +}
  14340. +
  14341. +void StyledStreamWriter::writeCommentAfterValueOnSameLine(const Value& root) {
  14342. + if (root.hasComment(commentAfterOnSameLine))
  14343. + *document_ << ' ' << root.getComment(commentAfterOnSameLine);
  14344. +
  14345. + if (root.hasComment(commentAfter)) {
  14346. + writeIndent();
  14347. + *document_ << root.getComment(commentAfter);
  14348. + }
  14349. + indented_ = false;
  14350. +}
  14351. +
  14352. +bool StyledStreamWriter::hasCommentForValue(const Value& value) {
  14353. + return value.hasComment(commentBefore) ||
  14354. + value.hasComment(commentAfterOnSameLine) ||
  14355. + value.hasComment(commentAfter);
  14356. +}
  14357. +
  14358. +//////////////////////////
  14359. +// BuiltStyledStreamWriter
  14360. +
  14361. +/// Scoped enums are not available until C++11.
  14362. +struct CommentStyle {
  14363. + /// Decide whether to write comments.
  14364. + enum Enum {
  14365. + None, ///< Drop all comments.
  14366. + Most, ///< Recover odd behavior of previous versions (not implemented yet).
  14367. + All ///< Keep all comments.
  14368. + };
  14369. +};
  14370. +
  14371. +struct BuiltStyledStreamWriter : public StreamWriter
  14372. +{
  14373. + BuiltStyledStreamWriter(
  14374. + JSONCPP_STRING const& indentation,
  14375. + CommentStyle::Enum cs,
  14376. + JSONCPP_STRING const& colonSymbol,
  14377. + JSONCPP_STRING const& nullSymbol,
  14378. + JSONCPP_STRING const& endingLineFeedSymbol,
  14379. + bool useSpecialFloats,
  14380. + unsigned int precision);
  14381. + int write(Value const& root, JSONCPP_OSTREAM* sout) JSONCPP_OVERRIDE;
  14382. +private:
  14383. + void writeValue(Value const& value);
  14384. + void writeArrayValue(Value const& value);
  14385. + bool isMultineArray(Value const& value);
  14386. + void pushValue(JSONCPP_STRING const& value);
  14387. + void writeIndent();
  14388. + void writeWithIndent(JSONCPP_STRING const& value);
  14389. + void indent();
  14390. + void unindent();
  14391. + void writeCommentBeforeValue(Value const& root);
  14392. + void writeCommentAfterValueOnSameLine(Value const& root);
  14393. + static bool hasCommentForValue(const Value& value);
  14394. +
  14395. + typedef std::vector<JSONCPP_STRING> ChildValues;
  14396. +
  14397. + ChildValues childValues_;
  14398. + JSONCPP_STRING indentString_;
  14399. + unsigned int rightMargin_;
  14400. + JSONCPP_STRING indentation_;
  14401. + CommentStyle::Enum cs_;
  14402. + JSONCPP_STRING colonSymbol_;
  14403. + JSONCPP_STRING nullSymbol_;
  14404. + JSONCPP_STRING endingLineFeedSymbol_;
  14405. + bool addChildValues_ : 1;
  14406. + bool indented_ : 1;
  14407. + bool useSpecialFloats_ : 1;
  14408. + unsigned int precision_;
  14409. +};
  14410. +BuiltStyledStreamWriter::BuiltStyledStreamWriter(
  14411. + JSONCPP_STRING const& indentation,
  14412. + CommentStyle::Enum cs,
  14413. + JSONCPP_STRING const& colonSymbol,
  14414. + JSONCPP_STRING const& nullSymbol,
  14415. + JSONCPP_STRING const& endingLineFeedSymbol,
  14416. + bool useSpecialFloats,
  14417. + unsigned int precision)
  14418. + : rightMargin_(74)
  14419. + , indentation_(indentation)
  14420. + , cs_(cs)
  14421. + , colonSymbol_(colonSymbol)
  14422. + , nullSymbol_(nullSymbol)
  14423. + , endingLineFeedSymbol_(endingLineFeedSymbol)
  14424. + , addChildValues_(false)
  14425. + , indented_(false)
  14426. + , useSpecialFloats_(useSpecialFloats)
  14427. + , precision_(precision)
  14428. +{
  14429. +}
  14430. +int BuiltStyledStreamWriter::write(Value const& root, JSONCPP_OSTREAM* sout)
  14431. +{
  14432. + sout_ = sout;
  14433. + addChildValues_ = false;
  14434. + indented_ = true;
  14435. + indentString_ = "";
  14436. + writeCommentBeforeValue(root);
  14437. + if (!indented_) writeIndent();
  14438. + indented_ = true;
  14439. + writeValue(root);
  14440. + writeCommentAfterValueOnSameLine(root);
  14441. + *sout_ << endingLineFeedSymbol_;
  14442. + sout_ = NULL;
  14443. + return 0;
  14444. +}
  14445. +void BuiltStyledStreamWriter::writeValue(Value const& value) {
  14446. + switch (value.type()) {
  14447. + case nullValue:
  14448. + pushValue(nullSymbol_);
  14449. + break;
  14450. + case intValue:
  14451. + pushValue(valueToString(value.asLargestInt()));
  14452. + break;
  14453. + case uintValue:
  14454. + pushValue(valueToString(value.asLargestUInt()));
  14455. + break;
  14456. + case realValue:
  14457. + pushValue(valueToString(value.asDouble(), useSpecialFloats_, precision_));
  14458. + break;
  14459. + case stringValue:
  14460. + {
  14461. + // Is NULL is possible for value.string_? No.
  14462. + char const* str;
  14463. + char const* end;
  14464. + bool ok = value.getString(&str, &end);
  14465. + if (ok) pushValue(valueToQuotedStringN(str, static_cast<unsigned>(end-str)));
  14466. + else pushValue("");
  14467. + break;
  14468. + }
  14469. + case booleanValue:
  14470. + pushValue(valueToString(value.asBool()));
  14471. + break;
  14472. + case arrayValue:
  14473. + writeArrayValue(value);
  14474. + break;
  14475. + case objectValue: {
  14476. + Value::Members members(value.getMemberNames());
  14477. + if (members.empty())
  14478. + pushValue("{}");
  14479. + else {
  14480. + writeWithIndent("{");
  14481. + indent();
  14482. + Value::Members::iterator it = members.begin();
  14483. + for (;;) {
  14484. + JSONCPP_STRING const& name = *it;
  14485. + Value const& childValue = value[name];
  14486. + writeCommentBeforeValue(childValue);
  14487. + writeWithIndent(valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length())));
  14488. + *sout_ << colonSymbol_;
  14489. + writeValue(childValue);
  14490. + if (++it == members.end()) {
  14491. + writeCommentAfterValueOnSameLine(childValue);
  14492. + break;
  14493. + }
  14494. + *sout_ << ",";
  14495. + writeCommentAfterValueOnSameLine(childValue);
  14496. + }
  14497. + unindent();
  14498. + writeWithIndent("}");
  14499. + }
  14500. + } break;
  14501. + }
  14502. +}
  14503. +
  14504. +void BuiltStyledStreamWriter::writeArrayValue(Value const& value) {
  14505. + unsigned size = value.size();
  14506. + if (size == 0)
  14507. + pushValue("[]");
  14508. + else {
  14509. + bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value);
  14510. + if (isMultiLine) {
  14511. + writeWithIndent("[");
  14512. + indent();
  14513. + bool hasChildValue = !childValues_.empty();
  14514. + unsigned index = 0;
  14515. + for (;;) {
  14516. + Value const& childValue = value[index];
  14517. + writeCommentBeforeValue(childValue);
  14518. + if (hasChildValue)
  14519. + writeWithIndent(childValues_[index]);
  14520. + else {
  14521. + if (!indented_) writeIndent();
  14522. + indented_ = true;
  14523. + writeValue(childValue);
  14524. + indented_ = false;
  14525. + }
  14526. + if (++index == size) {
  14527. + writeCommentAfterValueOnSameLine(childValue);
  14528. + break;
  14529. + }
  14530. + *sout_ << ",";
  14531. + writeCommentAfterValueOnSameLine(childValue);
  14532. + }
  14533. + unindent();
  14534. + writeWithIndent("]");
  14535. + } else // output on a single line
  14536. + {
  14537. + assert(childValues_.size() == size);
  14538. + *sout_ << "[";
  14539. + if (!indentation_.empty()) *sout_ << " ";
  14540. + for (unsigned index = 0; index < size; ++index) {
  14541. + if (index > 0)
  14542. + *sout_ << ((!indentation_.empty()) ? ", " : ",");
  14543. + *sout_ << childValues_[index];
  14544. + }
  14545. + if (!indentation_.empty()) *sout_ << " ";
  14546. + *sout_ << "]";
  14547. + }
  14548. + }
  14549. +}
  14550. +
  14551. +bool BuiltStyledStreamWriter::isMultineArray(Value const& value) {
  14552. + ArrayIndex const size = value.size();
  14553. + bool isMultiLine = size * 3 >= rightMargin_;
  14554. + childValues_.clear();
  14555. + for (ArrayIndex index = 0; index < size && !isMultiLine; ++index) {
  14556. + Value const& childValue = value[index];
  14557. + isMultiLine = ((childValue.isArray() || childValue.isObject()) &&
  14558. + childValue.size() > 0);
  14559. + }
  14560. + if (!isMultiLine) // check if line length > max line length
  14561. + {
  14562. + childValues_.reserve(size);
  14563. + addChildValues_ = true;
  14564. + ArrayIndex lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]'
  14565. + for (ArrayIndex index = 0; index < size; ++index) {
  14566. + if (hasCommentForValue(value[index])) {
  14567. + isMultiLine = true;
  14568. + }
  14569. + writeValue(value[index]);
  14570. + lineLength += static_cast<ArrayIndex>(childValues_[index].length());
  14571. + }
  14572. + addChildValues_ = false;
  14573. + isMultiLine = isMultiLine || lineLength >= rightMargin_;
  14574. + }
  14575. + return isMultiLine;
  14576. +}
  14577. +
  14578. +void BuiltStyledStreamWriter::pushValue(JSONCPP_STRING const& value) {
  14579. + if (addChildValues_)
  14580. + childValues_.push_back(value);
  14581. + else
  14582. + *sout_ << value;
  14583. +}
  14584. +
  14585. +void BuiltStyledStreamWriter::writeIndent() {
  14586. + // blep intended this to look at the so-far-written string
  14587. + // to determine whether we are already indented, but
  14588. + // with a stream we cannot do that. So we rely on some saved state.
  14589. + // The caller checks indented_.
  14590. +
  14591. + if (!indentation_.empty()) {
  14592. + // In this case, drop newlines too.
  14593. + *sout_ << '\n' << indentString_;
  14594. + }
  14595. +}
  14596. +
  14597. +void BuiltStyledStreamWriter::writeWithIndent(JSONCPP_STRING const& value) {
  14598. + if (!indented_) writeIndent();
  14599. + *sout_ << value;
  14600. + indented_ = false;
  14601. +}
  14602. +
  14603. +void BuiltStyledStreamWriter::indent() { indentString_ += indentation_; }
  14604. +
  14605. +void BuiltStyledStreamWriter::unindent() {
  14606. + assert(indentString_.size() >= indentation_.size());
  14607. + indentString_.resize(indentString_.size() - indentation_.size());
  14608. +}
  14609. +
  14610. +void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) {
  14611. + if (cs_ == CommentStyle::None) return;
  14612. + if (!root.hasComment(commentBefore))
  14613. + return;
  14614. +
  14615. + if (!indented_) writeIndent();
  14616. + const JSONCPP_STRING& comment = root.getComment(commentBefore);
  14617. + JSONCPP_STRING::const_iterator iter = comment.begin();
  14618. + while (iter != comment.end()) {
  14619. + *sout_ << *iter;
  14620. + if (*iter == '\n' &&
  14621. + (iter != comment.end() && *(iter + 1) == '/'))
  14622. + // writeIndent(); // would write extra newline
  14623. + *sout_ << indentString_;
  14624. + ++iter;
  14625. + }
  14626. + indented_ = false;
  14627. +}
  14628. +
  14629. +void BuiltStyledStreamWriter::writeCommentAfterValueOnSameLine(Value const& root) {
  14630. + if (cs_ == CommentStyle::None) return;
  14631. + if (root.hasComment(commentAfterOnSameLine))
  14632. + *sout_ << " " + root.getComment(commentAfterOnSameLine);
  14633. +
  14634. + if (root.hasComment(commentAfter)) {
  14635. + writeIndent();
  14636. + *sout_ << root.getComment(commentAfter);
  14637. + }
  14638. +}
  14639. +
  14640. +// static
  14641. +bool BuiltStyledStreamWriter::hasCommentForValue(const Value& value) {
  14642. + return value.hasComment(commentBefore) ||
  14643. + value.hasComment(commentAfterOnSameLine) ||
  14644. + value.hasComment(commentAfter);
  14645. +}
  14646. +
  14647. +///////////////
  14648. +// StreamWriter
  14649. +
  14650. +StreamWriter::StreamWriter()
  14651. + : sout_(NULL)
  14652. +{
  14653. +}
  14654. +StreamWriter::~StreamWriter()
  14655. +{
  14656. +}
  14657. +StreamWriter::Factory::~Factory()
  14658. +{}
  14659. +StreamWriterBuilder::StreamWriterBuilder()
  14660. +{
  14661. + setDefaults(&settings_);
  14662. +}
  14663. +StreamWriterBuilder::~StreamWriterBuilder()
  14664. +{}
  14665. +StreamWriter* StreamWriterBuilder::newStreamWriter() const
  14666. +{
  14667. + JSONCPP_STRING indentation = settings_["indentation"].asString();
  14668. + JSONCPP_STRING cs_str = settings_["commentStyle"].asString();
  14669. + bool eyc = settings_["enableYAMLCompatibility"].asBool();
  14670. + bool dnp = settings_["dropNullPlaceholders"].asBool();
  14671. + bool usf = settings_["useSpecialFloats"].asBool();
  14672. + unsigned int pre = settings_["precision"].asUInt();
  14673. + CommentStyle::Enum cs = CommentStyle::All;
  14674. + if (cs_str == "All") {
  14675. + cs = CommentStyle::All;
  14676. + } else if (cs_str == "None") {
  14677. + cs = CommentStyle::None;
  14678. + } else {
  14679. + throwRuntimeError("commentStyle must be 'All' or 'None'");
  14680. + }
  14681. + JSONCPP_STRING colonSymbol = " : ";
  14682. + if (eyc) {
  14683. + colonSymbol = ": ";
  14684. + } else if (indentation.empty()) {
  14685. + colonSymbol = ":";
  14686. + }
  14687. + JSONCPP_STRING nullSymbol = "null";
  14688. + if (dnp) {
  14689. + nullSymbol = "";
  14690. + }
  14691. + if (pre > 17) pre = 17;
  14692. + JSONCPP_STRING endingLineFeedSymbol = "";
  14693. + return new BuiltStyledStreamWriter(
  14694. + indentation, cs,
  14695. + colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre);
  14696. +}
  14697. +static void getValidWriterKeys(std::set<JSONCPP_STRING>* valid_keys)
  14698. +{
  14699. + valid_keys->clear();
  14700. + valid_keys->insert("indentation");
  14701. + valid_keys->insert("commentStyle");
  14702. + valid_keys->insert("enableYAMLCompatibility");
  14703. + valid_keys->insert("dropNullPlaceholders");
  14704. + valid_keys->insert("useSpecialFloats");
  14705. + valid_keys->insert("precision");
  14706. +}
  14707. +bool StreamWriterBuilder::validate(Json::Value* invalid) const
  14708. +{
  14709. + Json::Value my_invalid;
  14710. + if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL
  14711. + Json::Value& inv = *invalid;
  14712. + std::set<JSONCPP_STRING> valid_keys;
  14713. + getValidWriterKeys(&valid_keys);
  14714. + Value::Members keys = settings_.getMemberNames();
  14715. + size_t n = keys.size();
  14716. + for (size_t i = 0; i < n; ++i) {
  14717. + JSONCPP_STRING const& key = keys[i];
  14718. + if (valid_keys.find(key) == valid_keys.end()) {
  14719. + inv[key] = settings_[key];
  14720. + }
  14721. + }
  14722. + return 0u == inv.size();
  14723. +}
  14724. +Value& StreamWriterBuilder::operator[](JSONCPP_STRING key)
  14725. +{
  14726. + return settings_[key];
  14727. +}
  14728. +// static
  14729. +void StreamWriterBuilder::setDefaults(Json::Value* settings)
  14730. +{
  14731. + //! [StreamWriterBuilderDefaults]
  14732. + (*settings)["commentStyle"] = "All";
  14733. + (*settings)["indentation"] = "\t";
  14734. + (*settings)["enableYAMLCompatibility"] = false;
  14735. + (*settings)["dropNullPlaceholders"] = false;
  14736. + (*settings)["useSpecialFloats"] = false;
  14737. + (*settings)["precision"] = 17;
  14738. + //! [StreamWriterBuilderDefaults]
  14739. +}
  14740. +
  14741. +JSONCPP_STRING writeString(StreamWriter::Factory const& builder, Value const& root) {
  14742. + JSONCPP_OSTRINGSTREAM sout;
  14743. + StreamWriterPtr const writer(builder.newStreamWriter());
  14744. + writer->write(root, &sout);
  14745. + return sout.str();
  14746. +}
  14747. +
  14748. +JSONCPP_OSTREAM& operator<<(JSONCPP_OSTREAM& sout, Value const& root) {
  14749. + StreamWriterBuilder builder;
  14750. + StreamWriterPtr const writer(builder.newStreamWriter());
  14751. + writer->write(root, &sout);
  14752. + return sout;
  14753. +}
  14754. +
  14755. +} // namespace Json
  14756. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/sconscript polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/sconscript
  14757. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/sconscript 1970-01-01 02:00:00.000000000 +0200
  14758. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/sconscript 2017-12-03 19:05:22.000000000 +0300
  14759. @@ -0,0 +1,8 @@
  14760. +Import( 'env buildLibrary' )
  14761. +
  14762. +buildLibrary( env, Split( """
  14763. + json_reader.cpp
  14764. + json_value.cpp
  14765. + json_writer.cpp
  14766. + """ ),
  14767. + 'json' )
  14768. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/version.h.in polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/version.h.in
  14769. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/version.h.in 1970-01-01 02:00:00.000000000 +0200
  14770. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/lib_json/version.h.in 2017-12-03 19:05:22.000000000 +0300
  14771. @@ -0,0 +1,20 @@
  14772. +// DO NOT EDIT. This file (and "version") is generated by CMake.
  14773. +// Run CMake configure step to update it.
  14774. +#ifndef JSON_VERSION_H_INCLUDED
  14775. +# define JSON_VERSION_H_INCLUDED
  14776. +
  14777. +# define JSONCPP_VERSION_STRING "@JSONCPP_VERSION@"
  14778. +# define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@
  14779. +# define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@
  14780. +# define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@
  14781. +# define JSONCPP_VERSION_QUALIFIER
  14782. +# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
  14783. +
  14784. +#ifdef JSONCPP_USING_SECURE_MEMORY
  14785. +#undef JSONCPP_USING_SECURE_MEMORY
  14786. +#endif
  14787. +#define JSONCPP_USING_SECURE_MEMORY @JSONCPP_USE_SECURE_MEMORY@
  14788. +// If non-zero, the library zeroes any memory that it has allocated before
  14789. +// it frees its memory.
  14790. +
  14791. +#endif // JSON_VERSION_H_INCLUDED
  14792. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/CMakeLists.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/CMakeLists.txt
  14793. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  14794. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/CMakeLists.txt 2017-12-03 19:05:22.000000000 +0300
  14795. @@ -0,0 +1,38 @@
  14796. +# vim: et ts=4 sts=4 sw=4 tw=0
  14797. +
  14798. +ADD_EXECUTABLE( jsoncpp_test
  14799. + jsontest.cpp
  14800. + jsontest.h
  14801. + main.cpp
  14802. + )
  14803. +
  14804. +
  14805. +IF(BUILD_SHARED_LIBS)
  14806. + ADD_DEFINITIONS( -DJSON_DLL )
  14807. + TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib)
  14808. +ELSE(BUILD_SHARED_LIBS)
  14809. + TARGET_LINK_LIBRARIES(jsoncpp_test jsoncpp_lib_static)
  14810. +ENDIF()
  14811. +
  14812. +# another way to solve issue #90
  14813. +#set_target_properties(jsoncpp_test PROPERTIES COMPILE_FLAGS -ffloat-store)
  14814. +
  14815. +# Run unit tests in post-build
  14816. +# (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?)
  14817. +IF(JSONCPP_WITH_POST_BUILD_UNITTEST)
  14818. + IF(BUILD_SHARED_LIBS)
  14819. + # First, copy the shared lib, for Microsoft.
  14820. + # Then, run the test executable.
  14821. + ADD_CUSTOM_COMMAND( TARGET jsoncpp_test
  14822. + POST_BUILD
  14823. + COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:jsoncpp_lib> $<TARGET_FILE_DIR:jsoncpp_test>
  14824. + COMMAND $<TARGET_FILE:jsoncpp_test>)
  14825. + ELSE(BUILD_SHARED_LIBS)
  14826. + # Just run the test executable.
  14827. + ADD_CUSTOM_COMMAND( TARGET jsoncpp_test
  14828. + POST_BUILD
  14829. + COMMAND $<TARGET_FILE:jsoncpp_test>)
  14830. + ENDIF()
  14831. +ENDIF()
  14832. +
  14833. +SET_TARGET_PROPERTIES(jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test)
  14834. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.cpp polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.cpp
  14835. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.cpp 1970-01-01 02:00:00.000000000 +0200
  14836. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.cpp 2017-12-03 19:05:22.000000000 +0300
  14837. @@ -0,0 +1,457 @@
  14838. +// Copyright 2007-2010 Baptiste Lepilleur
  14839. +// Distributed under MIT license, or public domain if desired and
  14840. +// recognized in your jurisdiction.
  14841. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  14842. +
  14843. +#define _CRT_SECURE_NO_WARNINGS 1 // Prevents deprecation warning with MSVC
  14844. +#include "jsontest.h"
  14845. +#include <stdio.h>
  14846. +#include <string>
  14847. +
  14848. +#if defined(_MSC_VER)
  14849. +// Used to install a report hook that prevent dialog on assertion and error.
  14850. +#include <crtdbg.h>
  14851. +#endif // if defined(_MSC_VER)
  14852. +
  14853. +#if defined(_WIN32)
  14854. +// Used to prevent dialog on memory fault.
  14855. +// Limits headers included by Windows.h
  14856. +#define WIN32_LEAN_AND_MEAN
  14857. +#define NOSERVICE
  14858. +#define NOMCX
  14859. +#define NOIME
  14860. +#define NOSOUND
  14861. +#define NOCOMM
  14862. +#define NORPC
  14863. +#define NOGDI
  14864. +#define NOUSER
  14865. +#define NODRIVERS
  14866. +#define NOLOGERROR
  14867. +#define NOPROFILER
  14868. +#define NOMEMMGR
  14869. +#define NOLFILEIO
  14870. +#define NOOPENFILE
  14871. +#define NORESOURCE
  14872. +#define NOATOM
  14873. +#define NOLANGUAGE
  14874. +#define NOLSTRING
  14875. +#define NODBCS
  14876. +#define NOKEYBOARDINFO
  14877. +#define NOGDICAPMASKS
  14878. +#define NOCOLOR
  14879. +#define NOGDIOBJ
  14880. +#define NODRAWTEXT
  14881. +#define NOTEXTMETRIC
  14882. +#define NOSCALABLEFONT
  14883. +#define NOBITMAP
  14884. +#define NORASTEROPS
  14885. +#define NOMETAFILE
  14886. +#define NOSYSMETRICS
  14887. +#define NOSYSTEMPARAMSINFO
  14888. +#define NOMSG
  14889. +#define NOWINSTYLES
  14890. +#define NOWINOFFSETS
  14891. +#define NOSHOWWINDOW
  14892. +#define NODEFERWINDOWPOS
  14893. +#define NOVIRTUALKEYCODES
  14894. +#define NOKEYSTATES
  14895. +#define NOWH
  14896. +#define NOMENUS
  14897. +#define NOSCROLL
  14898. +#define NOCLIPBOARD
  14899. +#define NOICONS
  14900. +#define NOMB
  14901. +#define NOSYSCOMMANDS
  14902. +#define NOMDI
  14903. +#define NOCTLMGR
  14904. +#define NOWINMESSAGES
  14905. +#include <windows.h>
  14906. +#endif // if defined(_WIN32)
  14907. +
  14908. +namespace JsonTest {
  14909. +
  14910. +// class TestResult
  14911. +// //////////////////////////////////////////////////////////////////
  14912. +
  14913. +TestResult::TestResult()
  14914. + : predicateId_(1), lastUsedPredicateId_(0), messageTarget_(0) {
  14915. + // The root predicate has id 0
  14916. + rootPredicateNode_.id_ = 0;
  14917. + rootPredicateNode_.next_ = 0;
  14918. + predicateStackTail_ = &rootPredicateNode_;
  14919. +}
  14920. +
  14921. +void TestResult::setTestName(const JSONCPP_STRING& name) { name_ = name; }
  14922. +
  14923. +TestResult&
  14924. +TestResult::addFailure(const char* file, unsigned int line, const char* expr) {
  14925. + /// Walks the PredicateContext stack adding them to failures_ if not already
  14926. + /// added.
  14927. + unsigned int nestingLevel = 0;
  14928. + PredicateContext* lastNode = rootPredicateNode_.next_;
  14929. + for (; lastNode != 0; lastNode = lastNode->next_) {
  14930. + if (lastNode->id_ > lastUsedPredicateId_) // new PredicateContext
  14931. + {
  14932. + lastUsedPredicateId_ = lastNode->id_;
  14933. + addFailureInfo(
  14934. + lastNode->file_, lastNode->line_, lastNode->expr_, nestingLevel);
  14935. + // Link the PredicateContext to the failure for message target when
  14936. + // popping the PredicateContext.
  14937. + lastNode->failure_ = &(failures_.back());
  14938. + }
  14939. + ++nestingLevel;
  14940. + }
  14941. +
  14942. + // Adds the failed assertion
  14943. + addFailureInfo(file, line, expr, nestingLevel);
  14944. + messageTarget_ = &(failures_.back());
  14945. + return *this;
  14946. +}
  14947. +
  14948. +void TestResult::addFailureInfo(const char* file,
  14949. + unsigned int line,
  14950. + const char* expr,
  14951. + unsigned int nestingLevel) {
  14952. + Failure failure;
  14953. + failure.file_ = file;
  14954. + failure.line_ = line;
  14955. + if (expr) {
  14956. + failure.expr_ = expr;
  14957. + }
  14958. + failure.nestingLevel_ = nestingLevel;
  14959. + failures_.push_back(failure);
  14960. +}
  14961. +
  14962. +TestResult& TestResult::popPredicateContext() {
  14963. + PredicateContext* lastNode = &rootPredicateNode_;
  14964. + while (lastNode->next_ != 0 && lastNode->next_->next_ != 0) {
  14965. + lastNode = lastNode->next_;
  14966. + }
  14967. + // Set message target to popped failure
  14968. + PredicateContext* tail = lastNode->next_;
  14969. + if (tail != 0 && tail->failure_ != 0) {
  14970. + messageTarget_ = tail->failure_;
  14971. + }
  14972. + // Remove tail from list
  14973. + predicateStackTail_ = lastNode;
  14974. + lastNode->next_ = 0;
  14975. + return *this;
  14976. +}
  14977. +
  14978. +bool TestResult::failed() const { return !failures_.empty(); }
  14979. +
  14980. +unsigned int TestResult::getAssertionNestingLevel() const {
  14981. + unsigned int level = 0;
  14982. + const PredicateContext* lastNode = &rootPredicateNode_;
  14983. + while (lastNode->next_ != 0) {
  14984. + lastNode = lastNode->next_;
  14985. + ++level;
  14986. + }
  14987. + return level;
  14988. +}
  14989. +
  14990. +void TestResult::printFailure(bool printTestName) const {
  14991. + if (failures_.empty()) {
  14992. + return;
  14993. + }
  14994. +
  14995. + if (printTestName) {
  14996. + printf("* Detail of %s test failure:\n", name_.c_str());
  14997. + }
  14998. +
  14999. + // Print in reverse to display the callstack in the right order
  15000. + Failures::const_iterator itEnd = failures_.end();
  15001. + for (Failures::const_iterator it = failures_.begin(); it != itEnd; ++it) {
  15002. + const Failure& failure = *it;
  15003. + JSONCPP_STRING indent(failure.nestingLevel_ * 2, ' ');
  15004. + if (failure.file_) {
  15005. + printf("%s%s(%d): ", indent.c_str(), failure.file_, failure.line_);
  15006. + }
  15007. + if (!failure.expr_.empty()) {
  15008. + printf("%s\n", failure.expr_.c_str());
  15009. + } else if (failure.file_) {
  15010. + printf("\n");
  15011. + }
  15012. + if (!failure.message_.empty()) {
  15013. + JSONCPP_STRING reindented = indentText(failure.message_, indent + " ");
  15014. + printf("%s\n", reindented.c_str());
  15015. + }
  15016. + }
  15017. +}
  15018. +
  15019. +JSONCPP_STRING TestResult::indentText(const JSONCPP_STRING& text,
  15020. + const JSONCPP_STRING& indent) {
  15021. + JSONCPP_STRING reindented;
  15022. + JSONCPP_STRING::size_type lastIndex = 0;
  15023. + while (lastIndex < text.size()) {
  15024. + JSONCPP_STRING::size_type nextIndex = text.find('\n', lastIndex);
  15025. + if (nextIndex == JSONCPP_STRING::npos) {
  15026. + nextIndex = text.size() - 1;
  15027. + }
  15028. + reindented += indent;
  15029. + reindented += text.substr(lastIndex, nextIndex - lastIndex + 1);
  15030. + lastIndex = nextIndex + 1;
  15031. + }
  15032. + return reindented;
  15033. +}
  15034. +
  15035. +TestResult& TestResult::addToLastFailure(const JSONCPP_STRING& message) {
  15036. + if (messageTarget_ != 0) {
  15037. + messageTarget_->message_ += message;
  15038. + }
  15039. + return *this;
  15040. +}
  15041. +
  15042. +TestResult& TestResult::operator<<(Json::Int64 value) {
  15043. + return addToLastFailure(Json::valueToString(value));
  15044. +}
  15045. +
  15046. +TestResult& TestResult::operator<<(Json::UInt64 value) {
  15047. + return addToLastFailure(Json::valueToString(value));
  15048. +}
  15049. +
  15050. +TestResult& TestResult::operator<<(bool value) {
  15051. + return addToLastFailure(value ? "true" : "false");
  15052. +}
  15053. +
  15054. +// class TestCase
  15055. +// //////////////////////////////////////////////////////////////////
  15056. +
  15057. +TestCase::TestCase() : result_(0) {}
  15058. +
  15059. +TestCase::~TestCase() {}
  15060. +
  15061. +void TestCase::run(TestResult& result) {
  15062. + result_ = &result;
  15063. + runTestCase();
  15064. +}
  15065. +
  15066. +// class Runner
  15067. +// //////////////////////////////////////////////////////////////////
  15068. +
  15069. +Runner::Runner() {}
  15070. +
  15071. +Runner& Runner::add(TestCaseFactory factory) {
  15072. + tests_.push_back(factory);
  15073. + return *this;
  15074. +}
  15075. +
  15076. +unsigned int Runner::testCount() const {
  15077. + return static_cast<unsigned int>(tests_.size());
  15078. +}
  15079. +
  15080. +JSONCPP_STRING Runner::testNameAt(unsigned int index) const {
  15081. + TestCase* test = tests_[index]();
  15082. + JSONCPP_STRING name = test->testName();
  15083. + delete test;
  15084. + return name;
  15085. +}
  15086. +
  15087. +void Runner::runTestAt(unsigned int index, TestResult& result) const {
  15088. + TestCase* test = tests_[index]();
  15089. + result.setTestName(test->testName());
  15090. + printf("Testing %s: ", test->testName());
  15091. + fflush(stdout);
  15092. +#if JSON_USE_EXCEPTION
  15093. + try {
  15094. +#endif // if JSON_USE_EXCEPTION
  15095. + test->run(result);
  15096. +#if JSON_USE_EXCEPTION
  15097. + }
  15098. + catch (const std::exception& e) {
  15099. + result.addFailure(__FILE__, __LINE__, "Unexpected exception caught:")
  15100. + << e.what();
  15101. + }
  15102. +#endif // if JSON_USE_EXCEPTION
  15103. + delete test;
  15104. + const char* status = result.failed() ? "FAILED" : "OK";
  15105. + printf("%s\n", status);
  15106. + fflush(stdout);
  15107. +}
  15108. +
  15109. +bool Runner::runAllTest(bool printSummary) const {
  15110. + unsigned int count = testCount();
  15111. + std::deque<TestResult> failures;
  15112. + for (unsigned int index = 0; index < count; ++index) {
  15113. + TestResult result;
  15114. + runTestAt(index, result);
  15115. + if (result.failed()) {
  15116. + failures.push_back(result);
  15117. + }
  15118. + }
  15119. +
  15120. + if (failures.empty()) {
  15121. + if (printSummary) {
  15122. + printf("All %d tests passed\n", count);
  15123. + }
  15124. + return true;
  15125. + } else {
  15126. + for (unsigned int index = 0; index < failures.size(); ++index) {
  15127. + TestResult& result = failures[index];
  15128. + result.printFailure(count > 1);
  15129. + }
  15130. +
  15131. + if (printSummary) {
  15132. + unsigned int failedCount = static_cast<unsigned int>(failures.size());
  15133. + unsigned int passedCount = count - failedCount;
  15134. + printf("%d/%d tests passed (%d failure(s))\n",
  15135. + passedCount,
  15136. + count,
  15137. + failedCount);
  15138. + }
  15139. + return false;
  15140. + }
  15141. +}
  15142. +
  15143. +bool Runner::testIndex(const JSONCPP_STRING& testName,
  15144. + unsigned int& indexOut) const {
  15145. + unsigned int count = testCount();
  15146. + for (unsigned int index = 0; index < count; ++index) {
  15147. + if (testNameAt(index) == testName) {
  15148. + indexOut = index;
  15149. + return true;
  15150. + }
  15151. + }
  15152. + return false;
  15153. +}
  15154. +
  15155. +void Runner::listTests() const {
  15156. + unsigned int count = testCount();
  15157. + for (unsigned int index = 0; index < count; ++index) {
  15158. + printf("%s\n", testNameAt(index).c_str());
  15159. + }
  15160. +}
  15161. +
  15162. +int Runner::runCommandLine(int argc, const char* argv[]) const {
  15163. + // typedef std::deque<JSONCPP_STRING> TestNames;
  15164. + Runner subrunner;
  15165. + for (int index = 1; index < argc; ++index) {
  15166. + JSONCPP_STRING opt = argv[index];
  15167. + if (opt == "--list-tests") {
  15168. + listTests();
  15169. + return 0;
  15170. + } else if (opt == "--test-auto") {
  15171. + preventDialogOnCrash();
  15172. + } else if (opt == "--test") {
  15173. + ++index;
  15174. + if (index < argc) {
  15175. + unsigned int testNameIndex;
  15176. + if (testIndex(argv[index], testNameIndex)) {
  15177. + subrunner.add(tests_[testNameIndex]);
  15178. + } else {
  15179. + fprintf(stderr, "Test '%s' does not exist!\n", argv[index]);
  15180. + return 2;
  15181. + }
  15182. + } else {
  15183. + printUsage(argv[0]);
  15184. + return 2;
  15185. + }
  15186. + } else {
  15187. + printUsage(argv[0]);
  15188. + return 2;
  15189. + }
  15190. + }
  15191. + bool succeeded;
  15192. + if (subrunner.testCount() > 0) {
  15193. + succeeded = subrunner.runAllTest(subrunner.testCount() > 1);
  15194. + } else {
  15195. + succeeded = runAllTest(true);
  15196. + }
  15197. + return succeeded ? 0 : 1;
  15198. +}
  15199. +
  15200. +#if defined(_MSC_VER) && defined(_DEBUG)
  15201. +// Hook MSVCRT assertions to prevent dialog from appearing
  15202. +static int
  15203. +msvcrtSilentReportHook(int reportType, char* message, int* /*returnValue*/) {
  15204. + // The default CRT handling of error and assertion is to display
  15205. + // an error dialog to the user.
  15206. + // Instead, when an error or an assertion occurs, we force the
  15207. + // application to terminate using abort() after display
  15208. + // the message on stderr.
  15209. + if (reportType == _CRT_ERROR || reportType == _CRT_ASSERT) {
  15210. + // calling abort() cause the ReportHook to be called
  15211. + // The following is used to detect this case and let's the
  15212. + // error handler fallback on its default behaviour (
  15213. + // display a warning message)
  15214. + static volatile bool isAborting = false;
  15215. + if (isAborting) {
  15216. + return TRUE;
  15217. + }
  15218. + isAborting = true;
  15219. +
  15220. + fprintf(stderr, "CRT Error/Assert:\n%s\n", message);
  15221. + fflush(stderr);
  15222. + abort();
  15223. + }
  15224. + // Let's other reportType (_CRT_WARNING) be handled as they would by default
  15225. + return FALSE;
  15226. +}
  15227. +#endif // if defined(_MSC_VER)
  15228. +
  15229. +void Runner::preventDialogOnCrash() {
  15230. +#if defined(_MSC_VER) && defined(_DEBUG)
  15231. + // Install a hook to prevent MSVCRT error and assertion from
  15232. + // popping a dialog
  15233. + // This function a NO-OP in release configuration
  15234. + // (which cause warning since msvcrtSilentReportHook is not referenced)
  15235. + _CrtSetReportHook(&msvcrtSilentReportHook);
  15236. +#endif // if defined(_MSC_VER)
  15237. +
  15238. +// @todo investiguate this handler (for buffer overflow)
  15239. +// _set_security_error_handler
  15240. +
  15241. +#if defined(_WIN32)
  15242. + // Prevents the system from popping a dialog for debugging if the
  15243. + // application fails due to invalid memory access.
  15244. + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
  15245. + SEM_NOOPENFILEERRORBOX);
  15246. +#endif // if defined(_WIN32)
  15247. +}
  15248. +
  15249. +void Runner::printUsage(const char* appName) {
  15250. + printf("Usage: %s [options]\n"
  15251. + "\n"
  15252. + "If --test is not specified, then all the test cases be run.\n"
  15253. + "\n"
  15254. + "Valid options:\n"
  15255. + "--list-tests: print the name of all test cases on the standard\n"
  15256. + " output and exit.\n"
  15257. + "--test TESTNAME: executes the test case with the specified name.\n"
  15258. + " May be repeated.\n"
  15259. + "--test-auto: prevent dialog prompting for debugging on crash.\n",
  15260. + appName);
  15261. +}
  15262. +
  15263. +// Assertion functions
  15264. +// //////////////////////////////////////////////////////////////////
  15265. +
  15266. +JSONCPP_STRING ToJsonString(const char* toConvert) {
  15267. + return JSONCPP_STRING(toConvert);
  15268. +}
  15269. +
  15270. +JSONCPP_STRING ToJsonString(JSONCPP_STRING in) {
  15271. + return in;
  15272. +}
  15273. +
  15274. +#if JSONCPP_USING_SECURE_MEMORY
  15275. +JSONCPP_STRING ToJsonString(std::string in) {
  15276. + return JSONCPP_STRING(in.data(), in.data() + in.length());
  15277. +}
  15278. +#endif
  15279. +
  15280. +TestResult& checkStringEqual(TestResult& result,
  15281. + const JSONCPP_STRING& expected,
  15282. + const JSONCPP_STRING& actual,
  15283. + const char* file,
  15284. + unsigned int line,
  15285. + const char* expr) {
  15286. + if (expected != actual) {
  15287. + result.addFailure(file, line, expr);
  15288. + result << "Expected: '" << expected << "'\n";
  15289. + result << "Actual : '" << actual << "'";
  15290. + }
  15291. + return result;
  15292. +}
  15293. +
  15294. +} // namespace JsonTest
  15295. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.h polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.h
  15296. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.h 1970-01-01 02:00:00.000000000 +0200
  15297. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/jsontest.h 2017-12-03 19:05:22.000000000 +0300
  15298. @@ -0,0 +1,286 @@
  15299. +// Copyright 2007-2010 Baptiste Lepilleur
  15300. +// Distributed under MIT license, or public domain if desired and
  15301. +// recognized in your jurisdiction.
  15302. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  15303. +
  15304. +#ifndef JSONTEST_H_INCLUDED
  15305. +#define JSONTEST_H_INCLUDED
  15306. +
  15307. +#include <json/config.h>
  15308. +#include <json/value.h>
  15309. +#include <json/writer.h>
  15310. +#include <stdio.h>
  15311. +#include <deque>
  15312. +#include <sstream>
  15313. +#include <string>
  15314. +
  15315. +// //////////////////////////////////////////////////////////////////
  15316. +// //////////////////////////////////////////////////////////////////
  15317. +// Mini Unit Testing framework
  15318. +// //////////////////////////////////////////////////////////////////
  15319. +// //////////////////////////////////////////////////////////////////
  15320. +
  15321. +/** \brief Unit testing framework.
  15322. + * \warning: all assertions are non-aborting, test case execution will continue
  15323. + * even if an assertion namespace.
  15324. + * This constraint is for portability: the framework needs to compile
  15325. + * on Visual Studio 6 and must not require exception usage.
  15326. + */
  15327. +namespace JsonTest {
  15328. +
  15329. +class Failure {
  15330. +public:
  15331. + const char* file_;
  15332. + unsigned int line_;
  15333. + JSONCPP_STRING expr_;
  15334. + JSONCPP_STRING message_;
  15335. + unsigned int nestingLevel_;
  15336. +};
  15337. +
  15338. +/// Context used to create the assertion callstack on failure.
  15339. +/// Must be a POD to allow inline initialisation without stepping
  15340. +/// into the debugger.
  15341. +struct PredicateContext {
  15342. + typedef unsigned int Id;
  15343. + Id id_;
  15344. + const char* file_;
  15345. + unsigned int line_;
  15346. + const char* expr_;
  15347. + PredicateContext* next_;
  15348. + /// Related Failure, set when the PredicateContext is converted
  15349. + /// into a Failure.
  15350. + Failure* failure_;
  15351. +};
  15352. +
  15353. +class TestResult {
  15354. +public:
  15355. + TestResult();
  15356. +
  15357. + /// \internal Implementation detail for assertion macros
  15358. + /// Not encapsulated to prevent step into when debugging failed assertions
  15359. + /// Incremented by one on assertion predicate entry, decreased by one
  15360. + /// by addPredicateContext().
  15361. + PredicateContext::Id predicateId_;
  15362. +
  15363. + /// \internal Implementation detail for predicate macros
  15364. + PredicateContext* predicateStackTail_;
  15365. +
  15366. + void setTestName(const JSONCPP_STRING& name);
  15367. +
  15368. + /// Adds an assertion failure.
  15369. + TestResult&
  15370. + addFailure(const char* file, unsigned int line, const char* expr = 0);
  15371. +
  15372. + /// Removes the last PredicateContext added to the predicate stack
  15373. + /// chained list.
  15374. + /// Next messages will be targed at the PredicateContext that was removed.
  15375. + TestResult& popPredicateContext();
  15376. +
  15377. + bool failed() const;
  15378. +
  15379. + void printFailure(bool printTestName) const;
  15380. +
  15381. + // Generic operator that will work with anything ostream can deal with.
  15382. + template <typename T> TestResult& operator<<(const T& value) {
  15383. + JSONCPP_OSTRINGSTREAM oss;
  15384. + oss.precision(16);
  15385. + oss.setf(std::ios_base::floatfield);
  15386. + oss << value;
  15387. + return addToLastFailure(oss.str());
  15388. + }
  15389. +
  15390. + // Specialized versions.
  15391. + TestResult& operator<<(bool value);
  15392. + // std:ostream does not support 64bits integers on all STL implementation
  15393. + TestResult& operator<<(Json::Int64 value);
  15394. + TestResult& operator<<(Json::UInt64 value);
  15395. +
  15396. +private:
  15397. + TestResult& addToLastFailure(const JSONCPP_STRING& message);
  15398. + unsigned int getAssertionNestingLevel() const;
  15399. + /// Adds a failure or a predicate context
  15400. + void addFailureInfo(const char* file,
  15401. + unsigned int line,
  15402. + const char* expr,
  15403. + unsigned int nestingLevel);
  15404. + static JSONCPP_STRING indentText(const JSONCPP_STRING& text,
  15405. + const JSONCPP_STRING& indent);
  15406. +
  15407. + typedef std::deque<Failure> Failures;
  15408. + Failures failures_;
  15409. + JSONCPP_STRING name_;
  15410. + PredicateContext rootPredicateNode_;
  15411. + PredicateContext::Id lastUsedPredicateId_;
  15412. + /// Failure which is the target of the messages added using operator <<
  15413. + Failure* messageTarget_;
  15414. +};
  15415. +
  15416. +class TestCase {
  15417. +public:
  15418. + TestCase();
  15419. +
  15420. + virtual ~TestCase();
  15421. +
  15422. + void run(TestResult& result);
  15423. +
  15424. + virtual const char* testName() const = 0;
  15425. +
  15426. +protected:
  15427. + TestResult* result_;
  15428. +
  15429. +private:
  15430. + virtual void runTestCase() = 0;
  15431. +};
  15432. +
  15433. +/// Function pointer type for TestCase factory
  15434. +typedef TestCase* (*TestCaseFactory)();
  15435. +
  15436. +class Runner {
  15437. +public:
  15438. + Runner();
  15439. +
  15440. + /// Adds a test to the suite
  15441. + Runner& add(TestCaseFactory factory);
  15442. +
  15443. + /// Runs test as specified on the command-line
  15444. + /// If no command-line arguments are provided, run all tests.
  15445. + /// If --list-tests is provided, then print the list of all test cases
  15446. + /// If --test <testname> is provided, then run test testname.
  15447. + int runCommandLine(int argc, const char* argv[]) const;
  15448. +
  15449. + /// Runs all the test cases
  15450. + bool runAllTest(bool printSummary) const;
  15451. +
  15452. + /// Returns the number of test case in the suite
  15453. + unsigned int testCount() const;
  15454. +
  15455. + /// Returns the name of the test case at the specified index
  15456. + JSONCPP_STRING testNameAt(unsigned int index) const;
  15457. +
  15458. + /// Runs the test case at the specified index using the specified TestResult
  15459. + void runTestAt(unsigned int index, TestResult& result) const;
  15460. +
  15461. + static void printUsage(const char* appName);
  15462. +
  15463. +private: // prevents copy construction and assignment
  15464. + Runner(const Runner& other);
  15465. + Runner& operator=(const Runner& other);
  15466. +
  15467. +private:
  15468. + void listTests() const;
  15469. + bool testIndex(const JSONCPP_STRING& testName, unsigned int& index) const;
  15470. + static void preventDialogOnCrash();
  15471. +
  15472. +private:
  15473. + typedef std::deque<TestCaseFactory> Factories;
  15474. + Factories tests_;
  15475. +};
  15476. +
  15477. +template <typename T, typename U>
  15478. +TestResult& checkEqual(TestResult& result,
  15479. + T expected,
  15480. + U actual,
  15481. + const char* file,
  15482. + unsigned int line,
  15483. + const char* expr) {
  15484. + if (static_cast<U>(expected) != actual) {
  15485. + result.addFailure(file, line, expr);
  15486. + result << "Expected: " << static_cast<U>(expected) << "\n";
  15487. + result << "Actual : " << actual;
  15488. + }
  15489. + return result;
  15490. +}
  15491. +
  15492. +JSONCPP_STRING ToJsonString(const char* toConvert);
  15493. +JSONCPP_STRING ToJsonString(JSONCPP_STRING in);
  15494. +#if JSONCPP_USING_SECURE_MEMORY
  15495. +JSONCPP_STRING ToJsonString(std::string in);
  15496. +#endif
  15497. +
  15498. +TestResult& checkStringEqual(TestResult& result,
  15499. + const JSONCPP_STRING& expected,
  15500. + const JSONCPP_STRING& actual,
  15501. + const char* file,
  15502. + unsigned int line,
  15503. + const char* expr);
  15504. +
  15505. +} // namespace JsonTest
  15506. +
  15507. +/// \brief Asserts that the given expression is true.
  15508. +/// JSONTEST_ASSERT( x == y ) << "x=" << x << ", y=" << y;
  15509. +/// JSONTEST_ASSERT( x == y );
  15510. +#define JSONTEST_ASSERT(expr) \
  15511. + if (expr) { \
  15512. + } else \
  15513. + result_->addFailure(__FILE__, __LINE__, #expr)
  15514. +
  15515. +/// \brief Asserts that the given predicate is true.
  15516. +/// The predicate may do other assertions and be a member function of the
  15517. +/// fixture.
  15518. +#define JSONTEST_ASSERT_PRED(expr) \
  15519. + { \
  15520. + JsonTest::PredicateContext _minitest_Context = { \
  15521. + result_->predicateId_, __FILE__, __LINE__, #expr, NULL, NULL \
  15522. + }; \
  15523. + result_->predicateStackTail_->next_ = &_minitest_Context; \
  15524. + result_->predicateId_ += 1; \
  15525. + result_->predicateStackTail_ = &_minitest_Context; \
  15526. + (expr); \
  15527. + result_->popPredicateContext(); \
  15528. + }
  15529. +
  15530. +/// \brief Asserts that two values are equals.
  15531. +#define JSONTEST_ASSERT_EQUAL(expected, actual) \
  15532. + JsonTest::checkEqual(*result_, \
  15533. + expected, \
  15534. + actual, \
  15535. + __FILE__, \
  15536. + __LINE__, \
  15537. + #expected " == " #actual)
  15538. +
  15539. +/// \brief Asserts that two values are equals.
  15540. +#define JSONTEST_ASSERT_STRING_EQUAL(expected, actual) \
  15541. + JsonTest::checkStringEqual(*result_, \
  15542. + JsonTest::ToJsonString(expected), \
  15543. + JsonTest::ToJsonString(actual), \
  15544. + __FILE__, \
  15545. + __LINE__, \
  15546. + #expected " == " #actual)
  15547. +
  15548. +/// \brief Asserts that a given expression throws an exception
  15549. +#define JSONTEST_ASSERT_THROWS(expr) \
  15550. + { \
  15551. + bool _threw = false; \
  15552. + try { \
  15553. + expr; \
  15554. + } \
  15555. + catch (...) { \
  15556. + _threw = true; \
  15557. + } \
  15558. + if (!_threw) \
  15559. + result_->addFailure( \
  15560. + __FILE__, __LINE__, "expected exception thrown: " #expr); \
  15561. + }
  15562. +
  15563. +/// \brief Begin a fixture test case.
  15564. +#define JSONTEST_FIXTURE(FixtureType, name) \
  15565. + class Test##FixtureType##name : public FixtureType { \
  15566. + public: \
  15567. + static JsonTest::TestCase* factory() { \
  15568. + return new Test##FixtureType##name(); \
  15569. + } \
  15570. + \
  15571. + public: /* overidden from TestCase */ \
  15572. + const char* testName() const JSONCPP_OVERRIDE { return #FixtureType "/" #name; } \
  15573. + void runTestCase() JSONCPP_OVERRIDE; \
  15574. + }; \
  15575. + \
  15576. + void Test##FixtureType##name::runTestCase()
  15577. +
  15578. +#define JSONTEST_FIXTURE_FACTORY(FixtureType, name) \
  15579. + &Test##FixtureType##name::factory
  15580. +
  15581. +#define JSONTEST_REGISTER_FIXTURE(runner, FixtureType, name) \
  15582. + (runner).add(JSONTEST_FIXTURE_FACTORY(FixtureType, name))
  15583. +
  15584. +#endif // ifndef JSONTEST_H_INCLUDED
  15585. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/main.cpp polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/main.cpp
  15586. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/main.cpp 1970-01-01 02:00:00.000000000 +0200
  15587. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/main.cpp 2017-12-03 19:05:22.000000000 +0300
  15588. @@ -0,0 +1,2589 @@
  15589. +// Copyright 2007-2010 Baptiste Lepilleur
  15590. +// Distributed under MIT license, or public domain if desired and
  15591. +// recognized in your jurisdiction.
  15592. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  15593. +
  15594. +#include "jsontest.h"
  15595. +#include <json/config.h>
  15596. +#include <json/json.h>
  15597. +#include <cstring>
  15598. +#include <limits>
  15599. +#include <sstream>
  15600. +#include <string>
  15601. +#include <iomanip>
  15602. +
  15603. +// Make numeric limits more convenient to talk about.
  15604. +// Assumes int type in 32 bits.
  15605. +#define kint32max Json::Value::maxInt
  15606. +#define kint32min Json::Value::minInt
  15607. +#define kuint32max Json::Value::maxUInt
  15608. +#define kint64max Json::Value::maxInt64
  15609. +#define kint64min Json::Value::minInt64
  15610. +#define kuint64max Json::Value::maxUInt64
  15611. +
  15612. +//static const double kdint64max = double(kint64max);
  15613. +//static const float kfint64max = float(kint64max);
  15614. +static const float kfint32max = float(kint32max);
  15615. +static const float kfuint32max = float(kuint32max);
  15616. +
  15617. +// //////////////////////////////////////////////////////////////////
  15618. +// //////////////////////////////////////////////////////////////////
  15619. +// Json Library test cases
  15620. +// //////////////////////////////////////////////////////////////////
  15621. +// //////////////////////////////////////////////////////////////////
  15622. +
  15623. +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  15624. +static inline double uint64ToDouble(Json::UInt64 value) {
  15625. + return static_cast<double>(value);
  15626. +}
  15627. +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  15628. +static inline double uint64ToDouble(Json::UInt64 value) {
  15629. + return static_cast<double>(Json::Int64(value / 2)) * 2.0 +
  15630. + static_cast<double>(Json::Int64(value & 1));
  15631. +}
  15632. +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION)
  15633. +
  15634. +struct ValueTest : JsonTest::TestCase {
  15635. + Json::Value null_;
  15636. + Json::Value emptyArray_;
  15637. + Json::Value emptyObject_;
  15638. + Json::Value integer_;
  15639. + Json::Value unsignedInteger_;
  15640. + Json::Value smallUnsignedInteger_;
  15641. + Json::Value real_;
  15642. + Json::Value float_;
  15643. + Json::Value array1_;
  15644. + Json::Value object1_;
  15645. + Json::Value emptyString_;
  15646. + Json::Value string1_;
  15647. + Json::Value string_;
  15648. + Json::Value true_;
  15649. + Json::Value false_;
  15650. +
  15651. + ValueTest()
  15652. + : emptyArray_(Json::arrayValue), emptyObject_(Json::objectValue),
  15653. + integer_(123456789), unsignedInteger_(34567890u),
  15654. + smallUnsignedInteger_(Json::Value::UInt(Json::Value::maxInt)),
  15655. + real_(1234.56789), float_(0.00390625f), emptyString_(""), string1_("a"),
  15656. + string_("sometext with space"), true_(true), false_(false) {
  15657. + array1_.append(1234);
  15658. + object1_["id"] = 1234;
  15659. + }
  15660. +
  15661. + struct IsCheck {
  15662. + /// Initialize all checks to \c false by default.
  15663. + IsCheck();
  15664. +
  15665. + bool isObject_;
  15666. + bool isArray_;
  15667. + bool isBool_;
  15668. + bool isString_;
  15669. + bool isNull_;
  15670. +
  15671. + bool isInt_;
  15672. + bool isInt64_;
  15673. + bool isUInt_;
  15674. + bool isUInt64_;
  15675. + bool isIntegral_;
  15676. + bool isDouble_;
  15677. + bool isNumeric_;
  15678. + };
  15679. +
  15680. + void checkConstMemberCount(const Json::Value& value,
  15681. + unsigned int expectedCount);
  15682. +
  15683. + void checkMemberCount(Json::Value& value, unsigned int expectedCount);
  15684. +
  15685. + void checkIs(const Json::Value& value, const IsCheck& check);
  15686. +
  15687. + void checkIsLess(const Json::Value& x, const Json::Value& y);
  15688. +
  15689. + void checkIsEqual(const Json::Value& x, const Json::Value& y);
  15690. +
  15691. + /// Normalize the representation of floating-point number by stripped leading
  15692. + /// 0 in exponent.
  15693. + static JSONCPP_STRING normalizeFloatingPointStr(const JSONCPP_STRING& s);
  15694. +};
  15695. +
  15696. +JSONCPP_STRING ValueTest::normalizeFloatingPointStr(const JSONCPP_STRING& s) {
  15697. + JSONCPP_STRING::size_type index = s.find_last_of("eE");
  15698. + if (index != JSONCPP_STRING::npos) {
  15699. + JSONCPP_STRING::size_type hasSign =
  15700. + (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
  15701. + JSONCPP_STRING::size_type exponentStartIndex = index + 1 + hasSign;
  15702. + JSONCPP_STRING normalized = s.substr(0, exponentStartIndex);
  15703. + JSONCPP_STRING::size_type indexDigit =
  15704. + s.find_first_not_of('0', exponentStartIndex);
  15705. + JSONCPP_STRING exponent = "0";
  15706. + if (indexDigit !=
  15707. + JSONCPP_STRING::npos) // There is an exponent different from 0
  15708. + {
  15709. + exponent = s.substr(indexDigit);
  15710. + }
  15711. + return normalized + exponent;
  15712. + }
  15713. + return s;
  15714. +}
  15715. +
  15716. +JSONTEST_FIXTURE(ValueTest, checkNormalizeFloatingPointStr) {
  15717. + JSONTEST_ASSERT_STRING_EQUAL("0.0", normalizeFloatingPointStr("0.0"));
  15718. + JSONTEST_ASSERT_STRING_EQUAL("0e0", normalizeFloatingPointStr("0e0"));
  15719. + JSONTEST_ASSERT_STRING_EQUAL("1234.0", normalizeFloatingPointStr("1234.0"));
  15720. + JSONTEST_ASSERT_STRING_EQUAL("1234.0e0",
  15721. + normalizeFloatingPointStr("1234.0e0"));
  15722. + JSONTEST_ASSERT_STRING_EQUAL("1234.0e+0",
  15723. + normalizeFloatingPointStr("1234.0e+0"));
  15724. + JSONTEST_ASSERT_STRING_EQUAL("1234e-1", normalizeFloatingPointStr("1234e-1"));
  15725. + JSONTEST_ASSERT_STRING_EQUAL("1234e10", normalizeFloatingPointStr("1234e10"));
  15726. + JSONTEST_ASSERT_STRING_EQUAL("1234e10",
  15727. + normalizeFloatingPointStr("1234e010"));
  15728. + JSONTEST_ASSERT_STRING_EQUAL("1234e+10",
  15729. + normalizeFloatingPointStr("1234e+010"));
  15730. + JSONTEST_ASSERT_STRING_EQUAL("1234e-10",
  15731. + normalizeFloatingPointStr("1234e-010"));
  15732. + JSONTEST_ASSERT_STRING_EQUAL("1234e+100",
  15733. + normalizeFloatingPointStr("1234e+100"));
  15734. + JSONTEST_ASSERT_STRING_EQUAL("1234e-100",
  15735. + normalizeFloatingPointStr("1234e-100"));
  15736. + JSONTEST_ASSERT_STRING_EQUAL("1234e+1",
  15737. + normalizeFloatingPointStr("1234e+001"));
  15738. +}
  15739. +
  15740. +JSONTEST_FIXTURE(ValueTest, memberCount) {
  15741. + JSONTEST_ASSERT_PRED(checkMemberCount(emptyArray_, 0));
  15742. + JSONTEST_ASSERT_PRED(checkMemberCount(emptyObject_, 0));
  15743. + JSONTEST_ASSERT_PRED(checkMemberCount(array1_, 1));
  15744. + JSONTEST_ASSERT_PRED(checkMemberCount(object1_, 1));
  15745. + JSONTEST_ASSERT_PRED(checkMemberCount(null_, 0));
  15746. + JSONTEST_ASSERT_PRED(checkMemberCount(integer_, 0));
  15747. + JSONTEST_ASSERT_PRED(checkMemberCount(unsignedInteger_, 0));
  15748. + JSONTEST_ASSERT_PRED(checkMemberCount(smallUnsignedInteger_, 0));
  15749. + JSONTEST_ASSERT_PRED(checkMemberCount(real_, 0));
  15750. + JSONTEST_ASSERT_PRED(checkMemberCount(emptyString_, 0));
  15751. + JSONTEST_ASSERT_PRED(checkMemberCount(string_, 0));
  15752. + JSONTEST_ASSERT_PRED(checkMemberCount(true_, 0));
  15753. +}
  15754. +
  15755. +JSONTEST_FIXTURE(ValueTest, objects) {
  15756. + // Types
  15757. + IsCheck checks;
  15758. + checks.isObject_ = true;
  15759. + JSONTEST_ASSERT_PRED(checkIs(emptyObject_, checks));
  15760. + JSONTEST_ASSERT_PRED(checkIs(object1_, checks));
  15761. +
  15762. + JSONTEST_ASSERT_EQUAL(Json::objectValue, emptyObject_.type());
  15763. +
  15764. + // Empty object okay
  15765. + JSONTEST_ASSERT(emptyObject_.isConvertibleTo(Json::nullValue));
  15766. +
  15767. + // Non-empty object not okay
  15768. + JSONTEST_ASSERT(!object1_.isConvertibleTo(Json::nullValue));
  15769. +
  15770. + // Always okay
  15771. + JSONTEST_ASSERT(emptyObject_.isConvertibleTo(Json::objectValue));
  15772. +
  15773. + // Never okay
  15774. + JSONTEST_ASSERT(!emptyObject_.isConvertibleTo(Json::arrayValue));
  15775. + JSONTEST_ASSERT(!emptyObject_.isConvertibleTo(Json::intValue));
  15776. + JSONTEST_ASSERT(!emptyObject_.isConvertibleTo(Json::uintValue));
  15777. + JSONTEST_ASSERT(!emptyObject_.isConvertibleTo(Json::realValue));
  15778. + JSONTEST_ASSERT(!emptyObject_.isConvertibleTo(Json::booleanValue));
  15779. + JSONTEST_ASSERT(!emptyObject_.isConvertibleTo(Json::stringValue));
  15780. +
  15781. + // Access through const reference
  15782. + const Json::Value& constObject = object1_;
  15783. +
  15784. + JSONTEST_ASSERT_EQUAL(Json::Value(1234), constObject["id"]);
  15785. + JSONTEST_ASSERT_EQUAL(Json::Value(), constObject["unknown id"]);
  15786. +
  15787. + // Access through non-const reference
  15788. + JSONTEST_ASSERT_EQUAL(Json::Value(1234), object1_["id"]);
  15789. + JSONTEST_ASSERT_EQUAL(Json::Value(), object1_["unknown id"]);
  15790. +
  15791. + object1_["some other id"] = "foo";
  15792. + JSONTEST_ASSERT_EQUAL(Json::Value("foo"), object1_["some other id"]);
  15793. + JSONTEST_ASSERT_EQUAL(Json::Value("foo"), object1_["some other id"]);
  15794. +
  15795. + // Remove.
  15796. + Json::Value got;
  15797. + bool did;
  15798. + did = object1_.removeMember("some other id", &got);
  15799. + JSONTEST_ASSERT_EQUAL(Json::Value("foo"), got);
  15800. + JSONTEST_ASSERT_EQUAL(true, did);
  15801. + got = Json::Value("bar");
  15802. + did = object1_.removeMember("some other id", &got);
  15803. + JSONTEST_ASSERT_EQUAL(Json::Value("bar"), got);
  15804. + JSONTEST_ASSERT_EQUAL(false, did);
  15805. +}
  15806. +
  15807. +JSONTEST_FIXTURE(ValueTest, arrays) {
  15808. + const unsigned int index0 = 0;
  15809. +
  15810. + // Types
  15811. + IsCheck checks;
  15812. + checks.isArray_ = true;
  15813. + JSONTEST_ASSERT_PRED(checkIs(emptyArray_, checks));
  15814. + JSONTEST_ASSERT_PRED(checkIs(array1_, checks));
  15815. +
  15816. + JSONTEST_ASSERT_EQUAL(Json::arrayValue, array1_.type());
  15817. +
  15818. + // Empty array okay
  15819. + JSONTEST_ASSERT(emptyArray_.isConvertibleTo(Json::nullValue));
  15820. +
  15821. + // Non-empty array not okay
  15822. + JSONTEST_ASSERT(!array1_.isConvertibleTo(Json::nullValue));
  15823. +
  15824. + // Always okay
  15825. + JSONTEST_ASSERT(emptyArray_.isConvertibleTo(Json::arrayValue));
  15826. +
  15827. + // Never okay
  15828. + JSONTEST_ASSERT(!emptyArray_.isConvertibleTo(Json::objectValue));
  15829. + JSONTEST_ASSERT(!emptyArray_.isConvertibleTo(Json::intValue));
  15830. + JSONTEST_ASSERT(!emptyArray_.isConvertibleTo(Json::uintValue));
  15831. + JSONTEST_ASSERT(!emptyArray_.isConvertibleTo(Json::realValue));
  15832. + JSONTEST_ASSERT(!emptyArray_.isConvertibleTo(Json::booleanValue));
  15833. + JSONTEST_ASSERT(!emptyArray_.isConvertibleTo(Json::stringValue));
  15834. +
  15835. + // Access through const reference
  15836. + const Json::Value& constArray = array1_;
  15837. + JSONTEST_ASSERT_EQUAL(Json::Value(1234), constArray[index0]);
  15838. + JSONTEST_ASSERT_EQUAL(Json::Value(1234), constArray[0]);
  15839. +
  15840. + // Access through non-const reference
  15841. + JSONTEST_ASSERT_EQUAL(Json::Value(1234), array1_[index0]);
  15842. + JSONTEST_ASSERT_EQUAL(Json::Value(1234), array1_[0]);
  15843. +
  15844. + array1_[2] = Json::Value(17);
  15845. + JSONTEST_ASSERT_EQUAL(Json::Value(), array1_[1]);
  15846. + JSONTEST_ASSERT_EQUAL(Json::Value(17), array1_[2]);
  15847. + Json::Value got;
  15848. + JSONTEST_ASSERT_EQUAL(true, array1_.removeIndex(2, &got));
  15849. + JSONTEST_ASSERT_EQUAL(Json::Value(17), got);
  15850. + JSONTEST_ASSERT_EQUAL(false, array1_.removeIndex(2, &got)); // gone now
  15851. +}
  15852. +JSONTEST_FIXTURE(ValueTest, arrayIssue252)
  15853. +{
  15854. + int count = 5;
  15855. + Json::Value root;
  15856. + Json::Value item;
  15857. + root["array"] = Json::Value::nullRef;
  15858. + for (int i = 0; i < count; i++)
  15859. + {
  15860. + item["a"] = i;
  15861. + item["b"] = i;
  15862. + root["array"][i] = item;
  15863. + }
  15864. + //JSONTEST_ASSERT_EQUAL(5, root["array"].size());
  15865. +}
  15866. +
  15867. +JSONTEST_FIXTURE(ValueTest, null) {
  15868. + JSONTEST_ASSERT_EQUAL(Json::nullValue, null_.type());
  15869. +
  15870. + IsCheck checks;
  15871. + checks.isNull_ = true;
  15872. + JSONTEST_ASSERT_PRED(checkIs(null_, checks));
  15873. +
  15874. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::nullValue));
  15875. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::intValue));
  15876. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::uintValue));
  15877. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::realValue));
  15878. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::booleanValue));
  15879. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::stringValue));
  15880. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::arrayValue));
  15881. + JSONTEST_ASSERT(null_.isConvertibleTo(Json::objectValue));
  15882. +
  15883. + JSONTEST_ASSERT_EQUAL(Json::Int(0), null_.asInt());
  15884. + JSONTEST_ASSERT_EQUAL(Json::LargestInt(0), null_.asLargestInt());
  15885. + JSONTEST_ASSERT_EQUAL(Json::UInt(0), null_.asUInt());
  15886. + JSONTEST_ASSERT_EQUAL(Json::LargestUInt(0), null_.asLargestUInt());
  15887. + JSONTEST_ASSERT_EQUAL(0.0, null_.asDouble());
  15888. + JSONTEST_ASSERT_EQUAL(0.0, null_.asFloat());
  15889. + JSONTEST_ASSERT_STRING_EQUAL("", null_.asString());
  15890. +
  15891. + JSONTEST_ASSERT_EQUAL(Json::Value::null, null_);
  15892. +}
  15893. +
  15894. +JSONTEST_FIXTURE(ValueTest, strings) {
  15895. + JSONTEST_ASSERT_EQUAL(Json::stringValue, string1_.type());
  15896. +
  15897. + IsCheck checks;
  15898. + checks.isString_ = true;
  15899. + JSONTEST_ASSERT_PRED(checkIs(emptyString_, checks));
  15900. + JSONTEST_ASSERT_PRED(checkIs(string_, checks));
  15901. + JSONTEST_ASSERT_PRED(checkIs(string1_, checks));
  15902. +
  15903. + // Empty string okay
  15904. + JSONTEST_ASSERT(emptyString_.isConvertibleTo(Json::nullValue));
  15905. +
  15906. + // Non-empty string not okay
  15907. + JSONTEST_ASSERT(!string1_.isConvertibleTo(Json::nullValue));
  15908. +
  15909. + // Always okay
  15910. + JSONTEST_ASSERT(string1_.isConvertibleTo(Json::stringValue));
  15911. +
  15912. + // Never okay
  15913. + JSONTEST_ASSERT(!string1_.isConvertibleTo(Json::objectValue));
  15914. + JSONTEST_ASSERT(!string1_.isConvertibleTo(Json::arrayValue));
  15915. + JSONTEST_ASSERT(!string1_.isConvertibleTo(Json::intValue));
  15916. + JSONTEST_ASSERT(!string1_.isConvertibleTo(Json::uintValue));
  15917. + JSONTEST_ASSERT(!string1_.isConvertibleTo(Json::realValue));
  15918. +
  15919. + JSONTEST_ASSERT_STRING_EQUAL("a", string1_.asString());
  15920. + JSONTEST_ASSERT_STRING_EQUAL("a", string1_.asCString());
  15921. +}
  15922. +
  15923. +JSONTEST_FIXTURE(ValueTest, bools) {
  15924. + JSONTEST_ASSERT_EQUAL(Json::booleanValue, false_.type());
  15925. +
  15926. + IsCheck checks;
  15927. + checks.isBool_ = true;
  15928. + JSONTEST_ASSERT_PRED(checkIs(false_, checks));
  15929. + JSONTEST_ASSERT_PRED(checkIs(true_, checks));
  15930. +
  15931. + // False okay
  15932. + JSONTEST_ASSERT(false_.isConvertibleTo(Json::nullValue));
  15933. +
  15934. + // True not okay
  15935. + JSONTEST_ASSERT(!true_.isConvertibleTo(Json::nullValue));
  15936. +
  15937. + // Always okay
  15938. + JSONTEST_ASSERT(true_.isConvertibleTo(Json::intValue));
  15939. + JSONTEST_ASSERT(true_.isConvertibleTo(Json::uintValue));
  15940. + JSONTEST_ASSERT(true_.isConvertibleTo(Json::realValue));
  15941. + JSONTEST_ASSERT(true_.isConvertibleTo(Json::booleanValue));
  15942. + JSONTEST_ASSERT(true_.isConvertibleTo(Json::stringValue));
  15943. +
  15944. + // Never okay
  15945. + JSONTEST_ASSERT(!true_.isConvertibleTo(Json::arrayValue));
  15946. + JSONTEST_ASSERT(!true_.isConvertibleTo(Json::objectValue));
  15947. +
  15948. + JSONTEST_ASSERT_EQUAL(true, true_.asBool());
  15949. + JSONTEST_ASSERT_EQUAL(1, true_.asInt());
  15950. + JSONTEST_ASSERT_EQUAL(1, true_.asLargestInt());
  15951. + JSONTEST_ASSERT_EQUAL(1, true_.asUInt());
  15952. + JSONTEST_ASSERT_EQUAL(1, true_.asLargestUInt());
  15953. + JSONTEST_ASSERT_EQUAL(1.0, true_.asDouble());
  15954. + JSONTEST_ASSERT_EQUAL(1.0, true_.asFloat());
  15955. +
  15956. + JSONTEST_ASSERT_EQUAL(false, false_.asBool());
  15957. + JSONTEST_ASSERT_EQUAL(0, false_.asInt());
  15958. + JSONTEST_ASSERT_EQUAL(0, false_.asLargestInt());
  15959. + JSONTEST_ASSERT_EQUAL(0, false_.asUInt());
  15960. + JSONTEST_ASSERT_EQUAL(0, false_.asLargestUInt());
  15961. + JSONTEST_ASSERT_EQUAL(0.0, false_.asDouble());
  15962. + JSONTEST_ASSERT_EQUAL(0.0, false_.asFloat());
  15963. +}
  15964. +
  15965. +JSONTEST_FIXTURE(ValueTest, integers) {
  15966. + IsCheck checks;
  15967. + Json::Value val;
  15968. +
  15969. + // Conversions that don't depend on the value.
  15970. + JSONTEST_ASSERT(Json::Value(17).isConvertibleTo(Json::realValue));
  15971. + JSONTEST_ASSERT(Json::Value(17).isConvertibleTo(Json::stringValue));
  15972. + JSONTEST_ASSERT(Json::Value(17).isConvertibleTo(Json::booleanValue));
  15973. + JSONTEST_ASSERT(!Json::Value(17).isConvertibleTo(Json::arrayValue));
  15974. + JSONTEST_ASSERT(!Json::Value(17).isConvertibleTo(Json::objectValue));
  15975. +
  15976. + JSONTEST_ASSERT(Json::Value(17U).isConvertibleTo(Json::realValue));
  15977. + JSONTEST_ASSERT(Json::Value(17U).isConvertibleTo(Json::stringValue));
  15978. + JSONTEST_ASSERT(Json::Value(17U).isConvertibleTo(Json::booleanValue));
  15979. + JSONTEST_ASSERT(!Json::Value(17U).isConvertibleTo(Json::arrayValue));
  15980. + JSONTEST_ASSERT(!Json::Value(17U).isConvertibleTo(Json::objectValue));
  15981. +
  15982. + JSONTEST_ASSERT(Json::Value(17.0).isConvertibleTo(Json::realValue));
  15983. + JSONTEST_ASSERT(Json::Value(17.0).isConvertibleTo(Json::stringValue));
  15984. + JSONTEST_ASSERT(Json::Value(17.0).isConvertibleTo(Json::booleanValue));
  15985. + JSONTEST_ASSERT(!Json::Value(17.0).isConvertibleTo(Json::arrayValue));
  15986. + JSONTEST_ASSERT(!Json::Value(17.0).isConvertibleTo(Json::objectValue));
  15987. +
  15988. + // Default int
  15989. + val = Json::Value(Json::intValue);
  15990. +
  15991. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  15992. +
  15993. + checks = IsCheck();
  15994. + checks.isInt_ = true;
  15995. + checks.isInt64_ = true;
  15996. + checks.isUInt_ = true;
  15997. + checks.isUInt64_ = true;
  15998. + checks.isIntegral_ = true;
  15999. + checks.isDouble_ = true;
  16000. + checks.isNumeric_ = true;
  16001. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16002. +
  16003. + JSONTEST_ASSERT(val.isConvertibleTo(Json::nullValue));
  16004. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16005. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16006. +
  16007. + JSONTEST_ASSERT_EQUAL(0, val.asInt());
  16008. + JSONTEST_ASSERT_EQUAL(0, val.asLargestInt());
  16009. + JSONTEST_ASSERT_EQUAL(0, val.asUInt());
  16010. + JSONTEST_ASSERT_EQUAL(0, val.asLargestUInt());
  16011. + JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
  16012. + JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
  16013. + JSONTEST_ASSERT_EQUAL(false, val.asBool());
  16014. + JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
  16015. +
  16016. + // Default uint
  16017. + val = Json::Value(Json::uintValue);
  16018. +
  16019. + JSONTEST_ASSERT_EQUAL(Json::uintValue, val.type());
  16020. +
  16021. + checks = IsCheck();
  16022. + checks.isInt_ = true;
  16023. + checks.isInt64_ = true;
  16024. + checks.isUInt_ = true;
  16025. + checks.isUInt64_ = true;
  16026. + checks.isIntegral_ = true;
  16027. + checks.isDouble_ = true;
  16028. + checks.isNumeric_ = true;
  16029. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16030. +
  16031. + JSONTEST_ASSERT(val.isConvertibleTo(Json::nullValue));
  16032. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16033. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16034. +
  16035. + JSONTEST_ASSERT_EQUAL(0, val.asInt());
  16036. + JSONTEST_ASSERT_EQUAL(0, val.asLargestInt());
  16037. + JSONTEST_ASSERT_EQUAL(0, val.asUInt());
  16038. + JSONTEST_ASSERT_EQUAL(0, val.asLargestUInt());
  16039. + JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
  16040. + JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
  16041. + JSONTEST_ASSERT_EQUAL(false, val.asBool());
  16042. + JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
  16043. +
  16044. + // Default real
  16045. + val = Json::Value(Json::realValue);
  16046. +
  16047. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16048. +
  16049. + JSONTEST_ASSERT(val.isConvertibleTo(Json::nullValue));
  16050. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16051. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16052. +
  16053. + checks = IsCheck();
  16054. + checks.isInt_ = true;
  16055. + checks.isInt64_ = true;
  16056. + checks.isUInt_ = true;
  16057. + checks.isUInt64_ = true;
  16058. + checks.isIntegral_ = true;
  16059. + checks.isDouble_ = true;
  16060. + checks.isNumeric_ = true;
  16061. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16062. +
  16063. + JSONTEST_ASSERT_EQUAL(0, val.asInt());
  16064. + JSONTEST_ASSERT_EQUAL(0, val.asLargestInt());
  16065. + JSONTEST_ASSERT_EQUAL(0, val.asUInt());
  16066. + JSONTEST_ASSERT_EQUAL(0, val.asLargestUInt());
  16067. + JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
  16068. + JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
  16069. + JSONTEST_ASSERT_EQUAL(false, val.asBool());
  16070. + JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
  16071. +
  16072. + // Zero (signed constructor arg)
  16073. + val = Json::Value(0);
  16074. +
  16075. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16076. +
  16077. + checks = IsCheck();
  16078. + checks.isInt_ = true;
  16079. + checks.isInt64_ = true;
  16080. + checks.isUInt_ = true;
  16081. + checks.isUInt64_ = true;
  16082. + checks.isIntegral_ = true;
  16083. + checks.isDouble_ = true;
  16084. + checks.isNumeric_ = true;
  16085. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16086. +
  16087. + JSONTEST_ASSERT(val.isConvertibleTo(Json::nullValue));
  16088. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16089. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16090. +
  16091. + JSONTEST_ASSERT_EQUAL(0, val.asInt());
  16092. + JSONTEST_ASSERT_EQUAL(0, val.asLargestInt());
  16093. + JSONTEST_ASSERT_EQUAL(0, val.asUInt());
  16094. + JSONTEST_ASSERT_EQUAL(0, val.asLargestUInt());
  16095. + JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
  16096. + JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
  16097. + JSONTEST_ASSERT_EQUAL(false, val.asBool());
  16098. + JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
  16099. +
  16100. + // Zero (unsigned constructor arg)
  16101. + val = Json::Value(0u);
  16102. +
  16103. + JSONTEST_ASSERT_EQUAL(Json::uintValue, val.type());
  16104. +
  16105. + checks = IsCheck();
  16106. + checks.isInt_ = true;
  16107. + checks.isInt64_ = true;
  16108. + checks.isUInt_ = true;
  16109. + checks.isUInt64_ = true;
  16110. + checks.isIntegral_ = true;
  16111. + checks.isDouble_ = true;
  16112. + checks.isNumeric_ = true;
  16113. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16114. +
  16115. + JSONTEST_ASSERT(val.isConvertibleTo(Json::nullValue));
  16116. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16117. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16118. +
  16119. + JSONTEST_ASSERT_EQUAL(0, val.asInt());
  16120. + JSONTEST_ASSERT_EQUAL(0, val.asLargestInt());
  16121. + JSONTEST_ASSERT_EQUAL(0, val.asUInt());
  16122. + JSONTEST_ASSERT_EQUAL(0, val.asLargestUInt());
  16123. + JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
  16124. + JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
  16125. + JSONTEST_ASSERT_EQUAL(false, val.asBool());
  16126. + JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
  16127. +
  16128. + // Zero (floating-point constructor arg)
  16129. + val = Json::Value(0.0);
  16130. +
  16131. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16132. +
  16133. + checks = IsCheck();
  16134. + checks.isInt_ = true;
  16135. + checks.isInt64_ = true;
  16136. + checks.isUInt_ = true;
  16137. + checks.isUInt64_ = true;
  16138. + checks.isIntegral_ = true;
  16139. + checks.isDouble_ = true;
  16140. + checks.isNumeric_ = true;
  16141. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16142. +
  16143. + JSONTEST_ASSERT(val.isConvertibleTo(Json::nullValue));
  16144. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16145. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16146. +
  16147. + JSONTEST_ASSERT_EQUAL(0, val.asInt());
  16148. + JSONTEST_ASSERT_EQUAL(0, val.asLargestInt());
  16149. + JSONTEST_ASSERT_EQUAL(0, val.asUInt());
  16150. + JSONTEST_ASSERT_EQUAL(0, val.asLargestUInt());
  16151. + JSONTEST_ASSERT_EQUAL(0.0, val.asDouble());
  16152. + JSONTEST_ASSERT_EQUAL(0.0, val.asFloat());
  16153. + JSONTEST_ASSERT_EQUAL(false, val.asBool());
  16154. + JSONTEST_ASSERT_STRING_EQUAL("0", val.asString());
  16155. +
  16156. + // 2^20 (signed constructor arg)
  16157. + val = Json::Value(1 << 20);
  16158. +
  16159. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16160. + checks = IsCheck();
  16161. + checks.isInt_ = true;
  16162. + checks.isInt64_ = true;
  16163. + checks.isUInt_ = true;
  16164. + checks.isUInt64_ = true;
  16165. + checks.isIntegral_ = true;
  16166. + checks.isDouble_ = true;
  16167. + checks.isNumeric_ = true;
  16168. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16169. +
  16170. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16171. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16172. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16173. +
  16174. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asInt());
  16175. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asLargestInt());
  16176. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asUInt());
  16177. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asLargestUInt());
  16178. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asDouble());
  16179. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asFloat());
  16180. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16181. + JSONTEST_ASSERT_STRING_EQUAL("1048576", val.asString());
  16182. +
  16183. + // 2^20 (unsigned constructor arg)
  16184. + val = Json::Value(Json::UInt(1 << 20));
  16185. +
  16186. + JSONTEST_ASSERT_EQUAL(Json::uintValue, val.type());
  16187. +
  16188. + checks = IsCheck();
  16189. + checks.isInt_ = true;
  16190. + checks.isInt64_ = true;
  16191. + checks.isUInt_ = true;
  16192. + checks.isUInt64_ = true;
  16193. + checks.isIntegral_ = true;
  16194. + checks.isDouble_ = true;
  16195. + checks.isNumeric_ = true;
  16196. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16197. +
  16198. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16199. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16200. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16201. +
  16202. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asInt());
  16203. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asLargestInt());
  16204. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asUInt());
  16205. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asLargestUInt());
  16206. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asDouble());
  16207. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asFloat());
  16208. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16209. + JSONTEST_ASSERT_STRING_EQUAL("1048576", val.asString());
  16210. +
  16211. + // 2^20 (floating-point constructor arg)
  16212. + val = Json::Value((1 << 20) / 1.0);
  16213. +
  16214. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16215. +
  16216. + checks = IsCheck();
  16217. + checks.isInt_ = true;
  16218. + checks.isInt64_ = true;
  16219. + checks.isUInt_ = true;
  16220. + checks.isUInt64_ = true;
  16221. + checks.isIntegral_ = true;
  16222. + checks.isDouble_ = true;
  16223. + checks.isNumeric_ = true;
  16224. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16225. +
  16226. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16227. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16228. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16229. +
  16230. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asInt());
  16231. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asLargestInt());
  16232. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asUInt());
  16233. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asLargestUInt());
  16234. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asDouble());
  16235. + JSONTEST_ASSERT_EQUAL((1 << 20), val.asFloat());
  16236. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16237. + JSONTEST_ASSERT_STRING_EQUAL("1048576",
  16238. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16239. +
  16240. + // -2^20
  16241. + val = Json::Value(-(1 << 20));
  16242. +
  16243. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16244. +
  16245. + checks = IsCheck();
  16246. + checks.isInt_ = true;
  16247. + checks.isInt64_ = true;
  16248. + checks.isIntegral_ = true;
  16249. + checks.isDouble_ = true;
  16250. + checks.isNumeric_ = true;
  16251. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16252. +
  16253. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16254. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16255. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16256. +
  16257. + JSONTEST_ASSERT_EQUAL(-(1 << 20), val.asInt());
  16258. + JSONTEST_ASSERT_EQUAL(-(1 << 20), val.asLargestInt());
  16259. + JSONTEST_ASSERT_EQUAL(-(1 << 20), val.asDouble());
  16260. + JSONTEST_ASSERT_EQUAL(-(1 << 20), val.asFloat());
  16261. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16262. + JSONTEST_ASSERT_STRING_EQUAL("-1048576", val.asString());
  16263. +
  16264. + // int32 max
  16265. + val = Json::Value(kint32max);
  16266. +
  16267. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16268. +
  16269. + checks = IsCheck();
  16270. + checks.isInt_ = true;
  16271. + checks.isInt64_ = true;
  16272. + checks.isUInt_ = true;
  16273. + checks.isUInt64_ = true;
  16274. + checks.isIntegral_ = true;
  16275. + checks.isDouble_ = true;
  16276. + checks.isNumeric_ = true;
  16277. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16278. +
  16279. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16280. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16281. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16282. +
  16283. + JSONTEST_ASSERT_EQUAL(kint32max, val.asInt());
  16284. + JSONTEST_ASSERT_EQUAL(kint32max, val.asLargestInt());
  16285. + JSONTEST_ASSERT_EQUAL(kint32max, val.asUInt());
  16286. + JSONTEST_ASSERT_EQUAL(kint32max, val.asLargestUInt());
  16287. + JSONTEST_ASSERT_EQUAL(kint32max, val.asDouble());
  16288. + JSONTEST_ASSERT_EQUAL(kfint32max, val.asFloat());
  16289. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16290. + JSONTEST_ASSERT_STRING_EQUAL("2147483647", val.asString());
  16291. +
  16292. + // int32 min
  16293. + val = Json::Value(kint32min);
  16294. +
  16295. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16296. +
  16297. + checks = IsCheck();
  16298. + checks.isInt_ = true;
  16299. + checks.isInt64_ = true;
  16300. + checks.isIntegral_ = true;
  16301. + checks.isDouble_ = true;
  16302. + checks.isNumeric_ = true;
  16303. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16304. +
  16305. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16306. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16307. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16308. +
  16309. + JSONTEST_ASSERT_EQUAL(kint32min, val.asInt());
  16310. + JSONTEST_ASSERT_EQUAL(kint32min, val.asLargestInt());
  16311. + JSONTEST_ASSERT_EQUAL(kint32min, val.asDouble());
  16312. + JSONTEST_ASSERT_EQUAL(kint32min, val.asFloat());
  16313. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16314. + JSONTEST_ASSERT_STRING_EQUAL("-2147483648", val.asString());
  16315. +
  16316. + // uint32 max
  16317. + val = Json::Value(kuint32max);
  16318. +
  16319. + JSONTEST_ASSERT_EQUAL(Json::uintValue, val.type());
  16320. +
  16321. + checks = IsCheck();
  16322. + checks.isInt64_ = true;
  16323. + checks.isUInt_ = true;
  16324. + checks.isUInt64_ = true;
  16325. + checks.isIntegral_ = true;
  16326. + checks.isDouble_ = true;
  16327. + checks.isNumeric_ = true;
  16328. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16329. +
  16330. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16331. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16332. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16333. +
  16334. +#ifndef JSON_NO_INT64
  16335. + JSONTEST_ASSERT_EQUAL(kuint32max, val.asLargestInt());
  16336. +#endif
  16337. + JSONTEST_ASSERT_EQUAL(kuint32max, val.asUInt());
  16338. + JSONTEST_ASSERT_EQUAL(kuint32max, val.asLargestUInt());
  16339. + JSONTEST_ASSERT_EQUAL(kuint32max, val.asDouble());
  16340. + JSONTEST_ASSERT_EQUAL(kfuint32max, val.asFloat());
  16341. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16342. + JSONTEST_ASSERT_STRING_EQUAL("4294967295", val.asString());
  16343. +
  16344. +#ifdef JSON_NO_INT64
  16345. + // int64 max
  16346. + val = Json::Value(double(kint64max));
  16347. +
  16348. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16349. +
  16350. + checks = IsCheck();
  16351. + checks.isDouble_ = true;
  16352. + checks.isNumeric_ = true;
  16353. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16354. +
  16355. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16356. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16357. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16358. +
  16359. + JSONTEST_ASSERT_EQUAL(double(kint64max), val.asDouble());
  16360. + JSONTEST_ASSERT_EQUAL(float(kint64max), val.asFloat());
  16361. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16362. + JSONTEST_ASSERT_STRING_EQUAL("9.22337e+18", val.asString());
  16363. +
  16364. + // int64 min
  16365. + val = Json::Value(double(kint64min));
  16366. +
  16367. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16368. +
  16369. + checks = IsCheck();
  16370. + checks.isDouble_ = true;
  16371. + checks.isNumeric_ = true;
  16372. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16373. +
  16374. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16375. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16376. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16377. +
  16378. + JSONTEST_ASSERT_EQUAL(double(kint64min), val.asDouble());
  16379. + JSONTEST_ASSERT_EQUAL(float(kint64min), val.asFloat());
  16380. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16381. + JSONTEST_ASSERT_STRING_EQUAL("-9.22337e+18", val.asString());
  16382. +
  16383. + // uint64 max
  16384. + val = Json::Value(double(kuint64max));
  16385. +
  16386. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16387. +
  16388. + checks = IsCheck();
  16389. + checks.isDouble_ = true;
  16390. + checks.isNumeric_ = true;
  16391. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16392. +
  16393. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16394. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16395. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16396. +
  16397. + JSONTEST_ASSERT_EQUAL(double(kuint64max), val.asDouble());
  16398. + JSONTEST_ASSERT_EQUAL(float(kuint64max), val.asFloat());
  16399. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16400. + JSONTEST_ASSERT_STRING_EQUAL("1.84467e+19", val.asString());
  16401. +#else // ifdef JSON_NO_INT64
  16402. + // 2^40 (signed constructor arg)
  16403. + val = Json::Value(Json::Int64(1) << 40);
  16404. +
  16405. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16406. +
  16407. + checks = IsCheck();
  16408. + checks.isInt64_ = true;
  16409. + checks.isUInt64_ = true;
  16410. + checks.isIntegral_ = true;
  16411. + checks.isDouble_ = true;
  16412. + checks.isNumeric_ = true;
  16413. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16414. +
  16415. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16416. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16417. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16418. +
  16419. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asInt64());
  16420. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asLargestInt());
  16421. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asUInt64());
  16422. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asLargestUInt());
  16423. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asDouble());
  16424. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asFloat());
  16425. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16426. + JSONTEST_ASSERT_STRING_EQUAL("1099511627776", val.asString());
  16427. +
  16428. + // 2^40 (unsigned constructor arg)
  16429. + val = Json::Value(Json::UInt64(1) << 40);
  16430. +
  16431. + JSONTEST_ASSERT_EQUAL(Json::uintValue, val.type());
  16432. +
  16433. + checks = IsCheck();
  16434. + checks.isInt64_ = true;
  16435. + checks.isUInt64_ = true;
  16436. + checks.isIntegral_ = true;
  16437. + checks.isDouble_ = true;
  16438. + checks.isNumeric_ = true;
  16439. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16440. +
  16441. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16442. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16443. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16444. +
  16445. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asInt64());
  16446. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asLargestInt());
  16447. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asUInt64());
  16448. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asLargestUInt());
  16449. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asDouble());
  16450. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asFloat());
  16451. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16452. + JSONTEST_ASSERT_STRING_EQUAL("1099511627776", val.asString());
  16453. +
  16454. + // 2^40 (floating-point constructor arg)
  16455. + val = Json::Value((Json::Int64(1) << 40) / 1.0);
  16456. +
  16457. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16458. +
  16459. + checks = IsCheck();
  16460. + checks.isInt64_ = true;
  16461. + checks.isUInt64_ = true;
  16462. + checks.isIntegral_ = true;
  16463. + checks.isDouble_ = true;
  16464. + checks.isNumeric_ = true;
  16465. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16466. +
  16467. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16468. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16469. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16470. +
  16471. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asInt64());
  16472. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asLargestInt());
  16473. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asUInt64());
  16474. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asLargestUInt());
  16475. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asDouble());
  16476. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 40), val.asFloat());
  16477. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16478. + JSONTEST_ASSERT_STRING_EQUAL("1099511627776",
  16479. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16480. +
  16481. + // -2^40
  16482. + val = Json::Value(-(Json::Int64(1) << 40));
  16483. +
  16484. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16485. +
  16486. + checks = IsCheck();
  16487. + checks.isInt64_ = true;
  16488. + checks.isIntegral_ = true;
  16489. + checks.isDouble_ = true;
  16490. + checks.isNumeric_ = true;
  16491. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16492. +
  16493. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16494. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16495. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16496. +
  16497. + JSONTEST_ASSERT_EQUAL(-(Json::Int64(1) << 40), val.asInt64());
  16498. + JSONTEST_ASSERT_EQUAL(-(Json::Int64(1) << 40), val.asLargestInt());
  16499. + JSONTEST_ASSERT_EQUAL(-(Json::Int64(1) << 40), val.asDouble());
  16500. + JSONTEST_ASSERT_EQUAL(-(Json::Int64(1) << 40), val.asFloat());
  16501. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16502. + JSONTEST_ASSERT_STRING_EQUAL("-1099511627776", val.asString());
  16503. +
  16504. + // int64 max
  16505. + val = Json::Value(Json::Int64(kint64max));
  16506. +
  16507. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16508. +
  16509. + checks = IsCheck();
  16510. + checks.isInt64_ = true;
  16511. + checks.isUInt64_ = true;
  16512. + checks.isIntegral_ = true;
  16513. + checks.isDouble_ = true;
  16514. + checks.isNumeric_ = true;
  16515. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16516. +
  16517. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16518. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16519. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16520. +
  16521. + JSONTEST_ASSERT_EQUAL(kint64max, val.asInt64());
  16522. + JSONTEST_ASSERT_EQUAL(kint64max, val.asLargestInt());
  16523. + JSONTEST_ASSERT_EQUAL(kint64max, val.asUInt64());
  16524. + JSONTEST_ASSERT_EQUAL(kint64max, val.asLargestUInt());
  16525. + JSONTEST_ASSERT_EQUAL(double(kint64max), val.asDouble());
  16526. + JSONTEST_ASSERT_EQUAL(float(kint64max), val.asFloat());
  16527. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16528. + JSONTEST_ASSERT_STRING_EQUAL("9223372036854775807", val.asString());
  16529. +
  16530. + // int64 max (floating point constructor). Note that kint64max is not exactly
  16531. + // representable as a double, and will be rounded up to be higher.
  16532. + val = Json::Value(double(kint64max));
  16533. +
  16534. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16535. +
  16536. + checks = IsCheck();
  16537. + checks.isUInt64_ = true;
  16538. + checks.isIntegral_ = true;
  16539. + checks.isDouble_ = true;
  16540. + checks.isNumeric_ = true;
  16541. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16542. +
  16543. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16544. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16545. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16546. +
  16547. + JSONTEST_ASSERT_EQUAL(Json::UInt64(1) << 63, val.asUInt64());
  16548. + JSONTEST_ASSERT_EQUAL(Json::UInt64(1) << 63, val.asLargestUInt());
  16549. + JSONTEST_ASSERT_EQUAL(uint64ToDouble(Json::UInt64(1) << 63), val.asDouble());
  16550. + JSONTEST_ASSERT_EQUAL(float(uint64ToDouble(Json::UInt64(1) << 63)),
  16551. + val.asFloat());
  16552. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16553. + JSONTEST_ASSERT_STRING_EQUAL("9.2233720368547758e+18",
  16554. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16555. +
  16556. + // int64 min
  16557. + val = Json::Value(Json::Int64(kint64min));
  16558. +
  16559. + JSONTEST_ASSERT_EQUAL(Json::intValue, val.type());
  16560. +
  16561. + checks = IsCheck();
  16562. + checks.isInt64_ = true;
  16563. + checks.isIntegral_ = true;
  16564. + checks.isDouble_ = true;
  16565. + checks.isNumeric_ = true;
  16566. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16567. +
  16568. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16569. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16570. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16571. +
  16572. + JSONTEST_ASSERT_EQUAL(kint64min, val.asInt64());
  16573. + JSONTEST_ASSERT_EQUAL(kint64min, val.asLargestInt());
  16574. + JSONTEST_ASSERT_EQUAL(double(kint64min), val.asDouble());
  16575. + JSONTEST_ASSERT_EQUAL(float(kint64min), val.asFloat());
  16576. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16577. + JSONTEST_ASSERT_STRING_EQUAL("-9223372036854775808", val.asString());
  16578. +
  16579. + // int64 min (floating point constructor). Note that kint64min *is* exactly
  16580. + // representable as a double.
  16581. + val = Json::Value(double(kint64min));
  16582. +
  16583. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16584. +
  16585. + checks = IsCheck();
  16586. + checks.isInt64_ = true;
  16587. + checks.isIntegral_ = true;
  16588. + checks.isDouble_ = true;
  16589. + checks.isNumeric_ = true;
  16590. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16591. +
  16592. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16593. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16594. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16595. +
  16596. + JSONTEST_ASSERT_EQUAL(kint64min, val.asInt64());
  16597. + JSONTEST_ASSERT_EQUAL(kint64min, val.asLargestInt());
  16598. + JSONTEST_ASSERT_EQUAL(-9223372036854775808.0, val.asDouble());
  16599. + JSONTEST_ASSERT_EQUAL(-9223372036854775808.0, val.asFloat());
  16600. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16601. + JSONTEST_ASSERT_STRING_EQUAL("-9.2233720368547758e+18",
  16602. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16603. +
  16604. + // 10^19
  16605. + const Json::UInt64 ten_to_19 = static_cast<Json::UInt64>(1e19);
  16606. + val = Json::Value(Json::UInt64(ten_to_19));
  16607. +
  16608. + JSONTEST_ASSERT_EQUAL(Json::uintValue, val.type());
  16609. +
  16610. + checks = IsCheck();
  16611. + checks.isUInt64_ = true;
  16612. + checks.isIntegral_ = true;
  16613. + checks.isDouble_ = true;
  16614. + checks.isNumeric_ = true;
  16615. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16616. +
  16617. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16618. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16619. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16620. +
  16621. + JSONTEST_ASSERT_EQUAL(ten_to_19, val.asUInt64());
  16622. + JSONTEST_ASSERT_EQUAL(ten_to_19, val.asLargestUInt());
  16623. + JSONTEST_ASSERT_EQUAL(uint64ToDouble(ten_to_19), val.asDouble());
  16624. + JSONTEST_ASSERT_EQUAL(float(uint64ToDouble(ten_to_19)), val.asFloat());
  16625. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16626. + JSONTEST_ASSERT_STRING_EQUAL("10000000000000000000", val.asString());
  16627. +
  16628. + // 10^19 (double constructor). Note that 10^19 is not exactly representable
  16629. + // as a double.
  16630. + val = Json::Value(uint64ToDouble(ten_to_19));
  16631. +
  16632. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16633. +
  16634. + checks = IsCheck();
  16635. + checks.isUInt64_ = true;
  16636. + checks.isIntegral_ = true;
  16637. + checks.isDouble_ = true;
  16638. + checks.isNumeric_ = true;
  16639. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16640. +
  16641. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16642. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16643. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16644. +
  16645. + JSONTEST_ASSERT_EQUAL(1e19, val.asDouble());
  16646. + JSONTEST_ASSERT_EQUAL(1e19, val.asFloat());
  16647. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16648. + JSONTEST_ASSERT_STRING_EQUAL("1e+19",
  16649. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16650. +
  16651. + // uint64 max
  16652. + val = Json::Value(Json::UInt64(kuint64max));
  16653. +
  16654. + JSONTEST_ASSERT_EQUAL(Json::uintValue, val.type());
  16655. +
  16656. + checks = IsCheck();
  16657. + checks.isUInt64_ = true;
  16658. + checks.isIntegral_ = true;
  16659. + checks.isDouble_ = true;
  16660. + checks.isNumeric_ = true;
  16661. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16662. +
  16663. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16664. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16665. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16666. +
  16667. + JSONTEST_ASSERT_EQUAL(kuint64max, val.asUInt64());
  16668. + JSONTEST_ASSERT_EQUAL(kuint64max, val.asLargestUInt());
  16669. + JSONTEST_ASSERT_EQUAL(uint64ToDouble(kuint64max), val.asDouble());
  16670. + JSONTEST_ASSERT_EQUAL(float(uint64ToDouble(kuint64max)), val.asFloat());
  16671. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16672. + JSONTEST_ASSERT_STRING_EQUAL("18446744073709551615", val.asString());
  16673. +
  16674. + // uint64 max (floating point constructor). Note that kuint64max is not
  16675. + // exactly representable as a double, and will be rounded up to be higher.
  16676. + val = Json::Value(uint64ToDouble(kuint64max));
  16677. +
  16678. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16679. +
  16680. + checks = IsCheck();
  16681. + checks.isDouble_ = true;
  16682. + checks.isNumeric_ = true;
  16683. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16684. +
  16685. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16686. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16687. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16688. +
  16689. + JSONTEST_ASSERT_EQUAL(18446744073709551616.0, val.asDouble());
  16690. + JSONTEST_ASSERT_EQUAL(18446744073709551616.0, val.asFloat());
  16691. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16692. + JSONTEST_ASSERT_STRING_EQUAL("1.8446744073709552e+19",
  16693. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16694. +#endif
  16695. +}
  16696. +
  16697. +JSONTEST_FIXTURE(ValueTest, nonIntegers) {
  16698. + IsCheck checks;
  16699. + Json::Value val;
  16700. +
  16701. + // Small positive number
  16702. + val = Json::Value(1.5);
  16703. +
  16704. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16705. +
  16706. + checks = IsCheck();
  16707. + checks.isDouble_ = true;
  16708. + checks.isNumeric_ = true;
  16709. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16710. +
  16711. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16712. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16713. + JSONTEST_ASSERT(val.isConvertibleTo(Json::realValue));
  16714. + JSONTEST_ASSERT(val.isConvertibleTo(Json::booleanValue));
  16715. + JSONTEST_ASSERT(val.isConvertibleTo(Json::stringValue));
  16716. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16717. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::arrayValue));
  16718. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::objectValue));
  16719. +
  16720. + JSONTEST_ASSERT_EQUAL(1.5, val.asDouble());
  16721. + JSONTEST_ASSERT_EQUAL(1.5, val.asFloat());
  16722. + JSONTEST_ASSERT_EQUAL(1, val.asInt());
  16723. + JSONTEST_ASSERT_EQUAL(1, val.asLargestInt());
  16724. + JSONTEST_ASSERT_EQUAL(1, val.asUInt());
  16725. + JSONTEST_ASSERT_EQUAL(1, val.asLargestUInt());
  16726. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16727. + JSONTEST_ASSERT_EQUAL("1.5", val.asString());
  16728. +
  16729. + // Small negative number
  16730. + val = Json::Value(-1.5);
  16731. +
  16732. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16733. +
  16734. + checks = IsCheck();
  16735. + checks.isDouble_ = true;
  16736. + checks.isNumeric_ = true;
  16737. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16738. +
  16739. + JSONTEST_ASSERT(val.isConvertibleTo(Json::intValue));
  16740. + JSONTEST_ASSERT(val.isConvertibleTo(Json::realValue));
  16741. + JSONTEST_ASSERT(val.isConvertibleTo(Json::booleanValue));
  16742. + JSONTEST_ASSERT(val.isConvertibleTo(Json::stringValue));
  16743. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16744. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16745. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::arrayValue));
  16746. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::objectValue));
  16747. +
  16748. + JSONTEST_ASSERT_EQUAL(-1.5, val.asDouble());
  16749. + JSONTEST_ASSERT_EQUAL(-1.5, val.asFloat());
  16750. + JSONTEST_ASSERT_EQUAL(-1, val.asInt());
  16751. + JSONTEST_ASSERT_EQUAL(-1, val.asLargestInt());
  16752. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16753. + JSONTEST_ASSERT_EQUAL("-1.5", val.asString());
  16754. +
  16755. + // A bit over int32 max
  16756. + val = Json::Value(kint32max + 0.5);
  16757. +
  16758. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16759. +
  16760. + checks = IsCheck();
  16761. + checks.isDouble_ = true;
  16762. + checks.isNumeric_ = true;
  16763. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16764. +
  16765. + JSONTEST_ASSERT(val.isConvertibleTo(Json::uintValue));
  16766. + JSONTEST_ASSERT(val.isConvertibleTo(Json::realValue));
  16767. + JSONTEST_ASSERT(val.isConvertibleTo(Json::booleanValue));
  16768. + JSONTEST_ASSERT(val.isConvertibleTo(Json::stringValue));
  16769. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16770. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16771. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::arrayValue));
  16772. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::objectValue));
  16773. +
  16774. + JSONTEST_ASSERT_EQUAL(2147483647.5, val.asDouble());
  16775. + JSONTEST_ASSERT_EQUAL(float(2147483647.5), val.asFloat());
  16776. + JSONTEST_ASSERT_EQUAL(2147483647U, val.asUInt());
  16777. +#ifdef JSON_HAS_INT64
  16778. + JSONTEST_ASSERT_EQUAL(2147483647L, val.asLargestInt());
  16779. + JSONTEST_ASSERT_EQUAL(2147483647U, val.asLargestUInt());
  16780. +#endif
  16781. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16782. + JSONTEST_ASSERT_EQUAL("2147483647.5",
  16783. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16784. +
  16785. + // A bit under int32 min
  16786. + val = Json::Value(kint32min - 0.5);
  16787. +
  16788. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16789. +
  16790. + checks = IsCheck();
  16791. + checks.isDouble_ = true;
  16792. + checks.isNumeric_ = true;
  16793. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16794. +
  16795. + JSONTEST_ASSERT(val.isConvertibleTo(Json::realValue));
  16796. + JSONTEST_ASSERT(val.isConvertibleTo(Json::booleanValue));
  16797. + JSONTEST_ASSERT(val.isConvertibleTo(Json::stringValue));
  16798. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16799. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16800. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16801. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::arrayValue));
  16802. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::objectValue));
  16803. +
  16804. + JSONTEST_ASSERT_EQUAL(-2147483648.5, val.asDouble());
  16805. + JSONTEST_ASSERT_EQUAL(float(-2147483648.5), val.asFloat());
  16806. +#ifdef JSON_HAS_INT64
  16807. + JSONTEST_ASSERT_EQUAL(-(Json::Int64(1) << 31), val.asLargestInt());
  16808. +#endif
  16809. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16810. + JSONTEST_ASSERT_EQUAL("-2147483648.5",
  16811. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16812. +
  16813. + // A bit over uint32 max
  16814. + val = Json::Value(kuint32max + 0.5);
  16815. +
  16816. + JSONTEST_ASSERT_EQUAL(Json::realValue, val.type());
  16817. +
  16818. + checks = IsCheck();
  16819. + checks.isDouble_ = true;
  16820. + checks.isNumeric_ = true;
  16821. + JSONTEST_ASSERT_PRED(checkIs(val, checks));
  16822. +
  16823. + JSONTEST_ASSERT(val.isConvertibleTo(Json::realValue));
  16824. + JSONTEST_ASSERT(val.isConvertibleTo(Json::booleanValue));
  16825. + JSONTEST_ASSERT(val.isConvertibleTo(Json::stringValue));
  16826. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::nullValue));
  16827. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::intValue));
  16828. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::uintValue));
  16829. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::arrayValue));
  16830. + JSONTEST_ASSERT(!val.isConvertibleTo(Json::objectValue));
  16831. +
  16832. + JSONTEST_ASSERT_EQUAL(4294967295.5, val.asDouble());
  16833. + JSONTEST_ASSERT_EQUAL(float(4294967295.5), val.asFloat());
  16834. +#ifdef JSON_HAS_INT64
  16835. + JSONTEST_ASSERT_EQUAL((Json::Int64(1) << 32) - 1, val.asLargestInt());
  16836. + JSONTEST_ASSERT_EQUAL((Json::UInt64(1) << 32) - Json::UInt64(1),
  16837. + val.asLargestUInt());
  16838. +#endif
  16839. + JSONTEST_ASSERT_EQUAL(true, val.asBool());
  16840. + JSONTEST_ASSERT_EQUAL("4294967295.5",
  16841. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16842. +
  16843. + val = Json::Value(1.2345678901234);
  16844. + JSONTEST_ASSERT_STRING_EQUAL("1.2345678901234001",
  16845. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16846. +
  16847. + // A 16-digit floating point number.
  16848. + val = Json::Value(2199023255552000.0f);
  16849. + JSONTEST_ASSERT_EQUAL(float(2199023255552000.0f), val.asFloat());
  16850. + JSONTEST_ASSERT_STRING_EQUAL("2199023255552000",
  16851. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16852. +
  16853. + // A very large floating point number.
  16854. + val = Json::Value(3.402823466385289e38);
  16855. + JSONTEST_ASSERT_EQUAL(float(3.402823466385289e38), val.asFloat());
  16856. + JSONTEST_ASSERT_STRING_EQUAL("3.402823466385289e+38",
  16857. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16858. +
  16859. + // An even larger floating point number.
  16860. + val = Json::Value(1.2345678e300);
  16861. + JSONTEST_ASSERT_EQUAL(double(1.2345678e300), val.asDouble());
  16862. + JSONTEST_ASSERT_STRING_EQUAL("1.2345678e+300",
  16863. + normalizeFloatingPointStr(JsonTest::ToJsonString(val.asString())));
  16864. +}
  16865. +
  16866. +void ValueTest::checkConstMemberCount(const Json::Value& value,
  16867. + unsigned int expectedCount) {
  16868. + unsigned int count = 0;
  16869. + Json::Value::const_iterator itEnd = value.end();
  16870. + for (Json::Value::const_iterator it = value.begin(); it != itEnd; ++it) {
  16871. + ++count;
  16872. + }
  16873. + JSONTEST_ASSERT_EQUAL(expectedCount, count) << "Json::Value::const_iterator";
  16874. +}
  16875. +
  16876. +void ValueTest::checkMemberCount(Json::Value& value,
  16877. + unsigned int expectedCount) {
  16878. + JSONTEST_ASSERT_EQUAL(expectedCount, value.size());
  16879. +
  16880. + unsigned int count = 0;
  16881. + Json::Value::iterator itEnd = value.end();
  16882. + for (Json::Value::iterator it = value.begin(); it != itEnd; ++it) {
  16883. + ++count;
  16884. + }
  16885. + JSONTEST_ASSERT_EQUAL(expectedCount, count) << "Json::Value::iterator";
  16886. +
  16887. + JSONTEST_ASSERT_PRED(checkConstMemberCount(value, expectedCount));
  16888. +}
  16889. +
  16890. +ValueTest::IsCheck::IsCheck()
  16891. + : isObject_(false), isArray_(false), isBool_(false), isString_(false),
  16892. + isNull_(false), isInt_(false), isInt64_(false), isUInt_(false),
  16893. + isUInt64_(false), isIntegral_(false), isDouble_(false),
  16894. + isNumeric_(false) {}
  16895. +
  16896. +void ValueTest::checkIs(const Json::Value& value, const IsCheck& check) {
  16897. + JSONTEST_ASSERT_EQUAL(check.isObject_, value.isObject());
  16898. + JSONTEST_ASSERT_EQUAL(check.isArray_, value.isArray());
  16899. + JSONTEST_ASSERT_EQUAL(check.isBool_, value.isBool());
  16900. + JSONTEST_ASSERT_EQUAL(check.isDouble_, value.isDouble());
  16901. + JSONTEST_ASSERT_EQUAL(check.isInt_, value.isInt());
  16902. + JSONTEST_ASSERT_EQUAL(check.isUInt_, value.isUInt());
  16903. + JSONTEST_ASSERT_EQUAL(check.isIntegral_, value.isIntegral());
  16904. + JSONTEST_ASSERT_EQUAL(check.isNumeric_, value.isNumeric());
  16905. + JSONTEST_ASSERT_EQUAL(check.isString_, value.isString());
  16906. + JSONTEST_ASSERT_EQUAL(check.isNull_, value.isNull());
  16907. +
  16908. +#ifdef JSON_HAS_INT64
  16909. + JSONTEST_ASSERT_EQUAL(check.isInt64_, value.isInt64());
  16910. + JSONTEST_ASSERT_EQUAL(check.isUInt64_, value.isUInt64());
  16911. +#else
  16912. + JSONTEST_ASSERT_EQUAL(false, value.isInt64());
  16913. + JSONTEST_ASSERT_EQUAL(false, value.isUInt64());
  16914. +#endif
  16915. +}
  16916. +
  16917. +JSONTEST_FIXTURE(ValueTest, compareNull) {
  16918. + JSONTEST_ASSERT_PRED(checkIsEqual(Json::Value(), Json::Value()));
  16919. +}
  16920. +
  16921. +JSONTEST_FIXTURE(ValueTest, compareInt) {
  16922. + JSONTEST_ASSERT_PRED(checkIsLess(0, 10));
  16923. + JSONTEST_ASSERT_PRED(checkIsEqual(10, 10));
  16924. + JSONTEST_ASSERT_PRED(checkIsEqual(-10, -10));
  16925. + JSONTEST_ASSERT_PRED(checkIsLess(-10, 0));
  16926. +}
  16927. +
  16928. +JSONTEST_FIXTURE(ValueTest, compareUInt) {
  16929. + JSONTEST_ASSERT_PRED(checkIsLess(0u, 10u));
  16930. + JSONTEST_ASSERT_PRED(checkIsLess(0u, Json::Value::maxUInt));
  16931. + JSONTEST_ASSERT_PRED(checkIsEqual(10u, 10u));
  16932. +}
  16933. +
  16934. +JSONTEST_FIXTURE(ValueTest, compareDouble) {
  16935. + JSONTEST_ASSERT_PRED(checkIsLess(0.0, 10.0));
  16936. + JSONTEST_ASSERT_PRED(checkIsEqual(10.0, 10.0));
  16937. + JSONTEST_ASSERT_PRED(checkIsEqual(-10.0, -10.0));
  16938. + JSONTEST_ASSERT_PRED(checkIsLess(-10.0, 0.0));
  16939. +}
  16940. +
  16941. +JSONTEST_FIXTURE(ValueTest, compareString) {
  16942. + JSONTEST_ASSERT_PRED(checkIsLess("", " "));
  16943. + JSONTEST_ASSERT_PRED(checkIsLess("", "a"));
  16944. + JSONTEST_ASSERT_PRED(checkIsLess("abcd", "zyui"));
  16945. + JSONTEST_ASSERT_PRED(checkIsLess("abc", "abcd"));
  16946. + JSONTEST_ASSERT_PRED(checkIsEqual("abcd", "abcd"));
  16947. + JSONTEST_ASSERT_PRED(checkIsEqual(" ", " "));
  16948. + JSONTEST_ASSERT_PRED(checkIsLess("ABCD", "abcd"));
  16949. + JSONTEST_ASSERT_PRED(checkIsEqual("ABCD", "ABCD"));
  16950. +}
  16951. +
  16952. +JSONTEST_FIXTURE(ValueTest, compareBoolean) {
  16953. + JSONTEST_ASSERT_PRED(checkIsLess(false, true));
  16954. + JSONTEST_ASSERT_PRED(checkIsEqual(false, false));
  16955. + JSONTEST_ASSERT_PRED(checkIsEqual(true, true));
  16956. +}
  16957. +
  16958. +JSONTEST_FIXTURE(ValueTest, compareArray) {
  16959. + // array compare size then content
  16960. + Json::Value emptyArray(Json::arrayValue);
  16961. + Json::Value l1aArray;
  16962. + l1aArray.append(0);
  16963. + Json::Value l1bArray;
  16964. + l1bArray.append(10);
  16965. + Json::Value l2aArray;
  16966. + l2aArray.append(0);
  16967. + l2aArray.append(0);
  16968. + Json::Value l2bArray;
  16969. + l2bArray.append(0);
  16970. + l2bArray.append(10);
  16971. + JSONTEST_ASSERT_PRED(checkIsLess(emptyArray, l1aArray));
  16972. + JSONTEST_ASSERT_PRED(checkIsLess(emptyArray, l2aArray));
  16973. + JSONTEST_ASSERT_PRED(checkIsLess(l1aArray, l2aArray));
  16974. + JSONTEST_ASSERT_PRED(checkIsLess(l2aArray, l2bArray));
  16975. + JSONTEST_ASSERT_PRED(checkIsEqual(emptyArray, Json::Value(emptyArray)));
  16976. + JSONTEST_ASSERT_PRED(checkIsEqual(l1aArray, Json::Value(l1aArray)));
  16977. + JSONTEST_ASSERT_PRED(checkIsEqual(l2bArray, Json::Value(l2bArray)));
  16978. +}
  16979. +
  16980. +JSONTEST_FIXTURE(ValueTest, compareObject) {
  16981. + // object compare size then content
  16982. + Json::Value emptyObject(Json::objectValue);
  16983. + Json::Value l1aObject;
  16984. + l1aObject["key1"] = 0;
  16985. + Json::Value l1bObject;
  16986. + l1aObject["key1"] = 10;
  16987. + Json::Value l2aObject;
  16988. + l2aObject["key1"] = 0;
  16989. + l2aObject["key2"] = 0;
  16990. + JSONTEST_ASSERT_PRED(checkIsLess(emptyObject, l1aObject));
  16991. + JSONTEST_ASSERT_PRED(checkIsLess(emptyObject, l2aObject));
  16992. + JSONTEST_ASSERT_PRED(checkIsLess(l1aObject, l2aObject));
  16993. + JSONTEST_ASSERT_PRED(checkIsEqual(emptyObject, Json::Value(emptyObject)));
  16994. + JSONTEST_ASSERT_PRED(checkIsEqual(l1aObject, Json::Value(l1aObject)));
  16995. + JSONTEST_ASSERT_PRED(checkIsEqual(l2aObject, Json::Value(l2aObject)));
  16996. +}
  16997. +
  16998. +JSONTEST_FIXTURE(ValueTest, compareType) {
  16999. + // object of different type are ordered according to their type
  17000. + JSONTEST_ASSERT_PRED(checkIsLess(Json::Value(), Json::Value(1)));
  17001. + JSONTEST_ASSERT_PRED(checkIsLess(Json::Value(1), Json::Value(1u)));
  17002. + JSONTEST_ASSERT_PRED(checkIsLess(Json::Value(1u), Json::Value(1.0)));
  17003. + JSONTEST_ASSERT_PRED(checkIsLess(Json::Value(1.0), Json::Value("a")));
  17004. + JSONTEST_ASSERT_PRED(checkIsLess(Json::Value("a"), Json::Value(true)));
  17005. + JSONTEST_ASSERT_PRED(
  17006. + checkIsLess(Json::Value(true), Json::Value(Json::arrayValue)));
  17007. + JSONTEST_ASSERT_PRED(checkIsLess(Json::Value(Json::arrayValue),
  17008. + Json::Value(Json::objectValue)));
  17009. +}
  17010. +
  17011. +void ValueTest::checkIsLess(const Json::Value& x, const Json::Value& y) {
  17012. + JSONTEST_ASSERT(x < y);
  17013. + JSONTEST_ASSERT(y > x);
  17014. + JSONTEST_ASSERT(x <= y);
  17015. + JSONTEST_ASSERT(y >= x);
  17016. + JSONTEST_ASSERT(!(x == y));
  17017. + JSONTEST_ASSERT(!(y == x));
  17018. + JSONTEST_ASSERT(!(x >= y));
  17019. + JSONTEST_ASSERT(!(y <= x));
  17020. + JSONTEST_ASSERT(!(x > y));
  17021. + JSONTEST_ASSERT(!(y < x));
  17022. + JSONTEST_ASSERT(x.compare(y) < 0);
  17023. + JSONTEST_ASSERT(y.compare(x) >= 0);
  17024. +}
  17025. +
  17026. +void ValueTest::checkIsEqual(const Json::Value& x, const Json::Value& y) {
  17027. + JSONTEST_ASSERT(x == y);
  17028. + JSONTEST_ASSERT(y == x);
  17029. + JSONTEST_ASSERT(x <= y);
  17030. + JSONTEST_ASSERT(y <= x);
  17031. + JSONTEST_ASSERT(x >= y);
  17032. + JSONTEST_ASSERT(y >= x);
  17033. + JSONTEST_ASSERT(!(x < y));
  17034. + JSONTEST_ASSERT(!(y < x));
  17035. + JSONTEST_ASSERT(!(x > y));
  17036. + JSONTEST_ASSERT(!(y > x));
  17037. + JSONTEST_ASSERT(x.compare(y) == 0);
  17038. + JSONTEST_ASSERT(y.compare(x) == 0);
  17039. +}
  17040. +
  17041. +JSONTEST_FIXTURE(ValueTest, typeChecksThrowExceptions) {
  17042. +#if JSON_USE_EXCEPTION
  17043. +
  17044. + Json::Value intVal(1);
  17045. + Json::Value strVal("Test");
  17046. + Json::Value objVal(Json::objectValue);
  17047. + Json::Value arrVal(Json::arrayValue);
  17048. +
  17049. + JSONTEST_ASSERT_THROWS(intVal["test"]);
  17050. + JSONTEST_ASSERT_THROWS(strVal["test"]);
  17051. + JSONTEST_ASSERT_THROWS(arrVal["test"]);
  17052. +
  17053. + JSONTEST_ASSERT_THROWS(intVal.removeMember("test"));
  17054. + JSONTEST_ASSERT_THROWS(strVal.removeMember("test"));
  17055. + JSONTEST_ASSERT_THROWS(arrVal.removeMember("test"));
  17056. +
  17057. + JSONTEST_ASSERT_THROWS(intVal.getMemberNames());
  17058. + JSONTEST_ASSERT_THROWS(strVal.getMemberNames());
  17059. + JSONTEST_ASSERT_THROWS(arrVal.getMemberNames());
  17060. +
  17061. + JSONTEST_ASSERT_THROWS(intVal[0]);
  17062. + JSONTEST_ASSERT_THROWS(objVal[0]);
  17063. + JSONTEST_ASSERT_THROWS(strVal[0]);
  17064. +
  17065. + JSONTEST_ASSERT_THROWS(intVal.clear());
  17066. +
  17067. + JSONTEST_ASSERT_THROWS(intVal.resize(1));
  17068. + JSONTEST_ASSERT_THROWS(strVal.resize(1));
  17069. + JSONTEST_ASSERT_THROWS(objVal.resize(1));
  17070. +
  17071. + JSONTEST_ASSERT_THROWS(intVal.asCString());
  17072. +
  17073. + JSONTEST_ASSERT_THROWS(objVal.asString());
  17074. + JSONTEST_ASSERT_THROWS(arrVal.asString());
  17075. +
  17076. + JSONTEST_ASSERT_THROWS(strVal.asInt());
  17077. + JSONTEST_ASSERT_THROWS(objVal.asInt());
  17078. + JSONTEST_ASSERT_THROWS(arrVal.asInt());
  17079. +
  17080. + JSONTEST_ASSERT_THROWS(strVal.asUInt());
  17081. + JSONTEST_ASSERT_THROWS(objVal.asUInt());
  17082. + JSONTEST_ASSERT_THROWS(arrVal.asUInt());
  17083. +
  17084. + JSONTEST_ASSERT_THROWS(strVal.asInt64());
  17085. + JSONTEST_ASSERT_THROWS(objVal.asInt64());
  17086. + JSONTEST_ASSERT_THROWS(arrVal.asInt64());
  17087. +
  17088. + JSONTEST_ASSERT_THROWS(strVal.asUInt64());
  17089. + JSONTEST_ASSERT_THROWS(objVal.asUInt64());
  17090. + JSONTEST_ASSERT_THROWS(arrVal.asUInt64());
  17091. +
  17092. + JSONTEST_ASSERT_THROWS(strVal.asDouble());
  17093. + JSONTEST_ASSERT_THROWS(objVal.asDouble());
  17094. + JSONTEST_ASSERT_THROWS(arrVal.asDouble());
  17095. +
  17096. + JSONTEST_ASSERT_THROWS(strVal.asFloat());
  17097. + JSONTEST_ASSERT_THROWS(objVal.asFloat());
  17098. + JSONTEST_ASSERT_THROWS(arrVal.asFloat());
  17099. +
  17100. + JSONTEST_ASSERT_THROWS(strVal.asBool());
  17101. + JSONTEST_ASSERT_THROWS(objVal.asBool());
  17102. + JSONTEST_ASSERT_THROWS(arrVal.asBool());
  17103. +
  17104. +#endif
  17105. +}
  17106. +
  17107. +JSONTEST_FIXTURE(ValueTest, offsetAccessors) {
  17108. + Json::Value x;
  17109. + JSONTEST_ASSERT(x.getOffsetStart() == 0);
  17110. + JSONTEST_ASSERT(x.getOffsetLimit() == 0);
  17111. + x.setOffsetStart(10);
  17112. + x.setOffsetLimit(20);
  17113. + JSONTEST_ASSERT(x.getOffsetStart() == 10);
  17114. + JSONTEST_ASSERT(x.getOffsetLimit() == 20);
  17115. + Json::Value y(x);
  17116. + JSONTEST_ASSERT(y.getOffsetStart() == 10);
  17117. + JSONTEST_ASSERT(y.getOffsetLimit() == 20);
  17118. + Json::Value z;
  17119. + z.swap(y);
  17120. + JSONTEST_ASSERT(z.getOffsetStart() == 10);
  17121. + JSONTEST_ASSERT(z.getOffsetLimit() == 20);
  17122. + JSONTEST_ASSERT(y.getOffsetStart() == 0);
  17123. + JSONTEST_ASSERT(y.getOffsetLimit() == 0);
  17124. +}
  17125. +
  17126. +JSONTEST_FIXTURE(ValueTest, StaticString) {
  17127. + char mutant[] = "hello";
  17128. + Json::StaticString ss(mutant);
  17129. + JSONCPP_STRING regular(mutant);
  17130. + mutant[1] = 'a';
  17131. + JSONTEST_ASSERT_STRING_EQUAL("hallo", ss.c_str());
  17132. + JSONTEST_ASSERT_STRING_EQUAL("hello", regular.c_str());
  17133. + {
  17134. + Json::Value root;
  17135. + root["top"] = ss;
  17136. + JSONTEST_ASSERT_STRING_EQUAL("hallo", root["top"].asString());
  17137. + mutant[1] = 'u';
  17138. + JSONTEST_ASSERT_STRING_EQUAL("hullo", root["top"].asString());
  17139. + }
  17140. + {
  17141. + Json::Value root;
  17142. + root["top"] = regular;
  17143. + JSONTEST_ASSERT_STRING_EQUAL("hello", root["top"].asString());
  17144. + mutant[1] = 'u';
  17145. + JSONTEST_ASSERT_STRING_EQUAL("hello", root["top"].asString());
  17146. + }
  17147. +}
  17148. +
  17149. +JSONTEST_FIXTURE(ValueTest, CommentBefore) {
  17150. + Json::Value val; // fill val
  17151. + val.setComment(JSONCPP_STRING("// this comment should appear before"), Json::commentBefore);
  17152. + Json::StreamWriterBuilder wbuilder;
  17153. + wbuilder.settings_["commentStyle"] = "All";
  17154. + {
  17155. + char const expected[] = "// this comment should appear before\nnull";
  17156. + JSONCPP_STRING result = Json::writeString(wbuilder, val);
  17157. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17158. + JSONCPP_STRING res2 = val.toStyledString();
  17159. + JSONCPP_STRING exp2 = "\n";
  17160. + exp2 += expected;
  17161. + exp2 += "\n";
  17162. + JSONTEST_ASSERT_STRING_EQUAL(exp2, res2);
  17163. + }
  17164. + Json::Value other = "hello";
  17165. + val.swapPayload(other);
  17166. + {
  17167. + char const expected[] = "// this comment should appear before\n\"hello\"";
  17168. + JSONCPP_STRING result = Json::writeString(wbuilder, val);
  17169. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17170. + JSONCPP_STRING res2 = val.toStyledString();
  17171. + JSONCPP_STRING exp2 = "\n";
  17172. + exp2 += expected;
  17173. + exp2 += "\n";
  17174. + JSONTEST_ASSERT_STRING_EQUAL(exp2, res2);
  17175. + JSONTEST_ASSERT_STRING_EQUAL("null\n", other.toStyledString());
  17176. + }
  17177. + val = "hello";
  17178. + // val.setComment("// this comment should appear before", Json::CommentPlacement::commentBefore);
  17179. + // Assignment over-writes comments.
  17180. + {
  17181. + char const expected[] = "\"hello\"";
  17182. + JSONCPP_STRING result = Json::writeString(wbuilder, val);
  17183. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17184. + JSONCPP_STRING res2 = val.toStyledString();
  17185. + JSONCPP_STRING exp2 = "";
  17186. + exp2 += expected;
  17187. + exp2 += "\n";
  17188. + JSONTEST_ASSERT_STRING_EQUAL(exp2, res2);
  17189. + }
  17190. +}
  17191. +
  17192. +JSONTEST_FIXTURE(ValueTest, zeroes) {
  17193. + char const cstr[] = "h\0i";
  17194. + JSONCPP_STRING binary(cstr, sizeof(cstr)); // include trailing 0
  17195. + JSONTEST_ASSERT_EQUAL(4U, binary.length());
  17196. + Json::StreamWriterBuilder b;
  17197. + {
  17198. + Json::Value root;
  17199. + root = binary;
  17200. + JSONTEST_ASSERT_STRING_EQUAL(binary, root.asString());
  17201. + }
  17202. + {
  17203. + char const top[] = "top";
  17204. + Json::Value root;
  17205. + root[top] = binary;
  17206. + JSONTEST_ASSERT_STRING_EQUAL(binary, root[top].asString());
  17207. + Json::Value removed;
  17208. + bool did;
  17209. + did = root.removeMember(top, top + sizeof(top) - 1U,
  17210. + &removed);
  17211. + JSONTEST_ASSERT(did);
  17212. + JSONTEST_ASSERT_STRING_EQUAL(binary, removed.asString());
  17213. + did = root.removeMember(top, top + sizeof(top) - 1U,
  17214. + &removed);
  17215. + JSONTEST_ASSERT(!did);
  17216. + JSONTEST_ASSERT_STRING_EQUAL(binary, removed.asString()); // still
  17217. + }
  17218. +}
  17219. +
  17220. +JSONTEST_FIXTURE(ValueTest, zeroesInKeys) {
  17221. + char const cstr[] = "h\0i";
  17222. + JSONCPP_STRING binary(cstr, sizeof(cstr)); // include trailing 0
  17223. + JSONTEST_ASSERT_EQUAL(4U, binary.length());
  17224. + {
  17225. + Json::Value root;
  17226. + root[binary] = "there";
  17227. + JSONTEST_ASSERT_STRING_EQUAL("there", root[binary].asString());
  17228. + JSONTEST_ASSERT(!root.isMember("h"));
  17229. + JSONTEST_ASSERT(root.isMember(binary));
  17230. + JSONTEST_ASSERT_STRING_EQUAL("there", root.get(binary, Json::Value::nullRef).asString());
  17231. + Json::Value removed;
  17232. + bool did;
  17233. + did = root.removeMember(binary.data(), binary.data() + binary.length(),
  17234. + &removed);
  17235. + JSONTEST_ASSERT(did);
  17236. + JSONTEST_ASSERT_STRING_EQUAL("there", removed.asString());
  17237. + did = root.removeMember(binary.data(), binary.data() + binary.length(),
  17238. + &removed);
  17239. + JSONTEST_ASSERT(!did);
  17240. + JSONTEST_ASSERT_STRING_EQUAL("there", removed.asString()); // still
  17241. + JSONTEST_ASSERT(!root.isMember(binary));
  17242. + JSONTEST_ASSERT_STRING_EQUAL("", root.get(binary, Json::Value::nullRef).asString());
  17243. + }
  17244. +}
  17245. +
  17246. +JSONTEST_FIXTURE(ValueTest, specialFloats) {
  17247. + Json::StreamWriterBuilder b;
  17248. + b.settings_["useSpecialFloats"] = true;
  17249. +
  17250. + Json::Value v = std::numeric_limits<double>::quiet_NaN();
  17251. + JSONCPP_STRING expected = "NaN";
  17252. + JSONCPP_STRING result = Json::writeString(b, v);
  17253. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17254. +
  17255. + v = std::numeric_limits<double>::infinity();
  17256. + expected = "Infinity";
  17257. + result = Json::writeString(b, v);
  17258. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17259. +
  17260. + v = -std::numeric_limits<double>::infinity();
  17261. + expected = "-Infinity";
  17262. + result = Json::writeString(b, v);
  17263. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17264. +}
  17265. +
  17266. +JSONTEST_FIXTURE(ValueTest, precision) {
  17267. + Json::StreamWriterBuilder b;
  17268. + b.settings_["precision"] = 5;
  17269. +
  17270. + Json::Value v = 100.0/3;
  17271. + JSONCPP_STRING expected = "33.333";
  17272. + JSONCPP_STRING result = Json::writeString(b, v);
  17273. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17274. +
  17275. + v = 0.25000000;
  17276. + expected = "0.25";
  17277. + result = Json::writeString(b, v);
  17278. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17279. +
  17280. + v = 0.2563456;
  17281. + expected = "0.25635";
  17282. + result = Json::writeString(b, v);
  17283. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17284. +
  17285. + b.settings_["precision"] = 1;
  17286. + expected = "0.3";
  17287. + result = Json::writeString(b, v);
  17288. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17289. +
  17290. + b.settings_["precision"] = 17;
  17291. + v = 1234857476305.256345694873740545068;
  17292. + expected = "1234857476305.2563";
  17293. + result = Json::writeString(b, v);
  17294. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17295. +
  17296. + b.settings_["precision"] = 24;
  17297. + v = 0.256345694873740545068;
  17298. + expected = "0.25634569487374054";
  17299. + result = Json::writeString(b, v);
  17300. + JSONTEST_ASSERT_STRING_EQUAL(expected, result);
  17301. +}
  17302. +
  17303. +struct WriterTest : JsonTest::TestCase {};
  17304. +
  17305. +JSONTEST_FIXTURE(WriterTest, dropNullPlaceholders) {
  17306. + Json::FastWriter writer;
  17307. + Json::Value nullValue;
  17308. + JSONTEST_ASSERT(writer.write(nullValue) == "null\n");
  17309. +
  17310. + writer.dropNullPlaceholders();
  17311. + JSONTEST_ASSERT(writer.write(nullValue) == "\n");
  17312. +}
  17313. +
  17314. +struct StreamWriterTest : JsonTest::TestCase {};
  17315. +
  17316. +JSONTEST_FIXTURE(StreamWriterTest, dropNullPlaceholders) {
  17317. + Json::StreamWriterBuilder b;
  17318. + Json::Value nullValue;
  17319. + b.settings_["dropNullPlaceholders"] = false;
  17320. + JSONTEST_ASSERT(Json::writeString(b, nullValue) == "null");
  17321. + b.settings_["dropNullPlaceholders"] = true;
  17322. + JSONTEST_ASSERT(Json::writeString(b, nullValue) == "");
  17323. +}
  17324. +
  17325. +JSONTEST_FIXTURE(StreamWriterTest, writeZeroes) {
  17326. + JSONCPP_STRING binary("hi", 3); // include trailing 0
  17327. + JSONTEST_ASSERT_EQUAL(3, binary.length());
  17328. + JSONCPP_STRING expected("\"hi\\u0000\""); // unicoded zero
  17329. + Json::StreamWriterBuilder b;
  17330. + {
  17331. + Json::Value root;
  17332. + root = binary;
  17333. + JSONTEST_ASSERT_STRING_EQUAL(binary, root.asString());
  17334. + JSONCPP_STRING out = Json::writeString(b, root);
  17335. + JSONTEST_ASSERT_EQUAL(expected.size(), out.size());
  17336. + JSONTEST_ASSERT_STRING_EQUAL(expected, out);
  17337. + }
  17338. + {
  17339. + Json::Value root;
  17340. + root["top"] = binary;
  17341. + JSONTEST_ASSERT_STRING_EQUAL(binary, root["top"].asString());
  17342. + JSONCPP_STRING out = Json::writeString(b, root["top"]);
  17343. + JSONTEST_ASSERT_STRING_EQUAL(expected, out);
  17344. + }
  17345. +}
  17346. +
  17347. +struct ReaderTest : JsonTest::TestCase {};
  17348. +
  17349. +JSONTEST_FIXTURE(ReaderTest, parseWithNoErrors) {
  17350. + Json::Reader reader;
  17351. + Json::Value root;
  17352. + bool ok = reader.parse("{ \"property\" : \"value\" }", root);
  17353. + JSONTEST_ASSERT(ok);
  17354. + JSONTEST_ASSERT(reader.getFormattedErrorMessages().size() == 0);
  17355. + JSONTEST_ASSERT(reader.getStructuredErrors().size() == 0);
  17356. +}
  17357. +
  17358. +JSONTEST_FIXTURE(ReaderTest, parseWithNoErrorsTestingOffsets) {
  17359. + Json::Reader reader;
  17360. + Json::Value root;
  17361. + bool ok = reader.parse("{ \"property\" : [\"value\", \"value2\"], \"obj\" : "
  17362. + "{ \"nested\" : 123, \"bool\" : true}, \"null\" : "
  17363. + "null, \"false\" : false }",
  17364. + root);
  17365. + JSONTEST_ASSERT(ok);
  17366. + JSONTEST_ASSERT(reader.getFormattedErrorMessages().size() == 0);
  17367. + JSONTEST_ASSERT(reader.getStructuredErrors().size() == 0);
  17368. + JSONTEST_ASSERT(root["property"].getOffsetStart() == 15);
  17369. + JSONTEST_ASSERT(root["property"].getOffsetLimit() == 34);
  17370. + JSONTEST_ASSERT(root["property"][0].getOffsetStart() == 16);
  17371. + JSONTEST_ASSERT(root["property"][0].getOffsetLimit() == 23);
  17372. + JSONTEST_ASSERT(root["property"][1].getOffsetStart() == 25);
  17373. + JSONTEST_ASSERT(root["property"][1].getOffsetLimit() == 33);
  17374. + JSONTEST_ASSERT(root["obj"].getOffsetStart() == 44);
  17375. + JSONTEST_ASSERT(root["obj"].getOffsetLimit() == 76);
  17376. + JSONTEST_ASSERT(root["obj"]["nested"].getOffsetStart() == 57);
  17377. + JSONTEST_ASSERT(root["obj"]["nested"].getOffsetLimit() == 60);
  17378. + JSONTEST_ASSERT(root["obj"]["bool"].getOffsetStart() == 71);
  17379. + JSONTEST_ASSERT(root["obj"]["bool"].getOffsetLimit() == 75);
  17380. + JSONTEST_ASSERT(root["null"].getOffsetStart() == 87);
  17381. + JSONTEST_ASSERT(root["null"].getOffsetLimit() == 91);
  17382. + JSONTEST_ASSERT(root["false"].getOffsetStart() == 103);
  17383. + JSONTEST_ASSERT(root["false"].getOffsetLimit() == 108);
  17384. + JSONTEST_ASSERT(root.getOffsetStart() == 0);
  17385. + JSONTEST_ASSERT(root.getOffsetLimit() == 110);
  17386. +}
  17387. +
  17388. +JSONTEST_FIXTURE(ReaderTest, parseWithOneError) {
  17389. + Json::Reader reader;
  17390. + Json::Value root;
  17391. + bool ok = reader.parse("{ \"property\" :: \"value\" }", root);
  17392. + JSONTEST_ASSERT(!ok);
  17393. + JSONTEST_ASSERT(reader.getFormattedErrorMessages() ==
  17394. + "* Line 1, Column 15\n Syntax error: value, object or array "
  17395. + "expected.\n");
  17396. + std::vector<Json::Reader::StructuredError> errors =
  17397. + reader.getStructuredErrors();
  17398. + JSONTEST_ASSERT(errors.size() == 1);
  17399. + JSONTEST_ASSERT(errors.at(0).offset_start == 14);
  17400. + JSONTEST_ASSERT(errors.at(0).offset_limit == 15);
  17401. + JSONTEST_ASSERT(errors.at(0).message ==
  17402. + "Syntax error: value, object or array expected.");
  17403. +}
  17404. +
  17405. +JSONTEST_FIXTURE(ReaderTest, parseChineseWithOneError) {
  17406. + Json::Reader reader;
  17407. + Json::Value root;
  17408. + bool ok = reader.parse("{ \"pr佐藤erty\" :: \"value\" }", root);
  17409. + JSONTEST_ASSERT(!ok);
  17410. + JSONTEST_ASSERT(reader.getFormattedErrorMessages() ==
  17411. + "* Line 1, Column 19\n Syntax error: value, object or array "
  17412. + "expected.\n");
  17413. + std::vector<Json::Reader::StructuredError> errors =
  17414. + reader.getStructuredErrors();
  17415. + JSONTEST_ASSERT(errors.size() == 1);
  17416. + JSONTEST_ASSERT(errors.at(0).offset_start == 18);
  17417. + JSONTEST_ASSERT(errors.at(0).offset_limit == 19);
  17418. + JSONTEST_ASSERT(errors.at(0).message ==
  17419. + "Syntax error: value, object or array expected.");
  17420. +}
  17421. +
  17422. +JSONTEST_FIXTURE(ReaderTest, parseWithDetailError) {
  17423. + Json::Reader reader;
  17424. + Json::Value root;
  17425. + bool ok = reader.parse("{ \"property\" : \"v\\alue\" }", root);
  17426. + JSONTEST_ASSERT(!ok);
  17427. + JSONTEST_ASSERT(reader.getFormattedErrorMessages() ==
  17428. + "* Line 1, Column 16\n Bad escape sequence in string\nSee "
  17429. + "Line 1, Column 20 for detail.\n");
  17430. + std::vector<Json::Reader::StructuredError> errors =
  17431. + reader.getStructuredErrors();
  17432. + JSONTEST_ASSERT(errors.size() == 1);
  17433. + JSONTEST_ASSERT(errors.at(0).offset_start == 15);
  17434. + JSONTEST_ASSERT(errors.at(0).offset_limit == 23);
  17435. + JSONTEST_ASSERT(errors.at(0).message == "Bad escape sequence in string");
  17436. +}
  17437. +
  17438. +struct CharReaderTest : JsonTest::TestCase {};
  17439. +
  17440. +JSONTEST_FIXTURE(CharReaderTest, parseWithNoErrors) {
  17441. + Json::CharReaderBuilder b;
  17442. + Json::CharReader* reader(b.newCharReader());
  17443. + JSONCPP_STRING errs;
  17444. + Json::Value root;
  17445. + char const doc[] = "{ \"property\" : \"value\" }";
  17446. + bool ok = reader->parse(
  17447. + doc, doc + std::strlen(doc),
  17448. + &root, &errs);
  17449. + JSONTEST_ASSERT(ok);
  17450. + JSONTEST_ASSERT(errs.size() == 0);
  17451. + delete reader;
  17452. +}
  17453. +
  17454. +JSONTEST_FIXTURE(CharReaderTest, parseWithNoErrorsTestingOffsets) {
  17455. + Json::CharReaderBuilder b;
  17456. + Json::CharReader* reader(b.newCharReader());
  17457. + JSONCPP_STRING errs;
  17458. + Json::Value root;
  17459. + char const doc[] =
  17460. + "{ \"property\" : [\"value\", \"value2\"], \"obj\" : "
  17461. + "{ \"nested\" : 123, \"bool\" : true}, \"null\" : "
  17462. + "null, \"false\" : false }";
  17463. + bool ok = reader->parse(
  17464. + doc, doc + std::strlen(doc),
  17465. + &root, &errs);
  17466. + JSONTEST_ASSERT(ok);
  17467. + JSONTEST_ASSERT(errs.size() == 0);
  17468. + delete reader;
  17469. +}
  17470. +
  17471. +JSONTEST_FIXTURE(CharReaderTest, parseWithOneError) {
  17472. + Json::CharReaderBuilder b;
  17473. + Json::CharReader* reader(b.newCharReader());
  17474. + JSONCPP_STRING errs;
  17475. + Json::Value root;
  17476. + char const doc[] =
  17477. + "{ \"property\" :: \"value\" }";
  17478. + bool ok = reader->parse(
  17479. + doc, doc + std::strlen(doc),
  17480. + &root, &errs);
  17481. + JSONTEST_ASSERT(!ok);
  17482. + JSONTEST_ASSERT(errs ==
  17483. + "* Line 1, Column 15\n Syntax error: value, object or array "
  17484. + "expected.\n");
  17485. + delete reader;
  17486. +}
  17487. +
  17488. +JSONTEST_FIXTURE(CharReaderTest, parseChineseWithOneError) {
  17489. + Json::CharReaderBuilder b;
  17490. + Json::CharReader* reader(b.newCharReader());
  17491. + JSONCPP_STRING errs;
  17492. + Json::Value root;
  17493. + char const doc[] =
  17494. + "{ \"pr佐藤erty\" :: \"value\" }";
  17495. + bool ok = reader->parse(
  17496. + doc, doc + std::strlen(doc),
  17497. + &root, &errs);
  17498. + JSONTEST_ASSERT(!ok);
  17499. + JSONTEST_ASSERT(errs ==
  17500. + "* Line 1, Column 19\n Syntax error: value, object or array "
  17501. + "expected.\n");
  17502. + delete reader;
  17503. +}
  17504. +
  17505. +JSONTEST_FIXTURE(CharReaderTest, parseWithDetailError) {
  17506. + Json::CharReaderBuilder b;
  17507. + Json::CharReader* reader(b.newCharReader());
  17508. + JSONCPP_STRING errs;
  17509. + Json::Value root;
  17510. + char const doc[] =
  17511. + "{ \"property\" : \"v\\alue\" }";
  17512. + bool ok = reader->parse(
  17513. + doc, doc + std::strlen(doc),
  17514. + &root, &errs);
  17515. + JSONTEST_ASSERT(!ok);
  17516. + JSONTEST_ASSERT(errs ==
  17517. + "* Line 1, Column 16\n Bad escape sequence in string\nSee "
  17518. + "Line 1, Column 20 for detail.\n");
  17519. + delete reader;
  17520. +}
  17521. +
  17522. +JSONTEST_FIXTURE(CharReaderTest, parseWithStackLimit) {
  17523. + Json::CharReaderBuilder b;
  17524. + Json::Value root;
  17525. + char const doc[] =
  17526. + "{ \"property\" : \"value\" }";
  17527. + {
  17528. + b.settings_["stackLimit"] = 2;
  17529. + Json::CharReader* reader(b.newCharReader());
  17530. + JSONCPP_STRING errs;
  17531. + bool ok = reader->parse(
  17532. + doc, doc + std::strlen(doc),
  17533. + &root, &errs);
  17534. + JSONTEST_ASSERT(ok);
  17535. + JSONTEST_ASSERT(errs == "");
  17536. + JSONTEST_ASSERT_EQUAL("value", root["property"]);
  17537. + delete reader;
  17538. + }
  17539. + {
  17540. + b.settings_["stackLimit"] = 1;
  17541. + Json::CharReader* reader(b.newCharReader());
  17542. + JSONCPP_STRING errs;
  17543. + JSONTEST_ASSERT_THROWS(reader->parse(
  17544. + doc, doc + std::strlen(doc),
  17545. + &root, &errs));
  17546. + delete reader;
  17547. + }
  17548. +}
  17549. +
  17550. +struct CharReaderStrictModeTest : JsonTest::TestCase {};
  17551. +
  17552. +JSONTEST_FIXTURE(CharReaderStrictModeTest, dupKeys) {
  17553. + Json::CharReaderBuilder b;
  17554. + Json::Value root;
  17555. + char const doc[] =
  17556. + "{ \"property\" : \"value\", \"key\" : \"val1\", \"key\" : \"val2\" }";
  17557. + {
  17558. + b.strictMode(&b.settings_);
  17559. + Json::CharReader* reader(b.newCharReader());
  17560. + JSONCPP_STRING errs;
  17561. + bool ok = reader->parse(
  17562. + doc, doc + std::strlen(doc),
  17563. + &root, &errs);
  17564. + JSONTEST_ASSERT(!ok);
  17565. + JSONTEST_ASSERT_STRING_EQUAL(
  17566. + "* Line 1, Column 41\n"
  17567. + " Duplicate key: 'key'\n",
  17568. + errs);
  17569. + JSONTEST_ASSERT_EQUAL("val1", root["key"]); // so far
  17570. + delete reader;
  17571. + }
  17572. +}
  17573. +struct CharReaderFailIfExtraTest : JsonTest::TestCase {};
  17574. +
  17575. +JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue164) {
  17576. + // This is interpreted as a string value followed by a colon.
  17577. + Json::CharReaderBuilder b;
  17578. + Json::Value root;
  17579. + char const doc[] =
  17580. + " \"property\" : \"value\" }";
  17581. + {
  17582. + b.settings_["failIfExtra"] = false;
  17583. + Json::CharReader* reader(b.newCharReader());
  17584. + JSONCPP_STRING errs;
  17585. + bool ok = reader->parse(
  17586. + doc, doc + std::strlen(doc),
  17587. + &root, &errs);
  17588. + JSONTEST_ASSERT(ok);
  17589. + JSONTEST_ASSERT(errs == "");
  17590. + JSONTEST_ASSERT_EQUAL("property", root);
  17591. + delete reader;
  17592. + }
  17593. + {
  17594. + b.settings_["failIfExtra"] = true;
  17595. + Json::CharReader* reader(b.newCharReader());
  17596. + JSONCPP_STRING errs;
  17597. + bool ok = reader->parse(
  17598. + doc, doc + std::strlen(doc),
  17599. + &root, &errs);
  17600. + JSONTEST_ASSERT(!ok);
  17601. + JSONTEST_ASSERT_STRING_EQUAL(errs,
  17602. + "* Line 1, Column 13\n"
  17603. + " Extra non-whitespace after JSON value.\n");
  17604. + JSONTEST_ASSERT_EQUAL("property", root);
  17605. + delete reader;
  17606. + }
  17607. + {
  17608. + b.settings_["failIfExtra"] = false;
  17609. + b.strictMode(&b.settings_);
  17610. + Json::CharReader* reader(b.newCharReader());
  17611. + JSONCPP_STRING errs;
  17612. + bool ok = reader->parse(
  17613. + doc, doc + std::strlen(doc),
  17614. + &root, &errs);
  17615. + JSONTEST_ASSERT(!ok);
  17616. + JSONTEST_ASSERT_STRING_EQUAL(errs,
  17617. + "* Line 1, Column 13\n"
  17618. + " Extra non-whitespace after JSON value.\n");
  17619. + JSONTEST_ASSERT_EQUAL("property", root);
  17620. + delete reader;
  17621. + }
  17622. +}
  17623. +JSONTEST_FIXTURE(CharReaderFailIfExtraTest, issue107) {
  17624. + // This is interpretted as an int value followed by a colon.
  17625. + Json::CharReaderBuilder b;
  17626. + Json::Value root;
  17627. + char const doc[] =
  17628. + "1:2:3";
  17629. + b.settings_["failIfExtra"] = true;
  17630. + Json::CharReader* reader(b.newCharReader());
  17631. + JSONCPP_STRING errs;
  17632. + bool ok = reader->parse(
  17633. + doc, doc + std::strlen(doc),
  17634. + &root, &errs);
  17635. + JSONTEST_ASSERT(!ok);
  17636. + JSONTEST_ASSERT_STRING_EQUAL(
  17637. + "* Line 1, Column 2\n"
  17638. + " Extra non-whitespace after JSON value.\n",
  17639. + errs);
  17640. + JSONTEST_ASSERT_EQUAL(1, root.asInt());
  17641. + delete reader;
  17642. +}
  17643. +JSONTEST_FIXTURE(CharReaderFailIfExtraTest, commentAfterObject) {
  17644. + Json::CharReaderBuilder b;
  17645. + Json::Value root;
  17646. + {
  17647. + char const doc[] =
  17648. + "{ \"property\" : \"value\" } //trailing\n//comment\n";
  17649. + b.settings_["failIfExtra"] = true;
  17650. + Json::CharReader* reader(b.newCharReader());
  17651. + JSONCPP_STRING errs;
  17652. + bool ok = reader->parse(
  17653. + doc, doc + std::strlen(doc),
  17654. + &root, &errs);
  17655. + JSONTEST_ASSERT(ok);
  17656. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17657. + JSONTEST_ASSERT_EQUAL("value", root["property"]);
  17658. + delete reader;
  17659. + }
  17660. +}
  17661. +JSONTEST_FIXTURE(CharReaderFailIfExtraTest, commentAfterArray) {
  17662. + Json::CharReaderBuilder b;
  17663. + Json::Value root;
  17664. + char const doc[] =
  17665. + "[ \"property\" , \"value\" ] //trailing\n//comment\n";
  17666. + b.settings_["failIfExtra"] = true;
  17667. + Json::CharReader* reader(b.newCharReader());
  17668. + JSONCPP_STRING errs;
  17669. + bool ok = reader->parse(
  17670. + doc, doc + std::strlen(doc),
  17671. + &root, &errs);
  17672. + JSONTEST_ASSERT(ok);
  17673. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17674. + JSONTEST_ASSERT_EQUAL("value", root[1u]);
  17675. + delete reader;
  17676. +}
  17677. +JSONTEST_FIXTURE(CharReaderFailIfExtraTest, commentAfterBool) {
  17678. + Json::CharReaderBuilder b;
  17679. + Json::Value root;
  17680. + char const doc[] =
  17681. + " true /*trailing\ncomment*/";
  17682. + b.settings_["failIfExtra"] = true;
  17683. + Json::CharReader* reader(b.newCharReader());
  17684. + JSONCPP_STRING errs;
  17685. + bool ok = reader->parse(
  17686. + doc, doc + std::strlen(doc),
  17687. + &root, &errs);
  17688. + JSONTEST_ASSERT(ok);
  17689. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17690. + JSONTEST_ASSERT_EQUAL(true, root.asBool());
  17691. + delete reader;
  17692. +}
  17693. +struct CharReaderAllowDropNullTest : JsonTest::TestCase {};
  17694. +
  17695. +JSONTEST_FIXTURE(CharReaderAllowDropNullTest, issue178) {
  17696. + Json::CharReaderBuilder b;
  17697. + b.settings_["allowDroppedNullPlaceholders"] = true;
  17698. + Json::Value root;
  17699. + JSONCPP_STRING errs;
  17700. + Json::CharReader* reader(b.newCharReader());
  17701. + {
  17702. + char const doc[] = "{\"a\":,\"b\":true}";
  17703. + bool ok = reader->parse(
  17704. + doc, doc + std::strlen(doc),
  17705. + &root, &errs);
  17706. + JSONTEST_ASSERT(ok);
  17707. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17708. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17709. + JSONTEST_ASSERT_EQUAL(Json::nullValue, root.get("a", true));
  17710. + }
  17711. + {
  17712. + char const doc[] = "{\"a\":}";
  17713. + bool ok = reader->parse(
  17714. + doc, doc + std::strlen(doc),
  17715. + &root, &errs);
  17716. + JSONTEST_ASSERT(ok);
  17717. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17718. + JSONTEST_ASSERT_EQUAL(1u, root.size());
  17719. + JSONTEST_ASSERT_EQUAL(Json::nullValue, root.get("a", true));
  17720. + }
  17721. + {
  17722. + char const doc[] = "[]";
  17723. + bool ok = reader->parse(
  17724. + doc, doc + std::strlen(doc),
  17725. + &root, &errs);
  17726. + JSONTEST_ASSERT(ok);
  17727. + JSONTEST_ASSERT(errs == "");
  17728. + JSONTEST_ASSERT_EQUAL(0u, root.size());
  17729. + JSONTEST_ASSERT_EQUAL(Json::arrayValue, root);
  17730. + }
  17731. + {
  17732. + char const doc[] = "[null]";
  17733. + bool ok = reader->parse(
  17734. + doc, doc + std::strlen(doc),
  17735. + &root, &errs);
  17736. + JSONTEST_ASSERT(ok);
  17737. + JSONTEST_ASSERT(errs == "");
  17738. + JSONTEST_ASSERT_EQUAL(1u, root.size());
  17739. + }
  17740. + {
  17741. + char const doc[] = "[,]";
  17742. + bool ok = reader->parse(
  17743. + doc, doc + std::strlen(doc),
  17744. + &root, &errs);
  17745. + JSONTEST_ASSERT(ok);
  17746. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17747. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17748. + }
  17749. + {
  17750. + char const doc[] = "[,,,]";
  17751. + bool ok = reader->parse(
  17752. + doc, doc + std::strlen(doc),
  17753. + &root, &errs);
  17754. + JSONTEST_ASSERT(ok);
  17755. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17756. + JSONTEST_ASSERT_EQUAL(4u, root.size());
  17757. + }
  17758. + {
  17759. + char const doc[] = "[null,]";
  17760. + bool ok = reader->parse(
  17761. + doc, doc + std::strlen(doc),
  17762. + &root, &errs);
  17763. + JSONTEST_ASSERT(ok);
  17764. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17765. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17766. + }
  17767. + {
  17768. + char const doc[] = "[,null]";
  17769. + bool ok = reader->parse(
  17770. + doc, doc + std::strlen(doc),
  17771. + &root, &errs);
  17772. + JSONTEST_ASSERT(ok);
  17773. + JSONTEST_ASSERT(errs == "");
  17774. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17775. + }
  17776. + {
  17777. + char const doc[] = "[,,]";
  17778. + bool ok = reader->parse(
  17779. + doc, doc + std::strlen(doc),
  17780. + &root, &errs);
  17781. + JSONTEST_ASSERT(ok);
  17782. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17783. + JSONTEST_ASSERT_EQUAL(3u, root.size());
  17784. + }
  17785. + {
  17786. + char const doc[] = "[null,,]";
  17787. + bool ok = reader->parse(
  17788. + doc, doc + std::strlen(doc),
  17789. + &root, &errs);
  17790. + JSONTEST_ASSERT(ok);
  17791. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17792. + JSONTEST_ASSERT_EQUAL(3u, root.size());
  17793. + }
  17794. + {
  17795. + char const doc[] = "[,null,]";
  17796. + bool ok = reader->parse(
  17797. + doc, doc + std::strlen(doc),
  17798. + &root, &errs);
  17799. + JSONTEST_ASSERT(ok);
  17800. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17801. + JSONTEST_ASSERT_EQUAL(3u, root.size());
  17802. + }
  17803. + {
  17804. + char const doc[] = "[,,null]";
  17805. + bool ok = reader->parse(
  17806. + doc, doc + std::strlen(doc),
  17807. + &root, &errs);
  17808. + JSONTEST_ASSERT(ok);
  17809. + JSONTEST_ASSERT(errs == "");
  17810. + JSONTEST_ASSERT_EQUAL(3u, root.size());
  17811. + }
  17812. + {
  17813. + char const doc[] = "[[],,,]";
  17814. + bool ok = reader->parse(
  17815. + doc, doc + std::strlen(doc),
  17816. + &root, &errs);
  17817. + JSONTEST_ASSERT(ok);
  17818. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17819. + JSONTEST_ASSERT_EQUAL(4u, root.size());
  17820. + JSONTEST_ASSERT_EQUAL(Json::arrayValue, root[0u]);
  17821. + }
  17822. + {
  17823. + char const doc[] = "[,[],,]";
  17824. + bool ok = reader->parse(
  17825. + doc, doc + std::strlen(doc),
  17826. + &root, &errs);
  17827. + JSONTEST_ASSERT(ok);
  17828. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17829. + JSONTEST_ASSERT_EQUAL(4u, root.size());
  17830. + JSONTEST_ASSERT_EQUAL(Json::arrayValue, root[1u]);
  17831. + }
  17832. + {
  17833. + char const doc[] = "[,,,[]]";
  17834. + bool ok = reader->parse(
  17835. + doc, doc + std::strlen(doc),
  17836. + &root, &errs);
  17837. + JSONTEST_ASSERT(ok);
  17838. + JSONTEST_ASSERT(errs == "");
  17839. + JSONTEST_ASSERT_EQUAL(4u, root.size());
  17840. + JSONTEST_ASSERT_EQUAL(Json::arrayValue, root[3u]);
  17841. + }
  17842. + delete reader;
  17843. +}
  17844. +
  17845. +struct CharReaderAllowSingleQuotesTest : JsonTest::TestCase {};
  17846. +
  17847. +JSONTEST_FIXTURE(CharReaderAllowSingleQuotesTest, issue182) {
  17848. + Json::CharReaderBuilder b;
  17849. + b.settings_["allowSingleQuotes"] = true;
  17850. + Json::Value root;
  17851. + JSONCPP_STRING errs;
  17852. + Json::CharReader* reader(b.newCharReader());
  17853. + {
  17854. + char const doc[] = "{'a':true,\"b\":true}";
  17855. + bool ok = reader->parse(
  17856. + doc, doc + std::strlen(doc),
  17857. + &root, &errs);
  17858. + JSONTEST_ASSERT(ok);
  17859. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17860. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17861. + JSONTEST_ASSERT_EQUAL(true, root.get("a", false));
  17862. + JSONTEST_ASSERT_EQUAL(true, root.get("b", false));
  17863. + }
  17864. + {
  17865. + char const doc[] = "{'a': 'x', \"b\":'y'}";
  17866. + bool ok = reader->parse(
  17867. + doc, doc + std::strlen(doc),
  17868. + &root, &errs);
  17869. + JSONTEST_ASSERT(ok);
  17870. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17871. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17872. + JSONTEST_ASSERT_STRING_EQUAL("x", root["a"].asString());
  17873. + JSONTEST_ASSERT_STRING_EQUAL("y", root["b"].asString());
  17874. + }
  17875. + delete reader;
  17876. +}
  17877. +
  17878. +struct CharReaderAllowZeroesTest : JsonTest::TestCase {};
  17879. +
  17880. +JSONTEST_FIXTURE(CharReaderAllowZeroesTest, issue176) {
  17881. + Json::CharReaderBuilder b;
  17882. + b.settings_["allowSingleQuotes"] = true;
  17883. + Json::Value root;
  17884. + JSONCPP_STRING errs;
  17885. + Json::CharReader* reader(b.newCharReader());
  17886. + {
  17887. + char const doc[] = "{'a':true,\"b\":true}";
  17888. + bool ok = reader->parse(
  17889. + doc, doc + std::strlen(doc),
  17890. + &root, &errs);
  17891. + JSONTEST_ASSERT(ok);
  17892. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17893. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17894. + JSONTEST_ASSERT_EQUAL(true, root.get("a", false));
  17895. + JSONTEST_ASSERT_EQUAL(true, root.get("b", false));
  17896. + }
  17897. + {
  17898. + char const doc[] = "{'a': 'x', \"b\":'y'}";
  17899. + bool ok = reader->parse(
  17900. + doc, doc + std::strlen(doc),
  17901. + &root, &errs);
  17902. + JSONTEST_ASSERT(ok);
  17903. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17904. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17905. + JSONTEST_ASSERT_STRING_EQUAL("x", root["a"].asString());
  17906. + JSONTEST_ASSERT_STRING_EQUAL("y", root["b"].asString());
  17907. + }
  17908. + delete reader;
  17909. +}
  17910. +
  17911. +struct CharReaderAllowSpecialFloatsTest : JsonTest::TestCase {};
  17912. +
  17913. +JSONTEST_FIXTURE(CharReaderAllowSpecialFloatsTest, issue209) {
  17914. + Json::CharReaderBuilder b;
  17915. + b.settings_["allowSpecialFloats"] = true;
  17916. + Json::Value root;
  17917. + JSONCPP_STRING errs;
  17918. + Json::CharReader* reader(b.newCharReader());
  17919. + {
  17920. + char const doc[] = "{\"a\":NaN,\"b\":Infinity,\"c\":-Infinity}";
  17921. + bool ok = reader->parse(
  17922. + doc, doc + std::strlen(doc),
  17923. + &root, &errs);
  17924. + JSONTEST_ASSERT(ok);
  17925. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17926. + JSONTEST_ASSERT_EQUAL(3u, root.size());
  17927. + double n = root["a"].asDouble();
  17928. + JSONTEST_ASSERT(n != n);
  17929. + JSONTEST_ASSERT_EQUAL(std::numeric_limits<double>::infinity(), root.get("b", 0.0));
  17930. + JSONTEST_ASSERT_EQUAL(-std::numeric_limits<double>::infinity(), root.get("c", 0.0));
  17931. + }
  17932. +
  17933. + struct TestData {
  17934. + int line;
  17935. + bool ok;
  17936. + JSONCPP_STRING in;
  17937. + };
  17938. + const TestData test_data[] = {
  17939. + {__LINE__, 1, "{\"a\":9}"},
  17940. + {__LINE__, 0, "{\"a\":0Infinity}"},
  17941. + {__LINE__, 0, "{\"a\":1Infinity}"},
  17942. + {__LINE__, 0, "{\"a\":9Infinity}"},
  17943. + {__LINE__, 0, "{\"a\":0nfinity}"},
  17944. + {__LINE__, 0, "{\"a\":1nfinity}"},
  17945. + {__LINE__, 0, "{\"a\":9nfinity}"},
  17946. + {__LINE__, 0, "{\"a\":nfinity}"},
  17947. + {__LINE__, 0, "{\"a\":.nfinity}"},
  17948. + {__LINE__, 0, "{\"a\":9nfinity}"},
  17949. + {__LINE__, 0, "{\"a\":-nfinity}"},
  17950. + {__LINE__, 1, "{\"a\":Infinity}"},
  17951. + {__LINE__, 0, "{\"a\":.Infinity}"},
  17952. + {__LINE__, 0, "{\"a\":_Infinity}"},
  17953. + {__LINE__, 0, "{\"a\":_nfinity}"},
  17954. + {__LINE__, 1, "{\"a\":-Infinity}"}
  17955. + };
  17956. + for (size_t tdi = 0; tdi < sizeof(test_data) / sizeof(*test_data); ++tdi) {
  17957. + const TestData& td = test_data[tdi];
  17958. + bool ok = reader->parse(&*td.in.begin(),
  17959. + &*td.in.begin() + td.in.size(),
  17960. + &root, &errs);
  17961. + JSONTEST_ASSERT(td.ok == ok)
  17962. + << "line:" << td.line << "\n"
  17963. + << " expected: {"
  17964. + << "ok:" << td.ok
  17965. + << ", in:\'" << td.in << "\'"
  17966. + << "}\n"
  17967. + << " actual: {"
  17968. + << "ok:" << ok
  17969. + << "}\n";
  17970. + }
  17971. +
  17972. + {
  17973. + char const doc[] = "{\"posInf\": Infinity, \"NegInf\": -Infinity}";
  17974. + bool ok = reader->parse(
  17975. + doc, doc + std::strlen(doc),
  17976. + &root, &errs);
  17977. + JSONTEST_ASSERT(ok);
  17978. + JSONTEST_ASSERT_STRING_EQUAL("", errs);
  17979. + JSONTEST_ASSERT_EQUAL(2u, root.size());
  17980. + JSONTEST_ASSERT_EQUAL(std::numeric_limits<double>::infinity(), root["posInf"].asDouble());
  17981. + JSONTEST_ASSERT_EQUAL(-std::numeric_limits<double>::infinity(), root["NegInf"].asDouble());
  17982. + }
  17983. + delete reader;
  17984. +}
  17985. +
  17986. +struct BuilderTest : JsonTest::TestCase {};
  17987. +
  17988. +JSONTEST_FIXTURE(BuilderTest, settings) {
  17989. + {
  17990. + Json::Value errs;
  17991. + Json::CharReaderBuilder rb;
  17992. + JSONTEST_ASSERT_EQUAL(false, rb.settings_.isMember("foo"));
  17993. + JSONTEST_ASSERT_EQUAL(true, rb.validate(&errs));
  17994. + rb["foo"] = "bar";
  17995. + JSONTEST_ASSERT_EQUAL(true, rb.settings_.isMember("foo"));
  17996. + JSONTEST_ASSERT_EQUAL(false, rb.validate(&errs));
  17997. + }
  17998. + {
  17999. + Json::Value errs;
  18000. + Json::StreamWriterBuilder wb;
  18001. + JSONTEST_ASSERT_EQUAL(false, wb.settings_.isMember("foo"));
  18002. + JSONTEST_ASSERT_EQUAL(true, wb.validate(&errs));
  18003. + wb["foo"] = "bar";
  18004. + JSONTEST_ASSERT_EQUAL(true, wb.settings_.isMember("foo"));
  18005. + JSONTEST_ASSERT_EQUAL(false, wb.validate(&errs));
  18006. + }
  18007. +}
  18008. +
  18009. +struct IteratorTest : JsonTest::TestCase {};
  18010. +
  18011. +JSONTEST_FIXTURE(IteratorTest, distance) {
  18012. + Json::Value json;
  18013. + json["k1"] = "a";
  18014. + json["k2"] = "b";
  18015. + int dist = 0;
  18016. + JSONCPP_STRING str;
  18017. + for (Json::ValueIterator it = json.begin(); it != json.end(); ++it) {
  18018. + dist = it - json.begin();
  18019. + str = it->asString().c_str();
  18020. + }
  18021. + JSONTEST_ASSERT_EQUAL(1, dist);
  18022. + JSONTEST_ASSERT_STRING_EQUAL("b", str);
  18023. +}
  18024. +
  18025. +JSONTEST_FIXTURE(IteratorTest, names) {
  18026. + Json::Value json;
  18027. + json["k1"] = "a";
  18028. + json["k2"] = "b";
  18029. + Json::ValueIterator it = json.begin();
  18030. + JSONTEST_ASSERT(it != json.end());
  18031. + JSONTEST_ASSERT_EQUAL(Json::Value("k1"), it.key());
  18032. + JSONTEST_ASSERT_STRING_EQUAL("k1", it.name());
  18033. + JSONTEST_ASSERT_EQUAL(-1, it.index());
  18034. + ++it;
  18035. + JSONTEST_ASSERT(it != json.end());
  18036. + JSONTEST_ASSERT_EQUAL(Json::Value("k2"), it.key());
  18037. + JSONTEST_ASSERT_STRING_EQUAL("k2", it.name());
  18038. + JSONTEST_ASSERT_EQUAL(-1, it.index());
  18039. + ++it;
  18040. + JSONTEST_ASSERT(it == json.end());
  18041. +}
  18042. +
  18043. +JSONTEST_FIXTURE(IteratorTest, indexes) {
  18044. + Json::Value json;
  18045. + json[0] = "a";
  18046. + json[1] = "b";
  18047. + Json::ValueIterator it = json.begin();
  18048. + JSONTEST_ASSERT(it != json.end());
  18049. + JSONTEST_ASSERT_EQUAL(Json::Value(Json::ArrayIndex(0)), it.key());
  18050. + JSONTEST_ASSERT_STRING_EQUAL("", it.name());
  18051. + JSONTEST_ASSERT_EQUAL(0, it.index());
  18052. + ++it;
  18053. + JSONTEST_ASSERT(it != json.end());
  18054. + JSONTEST_ASSERT_EQUAL(Json::Value(Json::ArrayIndex(1)), it.key());
  18055. + JSONTEST_ASSERT_STRING_EQUAL("", it.name());
  18056. + JSONTEST_ASSERT_EQUAL(1, it.index());
  18057. + ++it;
  18058. + JSONTEST_ASSERT(it == json.end());
  18059. +}
  18060. +
  18061. +JSONTEST_FIXTURE(IteratorTest, const) {
  18062. + Json::Value const v;
  18063. + JSONTEST_ASSERT_THROWS(
  18064. + Json::Value::iterator it(v.begin()) // Compile, but throw.
  18065. + );
  18066. +
  18067. + Json::Value value;
  18068. +
  18069. + for(int i = 9; i < 12; ++i)
  18070. + {
  18071. + JSONCPP_OSTRINGSTREAM out;
  18072. + out << std::setw(2) << i;
  18073. + JSONCPP_STRING str = out.str();
  18074. + value[str] = str;
  18075. + }
  18076. +
  18077. + JSONCPP_OSTRINGSTREAM out;
  18078. + //in old code, this will get a compile error
  18079. + Json::Value::const_iterator iter = value.begin();
  18080. + for(; iter != value.end(); ++iter)
  18081. + {
  18082. + out << *iter << ',';
  18083. + }
  18084. + JSONCPP_STRING expected = "\" 9\",\"10\",\"11\",";
  18085. + JSONTEST_ASSERT_STRING_EQUAL(expected, out.str());
  18086. +}
  18087. +
  18088. +struct RValueTest : JsonTest::TestCase {};
  18089. +
  18090. +JSONTEST_FIXTURE(RValueTest, moveConstruction) {
  18091. +#if JSON_HAS_RVALUE_REFERENCES
  18092. + Json::Value json;
  18093. + json["key"] = "value";
  18094. + Json::Value moved = std::move(json);
  18095. + JSONTEST_ASSERT(moved != json); // Possibly not nullValue; definitely not equal.
  18096. + JSONTEST_ASSERT_EQUAL(Json::objectValue, moved.type());
  18097. + JSONTEST_ASSERT_EQUAL(Json::stringValue, moved["key"].type());
  18098. +#endif
  18099. +}
  18100. +
  18101. +int main(int argc, const char* argv[]) {
  18102. + JsonTest::Runner runner;
  18103. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, checkNormalizeFloatingPointStr);
  18104. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, memberCount);
  18105. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, objects);
  18106. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, arrays);
  18107. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, arrayIssue252);
  18108. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, null);
  18109. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, strings);
  18110. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, bools);
  18111. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, integers);
  18112. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, nonIntegers);
  18113. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareNull);
  18114. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareInt);
  18115. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareUInt);
  18116. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareDouble);
  18117. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareString);
  18118. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareBoolean);
  18119. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareArray);
  18120. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareObject);
  18121. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, compareType);
  18122. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, offsetAccessors);
  18123. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, typeChecksThrowExceptions);
  18124. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, StaticString);
  18125. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, CommentBefore);
  18126. + //JSONTEST_REGISTER_FIXTURE(runner, ValueTest, nulls);
  18127. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, zeroes);
  18128. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, zeroesInKeys);
  18129. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, specialFloats);
  18130. + JSONTEST_REGISTER_FIXTURE(runner, ValueTest, precision);
  18131. +
  18132. + JSONTEST_REGISTER_FIXTURE(runner, WriterTest, dropNullPlaceholders);
  18133. + JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, dropNullPlaceholders);
  18134. + JSONTEST_REGISTER_FIXTURE(runner, StreamWriterTest, writeZeroes);
  18135. +
  18136. + JSONTEST_REGISTER_FIXTURE(runner, ReaderTest, parseWithNoErrors);
  18137. + JSONTEST_REGISTER_FIXTURE(
  18138. + runner, ReaderTest, parseWithNoErrorsTestingOffsets);
  18139. + JSONTEST_REGISTER_FIXTURE(runner, ReaderTest, parseWithOneError);
  18140. + JSONTEST_REGISTER_FIXTURE(runner, ReaderTest, parseChineseWithOneError);
  18141. + JSONTEST_REGISTER_FIXTURE(runner, ReaderTest, parseWithDetailError);
  18142. +
  18143. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderTest, parseWithNoErrors);
  18144. + JSONTEST_REGISTER_FIXTURE(
  18145. + runner, CharReaderTest, parseWithNoErrorsTestingOffsets);
  18146. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderTest, parseWithOneError);
  18147. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderTest, parseChineseWithOneError);
  18148. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderTest, parseWithDetailError);
  18149. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderTest, parseWithStackLimit);
  18150. +
  18151. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderStrictModeTest, dupKeys);
  18152. +
  18153. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, issue164);
  18154. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, issue107);
  18155. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, commentAfterObject);
  18156. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, commentAfterArray);
  18157. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderFailIfExtraTest, commentAfterBool);
  18158. +
  18159. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowDropNullTest, issue178);
  18160. +
  18161. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowSingleQuotesTest, issue182);
  18162. +
  18163. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowZeroesTest, issue176);
  18164. +
  18165. + JSONTEST_REGISTER_FIXTURE(runner, CharReaderAllowSpecialFloatsTest, issue209);
  18166. +
  18167. + JSONTEST_REGISTER_FIXTURE(runner, BuilderTest, settings);
  18168. +
  18169. + JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, distance);
  18170. + JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, names);
  18171. + JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, indexes);
  18172. + JSONTEST_REGISTER_FIXTURE(runner, IteratorTest, const);
  18173. +
  18174. + JSONTEST_REGISTER_FIXTURE(runner, RValueTest, moveConstruction);
  18175. +
  18176. + return runner.runCommandLine(argc, argv);
  18177. +}
  18178. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/sconscript polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/sconscript
  18179. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/sconscript 1970-01-01 02:00:00.000000000 +0200
  18180. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/src/test_lib_json/sconscript 2017-12-03 19:05:22.000000000 +0300
  18181. @@ -0,0 +1,10 @@
  18182. +Import( 'env_testing buildUnitTests' )
  18183. +
  18184. +buildUnitTests( env_testing, Split( """
  18185. + main.cpp
  18186. + jsontest.cpp
  18187. + """ ),
  18188. + 'test_lib_json' )
  18189. +
  18190. +# For 'check' to work, 'libs' must be built first.
  18191. +env_testing.Depends('test_lib_json', '#libs')
  18192. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/cleantests.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/cleantests.py
  18193. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/cleantests.py 1970-01-01 02:00:00.000000000 +0200
  18194. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/cleantests.py 2017-12-03 19:05:22.000000000 +0300
  18195. @@ -0,0 +1,16 @@
  18196. +# Copyright 2007 Baptiste Lepilleur
  18197. +# Distributed under MIT license, or public domain if desired and
  18198. +# recognized in your jurisdiction.
  18199. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  18200. +
  18201. +"""Removes all files created during testing."""
  18202. +
  18203. +import glob
  18204. +import os
  18205. +
  18206. +paths = []
  18207. +for pattern in [ '*.actual', '*.actual-rewrite', '*.rewrite', '*.process-output' ]:
  18208. + paths += glob.glob('data/' + pattern)
  18209. +
  18210. +for path in paths:
  18211. + os.unlink(path)
  18212. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/fail_test_array_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/fail_test_array_01.json
  18213. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/fail_test_array_01.json 1970-01-01 02:00:00.000000000 +0200
  18214. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/fail_test_array_01.json 2017-12-03 19:05:22.000000000 +0300
  18215. @@ -0,0 +1 @@
  18216. +[ 1 2 3]
  18217. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.expected
  18218. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.expected 1970-01-01 02:00:00.000000000 +0200
  18219. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.expected 2017-12-03 19:05:22.000000000 +0300
  18220. @@ -0,0 +1 @@
  18221. +.=[]
  18222. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.json
  18223. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.json 1970-01-01 02:00:00.000000000 +0200
  18224. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_01.json 2017-12-03 19:05:22.000000000 +0300
  18225. @@ -0,0 +1 @@
  18226. +[]
  18227. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.expected
  18228. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.expected 1970-01-01 02:00:00.000000000 +0200
  18229. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.expected 2017-12-03 19:05:22.000000000 +0300
  18230. @@ -0,0 +1,2 @@
  18231. +.=[]
  18232. +.[0]=1
  18233. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.json
  18234. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.json 1970-01-01 02:00:00.000000000 +0200
  18235. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_02.json 2017-12-03 19:05:22.000000000 +0300
  18236. @@ -0,0 +1 @@
  18237. +[1]
  18238. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.expected
  18239. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.expected 1970-01-01 02:00:00.000000000 +0200
  18240. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.expected 2017-12-03 19:05:22.000000000 +0300
  18241. @@ -0,0 +1,6 @@
  18242. +.=[]
  18243. +.[0]=1
  18244. +.[1]=2
  18245. +.[2]=3
  18246. +.[3]=4
  18247. +.[4]=5
  18248. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.json
  18249. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.json 1970-01-01 02:00:00.000000000 +0200
  18250. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_03.json 2017-12-03 19:05:22.000000000 +0300
  18251. @@ -0,0 +1 @@
  18252. +[ 1, 2 , 3,4,5]
  18253. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.expected
  18254. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.expected 1970-01-01 02:00:00.000000000 +0200
  18255. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.expected 2017-12-03 19:05:22.000000000 +0300
  18256. @@ -0,0 +1,5 @@
  18257. +.=[]
  18258. +.[0]=1
  18259. +.[1]="abc"
  18260. +.[2]=12.3
  18261. +.[3]=-4
  18262. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.json
  18263. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.json 1970-01-01 02:00:00.000000000 +0200
  18264. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_04.json 2017-12-03 19:05:22.000000000 +0300
  18265. @@ -0,0 +1 @@
  18266. +[1, "abc" , 12.3, -4]
  18267. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.expected
  18268. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.expected 1970-01-01 02:00:00.000000000 +0200
  18269. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.expected 2017-12-03 19:05:22.000000000 +0300
  18270. @@ -0,0 +1,100 @@
  18271. +.=[]
  18272. +.[0]=1
  18273. +.[1]=2
  18274. +.[2]=3
  18275. +.[3]=4
  18276. +.[4]=5
  18277. +.[5]=6
  18278. +.[6]=7
  18279. +.[7]=8
  18280. +.[8]=9
  18281. +.[9]=10
  18282. +.[10]=11
  18283. +.[11]=12
  18284. +.[12]=13
  18285. +.[13]=14
  18286. +.[14]=15
  18287. +.[15]=16
  18288. +.[16]=17
  18289. +.[17]=18
  18290. +.[18]=19
  18291. +.[19]=20
  18292. +.[20]=21
  18293. +.[21]=22
  18294. +.[22]=23
  18295. +.[23]=24
  18296. +.[24]=25
  18297. +.[25]=26
  18298. +.[26]=27
  18299. +.[27]=28
  18300. +.[28]=29
  18301. +.[29]=30
  18302. +.[30]=31
  18303. +.[31]=32
  18304. +.[32]=33
  18305. +.[33]=34
  18306. +.[34]=35
  18307. +.[35]=36
  18308. +.[36]=37
  18309. +.[37]=38
  18310. +.[38]=39
  18311. +.[39]=40
  18312. +.[40]=41
  18313. +.[41]=42
  18314. +.[42]=43
  18315. +.[43]=44
  18316. +.[44]=45
  18317. +.[45]=46
  18318. +.[46]=47
  18319. +.[47]=48
  18320. +.[48]=49
  18321. +.[49]=50
  18322. +.[50]=51
  18323. +.[51]=52
  18324. +.[52]=53
  18325. +.[53]=54
  18326. +.[54]=55
  18327. +.[55]=56
  18328. +.[56]=57
  18329. +.[57]=58
  18330. +.[58]=59
  18331. +.[59]=60
  18332. +.[60]=61
  18333. +.[61]=62
  18334. +.[62]=63
  18335. +.[63]=64
  18336. +.[64]=65
  18337. +.[65]=66
  18338. +.[66]=67
  18339. +.[67]=68
  18340. +.[68]=69
  18341. +.[69]=70
  18342. +.[70]=71
  18343. +.[71]=72
  18344. +.[72]=73
  18345. +.[73]=74
  18346. +.[74]=75
  18347. +.[75]=76
  18348. +.[76]=77
  18349. +.[77]=78
  18350. +.[78]=79
  18351. +.[79]=80
  18352. +.[80]=81
  18353. +.[81]=82
  18354. +.[82]=83
  18355. +.[83]=84
  18356. +.[84]=85
  18357. +.[85]=86
  18358. +.[86]=87
  18359. +.[87]=88
  18360. +.[88]=89
  18361. +.[89]=90
  18362. +.[90]=91
  18363. +.[91]=92
  18364. +.[92]=93
  18365. +.[93]=94
  18366. +.[94]=95
  18367. +.[95]=96
  18368. +.[96]=97
  18369. +.[97]=98
  18370. +.[98]=99
  18371. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.json
  18372. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.json 1970-01-01 02:00:00.000000000 +0200
  18373. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_05.json 2017-12-03 19:05:22.000000000 +0300
  18374. @@ -0,0 +1 @@
  18375. +[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
  18376. \ Dosya sonunda yenisatır yok.
  18377. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.expected
  18378. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.expected 1970-01-01 02:00:00.000000000 +0200
  18379. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.expected 2017-12-03 19:05:22.000000000 +0300
  18380. @@ -0,0 +1,5 @@
  18381. +.=[]
  18382. +.[0]="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
  18383. +.[1]="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
  18384. +.[2]="ccccccccccccccccccccccc"
  18385. +.[3]="dddddddddddddddddddddddddddddddddddddddddddddddddddd"
  18386. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.json
  18387. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.json 1970-01-01 02:00:00.000000000 +0200
  18388. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_06.json 2017-12-03 19:05:22.000000000 +0300
  18389. @@ -0,0 +1,4 @@
  18390. +[ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  18391. + "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
  18392. + "ccccccccccccccccccccccc",
  18393. + "dddddddddddddddddddddddddddddddddddddddddddddddddddd" ]
  18394. \ Dosya sonunda yenisatır yok.
  18395. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.expected
  18396. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.expected 1970-01-01 02:00:00.000000000 +0200
  18397. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.expected 2017-12-03 19:05:22.000000000 +0300
  18398. @@ -0,0 +1,2122 @@
  18399. +.=[]
  18400. +.[0]=[]
  18401. +.[0][0]="A"
  18402. +.[0][1]=0
  18403. +.[0][2]=1
  18404. +.[0][3]=2
  18405. +.[0][4]=3
  18406. +.[0][5]=4
  18407. +.[0][6]=5
  18408. +.[0][7]=6
  18409. +.[0][8]=7
  18410. +.[0][9]=8
  18411. +.[0][10]=9
  18412. +.[0][11]=10
  18413. +.[0][12]=11
  18414. +.[0][13]=12
  18415. +.[0][14]=13
  18416. +.[0][15]=14
  18417. +.[0][16]=15
  18418. +.[0][17]=16
  18419. +.[0][18]=17
  18420. +.[0][19]=18
  18421. +.[0][20]=19
  18422. +.[0][21]=20
  18423. +.[0][22]=21
  18424. +.[0][23]=22
  18425. +.[0][24]=23
  18426. +.[0][25]=24
  18427. +.[0][26]=25
  18428. +.[0][27]=26
  18429. +.[0][28]=27
  18430. +.[0][29]=28
  18431. +.[0][30]=29
  18432. +.[0][31]=30
  18433. +.[0][32]=31
  18434. +.[0][33]=32
  18435. +.[0][34]=33
  18436. +.[0][35]=34
  18437. +.[0][36]=35
  18438. +.[0][37]=36
  18439. +.[0][38]=37
  18440. +.[0][39]=38
  18441. +.[0][40]=39
  18442. +.[0][41]=40
  18443. +.[0][42]=41
  18444. +.[0][43]=42
  18445. +.[0][44]=43
  18446. +.[0][45]=44
  18447. +.[0][46]=45
  18448. +.[0][47]=46
  18449. +.[0][48]=47
  18450. +.[0][49]=48
  18451. +.[0][50]=49
  18452. +.[0][51]=50
  18453. +.[0][52]=51
  18454. +.[0][53]=52
  18455. +.[0][54]=53
  18456. +.[0][55]=54
  18457. +.[0][56]=55
  18458. +.[0][57]=56
  18459. +.[0][58]=57
  18460. +.[0][59]=58
  18461. +.[0][60]=59
  18462. +.[0][61]=60
  18463. +.[0][62]=61
  18464. +.[0][63]=62
  18465. +.[0][64]=63
  18466. +.[0][65]=64
  18467. +.[0][66]=65
  18468. +.[0][67]=66
  18469. +.[0][68]=67
  18470. +.[0][69]=68
  18471. +.[0][70]=69
  18472. +.[0][71]=70
  18473. +.[0][72]=71
  18474. +.[0][73]=72
  18475. +.[0][74]=73
  18476. +.[0][75]=74
  18477. +.[0][76]=75
  18478. +.[0][77]=76
  18479. +.[0][78]=77
  18480. +.[0][79]=78
  18481. +.[0][80]=79
  18482. +.[0][81]=80
  18483. +.[0][82]=81
  18484. +.[0][83]=82
  18485. +.[0][84]=83
  18486. +.[0][85]=84
  18487. +.[0][86]=85
  18488. +.[0][87]=86
  18489. +.[0][88]=87
  18490. +.[0][89]=88
  18491. +.[0][90]=89
  18492. +.[0][91]=90
  18493. +.[0][92]=91
  18494. +.[0][93]=92
  18495. +.[0][94]=93
  18496. +.[0][95]=94
  18497. +.[0][96]=95
  18498. +.[0][97]=96
  18499. +.[0][98]=97
  18500. +.[0][99]=98
  18501. +.[0][100]=99
  18502. +.[0][101]=100
  18503. +.[0][102]=101
  18504. +.[0][103]=102
  18505. +.[0][104]=103
  18506. +.[0][105]=104
  18507. +.[0][106]=105
  18508. +.[0][107]=106
  18509. +.[0][108]=107
  18510. +.[0][109]=108
  18511. +.[0][110]=109
  18512. +.[0][111]=110
  18513. +.[0][112]=111
  18514. +.[0][113]=112
  18515. +.[0][114]=113
  18516. +.[0][115]=114
  18517. +.[0][116]=115
  18518. +.[0][117]=116
  18519. +.[0][118]=117
  18520. +.[0][119]=118
  18521. +.[0][120]=119
  18522. +.[0][121]=120
  18523. +.[0][122]=121
  18524. +.[0][123]=122
  18525. +.[0][124]=123
  18526. +.[0][125]=124
  18527. +.[0][126]=125
  18528. +.[0][127]=126
  18529. +.[0][128]=127
  18530. +.[0][129]=128
  18531. +.[0][130]=129
  18532. +.[0][131]=130
  18533. +.[0][132]=131
  18534. +.[0][133]=132
  18535. +.[0][134]=133
  18536. +.[0][135]=134
  18537. +.[0][136]=135
  18538. +.[0][137]=136
  18539. +.[0][138]=137
  18540. +.[0][139]=138
  18541. +.[0][140]=139
  18542. +.[0][141]=140
  18543. +.[0][142]=141
  18544. +.[0][143]=142
  18545. +.[0][144]=143
  18546. +.[0][145]=144
  18547. +.[0][146]=145
  18548. +.[0][147]=146
  18549. +.[0][148]=147
  18550. +.[0][149]=148
  18551. +.[0][150]=149
  18552. +.[0][151]=150
  18553. +.[0][152]=151
  18554. +.[0][153]=152
  18555. +.[0][154]=153
  18556. +.[0][155]=154
  18557. +.[0][156]=155
  18558. +.[0][157]=156
  18559. +.[0][158]=157
  18560. +.[0][159]=158
  18561. +.[0][160]=159
  18562. +.[0][161]=160
  18563. +.[0][162]=161
  18564. +.[0][163]=162
  18565. +.[0][164]=163
  18566. +.[0][165]=164
  18567. +.[0][166]=165
  18568. +.[0][167]=166
  18569. +.[0][168]=167
  18570. +.[0][169]=168
  18571. +.[0][170]=169
  18572. +.[0][171]=170
  18573. +.[0][172]=171
  18574. +.[0][173]=172
  18575. +.[0][174]=173
  18576. +.[0][175]=174
  18577. +.[0][176]=175
  18578. +.[0][177]=176
  18579. +.[0][178]=177
  18580. +.[0][179]=178
  18581. +.[0][180]=179
  18582. +.[0][181]=180
  18583. +.[0][182]=181
  18584. +.[0][183]=182
  18585. +.[0][184]=183
  18586. +.[0][185]=184
  18587. +.[0][186]=185
  18588. +.[0][187]=186
  18589. +.[0][188]=187
  18590. +.[0][189]=188
  18591. +.[0][190]=189
  18592. +.[0][191]=190
  18593. +.[0][192]=191
  18594. +.[0][193]=192
  18595. +.[0][194]=193
  18596. +.[0][195]=194
  18597. +.[0][196]=195
  18598. +.[0][197]=196
  18599. +.[0][198]=197
  18600. +.[0][199]=198
  18601. +.[0][200]=199
  18602. +.[0][201]=200
  18603. +.[0][202]=201
  18604. +.[0][203]=202
  18605. +.[0][204]=203
  18606. +.[0][205]=204
  18607. +.[0][206]=205
  18608. +.[0][207]=206
  18609. +.[0][208]=207
  18610. +.[0][209]=208
  18611. +.[0][210]=209
  18612. +.[0][211]=210
  18613. +.[0][212]=211
  18614. +.[0][213]=212
  18615. +.[0][214]=213
  18616. +.[0][215]=214
  18617. +.[0][216]=215
  18618. +.[0][217]=216
  18619. +.[0][218]=217
  18620. +.[0][219]=218
  18621. +.[0][220]=219
  18622. +.[0][221]=220
  18623. +.[0][222]=221
  18624. +.[0][223]=222
  18625. +.[0][224]=223
  18626. +.[0][225]=224
  18627. +.[0][226]=225
  18628. +.[0][227]=226
  18629. +.[0][228]=227
  18630. +.[0][229]=228
  18631. +.[0][230]=229
  18632. +.[0][231]=230
  18633. +.[0][232]=231
  18634. +.[0][233]=232
  18635. +.[0][234]=233
  18636. +.[0][235]=234
  18637. +.[0][236]=235
  18638. +.[0][237]=236
  18639. +.[0][238]=237
  18640. +.[0][239]=238
  18641. +.[0][240]=239
  18642. +.[0][241]=240
  18643. +.[0][242]=241
  18644. +.[0][243]=242
  18645. +.[0][244]=243
  18646. +.[0][245]=244
  18647. +.[0][246]=245
  18648. +.[0][247]=246
  18649. +.[0][248]=247
  18650. +.[0][249]=248
  18651. +.[0][250]=249
  18652. +.[0][251]=250
  18653. +.[0][252]=251
  18654. +.[0][253]=252
  18655. +.[0][254]=253
  18656. +.[0][255]=254
  18657. +.[0][256]=255
  18658. +.[0][257]=256
  18659. +.[0][258]=257
  18660. +.[0][259]=258
  18661. +.[0][260]=259
  18662. +.[0][261]=260
  18663. +.[0][262]=261
  18664. +.[0][263]=262
  18665. +.[0][264]=263
  18666. +.[0][265]=264
  18667. +.[0][266]=265
  18668. +.[0][267]=266
  18669. +.[0][268]=267
  18670. +.[0][269]=268
  18671. +.[0][270]=269
  18672. +.[0][271]=270
  18673. +.[0][272]=271
  18674. +.[0][273]=272
  18675. +.[0][274]=273
  18676. +.[0][275]=274
  18677. +.[0][276]=275
  18678. +.[0][277]=276
  18679. +.[0][278]=277
  18680. +.[0][279]=278
  18681. +.[0][280]=279
  18682. +.[0][281]=280
  18683. +.[0][282]=281
  18684. +.[0][283]=282
  18685. +.[0][284]=283
  18686. +.[0][285]=284
  18687. +.[0][286]=285
  18688. +.[0][287]=286
  18689. +.[0][288]=287
  18690. +.[0][289]=288
  18691. +.[0][290]=289
  18692. +.[0][291]=290
  18693. +.[0][292]=291
  18694. +.[0][293]=292
  18695. +.[0][294]=293
  18696. +.[0][295]=294
  18697. +.[0][296]=295
  18698. +.[0][297]=296
  18699. +.[0][298]=297
  18700. +.[0][299]=298
  18701. +.[0][300]=299
  18702. +.[0][301]=300
  18703. +.[0][302]=301
  18704. +.[0][303]=302
  18705. +.[0][304]=303
  18706. +.[0][305]=304
  18707. +.[0][306]=305
  18708. +.[0][307]=306
  18709. +.[0][308]=307
  18710. +.[0][309]=308
  18711. +.[0][310]=309
  18712. +.[0][311]=310
  18713. +.[0][312]=311
  18714. +.[0][313]=312
  18715. +.[0][314]=313
  18716. +.[0][315]=314
  18717. +.[0][316]=315
  18718. +.[0][317]=316
  18719. +.[0][318]=317
  18720. +.[0][319]=318
  18721. +.[0][320]=319
  18722. +.[0][321]=320
  18723. +.[0][322]=321
  18724. +.[0][323]=322
  18725. +.[0][324]=323
  18726. +.[0][325]=324
  18727. +.[0][326]=325
  18728. +.[0][327]=326
  18729. +.[0][328]=327
  18730. +.[0][329]=328
  18731. +.[0][330]=329
  18732. +.[0][331]=330
  18733. +.[0][332]=331
  18734. +.[0][333]=332
  18735. +.[0][334]=333
  18736. +.[0][335]=334
  18737. +.[0][336]=335
  18738. +.[0][337]=336
  18739. +.[0][338]=337
  18740. +.[0][339]=338
  18741. +.[0][340]=339
  18742. +.[0][341]=340
  18743. +.[0][342]=341
  18744. +.[0][343]=342
  18745. +.[0][344]=343
  18746. +.[0][345]=344
  18747. +.[0][346]=345
  18748. +.[0][347]=346
  18749. +.[0][348]=347
  18750. +.[0][349]=348
  18751. +.[0][350]=349
  18752. +.[0][351]=350
  18753. +.[0][352]=351
  18754. +.[0][353]=352
  18755. +.[0][354]=353
  18756. +.[0][355]=354
  18757. +.[0][356]=355
  18758. +.[0][357]=356
  18759. +.[0][358]=357
  18760. +.[0][359]=358
  18761. +.[0][360]=359
  18762. +.[0][361]=360
  18763. +.[0][362]=361
  18764. +.[0][363]=362
  18765. +.[0][364]=363
  18766. +.[0][365]=364
  18767. +.[0][366]=365
  18768. +.[0][367]=366
  18769. +.[0][368]=367
  18770. +.[0][369]=368
  18771. +.[0][370]=369
  18772. +.[0][371]=370
  18773. +.[0][372]=371
  18774. +.[0][373]=372
  18775. +.[0][374]=373
  18776. +.[0][375]=374
  18777. +.[0][376]=375
  18778. +.[0][377]=376
  18779. +.[0][378]=377
  18780. +.[0][379]=378
  18781. +.[0][380]=379
  18782. +.[0][381]=380
  18783. +.[0][382]=381
  18784. +.[0][383]=382
  18785. +.[0][384]=383
  18786. +.[0][385]=384
  18787. +.[0][386]=385
  18788. +.[0][387]=386
  18789. +.[0][388]=387
  18790. +.[0][389]=388
  18791. +.[0][390]=389
  18792. +.[0][391]=390
  18793. +.[0][392]=391
  18794. +.[0][393]=392
  18795. +.[0][394]=393
  18796. +.[0][395]=394
  18797. +.[0][396]=395
  18798. +.[0][397]=396
  18799. +.[0][398]=397
  18800. +.[0][399]=398
  18801. +.[0][400]=399
  18802. +.[0][401]=400
  18803. +.[0][402]=401
  18804. +.[0][403]=402
  18805. +.[0][404]=403
  18806. +.[0][405]=404
  18807. +.[0][406]=405
  18808. +.[0][407]=406
  18809. +.[0][408]=407
  18810. +.[0][409]=408
  18811. +.[0][410]=409
  18812. +.[0][411]=410
  18813. +.[0][412]=411
  18814. +.[0][413]=412
  18815. +.[0][414]=413
  18816. +.[0][415]=414
  18817. +.[0][416]=415
  18818. +.[0][417]=416
  18819. +.[0][418]=417
  18820. +.[0][419]=418
  18821. +.[0][420]=419
  18822. +.[0][421]=420
  18823. +.[0][422]=421
  18824. +.[0][423]=422
  18825. +.[0][424]=423
  18826. +.[0][425]=424
  18827. +.[0][426]=425
  18828. +.[0][427]=426
  18829. +.[0][428]=427
  18830. +.[0][429]=428
  18831. +.[0][430]=429
  18832. +.[0][431]=430
  18833. +.[0][432]=431
  18834. +.[0][433]=432
  18835. +.[0][434]=433
  18836. +.[0][435]=434
  18837. +.[0][436]=435
  18838. +.[0][437]=436
  18839. +.[0][438]=437
  18840. +.[0][439]=438
  18841. +.[0][440]=439
  18842. +.[0][441]=440
  18843. +.[0][442]=441
  18844. +.[0][443]=442
  18845. +.[0][444]=443
  18846. +.[0][445]=444
  18847. +.[0][446]=445
  18848. +.[0][447]=446
  18849. +.[0][448]=447
  18850. +.[0][449]=448
  18851. +.[0][450]=449
  18852. +.[0][451]=450
  18853. +.[0][452]=451
  18854. +.[0][453]=452
  18855. +.[0][454]=453
  18856. +.[0][455]=454
  18857. +.[0][456]=455
  18858. +.[0][457]=456
  18859. +.[0][458]=457
  18860. +.[0][459]=458
  18861. +.[0][460]=459
  18862. +.[0][461]=460
  18863. +.[0][462]=461
  18864. +.[0][463]=462
  18865. +.[0][464]=463
  18866. +.[0][465]=464
  18867. +.[0][466]=465
  18868. +.[0][467]=466
  18869. +.[0][468]=467
  18870. +.[0][469]=468
  18871. +.[0][470]=469
  18872. +.[0][471]=470
  18873. +.[0][472]=471
  18874. +.[0][473]=472
  18875. +.[0][474]=473
  18876. +.[0][475]=474
  18877. +.[0][476]=475
  18878. +.[0][477]=476
  18879. +.[0][478]=477
  18880. +.[0][479]=478
  18881. +.[0][480]=479
  18882. +.[0][481]=480
  18883. +.[0][482]=481
  18884. +.[0][483]=482
  18885. +.[0][484]=483
  18886. +.[0][485]=484
  18887. +.[0][486]=485
  18888. +.[0][487]=486
  18889. +.[0][488]=487
  18890. +.[0][489]=488
  18891. +.[0][490]=489
  18892. +.[0][491]=490
  18893. +.[0][492]=491
  18894. +.[0][493]=492
  18895. +.[0][494]=493
  18896. +.[0][495]=494
  18897. +.[0][496]=495
  18898. +.[0][497]=496
  18899. +.[0][498]=497
  18900. +.[0][499]=498
  18901. +.[0][500]=499
  18902. +.[0][501]=500
  18903. +.[0][502]=501
  18904. +.[0][503]=502
  18905. +.[0][504]=503
  18906. +.[0][505]=504
  18907. +.[0][506]=505
  18908. +.[0][507]=506
  18909. +.[0][508]=507
  18910. +.[0][509]=508
  18911. +.[0][510]=509
  18912. +.[0][511]=510
  18913. +.[0][512]=511
  18914. +.[0][513]=512
  18915. +.[0][514]=513
  18916. +.[0][515]=514
  18917. +.[0][516]=515
  18918. +.[0][517]=516
  18919. +.[0][518]=517
  18920. +.[0][519]=518
  18921. +.[0][520]=519
  18922. +.[0][521]=520
  18923. +.[0][522]=521
  18924. +.[0][523]=522
  18925. +.[0][524]=523
  18926. +.[0][525]=524
  18927. +.[0][526]=525
  18928. +.[0][527]=526
  18929. +.[0][528]=527
  18930. +.[0][529]=528
  18931. +.[0][530]=529
  18932. +.[0][531]=530
  18933. +.[0][532]=531
  18934. +.[0][533]=532
  18935. +.[0][534]=533
  18936. +.[0][535]=534
  18937. +.[0][536]=535
  18938. +.[0][537]=536
  18939. +.[0][538]=537
  18940. +.[0][539]=538
  18941. +.[0][540]=539
  18942. +.[0][541]=540
  18943. +.[0][542]=541
  18944. +.[0][543]=542
  18945. +.[0][544]=543
  18946. +.[0][545]=544
  18947. +.[0][546]=545
  18948. +.[0][547]=546
  18949. +.[0][548]=547
  18950. +.[0][549]=548
  18951. +.[0][550]=549
  18952. +.[0][551]=550
  18953. +.[0][552]=551
  18954. +.[0][553]=552
  18955. +.[0][554]=553
  18956. +.[0][555]=554
  18957. +.[0][556]=555
  18958. +.[0][557]=556
  18959. +.[0][558]=557
  18960. +.[0][559]=558
  18961. +.[0][560]=559
  18962. +.[0][561]=560
  18963. +.[0][562]=561
  18964. +.[0][563]=562
  18965. +.[0][564]=563
  18966. +.[0][565]=564
  18967. +.[0][566]=565
  18968. +.[0][567]=566
  18969. +.[0][568]=567
  18970. +.[0][569]=568
  18971. +.[0][570]=569
  18972. +.[0][571]=570
  18973. +.[0][572]=571
  18974. +.[0][573]=572
  18975. +.[0][574]=573
  18976. +.[0][575]=574
  18977. +.[0][576]=575
  18978. +.[0][577]=576
  18979. +.[0][578]=577
  18980. +.[0][579]=578
  18981. +.[0][580]=579
  18982. +.[0][581]=580
  18983. +.[0][582]=581
  18984. +.[0][583]=582
  18985. +.[0][584]=583
  18986. +.[0][585]=584
  18987. +.[0][586]=585
  18988. +.[0][587]=586
  18989. +.[0][588]=587
  18990. +.[0][589]=588
  18991. +.[0][590]=589
  18992. +.[0][591]=590
  18993. +.[0][592]=591
  18994. +.[0][593]=592
  18995. +.[0][594]=593
  18996. +.[0][595]=594
  18997. +.[0][596]=595
  18998. +.[0][597]=596
  18999. +.[0][598]=597
  19000. +.[0][599]=598
  19001. +.[0][600]=599
  19002. +.[0][601]=600
  19003. +.[0][602]=601
  19004. +.[0][603]=602
  19005. +.[0][604]=603
  19006. +.[0][605]=604
  19007. +.[0][606]=605
  19008. +.[0][607]=606
  19009. +.[0][608]=607
  19010. +.[0][609]=608
  19011. +.[0][610]=609
  19012. +.[0][611]=610
  19013. +.[0][612]=611
  19014. +.[0][613]=612
  19015. +.[0][614]=613
  19016. +.[0][615]=614
  19017. +.[0][616]=615
  19018. +.[0][617]=616
  19019. +.[0][618]=617
  19020. +.[0][619]=618
  19021. +.[0][620]=619
  19022. +.[0][621]=620
  19023. +.[0][622]=621
  19024. +.[0][623]=622
  19025. +.[0][624]=623
  19026. +.[0][625]=624
  19027. +.[0][626]=625
  19028. +.[0][627]=626
  19029. +.[0][628]=627
  19030. +.[0][629]=628
  19031. +.[0][630]=629
  19032. +.[0][631]=630
  19033. +.[0][632]=631
  19034. +.[0][633]=632
  19035. +.[0][634]=633
  19036. +.[0][635]=634
  19037. +.[0][636]=635
  19038. +.[0][637]=636
  19039. +.[0][638]=637
  19040. +.[0][639]=638
  19041. +.[0][640]=639
  19042. +.[0][641]=640
  19043. +.[0][642]=641
  19044. +.[0][643]=642
  19045. +.[0][644]=643
  19046. +.[0][645]=644
  19047. +.[0][646]=645
  19048. +.[0][647]=646
  19049. +.[0][648]=647
  19050. +.[0][649]=648
  19051. +.[0][650]=649
  19052. +.[0][651]=650
  19053. +.[0][652]=651
  19054. +.[0][653]=652
  19055. +.[0][654]=653
  19056. +.[0][655]=654
  19057. +.[0][656]=655
  19058. +.[0][657]=656
  19059. +.[0][658]=657
  19060. +.[0][659]=658
  19061. +.[0][660]=659
  19062. +.[0][661]=660
  19063. +.[0][662]=661
  19064. +.[0][663]=662
  19065. +.[0][664]=663
  19066. +.[0][665]=664
  19067. +.[0][666]=665
  19068. +.[0][667]=666
  19069. +.[0][668]=667
  19070. +.[0][669]=668
  19071. +.[0][670]=669
  19072. +.[0][671]=670
  19073. +.[0][672]=671
  19074. +.[0][673]=672
  19075. +.[0][674]=673
  19076. +.[0][675]=674
  19077. +.[0][676]=675
  19078. +.[0][677]=676
  19079. +.[0][678]=677
  19080. +.[0][679]=678
  19081. +.[0][680]=679
  19082. +.[0][681]=680
  19083. +.[0][682]=681
  19084. +.[0][683]=682
  19085. +.[0][684]=683
  19086. +.[0][685]=684
  19087. +.[0][686]=685
  19088. +.[0][687]=686
  19089. +.[0][688]=687
  19090. +.[0][689]=688
  19091. +.[0][690]=689
  19092. +.[0][691]=690
  19093. +.[0][692]=691
  19094. +.[0][693]=692
  19095. +.[0][694]=693
  19096. +.[0][695]=694
  19097. +.[0][696]=695
  19098. +.[0][697]=696
  19099. +.[0][698]=697
  19100. +.[0][699]=698
  19101. +.[0][700]=699
  19102. +.[0][701]=700
  19103. +.[0][702]=701
  19104. +.[0][703]=702
  19105. +.[0][704]=703
  19106. +.[0][705]=704
  19107. +.[0][706]=705
  19108. +.[0][707]=706
  19109. +.[0][708]=707
  19110. +.[0][709]=708
  19111. +.[0][710]=709
  19112. +.[0][711]=710
  19113. +.[0][712]=711
  19114. +.[0][713]=712
  19115. +.[0][714]=713
  19116. +.[0][715]=714
  19117. +.[0][716]=715
  19118. +.[0][717]=716
  19119. +.[0][718]=717
  19120. +.[0][719]=718
  19121. +.[0][720]=719
  19122. +.[0][721]=720
  19123. +.[0][722]=721
  19124. +.[0][723]=722
  19125. +.[0][724]=723
  19126. +.[0][725]=724
  19127. +.[0][726]=725
  19128. +.[0][727]=726
  19129. +.[0][728]=727
  19130. +.[0][729]=728
  19131. +.[0][730]=729
  19132. +.[0][731]=730
  19133. +.[0][732]=731
  19134. +.[0][733]=732
  19135. +.[0][734]=733
  19136. +.[0][735]=734
  19137. +.[0][736]=735
  19138. +.[0][737]=736
  19139. +.[0][738]=737
  19140. +.[0][739]=738
  19141. +.[0][740]=739
  19142. +.[0][741]=740
  19143. +.[0][742]=741
  19144. +.[0][743]=742
  19145. +.[0][744]=743
  19146. +.[0][745]=744
  19147. +.[0][746]=745
  19148. +.[0][747]=746
  19149. +.[0][748]=747
  19150. +.[0][749]=748
  19151. +.[0][750]=749
  19152. +.[0][751]=750
  19153. +.[0][752]=751
  19154. +.[0][753]=752
  19155. +.[0][754]=753
  19156. +.[0][755]=754
  19157. +.[0][756]=755
  19158. +.[0][757]=756
  19159. +.[0][758]=757
  19160. +.[0][759]=758
  19161. +.[0][760]=759
  19162. +.[0][761]=760
  19163. +.[0][762]=761
  19164. +.[0][763]=762
  19165. +.[0][764]=763
  19166. +.[0][765]=764
  19167. +.[0][766]=765
  19168. +.[0][767]=766
  19169. +.[0][768]=767
  19170. +.[0][769]=768
  19171. +.[0][770]=769
  19172. +.[0][771]=770
  19173. +.[0][772]=771
  19174. +.[0][773]=772
  19175. +.[0][774]=773
  19176. +.[0][775]=774
  19177. +.[0][776]=775
  19178. +.[0][777]=776
  19179. +.[0][778]=777
  19180. +.[0][779]=778
  19181. +.[0][780]=779
  19182. +.[0][781]=780
  19183. +.[0][782]=781
  19184. +.[0][783]=782
  19185. +.[0][784]=783
  19186. +.[0][785]=784
  19187. +.[0][786]=785
  19188. +.[0][787]=786
  19189. +.[0][788]=787
  19190. +.[0][789]=788
  19191. +.[0][790]=789
  19192. +.[0][791]=790
  19193. +.[0][792]=791
  19194. +.[0][793]=792
  19195. +.[0][794]=793
  19196. +.[0][795]=794
  19197. +.[0][796]=795
  19198. +.[0][797]=796
  19199. +.[0][798]=797
  19200. +.[0][799]=798
  19201. +.[0][800]=799
  19202. +.[0][801]=800
  19203. +.[0][802]=801
  19204. +.[0][803]=802
  19205. +.[0][804]=803
  19206. +.[0][805]=804
  19207. +.[0][806]=805
  19208. +.[0][807]=806
  19209. +.[0][808]=807
  19210. +.[0][809]=808
  19211. +.[0][810]=809
  19212. +.[0][811]=810
  19213. +.[0][812]=811
  19214. +.[0][813]=812
  19215. +.[0][814]=813
  19216. +.[0][815]=814
  19217. +.[0][816]=815
  19218. +.[0][817]=816
  19219. +.[0][818]=817
  19220. +.[0][819]=818
  19221. +.[0][820]=819
  19222. +.[0][821]=820
  19223. +.[0][822]=821
  19224. +.[0][823]=822
  19225. +.[0][824]=823
  19226. +.[0][825]=824
  19227. +.[0][826]=825
  19228. +.[0][827]=826
  19229. +.[0][828]=827
  19230. +.[0][829]=828
  19231. +.[0][830]=829
  19232. +.[0][831]=830
  19233. +.[0][832]=831
  19234. +.[0][833]=832
  19235. +.[0][834]=833
  19236. +.[0][835]=834
  19237. +.[0][836]=835
  19238. +.[0][837]=836
  19239. +.[0][838]=837
  19240. +.[0][839]=838
  19241. +.[0][840]=839
  19242. +.[0][841]=840
  19243. +.[0][842]=841
  19244. +.[0][843]=842
  19245. +.[0][844]=843
  19246. +.[0][845]=844
  19247. +.[0][846]=845
  19248. +.[0][847]=846
  19249. +.[0][848]=847
  19250. +.[0][849]=848
  19251. +.[0][850]=849
  19252. +.[0][851]=850
  19253. +.[0][852]=851
  19254. +.[0][853]=852
  19255. +.[0][854]=853
  19256. +.[0][855]=854
  19257. +.[0][856]=855
  19258. +.[0][857]=856
  19259. +.[0][858]=857
  19260. +.[0][859]=858
  19261. +.[0][860]=859
  19262. +.[0][861]=860
  19263. +.[0][862]=861
  19264. +.[0][863]=862
  19265. +.[0][864]=863
  19266. +.[0][865]=864
  19267. +.[0][866]=865
  19268. +.[0][867]=866
  19269. +.[0][868]=867
  19270. +.[0][869]=868
  19271. +.[0][870]=869
  19272. +.[0][871]=870
  19273. +.[0][872]=871
  19274. +.[0][873]=872
  19275. +.[0][874]=873
  19276. +.[0][875]=874
  19277. +.[0][876]=875
  19278. +.[0][877]=876
  19279. +.[0][878]=877
  19280. +.[0][879]=878
  19281. +.[0][880]=879
  19282. +.[0][881]=880
  19283. +.[0][882]=881
  19284. +.[0][883]=882
  19285. +.[0][884]=883
  19286. +.[0][885]=884
  19287. +.[0][886]=885
  19288. +.[0][887]=886
  19289. +.[0][888]=887
  19290. +.[0][889]=888
  19291. +.[0][890]=889
  19292. +.[0][891]=890
  19293. +.[0][892]=891
  19294. +.[0][893]=892
  19295. +.[0][894]=893
  19296. +.[0][895]=894
  19297. +.[0][896]=895
  19298. +.[0][897]=896
  19299. +.[0][898]=897
  19300. +.[0][899]=898
  19301. +.[0][900]=899
  19302. +.[0][901]=900
  19303. +.[0][902]=901
  19304. +.[0][903]=902
  19305. +.[0][904]=903
  19306. +.[0][905]=904
  19307. +.[0][906]=905
  19308. +.[0][907]=906
  19309. +.[0][908]=907
  19310. +.[0][909]=908
  19311. +.[0][910]=909
  19312. +.[0][911]=910
  19313. +.[0][912]=911
  19314. +.[0][913]=912
  19315. +.[0][914]=913
  19316. +.[0][915]=914
  19317. +.[0][916]=915
  19318. +.[0][917]=916
  19319. +.[0][918]=917
  19320. +.[0][919]=918
  19321. +.[0][920]=919
  19322. +.[0][921]=920
  19323. +.[0][922]=921
  19324. +.[0][923]=922
  19325. +.[0][924]=923
  19326. +.[0][925]=924
  19327. +.[0][926]=925
  19328. +.[0][927]=926
  19329. +.[0][928]=927
  19330. +.[0][929]=928
  19331. +.[0][930]=929
  19332. +.[0][931]=930
  19333. +.[0][932]=931
  19334. +.[0][933]=932
  19335. +.[0][934]=933
  19336. +.[0][935]=934
  19337. +.[0][936]=935
  19338. +.[0][937]=936
  19339. +.[0][938]=937
  19340. +.[0][939]=938
  19341. +.[0][940]=939
  19342. +.[0][941]=940
  19343. +.[0][942]=941
  19344. +.[0][943]=942
  19345. +.[0][944]=943
  19346. +.[0][945]=944
  19347. +.[0][946]=945
  19348. +.[0][947]=946
  19349. +.[0][948]=947
  19350. +.[0][949]=948
  19351. +.[0][950]=949
  19352. +.[0][951]=950
  19353. +.[0][952]=951
  19354. +.[0][953]=952
  19355. +.[0][954]=953
  19356. +.[0][955]=954
  19357. +.[0][956]=955
  19358. +.[0][957]=956
  19359. +.[0][958]=957
  19360. +.[0][959]=958
  19361. +.[0][960]=959
  19362. +.[0][961]=960
  19363. +.[0][962]=961
  19364. +.[0][963]=962
  19365. +.[0][964]=963
  19366. +.[0][965]=964
  19367. +.[0][966]=965
  19368. +.[0][967]=966
  19369. +.[0][968]=967
  19370. +.[0][969]=968
  19371. +.[0][970]=969
  19372. +.[0][971]=970
  19373. +.[0][972]=971
  19374. +.[0][973]=972
  19375. +.[0][974]=973
  19376. +.[0][975]=974
  19377. +.[0][976]=975
  19378. +.[0][977]=976
  19379. +.[0][978]=977
  19380. +.[0][979]=978
  19381. +.[0][980]=979
  19382. +.[0][981]=980
  19383. +.[0][982]=981
  19384. +.[0][983]=982
  19385. +.[0][984]=983
  19386. +.[0][985]=984
  19387. +.[0][986]=985
  19388. +.[0][987]=986
  19389. +.[0][988]=987
  19390. +.[0][989]=988
  19391. +.[0][990]=989
  19392. +.[0][991]=990
  19393. +.[0][992]=991
  19394. +.[0][993]=992
  19395. +.[0][994]=993
  19396. +.[0][995]=994
  19397. +.[0][996]=995
  19398. +.[0][997]=996
  19399. +.[0][998]=997
  19400. +.[0][999]=998
  19401. +.[0][1000]=999
  19402. +.[0][1001]=1000
  19403. +.[0][1002]=1001
  19404. +.[0][1003]=1002
  19405. +.[0][1004]=1003
  19406. +.[0][1005]=1004
  19407. +.[0][1006]=1005
  19408. +.[0][1007]=1006
  19409. +.[0][1008]=1007
  19410. +.[0][1009]=1008
  19411. +.[0][1010]=1009
  19412. +.[0][1011]=1010
  19413. +.[0][1012]=1011
  19414. +.[0][1013]=1012
  19415. +.[0][1014]=1013
  19416. +.[0][1015]=1014
  19417. +.[0][1016]=1015
  19418. +.[0][1017]=1016
  19419. +.[0][1018]=1017
  19420. +.[0][1019]=1018
  19421. +.[0][1020]=1019
  19422. +.[0][1021]=1020
  19423. +.[0][1022]=1021
  19424. +.[0][1023]=1022
  19425. +.[0][1024]=1023
  19426. +.[0][1025]=1024
  19427. +.[0][1026]=1025
  19428. +.[0][1027]=1026
  19429. +.[0][1028]=1027
  19430. +.[0][1029]=1028
  19431. +.[0][1030]=1029
  19432. +.[0][1031]=1030
  19433. +.[0][1032]=1031
  19434. +.[0][1033]=1032
  19435. +.[0][1034]=1033
  19436. +.[0][1035]=1034
  19437. +.[0][1036]=1035
  19438. +.[0][1037]=1036
  19439. +.[0][1038]=1037
  19440. +.[0][1039]=1038
  19441. +.[0][1040]=1039
  19442. +.[0][1041]=1040
  19443. +.[0][1042]=1041
  19444. +.[0][1043]=1042
  19445. +.[0][1044]=1043
  19446. +.[0][1045]=1044
  19447. +.[0][1046]=1045
  19448. +.[0][1047]=1046
  19449. +.[0][1048]=1047
  19450. +.[0][1049]=1048
  19451. +.[0][1050]=1049
  19452. +.[0][1051]=1050
  19453. +.[0][1052]=1051
  19454. +.[0][1053]=1052
  19455. +.[0][1054]=1053
  19456. +.[0][1055]=1054
  19457. +.[0][1056]=1055
  19458. +.[0][1057]=1056
  19459. +.[0][1058]=1057
  19460. +.[0][1059]=1058
  19461. +.[0][1060]=1059
  19462. +.[0][1061]=1060
  19463. +.[0][1062]=1061
  19464. +.[0][1063]=1062
  19465. +.[0][1064]=1063
  19466. +.[0][1065]=1064
  19467. +.[0][1066]=1065
  19468. +.[0][1067]=1066
  19469. +.[0][1068]=1067
  19470. +.[0][1069]=1068
  19471. +.[0][1070]=1069
  19472. +.[0][1071]=1070
  19473. +.[0][1072]=1071
  19474. +.[0][1073]=1072
  19475. +.[0][1074]=1073
  19476. +.[0][1075]=1074
  19477. +.[0][1076]=1075
  19478. +.[0][1077]=1076
  19479. +.[0][1078]=1077
  19480. +.[0][1079]=1078
  19481. +.[0][1080]=1079
  19482. +.[0][1081]=1080
  19483. +.[0][1082]=1081
  19484. +.[0][1083]=1082
  19485. +.[0][1084]=1083
  19486. +.[0][1085]=1084
  19487. +.[0][1086]=1085
  19488. +.[0][1087]=1086
  19489. +.[0][1088]=1087
  19490. +.[0][1089]=1088
  19491. +.[0][1090]=1089
  19492. +.[0][1091]=1090
  19493. +.[0][1092]=1091
  19494. +.[0][1093]=1092
  19495. +.[0][1094]=1093
  19496. +.[0][1095]=1094
  19497. +.[0][1096]=1095
  19498. +.[0][1097]=1096
  19499. +.[0][1098]=1097
  19500. +.[0][1099]=1098
  19501. +.[0][1100]=1099
  19502. +.[0][1101]=1100
  19503. +.[0][1102]=1101
  19504. +.[0][1103]=1102
  19505. +.[0][1104]=1103
  19506. +.[0][1105]=1104
  19507. +.[0][1106]=1105
  19508. +.[0][1107]=1106
  19509. +.[0][1108]=1107
  19510. +.[0][1109]=1108
  19511. +.[0][1110]=1109
  19512. +.[0][1111]=1110
  19513. +.[0][1112]=1111
  19514. +.[0][1113]=1112
  19515. +.[0][1114]=1113
  19516. +.[0][1115]=1114
  19517. +.[0][1116]=1115
  19518. +.[0][1117]=1116
  19519. +.[0][1118]=1117
  19520. +.[0][1119]=1118
  19521. +.[0][1120]=1119
  19522. +.[0][1121]=1120
  19523. +.[0][1122]=1121
  19524. +.[0][1123]=1122
  19525. +.[0][1124]=1123
  19526. +.[0][1125]=1124
  19527. +.[0][1126]=1125
  19528. +.[0][1127]=1126
  19529. +.[0][1128]=1127
  19530. +.[0][1129]=1128
  19531. +.[0][1130]=1129
  19532. +.[0][1131]=1130
  19533. +.[0][1132]=1131
  19534. +.[0][1133]=1132
  19535. +.[0][1134]=1133
  19536. +.[0][1135]=1134
  19537. +.[0][1136]=1135
  19538. +.[0][1137]=1136
  19539. +.[0][1138]=1137
  19540. +.[0][1139]=1138
  19541. +.[0][1140]=1139
  19542. +.[0][1141]=1140
  19543. +.[0][1142]=1141
  19544. +.[0][1143]=1142
  19545. +.[0][1144]=1143
  19546. +.[0][1145]=1144
  19547. +.[0][1146]=1145
  19548. +.[0][1147]=1146
  19549. +.[0][1148]=1147
  19550. +.[0][1149]=1148
  19551. +.[0][1150]=1149
  19552. +.[0][1151]=1150
  19553. +.[0][1152]=1151
  19554. +.[0][1153]=1152
  19555. +.[0][1154]=1153
  19556. +.[0][1155]=1154
  19557. +.[0][1156]=1155
  19558. +.[0][1157]=1156
  19559. +.[0][1158]=1157
  19560. +.[0][1159]=1158
  19561. +.[0][1160]=1159
  19562. +.[0][1161]=1160
  19563. +.[0][1162]=1161
  19564. +.[0][1163]=1162
  19565. +.[0][1164]=1163
  19566. +.[0][1165]=1164
  19567. +.[0][1166]=1165
  19568. +.[0][1167]=1166
  19569. +.[0][1168]=1167
  19570. +.[0][1169]=1168
  19571. +.[0][1170]=1169
  19572. +.[0][1171]=1170
  19573. +.[0][1172]=1171
  19574. +.[0][1173]=1172
  19575. +.[0][1174]=1173
  19576. +.[0][1175]=1174
  19577. +.[0][1176]=1175
  19578. +.[0][1177]=1176
  19579. +.[0][1178]=1177
  19580. +.[0][1179]=1178
  19581. +.[0][1180]=1179
  19582. +.[0][1181]=1180
  19583. +.[0][1182]=1181
  19584. +.[0][1183]=1182
  19585. +.[0][1184]=1183
  19586. +.[0][1185]=1184
  19587. +.[0][1186]=1185
  19588. +.[0][1187]=1186
  19589. +.[0][1188]=1187
  19590. +.[0][1189]=1188
  19591. +.[0][1190]=1189
  19592. +.[0][1191]=1190
  19593. +.[0][1192]=1191
  19594. +.[0][1193]=1192
  19595. +.[0][1194]=1193
  19596. +.[0][1195]=1194
  19597. +.[0][1196]=1195
  19598. +.[0][1197]=1196
  19599. +.[0][1198]=1197
  19600. +.[0][1199]=1198
  19601. +.[0][1200]=1199
  19602. +.[0][1201]=1200
  19603. +.[0][1202]=1201
  19604. +.[0][1203]=1202
  19605. +.[0][1204]=1203
  19606. +.[0][1205]=1204
  19607. +.[0][1206]=1205
  19608. +.[0][1207]=1206
  19609. +.[0][1208]=1207
  19610. +.[0][1209]=1208
  19611. +.[0][1210]=1209
  19612. +.[0][1211]=1210
  19613. +.[0][1212]=1211
  19614. +.[0][1213]=1212
  19615. +.[0][1214]=1213
  19616. +.[0][1215]=1214
  19617. +.[0][1216]=1215
  19618. +.[0][1217]=1216
  19619. +.[0][1218]=1217
  19620. +.[0][1219]=1218
  19621. +.[0][1220]=1219
  19622. +.[0][1221]=1220
  19623. +.[0][1222]=1221
  19624. +.[0][1223]=1222
  19625. +.[0][1224]=1223
  19626. +.[0][1225]=1224
  19627. +.[0][1226]=1225
  19628. +.[0][1227]=1226
  19629. +.[0][1228]=1227
  19630. +.[0][1229]=1228
  19631. +.[0][1230]=1229
  19632. +.[0][1231]=1230
  19633. +.[0][1232]=1231
  19634. +.[0][1233]=1232
  19635. +.[0][1234]=1233
  19636. +.[0][1235]=1234
  19637. +.[0][1236]=1235
  19638. +.[0][1237]=1236
  19639. +.[0][1238]=1237
  19640. +.[0][1239]=1238
  19641. +.[0][1240]=1239
  19642. +.[0][1241]=1240
  19643. +.[0][1242]=1241
  19644. +.[0][1243]=1242
  19645. +.[0][1244]=1243
  19646. +.[0][1245]=1244
  19647. +.[0][1246]=1245
  19648. +.[0][1247]=1246
  19649. +.[0][1248]=1247
  19650. +.[0][1249]=1248
  19651. +.[0][1250]=1249
  19652. +.[0][1251]=1250
  19653. +.[0][1252]=1251
  19654. +.[0][1253]=1252
  19655. +.[0][1254]=1253
  19656. +.[0][1255]=1254
  19657. +.[0][1256]=1255
  19658. +.[0][1257]=1256
  19659. +.[0][1258]=1257
  19660. +.[0][1259]=1258
  19661. +.[0][1260]=1259
  19662. +.[0][1261]=1260
  19663. +.[0][1262]=1261
  19664. +.[0][1263]=1262
  19665. +.[0][1264]=1263
  19666. +.[0][1265]=1264
  19667. +.[0][1266]=1265
  19668. +.[0][1267]=1266
  19669. +.[0][1268]=1267
  19670. +.[0][1269]=1268
  19671. +.[0][1270]=1269
  19672. +.[0][1271]=1270
  19673. +.[0][1272]=1271
  19674. +.[0][1273]=1272
  19675. +.[0][1274]=1273
  19676. +.[0][1275]=1274
  19677. +.[0][1276]=1275
  19678. +.[0][1277]=1276
  19679. +.[0][1278]=1277
  19680. +.[0][1279]=1278
  19681. +.[0][1280]=1279
  19682. +.[0][1281]=1280
  19683. +.[0][1282]=1281
  19684. +.[0][1283]=1282
  19685. +.[0][1284]=1283
  19686. +.[0][1285]=1284
  19687. +.[0][1286]=1285
  19688. +.[0][1287]=1286
  19689. +.[0][1288]=1287
  19690. +.[0][1289]=1288
  19691. +.[0][1290]=1289
  19692. +.[0][1291]=1290
  19693. +.[0][1292]=1291
  19694. +.[0][1293]=1292
  19695. +.[0][1294]=1293
  19696. +.[0][1295]=1294
  19697. +.[0][1296]=1295
  19698. +.[0][1297]=1296
  19699. +.[0][1298]=1297
  19700. +.[0][1299]=1298
  19701. +.[0][1300]=1299
  19702. +.[0][1301]=1300
  19703. +.[0][1302]=1301
  19704. +.[0][1303]=1302
  19705. +.[0][1304]=1303
  19706. +.[0][1305]=1304
  19707. +.[0][1306]=1305
  19708. +.[0][1307]=1306
  19709. +.[0][1308]=1307
  19710. +.[0][1309]=1308
  19711. +.[0][1310]=1309
  19712. +.[0][1311]=1310
  19713. +.[0][1312]=1311
  19714. +.[0][1313]=1312
  19715. +.[0][1314]=1313
  19716. +.[0][1315]=1314
  19717. +.[0][1316]=1315
  19718. +.[0][1317]=1316
  19719. +.[0][1318]=1317
  19720. +.[0][1319]=1318
  19721. +.[0][1320]=1319
  19722. +.[0][1321]=1320
  19723. +.[0][1322]=1321
  19724. +.[0][1323]=1322
  19725. +.[0][1324]=1323
  19726. +.[0][1325]=1324
  19727. +.[0][1326]=1325
  19728. +.[0][1327]=1326
  19729. +.[0][1328]=1327
  19730. +.[0][1329]=1328
  19731. +.[0][1330]=1329
  19732. +.[0][1331]=1330
  19733. +.[0][1332]=1331
  19734. +.[0][1333]=1332
  19735. +.[0][1334]=1333
  19736. +.[0][1335]=1334
  19737. +.[0][1336]=1335
  19738. +.[0][1337]=1336
  19739. +.[0][1338]=1337
  19740. +.[0][1339]=1338
  19741. +.[0][1340]=1339
  19742. +.[0][1341]=1340
  19743. +.[0][1342]=1341
  19744. +.[0][1343]=1342
  19745. +.[0][1344]=1343
  19746. +.[0][1345]=1344
  19747. +.[0][1346]=1345
  19748. +.[0][1347]=1346
  19749. +.[0][1348]=1347
  19750. +.[0][1349]=1348
  19751. +.[0][1350]=1349
  19752. +.[0][1351]=1350
  19753. +.[0][1352]=1351
  19754. +.[0][1353]=1352
  19755. +.[0][1354]=1353
  19756. +.[0][1355]=1354
  19757. +.[0][1356]=1355
  19758. +.[0][1357]=1356
  19759. +.[0][1358]=1357
  19760. +.[0][1359]=1358
  19761. +.[0][1360]=1359
  19762. +.[0][1361]=1360
  19763. +.[0][1362]=1361
  19764. +.[0][1363]=1362
  19765. +.[0][1364]=1363
  19766. +.[0][1365]=1364
  19767. +.[0][1366]=1365
  19768. +.[0][1367]=1366
  19769. +.[0][1368]=1367
  19770. +.[0][1369]=1368
  19771. +.[0][1370]=1369
  19772. +.[0][1371]=1370
  19773. +.[0][1372]=1371
  19774. +.[0][1373]=1372
  19775. +.[0][1374]=1373
  19776. +.[0][1375]=1374
  19777. +.[0][1376]=1375
  19778. +.[0][1377]=1376
  19779. +.[0][1378]=1377
  19780. +.[0][1379]=1378
  19781. +.[0][1380]=1379
  19782. +.[0][1381]=1380
  19783. +.[0][1382]=1381
  19784. +.[0][1383]=1382
  19785. +.[0][1384]=1383
  19786. +.[0][1385]=1384
  19787. +.[0][1386]=1385
  19788. +.[0][1387]=1386
  19789. +.[0][1388]=1387
  19790. +.[0][1389]=1388
  19791. +.[0][1390]=1389
  19792. +.[0][1391]=1390
  19793. +.[0][1392]=1391
  19794. +.[0][1393]=1392
  19795. +.[0][1394]=1393
  19796. +.[0][1395]=1394
  19797. +.[0][1396]=1395
  19798. +.[0][1397]=1396
  19799. +.[0][1398]=1397
  19800. +.[0][1399]=1398
  19801. +.[0][1400]=1399
  19802. +.[0][1401]=1400
  19803. +.[0][1402]=1401
  19804. +.[0][1403]=1402
  19805. +.[0][1404]=1403
  19806. +.[0][1405]=1404
  19807. +.[0][1406]=1405
  19808. +.[0][1407]=1406
  19809. +.[0][1408]=1407
  19810. +.[0][1409]=1408
  19811. +.[0][1410]=1409
  19812. +.[0][1411]=1410
  19813. +.[0][1412]=1411
  19814. +.[0][1413]=1412
  19815. +.[0][1414]=1413
  19816. +.[0][1415]=1414
  19817. +.[0][1416]=1415
  19818. +.[0][1417]=1416
  19819. +.[0][1418]=1417
  19820. +.[0][1419]=1418
  19821. +.[0][1420]=1419
  19822. +.[0][1421]=1420
  19823. +.[0][1422]=1421
  19824. +.[0][1423]=1422
  19825. +.[0][1424]=1423
  19826. +.[0][1425]=1424
  19827. +.[0][1426]=1425
  19828. +.[0][1427]=1426
  19829. +.[0][1428]=1427
  19830. +.[0][1429]=1428
  19831. +.[0][1430]=1429
  19832. +.[0][1431]=1430
  19833. +.[0][1432]=1431
  19834. +.[0][1433]=1432
  19835. +.[0][1434]=1433
  19836. +.[0][1435]=1434
  19837. +.[0][1436]=1435
  19838. +.[0][1437]=1436
  19839. +.[0][1438]=1437
  19840. +.[0][1439]=1438
  19841. +.[0][1440]=1439
  19842. +.[0][1441]=1440
  19843. +.[0][1442]=1441
  19844. +.[0][1443]=1442
  19845. +.[0][1444]=1443
  19846. +.[0][1445]=1444
  19847. +.[0][1446]=1445
  19848. +.[0][1447]=1446
  19849. +.[0][1448]=1447
  19850. +.[0][1449]=1448
  19851. +.[0][1450]=1449
  19852. +.[0][1451]=1450
  19853. +.[0][1452]=1451
  19854. +.[0][1453]=1452
  19855. +.[0][1454]=1453
  19856. +.[0][1455]=1454
  19857. +.[0][1456]=1455
  19858. +.[0][1457]=1456
  19859. +.[0][1458]=1457
  19860. +.[0][1459]=1458
  19861. +.[0][1460]=1459
  19862. +.[0][1461]=1460
  19863. +.[0][1462]=1461
  19864. +.[0][1463]=1462
  19865. +.[0][1464]=1463
  19866. +.[0][1465]=1464
  19867. +.[0][1466]=1465
  19868. +.[0][1467]=1466
  19869. +.[0][1468]=1467
  19870. +.[0][1469]=1468
  19871. +.[0][1470]=1469
  19872. +.[0][1471]=1470
  19873. +.[0][1472]=1471
  19874. +.[0][1473]=1472
  19875. +.[0][1474]=1473
  19876. +.[0][1475]=1474
  19877. +.[0][1476]=1475
  19878. +.[0][1477]=1476
  19879. +.[0][1478]=1477
  19880. +.[0][1479]=1478
  19881. +.[0][1480]=1479
  19882. +.[0][1481]=1480
  19883. +.[0][1482]=1481
  19884. +.[0][1483]=1482
  19885. +.[0][1484]=1483
  19886. +.[0][1485]=1484
  19887. +.[0][1486]=1485
  19888. +.[0][1487]=1486
  19889. +.[0][1488]=1487
  19890. +.[0][1489]=1488
  19891. +.[0][1490]=1489
  19892. +.[0][1491]=1490
  19893. +.[0][1492]=1491
  19894. +.[0][1493]=1492
  19895. +.[0][1494]=1493
  19896. +.[0][1495]=1494
  19897. +.[0][1496]=1495
  19898. +.[0][1497]=1496
  19899. +.[0][1498]=1497
  19900. +.[0][1499]=1498
  19901. +.[0][1500]=1499
  19902. +.[0][1501]=1500
  19903. +.[0][1502]=1501
  19904. +.[0][1503]=1502
  19905. +.[0][1504]=1503
  19906. +.[0][1505]=1504
  19907. +.[0][1506]=1505
  19908. +.[0][1507]=1506
  19909. +.[0][1508]=1507
  19910. +.[0][1509]=1508
  19911. +.[0][1510]=1509
  19912. +.[0][1511]=1510
  19913. +.[0][1512]=1511
  19914. +.[0][1513]=1512
  19915. +.[0][1514]=1513
  19916. +.[0][1515]=1514
  19917. +.[0][1516]=1515
  19918. +.[0][1517]=1516
  19919. +.[0][1518]=1517
  19920. +.[0][1519]=1518
  19921. +.[0][1520]=1519
  19922. +.[0][1521]=1520
  19923. +.[0][1522]=1521
  19924. +.[0][1523]=1522
  19925. +.[0][1524]=1523
  19926. +.[0][1525]=1524
  19927. +.[0][1526]=1525
  19928. +.[0][1527]=1526
  19929. +.[0][1528]=1527
  19930. +.[0][1529]=1528
  19931. +.[0][1530]=1529
  19932. +.[0][1531]=1530
  19933. +.[0][1532]=1531
  19934. +.[0][1533]=1532
  19935. +.[0][1534]=1533
  19936. +.[0][1535]=1534
  19937. +.[0][1536]=1535
  19938. +.[0][1537]=1536
  19939. +.[0][1538]=1537
  19940. +.[0][1539]=1538
  19941. +.[0][1540]=1539
  19942. +.[0][1541]=1540
  19943. +.[0][1542]=1541
  19944. +.[0][1543]=1542
  19945. +.[0][1544]=1543
  19946. +.[0][1545]=1544
  19947. +.[0][1546]=1545
  19948. +.[0][1547]=1546
  19949. +.[0][1548]=1547
  19950. +.[0][1549]=1548
  19951. +.[0][1550]=1549
  19952. +.[0][1551]=1550
  19953. +.[0][1552]=1551
  19954. +.[0][1553]=1552
  19955. +.[0][1554]=1553
  19956. +.[0][1555]=1554
  19957. +.[0][1556]=1555
  19958. +.[0][1557]=1556
  19959. +.[0][1558]=1557
  19960. +.[0][1559]=1558
  19961. +.[0][1560]=1559
  19962. +.[0][1561]=1560
  19963. +.[0][1562]=1561
  19964. +.[0][1563]=1562
  19965. +.[0][1564]=1563
  19966. +.[0][1565]=1564
  19967. +.[0][1566]=1565
  19968. +.[0][1567]=1566
  19969. +.[0][1568]=1567
  19970. +.[0][1569]=1568
  19971. +.[0][1570]=1569
  19972. +.[0][1571]=1570
  19973. +.[0][1572]=1571
  19974. +.[0][1573]=1572
  19975. +.[0][1574]=1573
  19976. +.[0][1575]=1574
  19977. +.[0][1576]=1575
  19978. +.[0][1577]=1576
  19979. +.[0][1578]=1577
  19980. +.[0][1579]=1578
  19981. +.[0][1580]=1579
  19982. +.[0][1581]=1580
  19983. +.[0][1582]=1581
  19984. +.[0][1583]=1582
  19985. +.[0][1584]=1583
  19986. +.[0][1585]=1584
  19987. +.[0][1586]=1585
  19988. +.[0][1587]=1586
  19989. +.[0][1588]=1587
  19990. +.[0][1589]=1588
  19991. +.[0][1590]=1589
  19992. +.[0][1591]=1590
  19993. +.[0][1592]=1591
  19994. +.[0][1593]=1592
  19995. +.[0][1594]=1593
  19996. +.[0][1595]=1594
  19997. +.[0][1596]=1595
  19998. +.[0][1597]=1596
  19999. +.[0][1598]=1597
  20000. +.[0][1599]=1598
  20001. +.[0][1600]=1599
  20002. +.[0][1601]=1600
  20003. +.[0][1602]=1601
  20004. +.[0][1603]=1602
  20005. +.[0][1604]=1603
  20006. +.[0][1605]=1604
  20007. +.[0][1606]=1605
  20008. +.[0][1607]=1606
  20009. +.[0][1608]=1607
  20010. +.[0][1609]=1608
  20011. +.[0][1610]=1609
  20012. +.[0][1611]=1610
  20013. +.[0][1612]=1611
  20014. +.[0][1613]=1612
  20015. +.[0][1614]=1613
  20016. +.[0][1615]=1614
  20017. +.[0][1616]=1615
  20018. +.[0][1617]=1616
  20019. +.[0][1618]=1617
  20020. +.[0][1619]=1618
  20021. +.[0][1620]=1619
  20022. +.[0][1621]=1620
  20023. +.[0][1622]=1621
  20024. +.[0][1623]=1622
  20025. +.[0][1624]=1623
  20026. +.[0][1625]=1624
  20027. +.[0][1626]=1625
  20028. +.[0][1627]=1626
  20029. +.[0][1628]=1627
  20030. +.[0][1629]=1628
  20031. +.[0][1630]=1629
  20032. +.[0][1631]=1630
  20033. +.[0][1632]=1631
  20034. +.[0][1633]=1632
  20035. +.[0][1634]=1633
  20036. +.[0][1635]=1634
  20037. +.[0][1636]=1635
  20038. +.[0][1637]=1636
  20039. +.[0][1638]=1637
  20040. +.[0][1639]=1638
  20041. +.[0][1640]=1639
  20042. +.[0][1641]=1640
  20043. +.[0][1642]=1641
  20044. +.[0][1643]=1642
  20045. +.[0][1644]=1643
  20046. +.[0][1645]=1644
  20047. +.[0][1646]=1645
  20048. +.[0][1647]=1646
  20049. +.[0][1648]=1647
  20050. +.[0][1649]=1648
  20051. +.[0][1650]=1649
  20052. +.[0][1651]=1650
  20053. +.[0][1652]=1651
  20054. +.[0][1653]=1652
  20055. +.[0][1654]=1653
  20056. +.[0][1655]=1654
  20057. +.[0][1656]=1655
  20058. +.[0][1657]=1656
  20059. +.[0][1658]=1657
  20060. +.[0][1659]=1658
  20061. +.[0][1660]=1659
  20062. +.[0][1661]=1660
  20063. +.[0][1662]=1661
  20064. +.[0][1663]=1662
  20065. +.[0][1664]=1663
  20066. +.[0][1665]=1664
  20067. +.[0][1666]=1665
  20068. +.[0][1667]=1666
  20069. +.[0][1668]=1667
  20070. +.[0][1669]=1668
  20071. +.[0][1670]=1669
  20072. +.[0][1671]=1670
  20073. +.[0][1672]=1671
  20074. +.[0][1673]=1672
  20075. +.[0][1674]=1673
  20076. +.[0][1675]=1674
  20077. +.[0][1676]=1675
  20078. +.[0][1677]=1676
  20079. +.[0][1678]=1677
  20080. +.[0][1679]=1678
  20081. +.[0][1680]=1679
  20082. +.[0][1681]=1680
  20083. +.[0][1682]=1681
  20084. +.[0][1683]=1682
  20085. +.[0][1684]=1683
  20086. +.[0][1685]=1684
  20087. +.[0][1686]=1685
  20088. +.[0][1687]=1686
  20089. +.[0][1688]=1687
  20090. +.[0][1689]=1688
  20091. +.[0][1690]=1689
  20092. +.[0][1691]=1690
  20093. +.[0][1692]=1691
  20094. +.[0][1693]=1692
  20095. +.[0][1694]=1693
  20096. +.[0][1695]=1694
  20097. +.[0][1696]=1695
  20098. +.[0][1697]=1696
  20099. +.[0][1698]=1697
  20100. +.[0][1699]=1698
  20101. +.[0][1700]=1699
  20102. +.[0][1701]=1700
  20103. +.[0][1702]=1701
  20104. +.[0][1703]=1702
  20105. +.[0][1704]=1703
  20106. +.[0][1705]=1704
  20107. +.[0][1706]=1705
  20108. +.[0][1707]=1706
  20109. +.[0][1708]=1707
  20110. +.[0][1709]=1708
  20111. +.[0][1710]=1709
  20112. +.[0][1711]=1710
  20113. +.[0][1712]=1711
  20114. +.[0][1713]=1712
  20115. +.[0][1714]=1713
  20116. +.[0][1715]=1714
  20117. +.[0][1716]=1715
  20118. +.[0][1717]=1716
  20119. +.[0][1718]=1717
  20120. +.[0][1719]=1718
  20121. +.[0][1720]=1719
  20122. +.[0][1721]=1720
  20123. +.[0][1722]=1721
  20124. +.[0][1723]=1722
  20125. +.[0][1724]=1723
  20126. +.[0][1725]=1724
  20127. +.[0][1726]=1725
  20128. +.[0][1727]=1726
  20129. +.[0][1728]=1727
  20130. +.[0][1729]=1728
  20131. +.[0][1730]=1729
  20132. +.[0][1731]=1730
  20133. +.[0][1732]=1731
  20134. +.[0][1733]=1732
  20135. +.[0][1734]=1733
  20136. +.[0][1735]=1734
  20137. +.[0][1736]=1735
  20138. +.[0][1737]=1736
  20139. +.[0][1738]=1737
  20140. +.[0][1739]=1738
  20141. +.[0][1740]=1739
  20142. +.[0][1741]=1740
  20143. +.[0][1742]=1741
  20144. +.[0][1743]=1742
  20145. +.[0][1744]=1743
  20146. +.[0][1745]=1744
  20147. +.[0][1746]=1745
  20148. +.[0][1747]=1746
  20149. +.[0][1748]=1747
  20150. +.[0][1749]=1748
  20151. +.[0][1750]=1749
  20152. +.[0][1751]=1750
  20153. +.[0][1752]=1751
  20154. +.[0][1753]=1752
  20155. +.[0][1754]=1753
  20156. +.[0][1755]=1754
  20157. +.[0][1756]=1755
  20158. +.[0][1757]=1756
  20159. +.[0][1758]=1757
  20160. +.[0][1759]=1758
  20161. +.[0][1760]=1759
  20162. +.[0][1761]=1760
  20163. +.[0][1762]=1761
  20164. +.[0][1763]=1762
  20165. +.[0][1764]=1763
  20166. +.[0][1765]=1764
  20167. +.[0][1766]=1765
  20168. +.[0][1767]=1766
  20169. +.[0][1768]=1767
  20170. +.[0][1769]=1768
  20171. +.[0][1770]=1769
  20172. +.[0][1771]=1770
  20173. +.[0][1772]=1771
  20174. +.[0][1773]=1772
  20175. +.[0][1774]=1773
  20176. +.[0][1775]=1774
  20177. +.[0][1776]=1775
  20178. +.[0][1777]=1776
  20179. +.[0][1778]=1777
  20180. +.[0][1779]=1778
  20181. +.[0][1780]=1779
  20182. +.[0][1781]=1780
  20183. +.[0][1782]=1781
  20184. +.[0][1783]=1782
  20185. +.[0][1784]=1783
  20186. +.[0][1785]=1784
  20187. +.[0][1786]=1785
  20188. +.[0][1787]=1786
  20189. +.[0][1788]=1787
  20190. +.[0][1789]=1788
  20191. +.[0][1790]=1789
  20192. +.[0][1791]=1790
  20193. +.[0][1792]=1791
  20194. +.[0][1793]=1792
  20195. +.[0][1794]=1793
  20196. +.[0][1795]=1794
  20197. +.[0][1796]=1795
  20198. +.[0][1797]=1796
  20199. +.[0][1798]=1797
  20200. +.[0][1799]=1798
  20201. +.[0][1800]=1799
  20202. +.[0][1801]=1800
  20203. +.[0][1802]=1801
  20204. +.[0][1803]=1802
  20205. +.[0][1804]=1803
  20206. +.[0][1805]=1804
  20207. +.[0][1806]=1805
  20208. +.[0][1807]=1806
  20209. +.[0][1808]=1807
  20210. +.[0][1809]=1808
  20211. +.[0][1810]=1809
  20212. +.[0][1811]=1810
  20213. +.[0][1812]=1811
  20214. +.[0][1813]=1812
  20215. +.[0][1814]=1813
  20216. +.[0][1815]=1814
  20217. +.[0][1816]=1815
  20218. +.[0][1817]=1816
  20219. +.[0][1818]=1817
  20220. +.[0][1819]=1818
  20221. +.[0][1820]=1819
  20222. +.[0][1821]=1820
  20223. +.[0][1822]=1821
  20224. +.[0][1823]=1822
  20225. +.[0][1824]=1823
  20226. +.[0][1825]=1824
  20227. +.[0][1826]=1825
  20228. +.[0][1827]=1826
  20229. +.[0][1828]=1827
  20230. +.[0][1829]=1828
  20231. +.[0][1830]=1829
  20232. +.[0][1831]=1830
  20233. +.[0][1832]=1831
  20234. +.[0][1833]=1832
  20235. +.[0][1834]=1833
  20236. +.[0][1835]=1834
  20237. +.[0][1836]=1835
  20238. +.[0][1837]=1836
  20239. +.[0][1838]=1837
  20240. +.[0][1839]=1838
  20241. +.[0][1840]=1839
  20242. +.[0][1841]=1840
  20243. +.[0][1842]=1841
  20244. +.[0][1843]=1842
  20245. +.[0][1844]=1843
  20246. +.[0][1845]=1844
  20247. +.[0][1846]=1845
  20248. +.[0][1847]=1846
  20249. +.[0][1848]=1847
  20250. +.[0][1849]=1848
  20251. +.[0][1850]=1849
  20252. +.[0][1851]=1850
  20253. +.[0][1852]=1851
  20254. +.[0][1853]=1852
  20255. +.[0][1854]=1853
  20256. +.[0][1855]=1854
  20257. +.[0][1856]=1855
  20258. +.[0][1857]=1856
  20259. +.[0][1858]=1857
  20260. +.[0][1859]=1858
  20261. +.[0][1860]=1859
  20262. +.[0][1861]=1860
  20263. +.[0][1862]=1861
  20264. +.[0][1863]=1862
  20265. +.[0][1864]=1863
  20266. +.[0][1865]=1864
  20267. +.[0][1866]=1865
  20268. +.[0][1867]=1866
  20269. +.[0][1868]=1867
  20270. +.[0][1869]=1868
  20271. +.[0][1870]=1869
  20272. +.[0][1871]=1870
  20273. +.[0][1872]=1871
  20274. +.[0][1873]=1872
  20275. +.[0][1874]=1873
  20276. +.[0][1875]=1874
  20277. +.[0][1876]=1875
  20278. +.[0][1877]=1876
  20279. +.[0][1878]=1877
  20280. +.[0][1879]=1878
  20281. +.[0][1880]=1879
  20282. +.[0][1881]=1880
  20283. +.[0][1882]=1881
  20284. +.[0][1883]=1882
  20285. +.[0][1884]=1883
  20286. +.[0][1885]=1884
  20287. +.[0][1886]=1885
  20288. +.[0][1887]=1886
  20289. +.[0][1888]=1887
  20290. +.[0][1889]=1888
  20291. +.[0][1890]=1889
  20292. +.[0][1891]=1890
  20293. +.[0][1892]=1891
  20294. +.[0][1893]=1892
  20295. +.[0][1894]=1893
  20296. +.[0][1895]=1894
  20297. +.[0][1896]=1895
  20298. +.[0][1897]=1896
  20299. +.[0][1898]=1897
  20300. +.[0][1899]=1898
  20301. +.[0][1900]=1899
  20302. +.[0][1901]=1900
  20303. +.[0][1902]=1901
  20304. +.[0][1903]=1902
  20305. +.[0][1904]=1903
  20306. +.[0][1905]=1904
  20307. +.[0][1906]=1905
  20308. +.[0][1907]=1906
  20309. +.[0][1908]=1907
  20310. +.[0][1909]=1908
  20311. +.[0][1910]=1909
  20312. +.[0][1911]=1910
  20313. +.[0][1912]=1911
  20314. +.[0][1913]=1912
  20315. +.[0][1914]=1913
  20316. +.[0][1915]=1914
  20317. +.[0][1916]=1915
  20318. +.[0][1917]=1916
  20319. +.[0][1918]=1917
  20320. +.[0][1919]=1918
  20321. +.[0][1920]=1919
  20322. +.[0][1921]=1920
  20323. +.[0][1922]=1921
  20324. +.[0][1923]=1922
  20325. +.[0][1924]=1923
  20326. +.[0][1925]=1924
  20327. +.[0][1926]=1925
  20328. +.[0][1927]=1926
  20329. +.[0][1928]=1927
  20330. +.[0][1929]=1928
  20331. +.[0][1930]=1929
  20332. +.[0][1931]=1930
  20333. +.[0][1932]=1931
  20334. +.[0][1933]=1932
  20335. +.[0][1934]=1933
  20336. +.[0][1935]=1934
  20337. +.[0][1936]=1935
  20338. +.[0][1937]=1936
  20339. +.[0][1938]=1937
  20340. +.[0][1939]=1938
  20341. +.[0][1940]=1939
  20342. +.[0][1941]=1940
  20343. +.[0][1942]=1941
  20344. +.[0][1943]=1942
  20345. +.[0][1944]=1943
  20346. +.[0][1945]=1944
  20347. +.[0][1946]=1945
  20348. +.[0][1947]=1946
  20349. +.[0][1948]=1947
  20350. +.[0][1949]=1948
  20351. +.[0][1950]=1949
  20352. +.[0][1951]=1950
  20353. +.[0][1952]=1951
  20354. +.[0][1953]=1952
  20355. +.[0][1954]=1953
  20356. +.[0][1955]=1954
  20357. +.[0][1956]=1955
  20358. +.[0][1957]=1956
  20359. +.[0][1958]=1957
  20360. +.[0][1959]=1958
  20361. +.[0][1960]=1959
  20362. +.[0][1961]=1960
  20363. +.[0][1962]=1961
  20364. +.[0][1963]=1962
  20365. +.[0][1964]=1963
  20366. +.[0][1965]=1964
  20367. +.[0][1966]=1965
  20368. +.[0][1967]=1966
  20369. +.[0][1968]=1967
  20370. +.[0][1969]=1968
  20371. +.[0][1970]=1969
  20372. +.[0][1971]=1970
  20373. +.[0][1972]=1971
  20374. +.[0][1973]=1972
  20375. +.[0][1974]=1973
  20376. +.[0][1975]=1974
  20377. +.[0][1976]=1975
  20378. +.[0][1977]=1976
  20379. +.[0][1978]=1977
  20380. +.[0][1979]=1978
  20381. +.[0][1980]=1979
  20382. +.[0][1981]=1980
  20383. +.[0][1982]=1981
  20384. +.[0][1983]=1982
  20385. +.[0][1984]=1983
  20386. +.[0][1985]=1984
  20387. +.[0][1986]=1985
  20388. +.[0][1987]=1986
  20389. +.[0][1988]=1987
  20390. +.[0][1989]=1988
  20391. +.[0][1990]=1989
  20392. +.[0][1991]=1990
  20393. +.[0][1992]=1991
  20394. +.[0][1993]=1992
  20395. +.[0][1994]=1993
  20396. +.[0][1995]=1994
  20397. +.[0][1996]=1995
  20398. +.[0][1997]=1996
  20399. +.[0][1998]=1997
  20400. +.[0][1999]=1998
  20401. +.[0][2000]=1999
  20402. +.[0][2001]=2000
  20403. +.[0][2002]=2001
  20404. +.[0][2003]=2002
  20405. +.[0][2004]=2003
  20406. +.[0][2005]=2004
  20407. +.[0][2006]=2005
  20408. +.[0][2007]=2006
  20409. +.[0][2008]=2007
  20410. +.[0][2009]=2008
  20411. +.[0][2010]=2009
  20412. +.[0][2011]=2010
  20413. +.[0][2012]=2011
  20414. +.[0][2013]=2012
  20415. +.[0][2014]=2013
  20416. +.[0][2015]=2014
  20417. +.[0][2016]=2015
  20418. +.[0][2017]=2016
  20419. +.[0][2018]=2017
  20420. +.[0][2019]=2018
  20421. +.[0][2020]=2019
  20422. +.[0][2021]=2020
  20423. +.[0][2022]=2021
  20424. +.[0][2023]=2022
  20425. +.[0][2024]=2023
  20426. +.[0][2025]=2024
  20427. +.[0][2026]=2025
  20428. +.[0][2027]=2026
  20429. +.[0][2028]=2027
  20430. +.[0][2029]=2028
  20431. +.[0][2030]=2029
  20432. +.[0][2031]=2030
  20433. +.[0][2032]=2031
  20434. +.[0][2033]=2032
  20435. +.[0][2034]=2033
  20436. +.[0][2035]=2034
  20437. +.[0][2036]=2035
  20438. +.[0][2037]=2036
  20439. +.[0][2038]=2037
  20440. +.[0][2039]=2038
  20441. +.[0][2040]=2039
  20442. +.[0][2041]=2040
  20443. +.[0][2042]=2041
  20444. +.[0][2043]=2042
  20445. +.[0][2044]=2043
  20446. +.[0][2045]=2044
  20447. +.[0][2046]=2045
  20448. +.[0][2047]=2046
  20449. +.[0][2048]=2047
  20450. +.[0][2049]=2048
  20451. +.[0][2050]=2049
  20452. +.[0][2051]=2050
  20453. +.[0][2052]=2051
  20454. +.[0][2053]=2052
  20455. +.[0][2054]=2053
  20456. +.[0][2055]=2054
  20457. +.[0][2056]=2055
  20458. +.[0][2057]=2056
  20459. +.[0][2058]=2057
  20460. +.[0][2059]=2058
  20461. +.[0][2060]=2059
  20462. +.[0][2061]=2060
  20463. +.[0][2062]=2061
  20464. +.[0][2063]=2062
  20465. +.[0][2064]=2063
  20466. +.[0][2065]=2064
  20467. +.[0][2066]=2065
  20468. +.[0][2067]=2066
  20469. +.[0][2068]=2067
  20470. +.[0][2069]=2068
  20471. +.[0][2070]=2069
  20472. +.[0][2071]=2070
  20473. +.[0][2072]=2071
  20474. +.[0][2073]=2072
  20475. +.[0][2074]=2073
  20476. +.[0][2075]=2074
  20477. +.[0][2076]=2075
  20478. +.[0][2077]=2076
  20479. +.[0][2078]=2077
  20480. +.[0][2079]=2078
  20481. +.[0][2080]=2079
  20482. +.[0][2081]=2080
  20483. +.[0][2082]=2081
  20484. +.[0][2083]=2082
  20485. +.[0][2084]=2083
  20486. +.[0][2085]=2084
  20487. +.[0][2086]=2085
  20488. +.[0][2087]=2086
  20489. +.[0][2088]=2087
  20490. +.[0][2089]=2088
  20491. +.[0][2090]=2089
  20492. +.[0][2091]=2090
  20493. +.[0][2092]=2091
  20494. +.[0][2093]=2092
  20495. +.[0][2094]=2093
  20496. +.[0][2095]=2094
  20497. +.[0][2096]=2095
  20498. +.[0][2097]=2096
  20499. +.[0][2098]=2097
  20500. +.[0][2099]=2098
  20501. +.[0][2100]=2099
  20502. +.[0][2101]=2100
  20503. +.[0][2102]=2101
  20504. +.[0][2103]=2102
  20505. +.[0][2104]=2103
  20506. +.[0][2105]=2104
  20507. +.[0][2106]=2105
  20508. +.[0][2107]=2106
  20509. +.[0][2108]=2107
  20510. +.[0][2109]=2108
  20511. +.[0][2110]=2109
  20512. +.[0][2111]=2110
  20513. +.[0][2112]=2111
  20514. +.[0][2113]=2112
  20515. +.[0][2114]=2113
  20516. +.[0][2115]=2114
  20517. +.[0][2116]=2115
  20518. +.[0][2117]=2116
  20519. +.[0][2118]=2117
  20520. +.[0][2119]=2118
  20521. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.json
  20522. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.json 1970-01-01 02:00:00.000000000 +0200
  20523. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_array_07.json 2017-12-03 19:05:22.000000000 +0300
  20524. @@ -0,0 +1,2 @@
  20525. +[["A",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1854,1855,1856,1857,1858,1859,1860,1861,1862,1863,1864,1865,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,2113,2114,2115,2116,2117,2118]
  20526. +]
  20527. \ Dosya sonunda yenisatır yok.
  20528. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.expected
  20529. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.expected 1970-01-01 02:00:00.000000000 +0200
  20530. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.expected 2017-12-03 19:05:22.000000000 +0300
  20531. @@ -0,0 +1 @@
  20532. +.=123456789
  20533. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.json
  20534. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.json 1970-01-01 02:00:00.000000000 +0200
  20535. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_01.json 2017-12-03 19:05:22.000000000 +0300
  20536. @@ -0,0 +1 @@
  20537. +0123456789
  20538. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.expected
  20539. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.expected 1970-01-01 02:00:00.000000000 +0200
  20540. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.expected 2017-12-03 19:05:22.000000000 +0300
  20541. @@ -0,0 +1 @@
  20542. +.=-123456789
  20543. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.json
  20544. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.json 1970-01-01 02:00:00.000000000 +0200
  20545. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_02.json 2017-12-03 19:05:22.000000000 +0300
  20546. @@ -0,0 +1 @@
  20547. +-0123456789
  20548. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.expected
  20549. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.expected 1970-01-01 02:00:00.000000000 +0200
  20550. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.expected 2017-12-03 19:05:22.000000000 +0300
  20551. @@ -0,0 +1,3 @@
  20552. +.=1.2345678
  20553. +
  20554. +
  20555. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.json
  20556. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.json 1970-01-01 02:00:00.000000000 +0200
  20557. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_03.json 2017-12-03 19:05:22.000000000 +0300
  20558. @@ -0,0 +1,3 @@
  20559. +1.2345678
  20560. +
  20561. +
  20562. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.expected
  20563. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.expected 1970-01-01 02:00:00.000000000 +0200
  20564. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.expected 2017-12-03 19:05:22.000000000 +0300
  20565. @@ -0,0 +1,2 @@
  20566. +.="abcdef"
  20567. +
  20568. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.json
  20569. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.json 1970-01-01 02:00:00.000000000 +0200
  20570. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_04.json 2017-12-03 19:05:22.000000000 +0300
  20571. @@ -0,0 +1,2 @@
  20572. +"abcdef"
  20573. +
  20574. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.expected
  20575. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.expected 1970-01-01 02:00:00.000000000 +0200
  20576. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.expected 2017-12-03 19:05:22.000000000 +0300
  20577. @@ -0,0 +1,2 @@
  20578. +.=null
  20579. +
  20580. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.json
  20581. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.json 1970-01-01 02:00:00.000000000 +0200
  20582. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_05.json 2017-12-03 19:05:22.000000000 +0300
  20583. @@ -0,0 +1,2 @@
  20584. +null
  20585. +
  20586. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.expected
  20587. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.expected 1970-01-01 02:00:00.000000000 +0200
  20588. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.expected 2017-12-03 19:05:22.000000000 +0300
  20589. @@ -0,0 +1,2 @@
  20590. +.=true
  20591. +
  20592. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.json
  20593. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.json 1970-01-01 02:00:00.000000000 +0200
  20594. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_06.json 2017-12-03 19:05:22.000000000 +0300
  20595. @@ -0,0 +1,2 @@
  20596. +true
  20597. +
  20598. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.expected
  20599. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.expected 1970-01-01 02:00:00.000000000 +0200
  20600. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.expected 2017-12-03 19:05:22.000000000 +0300
  20601. @@ -0,0 +1,2 @@
  20602. +.=false
  20603. +
  20604. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.json
  20605. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.json 1970-01-01 02:00:00.000000000 +0200
  20606. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_07.json 2017-12-03 19:05:22.000000000 +0300
  20607. @@ -0,0 +1,2 @@
  20608. +false
  20609. +
  20610. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.expected
  20611. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.expected 1970-01-01 02:00:00.000000000 +0200
  20612. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.expected 2017-12-03 19:05:22.000000000 +0300
  20613. @@ -0,0 +1,3 @@
  20614. +// C++ style comment
  20615. +.=null
  20616. +
  20617. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.json
  20618. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.json 1970-01-01 02:00:00.000000000 +0200
  20619. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_08.json 2017-12-03 19:05:22.000000000 +0300
  20620. @@ -0,0 +1,3 @@
  20621. +// C++ style comment
  20622. +null
  20623. +
  20624. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.expected
  20625. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.expected 1970-01-01 02:00:00.000000000 +0200
  20626. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.expected 2017-12-03 19:05:22.000000000 +0300
  20627. @@ -0,0 +1,4 @@
  20628. +/* C style comment
  20629. + */
  20630. +.=null
  20631. +
  20632. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.json
  20633. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.json 1970-01-01 02:00:00.000000000 +0200
  20634. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_basic_09.json 2017-12-03 19:05:22.000000000 +0300
  20635. @@ -0,0 +1,4 @@
  20636. +/* C style comment
  20637. + */
  20638. +null
  20639. +
  20640. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.expected
  20641. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.expected 1970-01-01 02:00:00.000000000 +0200
  20642. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.expected 2017-12-03 19:05:22.000000000 +0300
  20643. @@ -0,0 +1,4 @@
  20644. +// Comment for array
  20645. +.=[]
  20646. +// Comment within array
  20647. +.[0]="one-element"
  20648. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.json
  20649. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.json 1970-01-01 02:00:00.000000000 +0200
  20650. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_00.json 2017-12-03 19:05:22.000000000 +0300
  20651. @@ -0,0 +1,5 @@
  20652. +// Comment for array
  20653. +[
  20654. + // Comment within array
  20655. + "one-element"
  20656. +]
  20657. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.expected
  20658. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.expected 1970-01-01 02:00:00.000000000 +0200
  20659. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.expected 2017-12-03 19:05:22.000000000 +0300
  20660. @@ -0,0 +1,10 @@
  20661. +.={}
  20662. +// Comment for array
  20663. +.test=[]
  20664. +// Comment within array
  20665. +.test[0]={}
  20666. +.test[0].a="aaa"
  20667. +.test[1]={}
  20668. +.test[1].b="bbb"
  20669. +.test[2]={}
  20670. +.test[2].c="ccc"
  20671. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.json
  20672. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.json 1970-01-01 02:00:00.000000000 +0200
  20673. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_01.json 2017-12-03 19:05:22.000000000 +0300
  20674. @@ -0,0 +1,10 @@
  20675. +{
  20676. + "test":
  20677. + // Comment for array
  20678. + [
  20679. + // Comment within array
  20680. + { "a" : "aaa" }, // Comment for a
  20681. + { "b" : "bbb" }, // Comment for b
  20682. + { "c" : "ccc" } // Comment for c
  20683. + ]
  20684. +}
  20685. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.expected
  20686. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.expected 1970-01-01 02:00:00.000000000 +0200
  20687. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.expected 2017-12-03 19:05:22.000000000 +0300
  20688. @@ -0,0 +1,23 @@
  20689. +.={}
  20690. +/* C-style comment
  20691. +
  20692. + C-style-2 comment */
  20693. +.c-test={}
  20694. +.c-test.a=1
  20695. +/* Internal comment c-style */
  20696. +.c-test.b=2
  20697. +// C++-style comment
  20698. +.cpp-test={}
  20699. +// Multiline comment cpp-style
  20700. +// Second line
  20701. +.cpp-test.c=3
  20702. +// Comment before double
  20703. +.cpp-test.d=4.1
  20704. +// Comment before string
  20705. +.cpp-test.e="e-string"
  20706. +// Comment before true
  20707. +.cpp-test.f=true
  20708. +// Comment before false
  20709. +.cpp-test.g=false
  20710. +// Comment before null
  20711. +.cpp-test.h=null
  20712. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.json
  20713. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.json 1970-01-01 02:00:00.000000000 +0200
  20714. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_comment_02.json 2017-12-03 19:05:22.000000000 +0300
  20715. @@ -0,0 +1,26 @@
  20716. +{
  20717. + /* C-style comment
  20718. +
  20719. + C-style-2 comment */
  20720. + "c-test" : {
  20721. + "a" : 1,
  20722. + /* Internal comment c-style */
  20723. + "b" : 2
  20724. + },
  20725. + // C++-style comment
  20726. + "cpp-test" : {
  20727. + // Multiline comment cpp-style
  20728. + // Second line
  20729. + "c" : 3,
  20730. + // Comment before double
  20731. + "d" : 4.1,
  20732. + // Comment before string
  20733. + "e" : "e-string",
  20734. + // Comment before true
  20735. + "f" : true,
  20736. + // Comment before false
  20737. + "g" : false,
  20738. + // Comment before null
  20739. + "h" : null
  20740. + }
  20741. +}
  20742. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.expected
  20743. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.expected 1970-01-01 02:00:00.000000000 +0200
  20744. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.expected 2017-12-03 19:05:22.000000000 +0300
  20745. @@ -0,0 +1,20 @@
  20746. +.={}
  20747. +.attribute=[]
  20748. +.attribute[0]="random"
  20749. +.attribute[1]="short"
  20750. +.attribute[2]="bold"
  20751. +.attribute[3]=12
  20752. +.attribute[4]={}
  20753. +.attribute[4].height=7
  20754. +.attribute[4].width=64
  20755. +.count=1234
  20756. +.name={}
  20757. +.name.aka="T.E.S.T."
  20758. +.name.id=123987
  20759. +.test={}
  20760. +.test.1={}
  20761. +.test.1.2={}
  20762. +.test.1.2.3={}
  20763. +.test.1.2.3.coord=[]
  20764. +.test.1.2.3.coord[0]=1
  20765. +.test.1.2.3.coord[1]=2
  20766. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.json
  20767. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.json 1970-01-01 02:00:00.000000000 +0200
  20768. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_complex_01.json 2017-12-03 19:05:22.000000000 +0300
  20769. @@ -0,0 +1,17 @@
  20770. +{
  20771. + "count" : 1234,
  20772. + "name" : { "aka" : "T.E.S.T.", "id" : 123987 },
  20773. + "attribute" : [
  20774. + "random",
  20775. + "short",
  20776. + "bold",
  20777. + 12,
  20778. + { "height" : 7, "width" : 64 }
  20779. + ],
  20780. + "test": { "1" :
  20781. + { "2" :
  20782. + { "3" : { "coord" : [ 1,2] }
  20783. + }
  20784. + }
  20785. + }
  20786. +}
  20787. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.expected
  20788. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.expected 1970-01-01 02:00:00.000000000 +0200
  20789. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.expected 2017-12-03 19:05:22.000000000 +0300
  20790. @@ -0,0 +1,2 @@
  20791. +// Max signed integer
  20792. +.=2147483647
  20793. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.json
  20794. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.json 1970-01-01 02:00:00.000000000 +0200
  20795. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_01.json 2017-12-03 19:05:22.000000000 +0300
  20796. @@ -0,0 +1,2 @@
  20797. +// Max signed integer
  20798. +2147483647
  20799. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.expected
  20800. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.expected 1970-01-01 02:00:00.000000000 +0200
  20801. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.expected 2017-12-03 19:05:22.000000000 +0300
  20802. @@ -0,0 +1,2 @@
  20803. +// Min signed integer
  20804. +.=-2147483648
  20805. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.json
  20806. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.json 1970-01-01 02:00:00.000000000 +0200
  20807. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_02.json 2017-12-03 19:05:22.000000000 +0300
  20808. @@ -0,0 +1,2 @@
  20809. +// Min signed integer
  20810. +-2147483648
  20811. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.expected
  20812. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.expected 1970-01-01 02:00:00.000000000 +0200
  20813. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.expected 2017-12-03 19:05:22.000000000 +0300
  20814. @@ -0,0 +1,2 @@
  20815. +// Max unsigned integer
  20816. +.=4294967295
  20817. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.json
  20818. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.json 1970-01-01 02:00:00.000000000 +0200
  20819. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_03.json 2017-12-03 19:05:22.000000000 +0300
  20820. @@ -0,0 +1,2 @@
  20821. +// Max unsigned integer
  20822. +4294967295
  20823. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.expected
  20824. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.expected 1970-01-01 02:00:00.000000000 +0200
  20825. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.expected 2017-12-03 19:05:22.000000000 +0300
  20826. @@ -0,0 +1,3 @@
  20827. +// Min unsigned integer
  20828. +.=0
  20829. +
  20830. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.json
  20831. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.json 1970-01-01 02:00:00.000000000 +0200
  20832. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_04.json 2017-12-03 19:05:22.000000000 +0300
  20833. @@ -0,0 +1,3 @@
  20834. +// Min unsigned integer
  20835. +0
  20836. +
  20837. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.expected
  20838. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.expected 1970-01-01 02:00:00.000000000 +0200
  20839. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.expected 2017-12-03 19:05:22.000000000 +0300
  20840. @@ -0,0 +1,2 @@
  20841. +.=1
  20842. +
  20843. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.json
  20844. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.json 1970-01-01 02:00:00.000000000 +0200
  20845. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_05.json 2017-12-03 19:05:22.000000000 +0300
  20846. @@ -0,0 +1,2 @@
  20847. +1
  20848. +
  20849. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.expected
  20850. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.expected 1970-01-01 02:00:00.000000000 +0200
  20851. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.expected 2017-12-03 19:05:22.000000000 +0300
  20852. @@ -0,0 +1 @@
  20853. +.=9223372036854775808
  20854. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.json
  20855. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.json 1970-01-01 02:00:00.000000000 +0200
  20856. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_06_64bits.json 2017-12-03 19:05:22.000000000 +0300
  20857. @@ -0,0 +1,2 @@
  20858. +9223372036854775808
  20859. +
  20860. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.expected
  20861. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.expected 1970-01-01 02:00:00.000000000 +0200
  20862. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.expected 2017-12-03 19:05:22.000000000 +0300
  20863. @@ -0,0 +1 @@
  20864. +.=-9223372036854775808
  20865. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.json
  20866. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.json 1970-01-01 02:00:00.000000000 +0200
  20867. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_07_64bits.json 2017-12-03 19:05:22.000000000 +0300
  20868. @@ -0,0 +1,2 @@
  20869. +-9223372036854775808
  20870. +
  20871. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.expected
  20872. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.expected 1970-01-01 02:00:00.000000000 +0200
  20873. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.expected 2017-12-03 19:05:22.000000000 +0300
  20874. @@ -0,0 +1 @@
  20875. +.=18446744073709551615
  20876. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.json
  20877. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.json 1970-01-01 02:00:00.000000000 +0200
  20878. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_integer_08_64bits.json 2017-12-03 19:05:22.000000000 +0300
  20879. @@ -0,0 +1,2 @@
  20880. +18446744073709551615
  20881. +
  20882. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.expected
  20883. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.expected 1970-01-01 02:00:00.000000000 +0200
  20884. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.expected 2017-12-03 19:05:22.000000000 +0300
  20885. @@ -0,0 +1,2122 @@
  20886. +.=[]
  20887. +.[0]=[]
  20888. +.[0][0]="A"
  20889. +.[0][1]=0
  20890. +.[0][2]=1
  20891. +.[0][3]=2
  20892. +.[0][4]=3
  20893. +.[0][5]=4
  20894. +.[0][6]=5
  20895. +.[0][7]=6
  20896. +.[0][8]=7
  20897. +.[0][9]=8
  20898. +.[0][10]=9
  20899. +.[0][11]=10
  20900. +.[0][12]=11
  20901. +.[0][13]=12
  20902. +.[0][14]=13
  20903. +.[0][15]=14
  20904. +.[0][16]=15
  20905. +.[0][17]=16
  20906. +.[0][18]=17
  20907. +.[0][19]=18
  20908. +.[0][20]=19
  20909. +.[0][21]=20
  20910. +.[0][22]=21
  20911. +.[0][23]=22
  20912. +.[0][24]=23
  20913. +.[0][25]=24
  20914. +.[0][26]=25
  20915. +.[0][27]=26
  20916. +.[0][28]=27
  20917. +.[0][29]=28
  20918. +.[0][30]=29
  20919. +.[0][31]=30
  20920. +.[0][32]=31
  20921. +.[0][33]=32
  20922. +.[0][34]=33
  20923. +.[0][35]=34
  20924. +.[0][36]=35
  20925. +.[0][37]=36
  20926. +.[0][38]=37
  20927. +.[0][39]=38
  20928. +.[0][40]=39
  20929. +.[0][41]=40
  20930. +.[0][42]=41
  20931. +.[0][43]=42
  20932. +.[0][44]=43
  20933. +.[0][45]=44
  20934. +.[0][46]=45
  20935. +.[0][47]=46
  20936. +.[0][48]=47
  20937. +.[0][49]=48
  20938. +.[0][50]=49
  20939. +.[0][51]=50
  20940. +.[0][52]=51
  20941. +.[0][53]=52
  20942. +.[0][54]=53
  20943. +.[0][55]=54
  20944. +.[0][56]=55
  20945. +.[0][57]=56
  20946. +.[0][58]=57
  20947. +.[0][59]=58
  20948. +.[0][60]=59
  20949. +.[0][61]=60
  20950. +.[0][62]=61
  20951. +.[0][63]=62
  20952. +.[0][64]=63
  20953. +.[0][65]=64
  20954. +.[0][66]=65
  20955. +.[0][67]=66
  20956. +.[0][68]=67
  20957. +.[0][69]=68
  20958. +.[0][70]=69
  20959. +.[0][71]=70
  20960. +.[0][72]=71
  20961. +.[0][73]=72
  20962. +.[0][74]=73
  20963. +.[0][75]=74
  20964. +.[0][76]=75
  20965. +.[0][77]=76
  20966. +.[0][78]=77
  20967. +.[0][79]=78
  20968. +.[0][80]=79
  20969. +.[0][81]=80
  20970. +.[0][82]=81
  20971. +.[0][83]=82
  20972. +.[0][84]=83
  20973. +.[0][85]=84
  20974. +.[0][86]=85
  20975. +.[0][87]=86
  20976. +.[0][88]=87
  20977. +.[0][89]=88
  20978. +.[0][90]=89
  20979. +.[0][91]=90
  20980. +.[0][92]=91
  20981. +.[0][93]=92
  20982. +.[0][94]=93
  20983. +.[0][95]=94
  20984. +.[0][96]=95
  20985. +.[0][97]=96
  20986. +.[0][98]=97
  20987. +.[0][99]=98
  20988. +.[0][100]=99
  20989. +.[0][101]=100
  20990. +.[0][102]=101
  20991. +.[0][103]=102
  20992. +.[0][104]=103
  20993. +.[0][105]=104
  20994. +.[0][106]=105
  20995. +.[0][107]=106
  20996. +.[0][108]=107
  20997. +.[0][109]=108
  20998. +.[0][110]=109
  20999. +.[0][111]=110
  21000. +.[0][112]=111
  21001. +.[0][113]=112
  21002. +.[0][114]=113
  21003. +.[0][115]=114
  21004. +.[0][116]=115
  21005. +.[0][117]=116
  21006. +.[0][118]=117
  21007. +.[0][119]=118
  21008. +.[0][120]=119
  21009. +.[0][121]=120
  21010. +.[0][122]=121
  21011. +.[0][123]=122
  21012. +.[0][124]=123
  21013. +.[0][125]=124
  21014. +.[0][126]=125
  21015. +.[0][127]=126
  21016. +.[0][128]=127
  21017. +.[0][129]=128
  21018. +.[0][130]=129
  21019. +.[0][131]=130
  21020. +.[0][132]=131
  21021. +.[0][133]=132
  21022. +.[0][134]=133
  21023. +.[0][135]=134
  21024. +.[0][136]=135
  21025. +.[0][137]=136
  21026. +.[0][138]=137
  21027. +.[0][139]=138
  21028. +.[0][140]=139
  21029. +.[0][141]=140
  21030. +.[0][142]=141
  21031. +.[0][143]=142
  21032. +.[0][144]=143
  21033. +.[0][145]=144
  21034. +.[0][146]=145
  21035. +.[0][147]=146
  21036. +.[0][148]=147
  21037. +.[0][149]=148
  21038. +.[0][150]=149
  21039. +.[0][151]=150
  21040. +.[0][152]=151
  21041. +.[0][153]=152
  21042. +.[0][154]=153
  21043. +.[0][155]=154
  21044. +.[0][156]=155
  21045. +.[0][157]=156
  21046. +.[0][158]=157
  21047. +.[0][159]=158
  21048. +.[0][160]=159
  21049. +.[0][161]=160
  21050. +.[0][162]=161
  21051. +.[0][163]=162
  21052. +.[0][164]=163
  21053. +.[0][165]=164
  21054. +.[0][166]=165
  21055. +.[0][167]=166
  21056. +.[0][168]=167
  21057. +.[0][169]=168
  21058. +.[0][170]=169
  21059. +.[0][171]=170
  21060. +.[0][172]=171
  21061. +.[0][173]=172
  21062. +.[0][174]=173
  21063. +.[0][175]=174
  21064. +.[0][176]=175
  21065. +.[0][177]=176
  21066. +.[0][178]=177
  21067. +.[0][179]=178
  21068. +.[0][180]=179
  21069. +.[0][181]=180
  21070. +.[0][182]=181
  21071. +.[0][183]=182
  21072. +.[0][184]=183
  21073. +.[0][185]=184
  21074. +.[0][186]=185
  21075. +.[0][187]=186
  21076. +.[0][188]=187
  21077. +.[0][189]=188
  21078. +.[0][190]=189
  21079. +.[0][191]=190
  21080. +.[0][192]=191
  21081. +.[0][193]=192
  21082. +.[0][194]=193
  21083. +.[0][195]=194
  21084. +.[0][196]=195
  21085. +.[0][197]=196
  21086. +.[0][198]=197
  21087. +.[0][199]=198
  21088. +.[0][200]=199
  21089. +.[0][201]=200
  21090. +.[0][202]=201
  21091. +.[0][203]=202
  21092. +.[0][204]=203
  21093. +.[0][205]=204
  21094. +.[0][206]=205
  21095. +.[0][207]=206
  21096. +.[0][208]=207
  21097. +.[0][209]=208
  21098. +.[0][210]=209
  21099. +.[0][211]=210
  21100. +.[0][212]=211
  21101. +.[0][213]=212
  21102. +.[0][214]=213
  21103. +.[0][215]=214
  21104. +.[0][216]=215
  21105. +.[0][217]=216
  21106. +.[0][218]=217
  21107. +.[0][219]=218
  21108. +.[0][220]=219
  21109. +.[0][221]=220
  21110. +.[0][222]=221
  21111. +.[0][223]=222
  21112. +.[0][224]=223
  21113. +.[0][225]=224
  21114. +.[0][226]=225
  21115. +.[0][227]=226
  21116. +.[0][228]=227
  21117. +.[0][229]=228
  21118. +.[0][230]=229
  21119. +.[0][231]=230
  21120. +.[0][232]=231
  21121. +.[0][233]=232
  21122. +.[0][234]=233
  21123. +.[0][235]=234
  21124. +.[0][236]=235
  21125. +.[0][237]=236
  21126. +.[0][238]=237
  21127. +.[0][239]=238
  21128. +.[0][240]=239
  21129. +.[0][241]=240
  21130. +.[0][242]=241
  21131. +.[0][243]=242
  21132. +.[0][244]=243
  21133. +.[0][245]=244
  21134. +.[0][246]=245
  21135. +.[0][247]=246
  21136. +.[0][248]=247
  21137. +.[0][249]=248
  21138. +.[0][250]=249
  21139. +.[0][251]=250
  21140. +.[0][252]=251
  21141. +.[0][253]=252
  21142. +.[0][254]=253
  21143. +.[0][255]=254
  21144. +.[0][256]=255
  21145. +.[0][257]=256
  21146. +.[0][258]=257
  21147. +.[0][259]=258
  21148. +.[0][260]=259
  21149. +.[0][261]=260
  21150. +.[0][262]=261
  21151. +.[0][263]=262
  21152. +.[0][264]=263
  21153. +.[0][265]=264
  21154. +.[0][266]=265
  21155. +.[0][267]=266
  21156. +.[0][268]=267
  21157. +.[0][269]=268
  21158. +.[0][270]=269
  21159. +.[0][271]=270
  21160. +.[0][272]=271
  21161. +.[0][273]=272
  21162. +.[0][274]=273
  21163. +.[0][275]=274
  21164. +.[0][276]=275
  21165. +.[0][277]=276
  21166. +.[0][278]=277
  21167. +.[0][279]=278
  21168. +.[0][280]=279
  21169. +.[0][281]=280
  21170. +.[0][282]=281
  21171. +.[0][283]=282
  21172. +.[0][284]=283
  21173. +.[0][285]=284
  21174. +.[0][286]=285
  21175. +.[0][287]=286
  21176. +.[0][288]=287
  21177. +.[0][289]=288
  21178. +.[0][290]=289
  21179. +.[0][291]=290
  21180. +.[0][292]=291
  21181. +.[0][293]=292
  21182. +.[0][294]=293
  21183. +.[0][295]=294
  21184. +.[0][296]=295
  21185. +.[0][297]=296
  21186. +.[0][298]=297
  21187. +.[0][299]=298
  21188. +.[0][300]=299
  21189. +.[0][301]=300
  21190. +.[0][302]=301
  21191. +.[0][303]=302
  21192. +.[0][304]=303
  21193. +.[0][305]=304
  21194. +.[0][306]=305
  21195. +.[0][307]=306
  21196. +.[0][308]=307
  21197. +.[0][309]=308
  21198. +.[0][310]=309
  21199. +.[0][311]=310
  21200. +.[0][312]=311
  21201. +.[0][313]=312
  21202. +.[0][314]=313
  21203. +.[0][315]=314
  21204. +.[0][316]=315
  21205. +.[0][317]=316
  21206. +.[0][318]=317
  21207. +.[0][319]=318
  21208. +.[0][320]=319
  21209. +.[0][321]=320
  21210. +.[0][322]=321
  21211. +.[0][323]=322
  21212. +.[0][324]=323
  21213. +.[0][325]=324
  21214. +.[0][326]=325
  21215. +.[0][327]=326
  21216. +.[0][328]=327
  21217. +.[0][329]=328
  21218. +.[0][330]=329
  21219. +.[0][331]=330
  21220. +.[0][332]=331
  21221. +.[0][333]=332
  21222. +.[0][334]=333
  21223. +.[0][335]=334
  21224. +.[0][336]=335
  21225. +.[0][337]=336
  21226. +.[0][338]=337
  21227. +.[0][339]=338
  21228. +.[0][340]=339
  21229. +.[0][341]=340
  21230. +.[0][342]=341
  21231. +.[0][343]=342
  21232. +.[0][344]=343
  21233. +.[0][345]=344
  21234. +.[0][346]=345
  21235. +.[0][347]=346
  21236. +.[0][348]=347
  21237. +.[0][349]=348
  21238. +.[0][350]=349
  21239. +.[0][351]=350
  21240. +.[0][352]=351
  21241. +.[0][353]=352
  21242. +.[0][354]=353
  21243. +.[0][355]=354
  21244. +.[0][356]=355
  21245. +.[0][357]=356
  21246. +.[0][358]=357
  21247. +.[0][359]=358
  21248. +.[0][360]=359
  21249. +.[0][361]=360
  21250. +.[0][362]=361
  21251. +.[0][363]=362
  21252. +.[0][364]=363
  21253. +.[0][365]=364
  21254. +.[0][366]=365
  21255. +.[0][367]=366
  21256. +.[0][368]=367
  21257. +.[0][369]=368
  21258. +.[0][370]=369
  21259. +.[0][371]=370
  21260. +.[0][372]=371
  21261. +.[0][373]=372
  21262. +.[0][374]=373
  21263. +.[0][375]=374
  21264. +.[0][376]=375
  21265. +.[0][377]=376
  21266. +.[0][378]=377
  21267. +.[0][379]=378
  21268. +.[0][380]=379
  21269. +.[0][381]=380
  21270. +.[0][382]=381
  21271. +.[0][383]=382
  21272. +.[0][384]=383
  21273. +.[0][385]=384
  21274. +.[0][386]=385
  21275. +.[0][387]=386
  21276. +.[0][388]=387
  21277. +.[0][389]=388
  21278. +.[0][390]=389
  21279. +.[0][391]=390
  21280. +.[0][392]=391
  21281. +.[0][393]=392
  21282. +.[0][394]=393
  21283. +.[0][395]=394
  21284. +.[0][396]=395
  21285. +.[0][397]=396
  21286. +.[0][398]=397
  21287. +.[0][399]=398
  21288. +.[0][400]=399
  21289. +.[0][401]=400
  21290. +.[0][402]=401
  21291. +.[0][403]=402
  21292. +.[0][404]=403
  21293. +.[0][405]=404
  21294. +.[0][406]=405
  21295. +.[0][407]=406
  21296. +.[0][408]=407
  21297. +.[0][409]=408
  21298. +.[0][410]=409
  21299. +.[0][411]=410
  21300. +.[0][412]=411
  21301. +.[0][413]=412
  21302. +.[0][414]=413
  21303. +.[0][415]=414
  21304. +.[0][416]=415
  21305. +.[0][417]=416
  21306. +.[0][418]=417
  21307. +.[0][419]=418
  21308. +.[0][420]=419
  21309. +.[0][421]=420
  21310. +.[0][422]=421
  21311. +.[0][423]=422
  21312. +.[0][424]=423
  21313. +.[0][425]=424
  21314. +.[0][426]=425
  21315. +.[0][427]=426
  21316. +.[0][428]=427
  21317. +.[0][429]=428
  21318. +.[0][430]=429
  21319. +.[0][431]=430
  21320. +.[0][432]=431
  21321. +.[0][433]=432
  21322. +.[0][434]=433
  21323. +.[0][435]=434
  21324. +.[0][436]=435
  21325. +.[0][437]=436
  21326. +.[0][438]=437
  21327. +.[0][439]=438
  21328. +.[0][440]=439
  21329. +.[0][441]=440
  21330. +.[0][442]=441
  21331. +.[0][443]=442
  21332. +.[0][444]=443
  21333. +.[0][445]=444
  21334. +.[0][446]=445
  21335. +.[0][447]=446
  21336. +.[0][448]=447
  21337. +.[0][449]=448
  21338. +.[0][450]=449
  21339. +.[0][451]=450
  21340. +.[0][452]=451
  21341. +.[0][453]=452
  21342. +.[0][454]=453
  21343. +.[0][455]=454
  21344. +.[0][456]=455
  21345. +.[0][457]=456
  21346. +.[0][458]=457
  21347. +.[0][459]=458
  21348. +.[0][460]=459
  21349. +.[0][461]=460
  21350. +.[0][462]=461
  21351. +.[0][463]=462
  21352. +.[0][464]=463
  21353. +.[0][465]=464
  21354. +.[0][466]=465
  21355. +.[0][467]=466
  21356. +.[0][468]=467
  21357. +.[0][469]=468
  21358. +.[0][470]=469
  21359. +.[0][471]=470
  21360. +.[0][472]=471
  21361. +.[0][473]=472
  21362. +.[0][474]=473
  21363. +.[0][475]=474
  21364. +.[0][476]=475
  21365. +.[0][477]=476
  21366. +.[0][478]=477
  21367. +.[0][479]=478
  21368. +.[0][480]=479
  21369. +.[0][481]=480
  21370. +.[0][482]=481
  21371. +.[0][483]=482
  21372. +.[0][484]=483
  21373. +.[0][485]=484
  21374. +.[0][486]=485
  21375. +.[0][487]=486
  21376. +.[0][488]=487
  21377. +.[0][489]=488
  21378. +.[0][490]=489
  21379. +.[0][491]=490
  21380. +.[0][492]=491
  21381. +.[0][493]=492
  21382. +.[0][494]=493
  21383. +.[0][495]=494
  21384. +.[0][496]=495
  21385. +.[0][497]=496
  21386. +.[0][498]=497
  21387. +.[0][499]=498
  21388. +.[0][500]=499
  21389. +.[0][501]=500
  21390. +.[0][502]=501
  21391. +.[0][503]=502
  21392. +.[0][504]=503
  21393. +.[0][505]=504
  21394. +.[0][506]=505
  21395. +.[0][507]=506
  21396. +.[0][508]=507
  21397. +.[0][509]=508
  21398. +.[0][510]=509
  21399. +.[0][511]=510
  21400. +.[0][512]=511
  21401. +.[0][513]=512
  21402. +.[0][514]=513
  21403. +.[0][515]=514
  21404. +.[0][516]=515
  21405. +.[0][517]=516
  21406. +.[0][518]=517
  21407. +.[0][519]=518
  21408. +.[0][520]=519
  21409. +.[0][521]=520
  21410. +.[0][522]=521
  21411. +.[0][523]=522
  21412. +.[0][524]=523
  21413. +.[0][525]=524
  21414. +.[0][526]=525
  21415. +.[0][527]=526
  21416. +.[0][528]=527
  21417. +.[0][529]=528
  21418. +.[0][530]=529
  21419. +.[0][531]=530
  21420. +.[0][532]=531
  21421. +.[0][533]=532
  21422. +.[0][534]=533
  21423. +.[0][535]=534
  21424. +.[0][536]=535
  21425. +.[0][537]=536
  21426. +.[0][538]=537
  21427. +.[0][539]=538
  21428. +.[0][540]=539
  21429. +.[0][541]=540
  21430. +.[0][542]=541
  21431. +.[0][543]=542
  21432. +.[0][544]=543
  21433. +.[0][545]=544
  21434. +.[0][546]=545
  21435. +.[0][547]=546
  21436. +.[0][548]=547
  21437. +.[0][549]=548
  21438. +.[0][550]=549
  21439. +.[0][551]=550
  21440. +.[0][552]=551
  21441. +.[0][553]=552
  21442. +.[0][554]=553
  21443. +.[0][555]=554
  21444. +.[0][556]=555
  21445. +.[0][557]=556
  21446. +.[0][558]=557
  21447. +.[0][559]=558
  21448. +.[0][560]=559
  21449. +.[0][561]=560
  21450. +.[0][562]=561
  21451. +.[0][563]=562
  21452. +.[0][564]=563
  21453. +.[0][565]=564
  21454. +.[0][566]=565
  21455. +.[0][567]=566
  21456. +.[0][568]=567
  21457. +.[0][569]=568
  21458. +.[0][570]=569
  21459. +.[0][571]=570
  21460. +.[0][572]=571
  21461. +.[0][573]=572
  21462. +.[0][574]=573
  21463. +.[0][575]=574
  21464. +.[0][576]=575
  21465. +.[0][577]=576
  21466. +.[0][578]=577
  21467. +.[0][579]=578
  21468. +.[0][580]=579
  21469. +.[0][581]=580
  21470. +.[0][582]=581
  21471. +.[0][583]=582
  21472. +.[0][584]=583
  21473. +.[0][585]=584
  21474. +.[0][586]=585
  21475. +.[0][587]=586
  21476. +.[0][588]=587
  21477. +.[0][589]=588
  21478. +.[0][590]=589
  21479. +.[0][591]=590
  21480. +.[0][592]=591
  21481. +.[0][593]=592
  21482. +.[0][594]=593
  21483. +.[0][595]=594
  21484. +.[0][596]=595
  21485. +.[0][597]=596
  21486. +.[0][598]=597
  21487. +.[0][599]=598
  21488. +.[0][600]=599
  21489. +.[0][601]=600
  21490. +.[0][602]=601
  21491. +.[0][603]=602
  21492. +.[0][604]=603
  21493. +.[0][605]=604
  21494. +.[0][606]=605
  21495. +.[0][607]=606
  21496. +.[0][608]=607
  21497. +.[0][609]=608
  21498. +.[0][610]=609
  21499. +.[0][611]=610
  21500. +.[0][612]=611
  21501. +.[0][613]=612
  21502. +.[0][614]=613
  21503. +.[0][615]=614
  21504. +.[0][616]=615
  21505. +.[0][617]=616
  21506. +.[0][618]=617
  21507. +.[0][619]=618
  21508. +.[0][620]=619
  21509. +.[0][621]=620
  21510. +.[0][622]=621
  21511. +.[0][623]=622
  21512. +.[0][624]=623
  21513. +.[0][625]=624
  21514. +.[0][626]=625
  21515. +.[0][627]=626
  21516. +.[0][628]=627
  21517. +.[0][629]=628
  21518. +.[0][630]=629
  21519. +.[0][631]=630
  21520. +.[0][632]=631
  21521. +.[0][633]=632
  21522. +.[0][634]=633
  21523. +.[0][635]=634
  21524. +.[0][636]=635
  21525. +.[0][637]=636
  21526. +.[0][638]=637
  21527. +.[0][639]=638
  21528. +.[0][640]=639
  21529. +.[0][641]=640
  21530. +.[0][642]=641
  21531. +.[0][643]=642
  21532. +.[0][644]=643
  21533. +.[0][645]=644
  21534. +.[0][646]=645
  21535. +.[0][647]=646
  21536. +.[0][648]=647
  21537. +.[0][649]=648
  21538. +.[0][650]=649
  21539. +.[0][651]=650
  21540. +.[0][652]=651
  21541. +.[0][653]=652
  21542. +.[0][654]=653
  21543. +.[0][655]=654
  21544. +.[0][656]=655
  21545. +.[0][657]=656
  21546. +.[0][658]=657
  21547. +.[0][659]=658
  21548. +.[0][660]=659
  21549. +.[0][661]=660
  21550. +.[0][662]=661
  21551. +.[0][663]=662
  21552. +.[0][664]=663
  21553. +.[0][665]=664
  21554. +.[0][666]=665
  21555. +.[0][667]=666
  21556. +.[0][668]=667
  21557. +.[0][669]=668
  21558. +.[0][670]=669
  21559. +.[0][671]=670
  21560. +.[0][672]=671
  21561. +.[0][673]=672
  21562. +.[0][674]=673
  21563. +.[0][675]=674
  21564. +.[0][676]=675
  21565. +.[0][677]=676
  21566. +.[0][678]=677
  21567. +.[0][679]=678
  21568. +.[0][680]=679
  21569. +.[0][681]=680
  21570. +.[0][682]=681
  21571. +.[0][683]=682
  21572. +.[0][684]=683
  21573. +.[0][685]=684
  21574. +.[0][686]=685
  21575. +.[0][687]=686
  21576. +.[0][688]=687
  21577. +.[0][689]=688
  21578. +.[0][690]=689
  21579. +.[0][691]=690
  21580. +.[0][692]=691
  21581. +.[0][693]=692
  21582. +.[0][694]=693
  21583. +.[0][695]=694
  21584. +.[0][696]=695
  21585. +.[0][697]=696
  21586. +.[0][698]=697
  21587. +.[0][699]=698
  21588. +.[0][700]=699
  21589. +.[0][701]=700
  21590. +.[0][702]=701
  21591. +.[0][703]=702
  21592. +.[0][704]=703
  21593. +.[0][705]=704
  21594. +.[0][706]=705
  21595. +.[0][707]=706
  21596. +.[0][708]=707
  21597. +.[0][709]=708
  21598. +.[0][710]=709
  21599. +.[0][711]=710
  21600. +.[0][712]=711
  21601. +.[0][713]=712
  21602. +.[0][714]=713
  21603. +.[0][715]=714
  21604. +.[0][716]=715
  21605. +.[0][717]=716
  21606. +.[0][718]=717
  21607. +.[0][719]=718
  21608. +.[0][720]=719
  21609. +.[0][721]=720
  21610. +.[0][722]=721
  21611. +.[0][723]=722
  21612. +.[0][724]=723
  21613. +.[0][725]=724
  21614. +.[0][726]=725
  21615. +.[0][727]=726
  21616. +.[0][728]=727
  21617. +.[0][729]=728
  21618. +.[0][730]=729
  21619. +.[0][731]=730
  21620. +.[0][732]=731
  21621. +.[0][733]=732
  21622. +.[0][734]=733
  21623. +.[0][735]=734
  21624. +.[0][736]=735
  21625. +.[0][737]=736
  21626. +.[0][738]=737
  21627. +.[0][739]=738
  21628. +.[0][740]=739
  21629. +.[0][741]=740
  21630. +.[0][742]=741
  21631. +.[0][743]=742
  21632. +.[0][744]=743
  21633. +.[0][745]=744
  21634. +.[0][746]=745
  21635. +.[0][747]=746
  21636. +.[0][748]=747
  21637. +.[0][749]=748
  21638. +.[0][750]=749
  21639. +.[0][751]=750
  21640. +.[0][752]=751
  21641. +.[0][753]=752
  21642. +.[0][754]=753
  21643. +.[0][755]=754
  21644. +.[0][756]=755
  21645. +.[0][757]=756
  21646. +.[0][758]=757
  21647. +.[0][759]=758
  21648. +.[0][760]=759
  21649. +.[0][761]=760
  21650. +.[0][762]=761
  21651. +.[0][763]=762
  21652. +.[0][764]=763
  21653. +.[0][765]=764
  21654. +.[0][766]=765
  21655. +.[0][767]=766
  21656. +.[0][768]=767
  21657. +.[0][769]=768
  21658. +.[0][770]=769
  21659. +.[0][771]=770
  21660. +.[0][772]=771
  21661. +.[0][773]=772
  21662. +.[0][774]=773
  21663. +.[0][775]=774
  21664. +.[0][776]=775
  21665. +.[0][777]=776
  21666. +.[0][778]=777
  21667. +.[0][779]=778
  21668. +.[0][780]=779
  21669. +.[0][781]=780
  21670. +.[0][782]=781
  21671. +.[0][783]=782
  21672. +.[0][784]=783
  21673. +.[0][785]=784
  21674. +.[0][786]=785
  21675. +.[0][787]=786
  21676. +.[0][788]=787
  21677. +.[0][789]=788
  21678. +.[0][790]=789
  21679. +.[0][791]=790
  21680. +.[0][792]=791
  21681. +.[0][793]=792
  21682. +.[0][794]=793
  21683. +.[0][795]=794
  21684. +.[0][796]=795
  21685. +.[0][797]=796
  21686. +.[0][798]=797
  21687. +.[0][799]=798
  21688. +.[0][800]=799
  21689. +.[0][801]=800
  21690. +.[0][802]=801
  21691. +.[0][803]=802
  21692. +.[0][804]=803
  21693. +.[0][805]=804
  21694. +.[0][806]=805
  21695. +.[0][807]=806
  21696. +.[0][808]=807
  21697. +.[0][809]=808
  21698. +.[0][810]=809
  21699. +.[0][811]=810
  21700. +.[0][812]=811
  21701. +.[0][813]=812
  21702. +.[0][814]=813
  21703. +.[0][815]=814
  21704. +.[0][816]=815
  21705. +.[0][817]=816
  21706. +.[0][818]=817
  21707. +.[0][819]=818
  21708. +.[0][820]=819
  21709. +.[0][821]=820
  21710. +.[0][822]=821
  21711. +.[0][823]=822
  21712. +.[0][824]=823
  21713. +.[0][825]=824
  21714. +.[0][826]=825
  21715. +.[0][827]=826
  21716. +.[0][828]=827
  21717. +.[0][829]=828
  21718. +.[0][830]=829
  21719. +.[0][831]=830
  21720. +.[0][832]=831
  21721. +.[0][833]=832
  21722. +.[0][834]=833
  21723. +.[0][835]=834
  21724. +.[0][836]=835
  21725. +.[0][837]=836
  21726. +.[0][838]=837
  21727. +.[0][839]=838
  21728. +.[0][840]=839
  21729. +.[0][841]=840
  21730. +.[0][842]=841
  21731. +.[0][843]=842
  21732. +.[0][844]=843
  21733. +.[0][845]=844
  21734. +.[0][846]=845
  21735. +.[0][847]=846
  21736. +.[0][848]=847
  21737. +.[0][849]=848
  21738. +.[0][850]=849
  21739. +.[0][851]=850
  21740. +.[0][852]=851
  21741. +.[0][853]=852
  21742. +.[0][854]=853
  21743. +.[0][855]=854
  21744. +.[0][856]=855
  21745. +.[0][857]=856
  21746. +.[0][858]=857
  21747. +.[0][859]=858
  21748. +.[0][860]=859
  21749. +.[0][861]=860
  21750. +.[0][862]=861
  21751. +.[0][863]=862
  21752. +.[0][864]=863
  21753. +.[0][865]=864
  21754. +.[0][866]=865
  21755. +.[0][867]=866
  21756. +.[0][868]=867
  21757. +.[0][869]=868
  21758. +.[0][870]=869
  21759. +.[0][871]=870
  21760. +.[0][872]=871
  21761. +.[0][873]=872
  21762. +.[0][874]=873
  21763. +.[0][875]=874
  21764. +.[0][876]=875
  21765. +.[0][877]=876
  21766. +.[0][878]=877
  21767. +.[0][879]=878
  21768. +.[0][880]=879
  21769. +.[0][881]=880
  21770. +.[0][882]=881
  21771. +.[0][883]=882
  21772. +.[0][884]=883
  21773. +.[0][885]=884
  21774. +.[0][886]=885
  21775. +.[0][887]=886
  21776. +.[0][888]=887
  21777. +.[0][889]=888
  21778. +.[0][890]=889
  21779. +.[0][891]=890
  21780. +.[0][892]=891
  21781. +.[0][893]=892
  21782. +.[0][894]=893
  21783. +.[0][895]=894
  21784. +.[0][896]=895
  21785. +.[0][897]=896
  21786. +.[0][898]=897
  21787. +.[0][899]=898
  21788. +.[0][900]=899
  21789. +.[0][901]=900
  21790. +.[0][902]=901
  21791. +.[0][903]=902
  21792. +.[0][904]=903
  21793. +.[0][905]=904
  21794. +.[0][906]=905
  21795. +.[0][907]=906
  21796. +.[0][908]=907
  21797. +.[0][909]=908
  21798. +.[0][910]=909
  21799. +.[0][911]=910
  21800. +.[0][912]=911
  21801. +.[0][913]=912
  21802. +.[0][914]=913
  21803. +.[0][915]=914
  21804. +.[0][916]=915
  21805. +.[0][917]=916
  21806. +.[0][918]=917
  21807. +.[0][919]=918
  21808. +.[0][920]=919
  21809. +.[0][921]=920
  21810. +.[0][922]=921
  21811. +.[0][923]=922
  21812. +.[0][924]=923
  21813. +.[0][925]=924
  21814. +.[0][926]=925
  21815. +.[0][927]=926
  21816. +.[0][928]=927
  21817. +.[0][929]=928
  21818. +.[0][930]=929
  21819. +.[0][931]=930
  21820. +.[0][932]=931
  21821. +.[0][933]=932
  21822. +.[0][934]=933
  21823. +.[0][935]=934
  21824. +.[0][936]=935
  21825. +.[0][937]=936
  21826. +.[0][938]=937
  21827. +.[0][939]=938
  21828. +.[0][940]=939
  21829. +.[0][941]=940
  21830. +.[0][942]=941
  21831. +.[0][943]=942
  21832. +.[0][944]=943
  21833. +.[0][945]=944
  21834. +.[0][946]=945
  21835. +.[0][947]=946
  21836. +.[0][948]=947
  21837. +.[0][949]=948
  21838. +.[0][950]=949
  21839. +.[0][951]=950
  21840. +.[0][952]=951
  21841. +.[0][953]=952
  21842. +.[0][954]=953
  21843. +.[0][955]=954
  21844. +.[0][956]=955
  21845. +.[0][957]=956
  21846. +.[0][958]=957
  21847. +.[0][959]=958
  21848. +.[0][960]=959
  21849. +.[0][961]=960
  21850. +.[0][962]=961
  21851. +.[0][963]=962
  21852. +.[0][964]=963
  21853. +.[0][965]=964
  21854. +.[0][966]=965
  21855. +.[0][967]=966
  21856. +.[0][968]=967
  21857. +.[0][969]=968
  21858. +.[0][970]=969
  21859. +.[0][971]=970
  21860. +.[0][972]=971
  21861. +.[0][973]=972
  21862. +.[0][974]=973
  21863. +.[0][975]=974
  21864. +.[0][976]=975
  21865. +.[0][977]=976
  21866. +.[0][978]=977
  21867. +.[0][979]=978
  21868. +.[0][980]=979
  21869. +.[0][981]=980
  21870. +.[0][982]=981
  21871. +.[0][983]=982
  21872. +.[0][984]=983
  21873. +.[0][985]=984
  21874. +.[0][986]=985
  21875. +.[0][987]=986
  21876. +.[0][988]=987
  21877. +.[0][989]=988
  21878. +.[0][990]=989
  21879. +.[0][991]=990
  21880. +.[0][992]=991
  21881. +.[0][993]=992
  21882. +.[0][994]=993
  21883. +.[0][995]=994
  21884. +.[0][996]=995
  21885. +.[0][997]=996
  21886. +.[0][998]=997
  21887. +.[0][999]=998
  21888. +.[0][1000]=999
  21889. +.[0][1001]=1000
  21890. +.[0][1002]=1001
  21891. +.[0][1003]=1002
  21892. +.[0][1004]=1003
  21893. +.[0][1005]=1004
  21894. +.[0][1006]=1005
  21895. +.[0][1007]=1006
  21896. +.[0][1008]=1007
  21897. +.[0][1009]=1008
  21898. +.[0][1010]=1009
  21899. +.[0][1011]=1010
  21900. +.[0][1012]=1011
  21901. +.[0][1013]=1012
  21902. +.[0][1014]=1013
  21903. +.[0][1015]=1014
  21904. +.[0][1016]=1015
  21905. +.[0][1017]=1016
  21906. +.[0][1018]=1017
  21907. +.[0][1019]=1018
  21908. +.[0][1020]=1019
  21909. +.[0][1021]=1020
  21910. +.[0][1022]=1021
  21911. +.[0][1023]=1022
  21912. +.[0][1024]=1023
  21913. +.[0][1025]=1024
  21914. +.[0][1026]=1025
  21915. +.[0][1027]=1026
  21916. +.[0][1028]=1027
  21917. +.[0][1029]=1028
  21918. +.[0][1030]=1029
  21919. +.[0][1031]=1030
  21920. +.[0][1032]=1031
  21921. +.[0][1033]=1032
  21922. +.[0][1034]=1033
  21923. +.[0][1035]=1034
  21924. +.[0][1036]=1035
  21925. +.[0][1037]=1036
  21926. +.[0][1038]=1037
  21927. +.[0][1039]=1038
  21928. +.[0][1040]=1039
  21929. +.[0][1041]=1040
  21930. +.[0][1042]=1041
  21931. +.[0][1043]=1042
  21932. +.[0][1044]=1043
  21933. +.[0][1045]=1044
  21934. +.[0][1046]=1045
  21935. +.[0][1047]=1046
  21936. +.[0][1048]=1047
  21937. +.[0][1049]=1048
  21938. +.[0][1050]=1049
  21939. +.[0][1051]=1050
  21940. +.[0][1052]=1051
  21941. +.[0][1053]=1052
  21942. +.[0][1054]=1053
  21943. +.[0][1055]=1054
  21944. +.[0][1056]=1055
  21945. +.[0][1057]=1056
  21946. +.[0][1058]=1057
  21947. +.[0][1059]=1058
  21948. +.[0][1060]=1059
  21949. +.[0][1061]=1060
  21950. +.[0][1062]=1061
  21951. +.[0][1063]=1062
  21952. +.[0][1064]=1063
  21953. +.[0][1065]=1064
  21954. +.[0][1066]=1065
  21955. +.[0][1067]=1066
  21956. +.[0][1068]=1067
  21957. +.[0][1069]=1068
  21958. +.[0][1070]=1069
  21959. +.[0][1071]=1070
  21960. +.[0][1072]=1071
  21961. +.[0][1073]=1072
  21962. +.[0][1074]=1073
  21963. +.[0][1075]=1074
  21964. +.[0][1076]=1075
  21965. +.[0][1077]=1076
  21966. +.[0][1078]=1077
  21967. +.[0][1079]=1078
  21968. +.[0][1080]=1079
  21969. +.[0][1081]=1080
  21970. +.[0][1082]=1081
  21971. +.[0][1083]=1082
  21972. +.[0][1084]=1083
  21973. +.[0][1085]=1084
  21974. +.[0][1086]=1085
  21975. +.[0][1087]=1086
  21976. +.[0][1088]=1087
  21977. +.[0][1089]=1088
  21978. +.[0][1090]=1089
  21979. +.[0][1091]=1090
  21980. +.[0][1092]=1091
  21981. +.[0][1093]=1092
  21982. +.[0][1094]=1093
  21983. +.[0][1095]=1094
  21984. +.[0][1096]=1095
  21985. +.[0][1097]=1096
  21986. +.[0][1098]=1097
  21987. +.[0][1099]=1098
  21988. +.[0][1100]=1099
  21989. +.[0][1101]=1100
  21990. +.[0][1102]=1101
  21991. +.[0][1103]=1102
  21992. +.[0][1104]=1103
  21993. +.[0][1105]=1104
  21994. +.[0][1106]=1105
  21995. +.[0][1107]=1106
  21996. +.[0][1108]=1107
  21997. +.[0][1109]=1108
  21998. +.[0][1110]=1109
  21999. +.[0][1111]=1110
  22000. +.[0][1112]=1111
  22001. +.[0][1113]=1112
  22002. +.[0][1114]=1113
  22003. +.[0][1115]=1114
  22004. +.[0][1116]=1115
  22005. +.[0][1117]=1116
  22006. +.[0][1118]=1117
  22007. +.[0][1119]=1118
  22008. +.[0][1120]=1119
  22009. +.[0][1121]=1120
  22010. +.[0][1122]=1121
  22011. +.[0][1123]=1122
  22012. +.[0][1124]=1123
  22013. +.[0][1125]=1124
  22014. +.[0][1126]=1125
  22015. +.[0][1127]=1126
  22016. +.[0][1128]=1127
  22017. +.[0][1129]=1128
  22018. +.[0][1130]=1129
  22019. +.[0][1131]=1130
  22020. +.[0][1132]=1131
  22021. +.[0][1133]=1132
  22022. +.[0][1134]=1133
  22023. +.[0][1135]=1134
  22024. +.[0][1136]=1135
  22025. +.[0][1137]=1136
  22026. +.[0][1138]=1137
  22027. +.[0][1139]=1138
  22028. +.[0][1140]=1139
  22029. +.[0][1141]=1140
  22030. +.[0][1142]=1141
  22031. +.[0][1143]=1142
  22032. +.[0][1144]=1143
  22033. +.[0][1145]=1144
  22034. +.[0][1146]=1145
  22035. +.[0][1147]=1146
  22036. +.[0][1148]=1147
  22037. +.[0][1149]=1148
  22038. +.[0][1150]=1149
  22039. +.[0][1151]=1150
  22040. +.[0][1152]=1151
  22041. +.[0][1153]=1152
  22042. +.[0][1154]=1153
  22043. +.[0][1155]=1154
  22044. +.[0][1156]=1155
  22045. +.[0][1157]=1156
  22046. +.[0][1158]=1157
  22047. +.[0][1159]=1158
  22048. +.[0][1160]=1159
  22049. +.[0][1161]=1160
  22050. +.[0][1162]=1161
  22051. +.[0][1163]=1162
  22052. +.[0][1164]=1163
  22053. +.[0][1165]=1164
  22054. +.[0][1166]=1165
  22055. +.[0][1167]=1166
  22056. +.[0][1168]=1167
  22057. +.[0][1169]=1168
  22058. +.[0][1170]=1169
  22059. +.[0][1171]=1170
  22060. +.[0][1172]=1171
  22061. +.[0][1173]=1172
  22062. +.[0][1174]=1173
  22063. +.[0][1175]=1174
  22064. +.[0][1176]=1175
  22065. +.[0][1177]=1176
  22066. +.[0][1178]=1177
  22067. +.[0][1179]=1178
  22068. +.[0][1180]=1179
  22069. +.[0][1181]=1180
  22070. +.[0][1182]=1181
  22071. +.[0][1183]=1182
  22072. +.[0][1184]=1183
  22073. +.[0][1185]=1184
  22074. +.[0][1186]=1185
  22075. +.[0][1187]=1186
  22076. +.[0][1188]=1187
  22077. +.[0][1189]=1188
  22078. +.[0][1190]=1189
  22079. +.[0][1191]=1190
  22080. +.[0][1192]=1191
  22081. +.[0][1193]=1192
  22082. +.[0][1194]=1193
  22083. +.[0][1195]=1194
  22084. +.[0][1196]=1195
  22085. +.[0][1197]=1196
  22086. +.[0][1198]=1197
  22087. +.[0][1199]=1198
  22088. +.[0][1200]=1199
  22089. +.[0][1201]=1200
  22090. +.[0][1202]=1201
  22091. +.[0][1203]=1202
  22092. +.[0][1204]=1203
  22093. +.[0][1205]=1204
  22094. +.[0][1206]=1205
  22095. +.[0][1207]=1206
  22096. +.[0][1208]=1207
  22097. +.[0][1209]=1208
  22098. +.[0][1210]=1209
  22099. +.[0][1211]=1210
  22100. +.[0][1212]=1211
  22101. +.[0][1213]=1212
  22102. +.[0][1214]=1213
  22103. +.[0][1215]=1214
  22104. +.[0][1216]=1215
  22105. +.[0][1217]=1216
  22106. +.[0][1218]=1217
  22107. +.[0][1219]=1218
  22108. +.[0][1220]=1219
  22109. +.[0][1221]=1220
  22110. +.[0][1222]=1221
  22111. +.[0][1223]=1222
  22112. +.[0][1224]=1223
  22113. +.[0][1225]=1224
  22114. +.[0][1226]=1225
  22115. +.[0][1227]=1226
  22116. +.[0][1228]=1227
  22117. +.[0][1229]=1228
  22118. +.[0][1230]=1229
  22119. +.[0][1231]=1230
  22120. +.[0][1232]=1231
  22121. +.[0][1233]=1232
  22122. +.[0][1234]=1233
  22123. +.[0][1235]=1234
  22124. +.[0][1236]=1235
  22125. +.[0][1237]=1236
  22126. +.[0][1238]=1237
  22127. +.[0][1239]=1238
  22128. +.[0][1240]=1239
  22129. +.[0][1241]=1240
  22130. +.[0][1242]=1241
  22131. +.[0][1243]=1242
  22132. +.[0][1244]=1243
  22133. +.[0][1245]=1244
  22134. +.[0][1246]=1245
  22135. +.[0][1247]=1246
  22136. +.[0][1248]=1247
  22137. +.[0][1249]=1248
  22138. +.[0][1250]=1249
  22139. +.[0][1251]=1250
  22140. +.[0][1252]=1251
  22141. +.[0][1253]=1252
  22142. +.[0][1254]=1253
  22143. +.[0][1255]=1254
  22144. +.[0][1256]=1255
  22145. +.[0][1257]=1256
  22146. +.[0][1258]=1257
  22147. +.[0][1259]=1258
  22148. +.[0][1260]=1259
  22149. +.[0][1261]=1260
  22150. +.[0][1262]=1261
  22151. +.[0][1263]=1262
  22152. +.[0][1264]=1263
  22153. +.[0][1265]=1264
  22154. +.[0][1266]=1265
  22155. +.[0][1267]=1266
  22156. +.[0][1268]=1267
  22157. +.[0][1269]=1268
  22158. +.[0][1270]=1269
  22159. +.[0][1271]=1270
  22160. +.[0][1272]=1271
  22161. +.[0][1273]=1272
  22162. +.[0][1274]=1273
  22163. +.[0][1275]=1274
  22164. +.[0][1276]=1275
  22165. +.[0][1277]=1276
  22166. +.[0][1278]=1277
  22167. +.[0][1279]=1278
  22168. +.[0][1280]=1279
  22169. +.[0][1281]=1280
  22170. +.[0][1282]=1281
  22171. +.[0][1283]=1282
  22172. +.[0][1284]=1283
  22173. +.[0][1285]=1284
  22174. +.[0][1286]=1285
  22175. +.[0][1287]=1286
  22176. +.[0][1288]=1287
  22177. +.[0][1289]=1288
  22178. +.[0][1290]=1289
  22179. +.[0][1291]=1290
  22180. +.[0][1292]=1291
  22181. +.[0][1293]=1292
  22182. +.[0][1294]=1293
  22183. +.[0][1295]=1294
  22184. +.[0][1296]=1295
  22185. +.[0][1297]=1296
  22186. +.[0][1298]=1297
  22187. +.[0][1299]=1298
  22188. +.[0][1300]=1299
  22189. +.[0][1301]=1300
  22190. +.[0][1302]=1301
  22191. +.[0][1303]=1302
  22192. +.[0][1304]=1303
  22193. +.[0][1305]=1304
  22194. +.[0][1306]=1305
  22195. +.[0][1307]=1306
  22196. +.[0][1308]=1307
  22197. +.[0][1309]=1308
  22198. +.[0][1310]=1309
  22199. +.[0][1311]=1310
  22200. +.[0][1312]=1311
  22201. +.[0][1313]=1312
  22202. +.[0][1314]=1313
  22203. +.[0][1315]=1314
  22204. +.[0][1316]=1315
  22205. +.[0][1317]=1316
  22206. +.[0][1318]=1317
  22207. +.[0][1319]=1318
  22208. +.[0][1320]=1319
  22209. +.[0][1321]=1320
  22210. +.[0][1322]=1321
  22211. +.[0][1323]=1322
  22212. +.[0][1324]=1323
  22213. +.[0][1325]=1324
  22214. +.[0][1326]=1325
  22215. +.[0][1327]=1326
  22216. +.[0][1328]=1327
  22217. +.[0][1329]=1328
  22218. +.[0][1330]=1329
  22219. +.[0][1331]=1330
  22220. +.[0][1332]=1331
  22221. +.[0][1333]=1332
  22222. +.[0][1334]=1333
  22223. +.[0][1335]=1334
  22224. +.[0][1336]=1335
  22225. +.[0][1337]=1336
  22226. +.[0][1338]=1337
  22227. +.[0][1339]=1338
  22228. +.[0][1340]=1339
  22229. +.[0][1341]=1340
  22230. +.[0][1342]=1341
  22231. +.[0][1343]=1342
  22232. +.[0][1344]=1343
  22233. +.[0][1345]=1344
  22234. +.[0][1346]=1345
  22235. +.[0][1347]=1346
  22236. +.[0][1348]=1347
  22237. +.[0][1349]=1348
  22238. +.[0][1350]=1349
  22239. +.[0][1351]=1350
  22240. +.[0][1352]=1351
  22241. +.[0][1353]=1352
  22242. +.[0][1354]=1353
  22243. +.[0][1355]=1354
  22244. +.[0][1356]=1355
  22245. +.[0][1357]=1356
  22246. +.[0][1358]=1357
  22247. +.[0][1359]=1358
  22248. +.[0][1360]=1359
  22249. +.[0][1361]=1360
  22250. +.[0][1362]=1361
  22251. +.[0][1363]=1362
  22252. +.[0][1364]=1363
  22253. +.[0][1365]=1364
  22254. +.[0][1366]=1365
  22255. +.[0][1367]=1366
  22256. +.[0][1368]=1367
  22257. +.[0][1369]=1368
  22258. +.[0][1370]=1369
  22259. +.[0][1371]=1370
  22260. +.[0][1372]=1371
  22261. +.[0][1373]=1372
  22262. +.[0][1374]=1373
  22263. +.[0][1375]=1374
  22264. +.[0][1376]=1375
  22265. +.[0][1377]=1376
  22266. +.[0][1378]=1377
  22267. +.[0][1379]=1378
  22268. +.[0][1380]=1379
  22269. +.[0][1381]=1380
  22270. +.[0][1382]=1381
  22271. +.[0][1383]=1382
  22272. +.[0][1384]=1383
  22273. +.[0][1385]=1384
  22274. +.[0][1386]=1385
  22275. +.[0][1387]=1386
  22276. +.[0][1388]=1387
  22277. +.[0][1389]=1388
  22278. +.[0][1390]=1389
  22279. +.[0][1391]=1390
  22280. +.[0][1392]=1391
  22281. +.[0][1393]=1392
  22282. +.[0][1394]=1393
  22283. +.[0][1395]=1394
  22284. +.[0][1396]=1395
  22285. +.[0][1397]=1396
  22286. +.[0][1398]=1397
  22287. +.[0][1399]=1398
  22288. +.[0][1400]=1399
  22289. +.[0][1401]=1400
  22290. +.[0][1402]=1401
  22291. +.[0][1403]=1402
  22292. +.[0][1404]=1403
  22293. +.[0][1405]=1404
  22294. +.[0][1406]=1405
  22295. +.[0][1407]=1406
  22296. +.[0][1408]=1407
  22297. +.[0][1409]=1408
  22298. +.[0][1410]=1409
  22299. +.[0][1411]=1410
  22300. +.[0][1412]=1411
  22301. +.[0][1413]=1412
  22302. +.[0][1414]=1413
  22303. +.[0][1415]=1414
  22304. +.[0][1416]=1415
  22305. +.[0][1417]=1416
  22306. +.[0][1418]=1417
  22307. +.[0][1419]=1418
  22308. +.[0][1420]=1419
  22309. +.[0][1421]=1420
  22310. +.[0][1422]=1421
  22311. +.[0][1423]=1422
  22312. +.[0][1424]=1423
  22313. +.[0][1425]=1424
  22314. +.[0][1426]=1425
  22315. +.[0][1427]=1426
  22316. +.[0][1428]=1427
  22317. +.[0][1429]=1428
  22318. +.[0][1430]=1429
  22319. +.[0][1431]=1430
  22320. +.[0][1432]=1431
  22321. +.[0][1433]=1432
  22322. +.[0][1434]=1433
  22323. +.[0][1435]=1434
  22324. +.[0][1436]=1435
  22325. +.[0][1437]=1436
  22326. +.[0][1438]=1437
  22327. +.[0][1439]=1438
  22328. +.[0][1440]=1439
  22329. +.[0][1441]=1440
  22330. +.[0][1442]=1441
  22331. +.[0][1443]=1442
  22332. +.[0][1444]=1443
  22333. +.[0][1445]=1444
  22334. +.[0][1446]=1445
  22335. +.[0][1447]=1446
  22336. +.[0][1448]=1447
  22337. +.[0][1449]=1448
  22338. +.[0][1450]=1449
  22339. +.[0][1451]=1450
  22340. +.[0][1452]=1451
  22341. +.[0][1453]=1452
  22342. +.[0][1454]=1453
  22343. +.[0][1455]=1454
  22344. +.[0][1456]=1455
  22345. +.[0][1457]=1456
  22346. +.[0][1458]=1457
  22347. +.[0][1459]=1458
  22348. +.[0][1460]=1459
  22349. +.[0][1461]=1460
  22350. +.[0][1462]=1461
  22351. +.[0][1463]=1462
  22352. +.[0][1464]=1463
  22353. +.[0][1465]=1464
  22354. +.[0][1466]=1465
  22355. +.[0][1467]=1466
  22356. +.[0][1468]=1467
  22357. +.[0][1469]=1468
  22358. +.[0][1470]=1469
  22359. +.[0][1471]=1470
  22360. +.[0][1472]=1471
  22361. +.[0][1473]=1472
  22362. +.[0][1474]=1473
  22363. +.[0][1475]=1474
  22364. +.[0][1476]=1475
  22365. +.[0][1477]=1476
  22366. +.[0][1478]=1477
  22367. +.[0][1479]=1478
  22368. +.[0][1480]=1479
  22369. +.[0][1481]=1480
  22370. +.[0][1482]=1481
  22371. +.[0][1483]=1482
  22372. +.[0][1484]=1483
  22373. +.[0][1485]=1484
  22374. +.[0][1486]=1485
  22375. +.[0][1487]=1486
  22376. +.[0][1488]=1487
  22377. +.[0][1489]=1488
  22378. +.[0][1490]=1489
  22379. +.[0][1491]=1490
  22380. +.[0][1492]=1491
  22381. +.[0][1493]=1492
  22382. +.[0][1494]=1493
  22383. +.[0][1495]=1494
  22384. +.[0][1496]=1495
  22385. +.[0][1497]=1496
  22386. +.[0][1498]=1497
  22387. +.[0][1499]=1498
  22388. +.[0][1500]=1499
  22389. +.[0][1501]=1500
  22390. +.[0][1502]=1501
  22391. +.[0][1503]=1502
  22392. +.[0][1504]=1503
  22393. +.[0][1505]=1504
  22394. +.[0][1506]=1505
  22395. +.[0][1507]=1506
  22396. +.[0][1508]=1507
  22397. +.[0][1509]=1508
  22398. +.[0][1510]=1509
  22399. +.[0][1511]=1510
  22400. +.[0][1512]=1511
  22401. +.[0][1513]=1512
  22402. +.[0][1514]=1513
  22403. +.[0][1515]=1514
  22404. +.[0][1516]=1515
  22405. +.[0][1517]=1516
  22406. +.[0][1518]=1517
  22407. +.[0][1519]=1518
  22408. +.[0][1520]=1519
  22409. +.[0][1521]=1520
  22410. +.[0][1522]=1521
  22411. +.[0][1523]=1522
  22412. +.[0][1524]=1523
  22413. +.[0][1525]=1524
  22414. +.[0][1526]=1525
  22415. +.[0][1527]=1526
  22416. +.[0][1528]=1527
  22417. +.[0][1529]=1528
  22418. +.[0][1530]=1529
  22419. +.[0][1531]=1530
  22420. +.[0][1532]=1531
  22421. +.[0][1533]=1532
  22422. +.[0][1534]=1533
  22423. +.[0][1535]=1534
  22424. +.[0][1536]=1535
  22425. +.[0][1537]=1536
  22426. +.[0][1538]=1537
  22427. +.[0][1539]=1538
  22428. +.[0][1540]=1539
  22429. +.[0][1541]=1540
  22430. +.[0][1542]=1541
  22431. +.[0][1543]=1542
  22432. +.[0][1544]=1543
  22433. +.[0][1545]=1544
  22434. +.[0][1546]=1545
  22435. +.[0][1547]=1546
  22436. +.[0][1548]=1547
  22437. +.[0][1549]=1548
  22438. +.[0][1550]=1549
  22439. +.[0][1551]=1550
  22440. +.[0][1552]=1551
  22441. +.[0][1553]=1552
  22442. +.[0][1554]=1553
  22443. +.[0][1555]=1554
  22444. +.[0][1556]=1555
  22445. +.[0][1557]=1556
  22446. +.[0][1558]=1557
  22447. +.[0][1559]=1558
  22448. +.[0][1560]=1559
  22449. +.[0][1561]=1560
  22450. +.[0][1562]=1561
  22451. +.[0][1563]=1562
  22452. +.[0][1564]=1563
  22453. +.[0][1565]=1564
  22454. +.[0][1566]=1565
  22455. +.[0][1567]=1566
  22456. +.[0][1568]=1567
  22457. +.[0][1569]=1568
  22458. +.[0][1570]=1569
  22459. +.[0][1571]=1570
  22460. +.[0][1572]=1571
  22461. +.[0][1573]=1572
  22462. +.[0][1574]=1573
  22463. +.[0][1575]=1574
  22464. +.[0][1576]=1575
  22465. +.[0][1577]=1576
  22466. +.[0][1578]=1577
  22467. +.[0][1579]=1578
  22468. +.[0][1580]=1579
  22469. +.[0][1581]=1580
  22470. +.[0][1582]=1581
  22471. +.[0][1583]=1582
  22472. +.[0][1584]=1583
  22473. +.[0][1585]=1584
  22474. +.[0][1586]=1585
  22475. +.[0][1587]=1586
  22476. +.[0][1588]=1587
  22477. +.[0][1589]=1588
  22478. +.[0][1590]=1589
  22479. +.[0][1591]=1590
  22480. +.[0][1592]=1591
  22481. +.[0][1593]=1592
  22482. +.[0][1594]=1593
  22483. +.[0][1595]=1594
  22484. +.[0][1596]=1595
  22485. +.[0][1597]=1596
  22486. +.[0][1598]=1597
  22487. +.[0][1599]=1598
  22488. +.[0][1600]=1599
  22489. +.[0][1601]=1600
  22490. +.[0][1602]=1601
  22491. +.[0][1603]=1602
  22492. +.[0][1604]=1603
  22493. +.[0][1605]=1604
  22494. +.[0][1606]=1605
  22495. +.[0][1607]=1606
  22496. +.[0][1608]=1607
  22497. +.[0][1609]=1608
  22498. +.[0][1610]=1609
  22499. +.[0][1611]=1610
  22500. +.[0][1612]=1611
  22501. +.[0][1613]=1612
  22502. +.[0][1614]=1613
  22503. +.[0][1615]=1614
  22504. +.[0][1616]=1615
  22505. +.[0][1617]=1616
  22506. +.[0][1618]=1617
  22507. +.[0][1619]=1618
  22508. +.[0][1620]=1619
  22509. +.[0][1621]=1620
  22510. +.[0][1622]=1621
  22511. +.[0][1623]=1622
  22512. +.[0][1624]=1623
  22513. +.[0][1625]=1624
  22514. +.[0][1626]=1625
  22515. +.[0][1627]=1626
  22516. +.[0][1628]=1627
  22517. +.[0][1629]=1628
  22518. +.[0][1630]=1629
  22519. +.[0][1631]=1630
  22520. +.[0][1632]=1631
  22521. +.[0][1633]=1632
  22522. +.[0][1634]=1633
  22523. +.[0][1635]=1634
  22524. +.[0][1636]=1635
  22525. +.[0][1637]=1636
  22526. +.[0][1638]=1637
  22527. +.[0][1639]=1638
  22528. +.[0][1640]=1639
  22529. +.[0][1641]=1640
  22530. +.[0][1642]=1641
  22531. +.[0][1643]=1642
  22532. +.[0][1644]=1643
  22533. +.[0][1645]=1644
  22534. +.[0][1646]=1645
  22535. +.[0][1647]=1646
  22536. +.[0][1648]=1647
  22537. +.[0][1649]=1648
  22538. +.[0][1650]=1649
  22539. +.[0][1651]=1650
  22540. +.[0][1652]=1651
  22541. +.[0][1653]=1652
  22542. +.[0][1654]=1653
  22543. +.[0][1655]=1654
  22544. +.[0][1656]=1655
  22545. +.[0][1657]=1656
  22546. +.[0][1658]=1657
  22547. +.[0][1659]=1658
  22548. +.[0][1660]=1659
  22549. +.[0][1661]=1660
  22550. +.[0][1662]=1661
  22551. +.[0][1663]=1662
  22552. +.[0][1664]=1663
  22553. +.[0][1665]=1664
  22554. +.[0][1666]=1665
  22555. +.[0][1667]=1666
  22556. +.[0][1668]=1667
  22557. +.[0][1669]=1668
  22558. +.[0][1670]=1669
  22559. +.[0][1671]=1670
  22560. +.[0][1672]=1671
  22561. +.[0][1673]=1672
  22562. +.[0][1674]=1673
  22563. +.[0][1675]=1674
  22564. +.[0][1676]=1675
  22565. +.[0][1677]=1676
  22566. +.[0][1678]=1677
  22567. +.[0][1679]=1678
  22568. +.[0][1680]=1679
  22569. +.[0][1681]=1680
  22570. +.[0][1682]=1681
  22571. +.[0][1683]=1682
  22572. +.[0][1684]=1683
  22573. +.[0][1685]=1684
  22574. +.[0][1686]=1685
  22575. +.[0][1687]=1686
  22576. +.[0][1688]=1687
  22577. +.[0][1689]=1688
  22578. +.[0][1690]=1689
  22579. +.[0][1691]=1690
  22580. +.[0][1692]=1691
  22581. +.[0][1693]=1692
  22582. +.[0][1694]=1693
  22583. +.[0][1695]=1694
  22584. +.[0][1696]=1695
  22585. +.[0][1697]=1696
  22586. +.[0][1698]=1697
  22587. +.[0][1699]=1698
  22588. +.[0][1700]=1699
  22589. +.[0][1701]=1700
  22590. +.[0][1702]=1701
  22591. +.[0][1703]=1702
  22592. +.[0][1704]=1703
  22593. +.[0][1705]=1704
  22594. +.[0][1706]=1705
  22595. +.[0][1707]=1706
  22596. +.[0][1708]=1707
  22597. +.[0][1709]=1708
  22598. +.[0][1710]=1709
  22599. +.[0][1711]=1710
  22600. +.[0][1712]=1711
  22601. +.[0][1713]=1712
  22602. +.[0][1714]=1713
  22603. +.[0][1715]=1714
  22604. +.[0][1716]=1715
  22605. +.[0][1717]=1716
  22606. +.[0][1718]=1717
  22607. +.[0][1719]=1718
  22608. +.[0][1720]=1719
  22609. +.[0][1721]=1720
  22610. +.[0][1722]=1721
  22611. +.[0][1723]=1722
  22612. +.[0][1724]=1723
  22613. +.[0][1725]=1724
  22614. +.[0][1726]=1725
  22615. +.[0][1727]=1726
  22616. +.[0][1728]=1727
  22617. +.[0][1729]=1728
  22618. +.[0][1730]=1729
  22619. +.[0][1731]=1730
  22620. +.[0][1732]=1731
  22621. +.[0][1733]=1732
  22622. +.[0][1734]=1733
  22623. +.[0][1735]=1734
  22624. +.[0][1736]=1735
  22625. +.[0][1737]=1736
  22626. +.[0][1738]=1737
  22627. +.[0][1739]=1738
  22628. +.[0][1740]=1739
  22629. +.[0][1741]=1740
  22630. +.[0][1742]=1741
  22631. +.[0][1743]=1742
  22632. +.[0][1744]=1743
  22633. +.[0][1745]=1744
  22634. +.[0][1746]=1745
  22635. +.[0][1747]=1746
  22636. +.[0][1748]=1747
  22637. +.[0][1749]=1748
  22638. +.[0][1750]=1749
  22639. +.[0][1751]=1750
  22640. +.[0][1752]=1751
  22641. +.[0][1753]=1752
  22642. +.[0][1754]=1753
  22643. +.[0][1755]=1754
  22644. +.[0][1756]=1755
  22645. +.[0][1757]=1756
  22646. +.[0][1758]=1757
  22647. +.[0][1759]=1758
  22648. +.[0][1760]=1759
  22649. +.[0][1761]=1760
  22650. +.[0][1762]=1761
  22651. +.[0][1763]=1762
  22652. +.[0][1764]=1763
  22653. +.[0][1765]=1764
  22654. +.[0][1766]=1765
  22655. +.[0][1767]=1766
  22656. +.[0][1768]=1767
  22657. +.[0][1769]=1768
  22658. +.[0][1770]=1769
  22659. +.[0][1771]=1770
  22660. +.[0][1772]=1771
  22661. +.[0][1773]=1772
  22662. +.[0][1774]=1773
  22663. +.[0][1775]=1774
  22664. +.[0][1776]=1775
  22665. +.[0][1777]=1776
  22666. +.[0][1778]=1777
  22667. +.[0][1779]=1778
  22668. +.[0][1780]=1779
  22669. +.[0][1781]=1780
  22670. +.[0][1782]=1781
  22671. +.[0][1783]=1782
  22672. +.[0][1784]=1783
  22673. +.[0][1785]=1784
  22674. +.[0][1786]=1785
  22675. +.[0][1787]=1786
  22676. +.[0][1788]=1787
  22677. +.[0][1789]=1788
  22678. +.[0][1790]=1789
  22679. +.[0][1791]=1790
  22680. +.[0][1792]=1791
  22681. +.[0][1793]=1792
  22682. +.[0][1794]=1793
  22683. +.[0][1795]=1794
  22684. +.[0][1796]=1795
  22685. +.[0][1797]=1796
  22686. +.[0][1798]=1797
  22687. +.[0][1799]=1798
  22688. +.[0][1800]=1799
  22689. +.[0][1801]=1800
  22690. +.[0][1802]=1801
  22691. +.[0][1803]=1802
  22692. +.[0][1804]=1803
  22693. +.[0][1805]=1804
  22694. +.[0][1806]=1805
  22695. +.[0][1807]=1806
  22696. +.[0][1808]=1807
  22697. +.[0][1809]=1808
  22698. +.[0][1810]=1809
  22699. +.[0][1811]=1810
  22700. +.[0][1812]=1811
  22701. +.[0][1813]=1812
  22702. +.[0][1814]=1813
  22703. +.[0][1815]=1814
  22704. +.[0][1816]=1815
  22705. +.[0][1817]=1816
  22706. +.[0][1818]=1817
  22707. +.[0][1819]=1818
  22708. +.[0][1820]=1819
  22709. +.[0][1821]=1820
  22710. +.[0][1822]=1821
  22711. +.[0][1823]=1822
  22712. +.[0][1824]=1823
  22713. +.[0][1825]=1824
  22714. +.[0][1826]=1825
  22715. +.[0][1827]=1826
  22716. +.[0][1828]=1827
  22717. +.[0][1829]=1828
  22718. +.[0][1830]=1829
  22719. +.[0][1831]=1830
  22720. +.[0][1832]=1831
  22721. +.[0][1833]=1832
  22722. +.[0][1834]=1833
  22723. +.[0][1835]=1834
  22724. +.[0][1836]=1835
  22725. +.[0][1837]=1836
  22726. +.[0][1838]=1837
  22727. +.[0][1839]=1838
  22728. +.[0][1840]=1839
  22729. +.[0][1841]=1840
  22730. +.[0][1842]=1841
  22731. +.[0][1843]=1842
  22732. +.[0][1844]=1843
  22733. +.[0][1845]=1844
  22734. +.[0][1846]=1845
  22735. +.[0][1847]=1846
  22736. +.[0][1848]=1847
  22737. +.[0][1849]=1848
  22738. +.[0][1850]=1849
  22739. +.[0][1851]=1850
  22740. +.[0][1852]=1851
  22741. +.[0][1853]=1852
  22742. +.[0][1854]=1853
  22743. +.[0][1855]=1854
  22744. +.[0][1856]=1855
  22745. +.[0][1857]=1856
  22746. +.[0][1858]=1857
  22747. +.[0][1859]=1858
  22748. +.[0][1860]=1859
  22749. +.[0][1861]=1860
  22750. +.[0][1862]=1861
  22751. +.[0][1863]=1862
  22752. +.[0][1864]=1863
  22753. +.[0][1865]=1864
  22754. +.[0][1866]=1865
  22755. +.[0][1867]=1866
  22756. +.[0][1868]=1867
  22757. +.[0][1869]=1868
  22758. +.[0][1870]=1869
  22759. +.[0][1871]=1870
  22760. +.[0][1872]=1871
  22761. +.[0][1873]=1872
  22762. +.[0][1874]=1873
  22763. +.[0][1875]=1874
  22764. +.[0][1876]=1875
  22765. +.[0][1877]=1876
  22766. +.[0][1878]=1877
  22767. +.[0][1879]=1878
  22768. +.[0][1880]=1879
  22769. +.[0][1881]=1880
  22770. +.[0][1882]=1881
  22771. +.[0][1883]=1882
  22772. +.[0][1884]=1883
  22773. +.[0][1885]=1884
  22774. +.[0][1886]=1885
  22775. +.[0][1887]=1886
  22776. +.[0][1888]=1887
  22777. +.[0][1889]=1888
  22778. +.[0][1890]=1889
  22779. +.[0][1891]=1890
  22780. +.[0][1892]=1891
  22781. +.[0][1893]=1892
  22782. +.[0][1894]=1893
  22783. +.[0][1895]=1894
  22784. +.[0][1896]=1895
  22785. +.[0][1897]=1896
  22786. +.[0][1898]=1897
  22787. +.[0][1899]=1898
  22788. +.[0][1900]=1899
  22789. +.[0][1901]=1900
  22790. +.[0][1902]=1901
  22791. +.[0][1903]=1902
  22792. +.[0][1904]=1903
  22793. +.[0][1905]=1904
  22794. +.[0][1906]=1905
  22795. +.[0][1907]=1906
  22796. +.[0][1908]=1907
  22797. +.[0][1909]=1908
  22798. +.[0][1910]=1909
  22799. +.[0][1911]=1910
  22800. +.[0][1912]=1911
  22801. +.[0][1913]=1912
  22802. +.[0][1914]=1913
  22803. +.[0][1915]=1914
  22804. +.[0][1916]=1915
  22805. +.[0][1917]=1916
  22806. +.[0][1918]=1917
  22807. +.[0][1919]=1918
  22808. +.[0][1920]=1919
  22809. +.[0][1921]=1920
  22810. +.[0][1922]=1921
  22811. +.[0][1923]=1922
  22812. +.[0][1924]=1923
  22813. +.[0][1925]=1924
  22814. +.[0][1926]=1925
  22815. +.[0][1927]=1926
  22816. +.[0][1928]=1927
  22817. +.[0][1929]=1928
  22818. +.[0][1930]=1929
  22819. +.[0][1931]=1930
  22820. +.[0][1932]=1931
  22821. +.[0][1933]=1932
  22822. +.[0][1934]=1933
  22823. +.[0][1935]=1934
  22824. +.[0][1936]=1935
  22825. +.[0][1937]=1936
  22826. +.[0][1938]=1937
  22827. +.[0][1939]=1938
  22828. +.[0][1940]=1939
  22829. +.[0][1941]=1940
  22830. +.[0][1942]=1941
  22831. +.[0][1943]=1942
  22832. +.[0][1944]=1943
  22833. +.[0][1945]=1944
  22834. +.[0][1946]=1945
  22835. +.[0][1947]=1946
  22836. +.[0][1948]=1947
  22837. +.[0][1949]=1948
  22838. +.[0][1950]=1949
  22839. +.[0][1951]=1950
  22840. +.[0][1952]=1951
  22841. +.[0][1953]=1952
  22842. +.[0][1954]=1953
  22843. +.[0][1955]=1954
  22844. +.[0][1956]=1955
  22845. +.[0][1957]=1956
  22846. +.[0][1958]=1957
  22847. +.[0][1959]=1958
  22848. +.[0][1960]=1959
  22849. +.[0][1961]=1960
  22850. +.[0][1962]=1961
  22851. +.[0][1963]=1962
  22852. +.[0][1964]=1963
  22853. +.[0][1965]=1964
  22854. +.[0][1966]=1965
  22855. +.[0][1967]=1966
  22856. +.[0][1968]=1967
  22857. +.[0][1969]=1968
  22858. +.[0][1970]=1969
  22859. +.[0][1971]=1970
  22860. +.[0][1972]=1971
  22861. +.[0][1973]=1972
  22862. +.[0][1974]=1973
  22863. +.[0][1975]=1974
  22864. +.[0][1976]=1975
  22865. +.[0][1977]=1976
  22866. +.[0][1978]=1977
  22867. +.[0][1979]=1978
  22868. +.[0][1980]=1979
  22869. +.[0][1981]=1980
  22870. +.[0][1982]=1981
  22871. +.[0][1983]=1982
  22872. +.[0][1984]=1983
  22873. +.[0][1985]=1984
  22874. +.[0][1986]=1985
  22875. +.[0][1987]=1986
  22876. +.[0][1988]=1987
  22877. +.[0][1989]=1988
  22878. +.[0][1990]=1989
  22879. +.[0][1991]=1990
  22880. +.[0][1992]=1991
  22881. +.[0][1993]=1992
  22882. +.[0][1994]=1993
  22883. +.[0][1995]=1994
  22884. +.[0][1996]=1995
  22885. +.[0][1997]=1996
  22886. +.[0][1998]=1997
  22887. +.[0][1999]=1998
  22888. +.[0][2000]=1999
  22889. +.[0][2001]=2000
  22890. +.[0][2002]=2001
  22891. +.[0][2003]=2002
  22892. +.[0][2004]=2003
  22893. +.[0][2005]=2004
  22894. +.[0][2006]=2005
  22895. +.[0][2007]=2006
  22896. +.[0][2008]=2007
  22897. +.[0][2009]=2008
  22898. +.[0][2010]=2009
  22899. +.[0][2011]=2010
  22900. +.[0][2012]=2011
  22901. +.[0][2013]=2012
  22902. +.[0][2014]=2013
  22903. +.[0][2015]=2014
  22904. +.[0][2016]=2015
  22905. +.[0][2017]=2016
  22906. +.[0][2018]=2017
  22907. +.[0][2019]=2018
  22908. +.[0][2020]=2019
  22909. +.[0][2021]=2020
  22910. +.[0][2022]=2021
  22911. +.[0][2023]=2022
  22912. +.[0][2024]=2023
  22913. +.[0][2025]=2024
  22914. +.[0][2026]=2025
  22915. +.[0][2027]=2026
  22916. +.[0][2028]=2027
  22917. +.[0][2029]=2028
  22918. +.[0][2030]=2029
  22919. +.[0][2031]=2030
  22920. +.[0][2032]=2031
  22921. +.[0][2033]=2032
  22922. +.[0][2034]=2033
  22923. +.[0][2035]=2034
  22924. +.[0][2036]=2035
  22925. +.[0][2037]=2036
  22926. +.[0][2038]=2037
  22927. +.[0][2039]=2038
  22928. +.[0][2040]=2039
  22929. +.[0][2041]=2040
  22930. +.[0][2042]=2041
  22931. +.[0][2043]=2042
  22932. +.[0][2044]=2043
  22933. +.[0][2045]=2044
  22934. +.[0][2046]=2045
  22935. +.[0][2047]=2046
  22936. +.[0][2048]=2047
  22937. +.[0][2049]=2048
  22938. +.[0][2050]=2049
  22939. +.[0][2051]=2050
  22940. +.[0][2052]=2051
  22941. +.[0][2053]=2052
  22942. +.[0][2054]=2053
  22943. +.[0][2055]=2054
  22944. +.[0][2056]=2055
  22945. +.[0][2057]=2056
  22946. +.[0][2058]=2057
  22947. +.[0][2059]=2058
  22948. +.[0][2060]=2059
  22949. +.[0][2061]=2060
  22950. +.[0][2062]=2061
  22951. +.[0][2063]=2062
  22952. +.[0][2064]=2063
  22953. +.[0][2065]=2064
  22954. +.[0][2066]=2065
  22955. +.[0][2067]=2066
  22956. +.[0][2068]=2067
  22957. +.[0][2069]=2068
  22958. +.[0][2070]=2069
  22959. +.[0][2071]=2070
  22960. +.[0][2072]=2071
  22961. +.[0][2073]=2072
  22962. +.[0][2074]=2073
  22963. +.[0][2075]=2074
  22964. +.[0][2076]=2075
  22965. +.[0][2077]=2076
  22966. +.[0][2078]=2077
  22967. +.[0][2079]=2078
  22968. +.[0][2080]=2079
  22969. +.[0][2081]=2080
  22970. +.[0][2082]=2081
  22971. +.[0][2083]=2082
  22972. +.[0][2084]=2083
  22973. +.[0][2085]=2084
  22974. +.[0][2086]=2085
  22975. +.[0][2087]=2086
  22976. +.[0][2088]=2087
  22977. +.[0][2089]=2088
  22978. +.[0][2090]=2089
  22979. +.[0][2091]=2090
  22980. +.[0][2092]=2091
  22981. +.[0][2093]=2092
  22982. +.[0][2094]=2093
  22983. +.[0][2095]=2094
  22984. +.[0][2096]=2095
  22985. +.[0][2097]=2096
  22986. +.[0][2098]=2097
  22987. +.[0][2099]=2098
  22988. +.[0][2100]=2099
  22989. +.[0][2101]=2100
  22990. +.[0][2102]=2101
  22991. +.[0][2103]=2102
  22992. +.[0][2104]=2103
  22993. +.[0][2105]=2104
  22994. +.[0][2106]=2105
  22995. +.[0][2107]=2106
  22996. +.[0][2108]=2107
  22997. +.[0][2109]=2108
  22998. +.[0][2110]=2109
  22999. +.[0][2111]=2110
  23000. +.[0][2112]=2111
  23001. +.[0][2113]=2112
  23002. +.[0][2114]=2113
  23003. +.[0][2115]=2114
  23004. +.[0][2116]=2115
  23005. +.[0][2117]=2116
  23006. +.[0][2118]=2117
  23007. +.[0][2119]=2118
  23008. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.json
  23009. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.json 1970-01-01 02:00:00.000000000 +0200
  23010. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_large_01.json 2017-12-03 19:05:22.000000000 +0300
  23011. @@ -0,0 +1,2 @@
  23012. +[["A",0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,729,730,731,732,733,734,735,736,737,738,739,740,741,742,743,744,745,746,747,748,749,750,751,752,753,754,755,756,757,758,759,760,761,762,763,764,765,766,767,768,769,770,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,881,882,883,884,885,886,887,888,889,890,891,892,893,894,895,896,897,898,899,900,901,902,903,904,905,906,907,908,909,910,911,912,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,935,936,937,938,939,940,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,965,966,967,968,969,970,971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1410,1411,1412,1413,1414,1415,1416,1417,1418,1419,1420,1421,1422,1423,1424,1425,1426,1427,1428,1429,1430,1431,1432,1433,1434,1435,1436,1437,1438,1439,1440,1441,1442,1443,1444,1445,1446,1447,1448,1449,1450,1451,1452,1453,1454,1455,1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,1466,1467,1468,1469,1470,1471,1472,1473,1474,1475,1476,1477,1478,1479,1480,1481,1482,1483,1484,1485,1486,1487,1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503,1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,1515,1516,1517,1518,1519,1520,1521,1522,1523,1524,1525,1526,1527,1528,1529,1530,1531,1532,1533,1534,1535,1536,1537,1538,1539,1540,1541,1542,1543,1544,1545,1546,1547,1548,1549,1550,1551,1552,1553,1554,1555,1556,1557,1558,1559,1560,1561,1562,1563,1564,1565,1566,1567,1568,1569,1570,1571,1572,1573,1574,1575,1576,1577,1578,1579,1580,1581,1582,1583,1584,1585,1586,1587,1588,1589,1590,1591,1592,1593,1594,1595,1596,1597,1598,1599,1600,1601,1602,1603,1604,1605,1606,1607,1608,1609,1610,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,1674,1675,1676,1677,1678,1679,1680,1681,1682,1683,1684,1685,1686,1687,1688,1689,1690,1691,1692,1693,1694,1695,1696,1697,1698,1699,1700,1701,1702,1703,1704,1705,1706,1707,1708,1709,1710,1711,1712,1713,1714,1715,1716,1717,1718,1719,1720,1721,1722,1723,1724,1725,1726,1727,1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740,1741,1742,1743,1744,1745,1746,1747,1748,1749,1750,1751,1752,1753,1754,1755,1756,1757,1758,1759,1760,1761,1762,1763,1764,1765,1766,1767,1768,1769,1770,1771,1772,1773,1774,1775,1776,1777,1778,1779,1780,1781,1782,1783,1784,1785,1786,1787,1788,1789,1790,1791,1792,1793,1794,1795,1796,1797,1798,1799,1800,1801,1802,1803,1804,1805,1806,1807,1808,1809,1810,1811,1812,1813,1814,1815,1816,1817,1818,1819,1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1832,1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1850,1851,1852,1853,1854,1855,1856,1857,1858,1859,1860,1861,1862,1863,1864,1865,1866,1867,1868,1869,1870,1871,1872,1873,1874,1875,1876,1877,1878,1879,1880,1881,1882,1883,1884,1885,1886,1887,1888,1889,1890,1891,1892,1893,1894,1895,1896,1897,1898,1899,1900,1901,1902,1903,1904,1905,1906,1907,1908,1909,1910,1911,1912,1913,1914,1915,1916,1917,1918,1919,1920,1921,1922,1923,1924,1925,1926,1927,1928,1929,1930,1931,1932,1933,1934,1935,1936,1937,1938,1939,1940,1941,1942,1943,1944,1945,1946,1947,1948,1949,1950,1951,1952,1953,1954,1955,1956,1957,1958,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026,2027,2028,2029,2030,2031,2032,2033,2034,2035,2036,2037,2038,2039,2040,2041,2042,2043,2044,2045,2046,2047,2048,2049,2050,2051,2052,2053,2054,2055,2056,2057,2058,2059,2060,2061,2062,2063,2064,2065,2066,2067,2068,2069,2070,2071,2072,2073,2074,2075,2076,2077,2078,2079,2080,2081,2082,2083,2084,2085,2086,2087,2088,2089,2090,2091,2092,2093,2094,2095,2096,2097,2098,2099,2100,2101,2102,2103,2104,2105,2106,2107,2108,2109,2110,2111,2112,2113,2114,2115,2116,2117,2118]
  23013. +]
  23014. \ Dosya sonunda yenisatır yok.
  23015. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.expected
  23016. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.expected 1970-01-01 02:00:00.000000000 +0200
  23017. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.expected 2017-12-03 19:05:22.000000000 +0300
  23018. @@ -0,0 +1 @@
  23019. +.={}
  23020. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.json
  23021. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.json 1970-01-01 02:00:00.000000000 +0200
  23022. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_01.json 2017-12-03 19:05:22.000000000 +0300
  23023. @@ -0,0 +1 @@
  23024. +{}
  23025. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.expected
  23026. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.expected 1970-01-01 02:00:00.000000000 +0200
  23027. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.expected 2017-12-03 19:05:22.000000000 +0300
  23028. @@ -0,0 +1,2 @@
  23029. +.={}
  23030. +.count=1234
  23031. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.json
  23032. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.json 1970-01-01 02:00:00.000000000 +0200
  23033. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_02.json 2017-12-03 19:05:22.000000000 +0300
  23034. @@ -0,0 +1 @@
  23035. +{ "count" : 1234 }
  23036. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.expected
  23037. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.expected 1970-01-01 02:00:00.000000000 +0200
  23038. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.expected 2017-12-03 19:05:22.000000000 +0300
  23039. @@ -0,0 +1,4 @@
  23040. +.={}
  23041. +.attribute="random"
  23042. +.count=1234
  23043. +.name="test"
  23044. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.json
  23045. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.json 1970-01-01 02:00:00.000000000 +0200
  23046. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_03.json 2017-12-03 19:05:22.000000000 +0300
  23047. @@ -0,0 +1,5 @@
  23048. +{
  23049. + "count" : 1234,
  23050. + "name" : "test",
  23051. + "attribute" : "random"
  23052. +}
  23053. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.expected
  23054. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.expected 1970-01-01 02:00:00.000000000 +0200
  23055. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.expected 2017-12-03 19:05:22.000000000 +0300
  23056. @@ -0,0 +1,2 @@
  23057. +.={}
  23058. +.=1234
  23059. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.json
  23060. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.json 1970-01-01 02:00:00.000000000 +0200
  23061. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_object_04.json 2017-12-03 19:05:22.000000000 +0300
  23062. @@ -0,0 +1,3 @@
  23063. +{
  23064. + "" : 1234
  23065. +}
  23066. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.expected
  23067. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.expected 1970-01-01 02:00:00.000000000 +0200
  23068. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.expected 2017-12-03 19:05:22.000000000 +0300
  23069. @@ -0,0 +1,11 @@
  23070. +/* A comment
  23071. + at the beginning of the file.
  23072. + */
  23073. +.={}
  23074. +.first=1
  23075. +/* Comment before 'second'
  23076. + */
  23077. +.second=2
  23078. +/* A comment at
  23079. + the end of the file.
  23080. + */
  23081. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.json
  23082. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.json 1970-01-01 02:00:00.000000000 +0200
  23083. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_preserve_comment_01.json 2017-12-03 19:05:22.000000000 +0300
  23084. @@ -0,0 +1,14 @@
  23085. +/* A comment
  23086. + at the beginning of the file.
  23087. + */
  23088. +{
  23089. + "first" : 1, // comment after 'first' on the same line
  23090. +
  23091. +/* Comment before 'second'
  23092. + */
  23093. + "second" : 2
  23094. +}
  23095. +
  23096. +/* A comment at
  23097. + the end of the file.
  23098. + */
  23099. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.expected
  23100. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.expected 1970-01-01 02:00:00.000000000 +0200
  23101. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.expected 2017-12-03 19:05:22.000000000 +0300
  23102. @@ -0,0 +1,3 @@
  23103. +// 2^33 => out of integer range, switch to double
  23104. +.=8589934592
  23105. +
  23106. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.json
  23107. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.json 1970-01-01 02:00:00.000000000 +0200
  23108. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_01.json 2017-12-03 19:05:22.000000000 +0300
  23109. @@ -0,0 +1,3 @@
  23110. +// 2^33 => out of integer range, switch to double
  23111. +8589934592
  23112. +
  23113. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.expected
  23114. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.expected 1970-01-01 02:00:00.000000000 +0200
  23115. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.expected 2017-12-03 19:05:22.000000000 +0300
  23116. @@ -0,0 +1,3 @@
  23117. +// -2^32 => out of signed integer range, switch to double
  23118. +.=-4294967295
  23119. +
  23120. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.json
  23121. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.json 1970-01-01 02:00:00.000000000 +0200
  23122. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_02.json 2017-12-03 19:05:22.000000000 +0300
  23123. @@ -0,0 +1,3 @@
  23124. +// -2^32 => out of signed integer range, switch to double
  23125. +-4294967295
  23126. +
  23127. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.expected
  23128. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.expected 1970-01-01 02:00:00.000000000 +0200
  23129. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.expected 2017-12-03 19:05:22.000000000 +0300
  23130. @@ -0,0 +1,3 @@
  23131. +// -2^32 => out of signed integer range, switch to double
  23132. +.=-4294967295
  23133. +
  23134. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.json
  23135. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.json 1970-01-01 02:00:00.000000000 +0200
  23136. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_03.json 2017-12-03 19:05:22.000000000 +0300
  23137. @@ -0,0 +1,3 @@
  23138. +// -2^32 => out of signed integer range, switch to double
  23139. +-4294967295
  23140. +
  23141. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.expected
  23142. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.expected 1970-01-01 02:00:00.000000000 +0200
  23143. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.expected 2017-12-03 19:05:22.000000000 +0300
  23144. @@ -0,0 +1,3 @@
  23145. +// 1.2345678
  23146. +.=1.2345678
  23147. +
  23148. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.json
  23149. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.json 1970-01-01 02:00:00.000000000 +0200
  23150. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_04.json 2017-12-03 19:05:22.000000000 +0300
  23151. @@ -0,0 +1,3 @@
  23152. +// 1.2345678
  23153. +12345678e-7
  23154. +
  23155. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.expected
  23156. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.expected 1970-01-01 02:00:00.000000000 +0200
  23157. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.expected 2017-12-03 19:05:22.000000000 +0300
  23158. @@ -0,0 +1,4 @@
  23159. +// 1234567.8
  23160. +.=1234567.8
  23161. +
  23162. +
  23163. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.json
  23164. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.json 1970-01-01 02:00:00.000000000 +0200
  23165. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_05.json 2017-12-03 19:05:22.000000000 +0300
  23166. @@ -0,0 +1,3 @@
  23167. +// 1234567.8
  23168. +0.12345678e7
  23169. +
  23170. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.expected
  23171. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.expected 1970-01-01 02:00:00.000000000 +0200
  23172. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.expected 2017-12-03 19:05:22.000000000 +0300
  23173. @@ -0,0 +1,4 @@
  23174. +// -1.2345678
  23175. +.=-1.2345678
  23176. +
  23177. +
  23178. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.json
  23179. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.json 1970-01-01 02:00:00.000000000 +0200
  23180. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_06.json 2017-12-03 19:05:22.000000000 +0300
  23181. @@ -0,0 +1,3 @@
  23182. +// -1.2345678
  23183. +-12345678e-7
  23184. +
  23185. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.expected
  23186. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.expected 1970-01-01 02:00:00.000000000 +0200
  23187. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.expected 2017-12-03 19:05:22.000000000 +0300
  23188. @@ -0,0 +1,4 @@
  23189. +// -1234567.8
  23190. +.=-1234567.8
  23191. +
  23192. +
  23193. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.json
  23194. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.json 1970-01-01 02:00:00.000000000 +0200
  23195. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_07.json 2017-12-03 19:05:22.000000000 +0300
  23196. @@ -0,0 +1,3 @@
  23197. +// -1234567.8
  23198. +-0.12345678e7
  23199. +
  23200. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.expected
  23201. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.expected 1970-01-01 02:00:00.000000000 +0200
  23202. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.expected 2017-12-03 19:05:22.000000000 +0300
  23203. @@ -0,0 +1,4 @@
  23204. +// Out of 32-bit integer range, switch to double in 32-bit mode. Length the
  23205. +// same as UINT_MAX in base 10 and digit less than UINT_MAX's last digit in
  23206. +// order to catch a bug in the parsing code.
  23207. +.=4300000001
  23208. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.json
  23209. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.json 1970-01-01 02:00:00.000000000 +0200
  23210. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_08.json 2017-12-03 19:05:22.000000000 +0300
  23211. @@ -0,0 +1,4 @@
  23212. +// Out of 32-bit integer range, switch to double in 32-bit mode. Length the
  23213. +// same as UINT_MAX in base 10 and digit less than UINT_MAX's last digit in
  23214. +// order to catch a bug in the parsing code.
  23215. +4300000001
  23216. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.expected
  23217. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.expected 1970-01-01 02:00:00.000000000 +0200
  23218. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.expected 2017-12-03 19:05:22.000000000 +0300
  23219. @@ -0,0 +1,4 @@
  23220. +// Out of 64-bit integer range, switch to double in all modes. Length the same
  23221. +// as ULONG_MAX in base 10 and digit less than ULONG_MAX's last digit in order
  23222. +// to catch a bug in the parsing code.
  23223. +.=1.9e+19
  23224. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.json
  23225. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.json 1970-01-01 02:00:00.000000000 +0200
  23226. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_09.json 2017-12-03 19:05:22.000000000 +0300
  23227. @@ -0,0 +1,4 @@
  23228. +// Out of 64-bit integer range, switch to double in all modes. Length the same
  23229. +// as ULONG_MAX in base 10 and digit less than ULONG_MAX's last digit in order
  23230. +// to catch a bug in the parsing code.
  23231. +19000000000000000001
  23232. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.expected
  23233. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.expected 1970-01-01 02:00:00.000000000 +0200
  23234. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.expected 2017-12-03 19:05:22.000000000 +0300
  23235. @@ -0,0 +1,4 @@
  23236. +// Out of 32-bit signed integer range, switch to double in all modes. Length
  23237. +// the same as INT_MIN in base 10 and digit less than INT_MIN's last digit in
  23238. +// order to catch a bug in the parsing code.
  23239. +.=-2200000001
  23240. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.json
  23241. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.json 1970-01-01 02:00:00.000000000 +0200
  23242. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_10.json 2017-12-03 19:05:22.000000000 +0300
  23243. @@ -0,0 +1,4 @@
  23244. +// Out of 32-bit signed integer range, switch to double in all modes. Length
  23245. +// the same as INT_MIN in base 10 and digit less than INT_MIN's last digit in
  23246. +// order to catch a bug in the parsing code.
  23247. +-2200000001
  23248. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.expected
  23249. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.expected 1970-01-01 02:00:00.000000000 +0200
  23250. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.expected 2017-12-03 19:05:22.000000000 +0300
  23251. @@ -0,0 +1,4 @@
  23252. +// Out of 64-bit signed integer range, switch to double in all modes. Length
  23253. +// the same as LONG_MIN in base 10 and digit less than LONG_MIN's last digit in
  23254. +// order to catch a bug in the parsing code.
  23255. +.=-9.3e+18
  23256. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.json
  23257. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.json 1970-01-01 02:00:00.000000000 +0200
  23258. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_11.json 2017-12-03 19:05:22.000000000 +0300
  23259. @@ -0,0 +1,4 @@
  23260. +// Out of 64-bit signed integer range, switch to double in all modes. Length
  23261. +// the same as LONG_MIN in base 10 and digit less than LONG_MIN's last digit in
  23262. +// order to catch a bug in the parsing code.
  23263. +-9300000000000000001
  23264. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.expected
  23265. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.expected 1970-01-01 02:00:00.000000000 +0200
  23266. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.expected 2017-12-03 19:05:22.000000000 +0300
  23267. @@ -0,0 +1,2 @@
  23268. +// 2^64 -> switch to double.
  23269. +.=1.844674407370955e+19
  23270. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.json
  23271. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.json 1970-01-01 02:00:00.000000000 +0200
  23272. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_real_12.json 2017-12-03 19:05:22.000000000 +0300
  23273. @@ -0,0 +1,2 @@
  23274. +// 2^64 -> switch to double.
  23275. +18446744073709551616
  23276. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.expected
  23277. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.expected 1970-01-01 02:00:00.000000000 +0200
  23278. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.expected 2017-12-03 19:05:22.000000000 +0300
  23279. @@ -0,0 +1 @@
  23280. +.="!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
  23281. \ Dosya sonunda yenisatır yok.
  23282. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.json
  23283. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.json 1970-01-01 02:00:00.000000000 +0200
  23284. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_01.json 2017-12-03 19:05:22.000000000 +0300
  23285. @@ -0,0 +1 @@
  23286. +"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
  23287. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.expected
  23288. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.expected 1970-01-01 02:00:00.000000000 +0200
  23289. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.expected 2017-12-03 19:05:22.000000000 +0300
  23290. @@ -0,0 +1 @@
  23291. +.="!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
  23292. \ Dosya sonunda yenisatır yok.
  23293. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.json
  23294. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.json 1970-01-01 02:00:00.000000000 +0200
  23295. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_02.json 2017-12-03 19:05:22.000000000 +0300
  23296. @@ -0,0 +1 @@
  23297. +"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
  23298. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.expected
  23299. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.expected 1970-01-01 02:00:00.000000000 +0200
  23300. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.expected 2017-12-03 19:05:22.000000000 +0300
  23301. @@ -0,0 +1 @@
  23302. +.="http://jsoncpp.sourceforge.net/"
  23303. \ Dosya sonunda yenisatır yok.
  23304. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.json
  23305. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.json 1970-01-01 02:00:00.000000000 +0200
  23306. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_03.json 2017-12-03 19:05:22.000000000 +0300
  23307. @@ -0,0 +1 @@
  23308. +"http:\/\/jsoncpp.sourceforge.net\/"
  23309. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.expected
  23310. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.expected 1970-01-01 02:00:00.000000000 +0200
  23311. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.expected 2017-12-03 19:05:22.000000000 +0300
  23312. @@ -0,0 +1,2 @@
  23313. +.=""abc\def""
  23314. +
  23315. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.json
  23316. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.json 1970-01-01 02:00:00.000000000 +0200
  23317. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_04.json 2017-12-03 19:05:22.000000000 +0300
  23318. @@ -0,0 +1,2 @@
  23319. +"\"abc\\def\""
  23320. +
  23321. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.expected
  23322. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.expected 1970-01-01 02:00:00.000000000 +0200
  23323. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.expected 2017-12-03 19:05:22.000000000 +0300
  23324. @@ -0,0 +1,2 @@
  23325. +.="\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
  23326. +
  23327. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.json
  23328. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.json 1970-01-01 02:00:00.000000000 +0200
  23329. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_05.json 2017-12-03 19:05:22.000000000 +0300
  23330. @@ -0,0 +1,2 @@
  23331. +"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
  23332. +
  23333. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.expected
  23334. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.expected 1970-01-01 02:00:00.000000000 +0200
  23335. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.expected 2017-12-03 19:05:22.000000000 +0300
  23336. @@ -0,0 +1 @@
  23337. +.="a"
  23338. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.json
  23339. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.json 1970-01-01 02:00:00.000000000 +0200
  23340. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_01.json 2017-12-03 19:05:22.000000000 +0300
  23341. @@ -0,0 +1 @@
  23342. +"\u0061"
  23343. \ Dosya sonunda yenisatır yok.
  23344. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.expected
  23345. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.expected 1970-01-01 02:00:00.000000000 +0200
  23346. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.expected 2017-12-03 19:05:22.000000000 +0300
  23347. @@ -0,0 +1 @@
  23348. +.="¢"
  23349. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.json
  23350. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.json 1970-01-01 02:00:00.000000000 +0200
  23351. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_02.json 2017-12-03 19:05:22.000000000 +0300
  23352. @@ -0,0 +1 @@
  23353. +"\u00A2"
  23354. \ Dosya sonunda yenisatır yok.
  23355. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.expected
  23356. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.expected 1970-01-01 02:00:00.000000000 +0200
  23357. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.expected 2017-12-03 19:05:22.000000000 +0300
  23358. @@ -0,0 +1 @@
  23359. +.="€"
  23360. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.json
  23361. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.json 1970-01-01 02:00:00.000000000 +0200
  23362. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_03.json 2017-12-03 19:05:22.000000000 +0300
  23363. @@ -0,0 +1 @@
  23364. +"\u20AC"
  23365. \ Dosya sonunda yenisatır yok.
  23366. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.expected
  23367. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.expected 1970-01-01 02:00:00.000000000 +0200
  23368. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.expected 2017-12-03 19:05:22.000000000 +0300
  23369. @@ -0,0 +1 @@
  23370. +.="𝄞"
  23371. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.json
  23372. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.json 1970-01-01 02:00:00.000000000 +0200
  23373. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_04.json 2017-12-03 19:05:22.000000000 +0300
  23374. @@ -0,0 +1 @@
  23375. +"\uD834\uDD1E"
  23376. \ Dosya sonunda yenisatır yok.
  23377. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.expected polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.expected
  23378. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.expected 1970-01-01 02:00:00.000000000 +0200
  23379. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.expected 2017-12-03 19:05:22.000000000 +0300
  23380. @@ -0,0 +1,2 @@
  23381. +.="Zażółć gęślą jaźń"
  23382. +
  23383. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.json
  23384. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.json 1970-01-01 02:00:00.000000000 +0200
  23385. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/data/test_string_unicode_05.json 2017-12-03 19:05:22.000000000 +0300
  23386. @@ -0,0 +1 @@
  23387. +"Zażółć gęślą jaźń"
  23388. \ Dosya sonunda yenisatır yok.
  23389. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/generate_expected.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/generate_expected.py
  23390. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/generate_expected.py 1970-01-01 02:00:00.000000000 +0200
  23391. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/generate_expected.py 2017-12-03 19:05:22.000000000 +0300
  23392. @@ -0,0 +1,17 @@
  23393. +# Copyright 2007 Baptiste Lepilleur
  23394. +# Distributed under MIT license, or public domain if desired and
  23395. +# recognized in your jurisdiction.
  23396. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  23397. +
  23398. +from __future__ import print_function
  23399. +import glob
  23400. +import os.path
  23401. +for path in glob.glob('*.json'):
  23402. + text = file(path,'rt').read()
  23403. + target = os.path.splitext(path)[0] + '.expected'
  23404. + if os.path.exists(target):
  23405. + print('skipping:', target)
  23406. + else:
  23407. + print('creating:', target)
  23408. + file(target,'wt').write(text)
  23409. +
  23410. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail10.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail10.json
  23411. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail10.json 1970-01-01 02:00:00.000000000 +0200
  23412. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail10.json 2017-12-03 19:05:22.000000000 +0300
  23413. @@ -0,0 +1 @@
  23414. +{"Extra value after close": true} "misplaced quoted value"
  23415. \ Dosya sonunda yenisatır yok.
  23416. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail11.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail11.json
  23417. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail11.json 1970-01-01 02:00:00.000000000 +0200
  23418. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail11.json 2017-12-03 19:05:22.000000000 +0300
  23419. @@ -0,0 +1 @@
  23420. +{"Illegal expression": 1 + 2}
  23421. \ Dosya sonunda yenisatır yok.
  23422. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail12.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail12.json
  23423. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail12.json 1970-01-01 02:00:00.000000000 +0200
  23424. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail12.json 2017-12-03 19:05:22.000000000 +0300
  23425. @@ -0,0 +1 @@
  23426. +{"Illegal invocation": alert()}
  23427. \ Dosya sonunda yenisatır yok.
  23428. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail13.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail13.json
  23429. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail13.json 1970-01-01 02:00:00.000000000 +0200
  23430. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail13.json 2017-12-03 19:05:22.000000000 +0300
  23431. @@ -0,0 +1 @@
  23432. +{"Numbers cannot have leading zeroes": 013}
  23433. \ Dosya sonunda yenisatır yok.
  23434. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail14.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail14.json
  23435. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail14.json 1970-01-01 02:00:00.000000000 +0200
  23436. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail14.json 2017-12-03 19:05:22.000000000 +0300
  23437. @@ -0,0 +1 @@
  23438. +{"Numbers cannot be hex": 0x14}
  23439. \ Dosya sonunda yenisatır yok.
  23440. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail15.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail15.json
  23441. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail15.json 1970-01-01 02:00:00.000000000 +0200
  23442. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail15.json 2017-12-03 19:05:22.000000000 +0300
  23443. @@ -0,0 +1 @@
  23444. +["Illegal backslash escape: \x15"]
  23445. \ Dosya sonunda yenisatır yok.
  23446. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail16.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail16.json
  23447. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail16.json 1970-01-01 02:00:00.000000000 +0200
  23448. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail16.json 2017-12-03 19:05:22.000000000 +0300
  23449. @@ -0,0 +1 @@
  23450. +[\naked]
  23451. \ Dosya sonunda yenisatır yok.
  23452. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail17.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail17.json
  23453. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail17.json 1970-01-01 02:00:00.000000000 +0200
  23454. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail17.json 2017-12-03 19:05:22.000000000 +0300
  23455. @@ -0,0 +1 @@
  23456. +["Illegal backslash escape: \017"]
  23457. \ Dosya sonunda yenisatır yok.
  23458. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail18.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail18.json
  23459. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail18.json 1970-01-01 02:00:00.000000000 +0200
  23460. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail18.json 2017-12-03 19:05:22.000000000 +0300
  23461. @@ -0,0 +1 @@
  23462. +[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]
  23463. \ Dosya sonunda yenisatır yok.
  23464. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail19.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail19.json
  23465. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail19.json 1970-01-01 02:00:00.000000000 +0200
  23466. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail19.json 2017-12-03 19:05:22.000000000 +0300
  23467. @@ -0,0 +1 @@
  23468. +{"Missing colon" null}
  23469. \ Dosya sonunda yenisatır yok.
  23470. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail1.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail1.json
  23471. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail1.json 1970-01-01 02:00:00.000000000 +0200
  23472. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail1.json 2017-12-03 19:05:22.000000000 +0300
  23473. @@ -0,0 +1 @@
  23474. +"A JSON payload should be an object or array, not a string."
  23475. \ Dosya sonunda yenisatır yok.
  23476. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail20.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail20.json
  23477. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail20.json 1970-01-01 02:00:00.000000000 +0200
  23478. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail20.json 2017-12-03 19:05:22.000000000 +0300
  23479. @@ -0,0 +1 @@
  23480. +{"Double colon":: null}
  23481. \ Dosya sonunda yenisatır yok.
  23482. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail21.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail21.json
  23483. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail21.json 1970-01-01 02:00:00.000000000 +0200
  23484. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail21.json 2017-12-03 19:05:22.000000000 +0300
  23485. @@ -0,0 +1 @@
  23486. +{"Comma instead of colon", null}
  23487. \ Dosya sonunda yenisatır yok.
  23488. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail22.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail22.json
  23489. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail22.json 1970-01-01 02:00:00.000000000 +0200
  23490. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail22.json 2017-12-03 19:05:22.000000000 +0300
  23491. @@ -0,0 +1 @@
  23492. +["Colon instead of comma": false]
  23493. \ Dosya sonunda yenisatır yok.
  23494. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail23.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail23.json
  23495. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail23.json 1970-01-01 02:00:00.000000000 +0200
  23496. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail23.json 2017-12-03 19:05:22.000000000 +0300
  23497. @@ -0,0 +1 @@
  23498. +["Bad value", truth]
  23499. \ Dosya sonunda yenisatır yok.
  23500. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail24.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail24.json
  23501. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail24.json 1970-01-01 02:00:00.000000000 +0200
  23502. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail24.json 2017-12-03 19:05:22.000000000 +0300
  23503. @@ -0,0 +1 @@
  23504. +['single quote']
  23505. \ Dosya sonunda yenisatır yok.
  23506. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail25.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail25.json
  23507. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail25.json 1970-01-01 02:00:00.000000000 +0200
  23508. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail25.json 2017-12-03 19:05:22.000000000 +0300
  23509. @@ -0,0 +1 @@
  23510. +[" tab character in string "]
  23511. \ Dosya sonunda yenisatır yok.
  23512. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail26.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail26.json
  23513. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail26.json 1970-01-01 02:00:00.000000000 +0200
  23514. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail26.json 2017-12-03 19:05:22.000000000 +0300
  23515. @@ -0,0 +1 @@
  23516. +["tab\ character\ in\ string\ "]
  23517. \ Dosya sonunda yenisatır yok.
  23518. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail27.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail27.json
  23519. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail27.json 1970-01-01 02:00:00.000000000 +0200
  23520. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail27.json 2017-12-03 19:05:22.000000000 +0300
  23521. @@ -0,0 +1,2 @@
  23522. +["line
  23523. +break"]
  23524. \ Dosya sonunda yenisatır yok.
  23525. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail28.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail28.json
  23526. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail28.json 1970-01-01 02:00:00.000000000 +0200
  23527. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail28.json 2017-12-03 19:05:22.000000000 +0300
  23528. @@ -0,0 +1,2 @@
  23529. +["line\
  23530. +break"]
  23531. \ Dosya sonunda yenisatır yok.
  23532. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail29.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail29.json
  23533. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail29.json 1970-01-01 02:00:00.000000000 +0200
  23534. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail29.json 2017-12-03 19:05:22.000000000 +0300
  23535. @@ -0,0 +1 @@
  23536. +[0e]
  23537. \ Dosya sonunda yenisatır yok.
  23538. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail2.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail2.json
  23539. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail2.json 1970-01-01 02:00:00.000000000 +0200
  23540. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail2.json 2017-12-03 19:05:22.000000000 +0300
  23541. @@ -0,0 +1 @@
  23542. +["Unclosed array"
  23543. \ Dosya sonunda yenisatır yok.
  23544. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail30.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail30.json
  23545. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail30.json 1970-01-01 02:00:00.000000000 +0200
  23546. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail30.json 2017-12-03 19:05:22.000000000 +0300
  23547. @@ -0,0 +1 @@
  23548. +[0e+]
  23549. \ Dosya sonunda yenisatır yok.
  23550. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail31.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail31.json
  23551. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail31.json 1970-01-01 02:00:00.000000000 +0200
  23552. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail31.json 2017-12-03 19:05:22.000000000 +0300
  23553. @@ -0,0 +1 @@
  23554. +[0e+-1]
  23555. \ Dosya sonunda yenisatır yok.
  23556. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail32.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail32.json
  23557. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail32.json 1970-01-01 02:00:00.000000000 +0200
  23558. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail32.json 2017-12-03 19:05:22.000000000 +0300
  23559. @@ -0,0 +1 @@
  23560. +{"Comma instead if closing brace": true,
  23561. \ Dosya sonunda yenisatır yok.
  23562. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail33.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail33.json
  23563. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail33.json 1970-01-01 02:00:00.000000000 +0200
  23564. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail33.json 2017-12-03 19:05:22.000000000 +0300
  23565. @@ -0,0 +1 @@
  23566. +["mismatch"}
  23567. \ Dosya sonunda yenisatır yok.
  23568. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail3.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail3.json
  23569. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail3.json 1970-01-01 02:00:00.000000000 +0200
  23570. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail3.json 2017-12-03 19:05:22.000000000 +0300
  23571. @@ -0,0 +1 @@
  23572. +{unquoted_key: "keys must be quoted"}
  23573. \ Dosya sonunda yenisatır yok.
  23574. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail4.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail4.json
  23575. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail4.json 1970-01-01 02:00:00.000000000 +0200
  23576. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail4.json 2017-12-03 19:05:22.000000000 +0300
  23577. @@ -0,0 +1 @@
  23578. +["extra comma",]
  23579. \ Dosya sonunda yenisatır yok.
  23580. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail5.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail5.json
  23581. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail5.json 1970-01-01 02:00:00.000000000 +0200
  23582. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail5.json 2017-12-03 19:05:22.000000000 +0300
  23583. @@ -0,0 +1 @@
  23584. +["double extra comma",,]
  23585. \ Dosya sonunda yenisatır yok.
  23586. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail6.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail6.json
  23587. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail6.json 1970-01-01 02:00:00.000000000 +0200
  23588. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail6.json 2017-12-03 19:05:22.000000000 +0300
  23589. @@ -0,0 +1 @@
  23590. +[ , "<-- missing value"]
  23591. \ Dosya sonunda yenisatır yok.
  23592. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail7.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail7.json
  23593. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail7.json 1970-01-01 02:00:00.000000000 +0200
  23594. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail7.json 2017-12-03 19:05:22.000000000 +0300
  23595. @@ -0,0 +1 @@
  23596. +["Comma after the close"],
  23597. \ Dosya sonunda yenisatır yok.
  23598. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail8.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail8.json
  23599. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail8.json 1970-01-01 02:00:00.000000000 +0200
  23600. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail8.json 2017-12-03 19:05:22.000000000 +0300
  23601. @@ -0,0 +1 @@
  23602. +["Extra close"]]
  23603. \ Dosya sonunda yenisatır yok.
  23604. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail9.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail9.json
  23605. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail9.json 1970-01-01 02:00:00.000000000 +0200
  23606. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/fail9.json 2017-12-03 19:05:22.000000000 +0300
  23607. @@ -0,0 +1 @@
  23608. +{"Extra comma": true,}
  23609. \ Dosya sonunda yenisatır yok.
  23610. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass1.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass1.json
  23611. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass1.json 1970-01-01 02:00:00.000000000 +0200
  23612. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass1.json 2017-12-03 19:05:22.000000000 +0300
  23613. @@ -0,0 +1,58 @@
  23614. +[
  23615. + "JSON Test Pattern pass1",
  23616. + {"object with 1 member":["array with 1 element"]},
  23617. + {},
  23618. + [],
  23619. + -42,
  23620. + true,
  23621. + false,
  23622. + null,
  23623. + {
  23624. + "integer": 1234567890,
  23625. + "real": -9876.543210,
  23626. + "e": 0.123456789e-12,
  23627. + "E": 1.234567890E+34,
  23628. + "": 23456789012E66,
  23629. + "zero": 0,
  23630. + "one": 1,
  23631. + "space": " ",
  23632. + "quote": "\"",
  23633. + "backslash": "\\",
  23634. + "controls": "\b\f\n\r\t",
  23635. + "slash": "/ & \/",
  23636. + "alpha": "abcdefghijklmnopqrstuvwyz",
  23637. + "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
  23638. + "digit": "0123456789",
  23639. + "0123456789": "digit",
  23640. + "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
  23641. + "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
  23642. + "true": true,
  23643. + "false": false,
  23644. + "null": null,
  23645. + "array":[ ],
  23646. + "object":{ },
  23647. + "address": "50 St. James Street",
  23648. + "url": "http://www.JSON.org/",
  23649. + "comment": "// /* <!-- --",
  23650. + "# -- --> */": " ",
  23651. + " s p a c e d " :[1,2 , 3
  23652. +
  23653. +,
  23654. +
  23655. +4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
  23656. + "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
  23657. + "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
  23658. + "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
  23659. +: "A key can be any string"
  23660. + },
  23661. + 0.5 ,98.6
  23662. +,
  23663. +99.44
  23664. +,
  23665. +
  23666. +1066,
  23667. +1e1,
  23668. +0.1e1,
  23669. +1e-1,
  23670. +1e00,2e+00,2e-00
  23671. +,"rosebud"]
  23672. \ Dosya sonunda yenisatır yok.
  23673. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass2.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass2.json
  23674. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass2.json 1970-01-01 02:00:00.000000000 +0200
  23675. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass2.json 2017-12-03 19:05:22.000000000 +0300
  23676. @@ -0,0 +1 @@
  23677. +[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
  23678. \ Dosya sonunda yenisatır yok.
  23679. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass3.json polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass3.json
  23680. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass3.json 1970-01-01 02:00:00.000000000 +0200
  23681. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/pass3.json 2017-12-03 19:05:22.000000000 +0300
  23682. @@ -0,0 +1,6 @@
  23683. +{
  23684. + "JSON Test Pattern pass3": {
  23685. + "The outermost value": "must be an object or array.",
  23686. + "In this test": "It is an object."
  23687. + }
  23688. +}
  23689. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/readme.txt polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/readme.txt
  23690. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/readme.txt 1970-01-01 02:00:00.000000000 +0200
  23691. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/jsonchecker/readme.txt 2017-12-03 19:05:22.000000000 +0300
  23692. @@ -0,0 +1,3 @@
  23693. +Test suite from http://json.org/JSON_checker/.
  23694. +
  23695. +If the JSON_checker is working correctly, it must accept all of the pass*.json files and reject all of the fail*.json files.
  23696. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/pyjsontestrunner.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/pyjsontestrunner.py
  23697. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/pyjsontestrunner.py 1970-01-01 02:00:00.000000000 +0200
  23698. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/pyjsontestrunner.py 2017-12-03 19:05:22.000000000 +0300
  23699. @@ -0,0 +1,71 @@
  23700. +# Copyright 2007 Baptiste Lepilleur
  23701. +# Distributed under MIT license, or public domain if desired and
  23702. +# recognized in your jurisdiction.
  23703. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  23704. +
  23705. +"""Simple implementation of a json test runner to run the test against
  23706. +json-py."""
  23707. +
  23708. +from __future__ import print_function
  23709. +import sys
  23710. +import os.path
  23711. +import json
  23712. +import types
  23713. +
  23714. +if len(sys.argv) != 2:
  23715. + print("Usage: %s input-json-file", sys.argv[0])
  23716. + sys.exit(3)
  23717. +
  23718. +input_path = sys.argv[1]
  23719. +base_path = os.path.splitext(input_path)[0]
  23720. +actual_path = base_path + '.actual'
  23721. +rewrite_path = base_path + '.rewrite'
  23722. +rewrite_actual_path = base_path + '.actual-rewrite'
  23723. +
  23724. +def valueTreeToString(fout, value, path = '.'):
  23725. + ty = type(value)
  23726. + if ty is types.DictType:
  23727. + fout.write('%s={}\n' % path)
  23728. + suffix = path[-1] != '.' and '.' or ''
  23729. + names = value.keys()
  23730. + names.sort()
  23731. + for name in names:
  23732. + valueTreeToString(fout, value[name], path + suffix + name)
  23733. + elif ty is types.ListType:
  23734. + fout.write('%s=[]\n' % path)
  23735. + for index, childValue in zip(xrange(0,len(value)), value):
  23736. + valueTreeToString(fout, childValue, path + '[%d]' % index)
  23737. + elif ty is types.StringType:
  23738. + fout.write('%s="%s"\n' % (path,value))
  23739. + elif ty is types.IntType:
  23740. + fout.write('%s=%d\n' % (path,value))
  23741. + elif ty is types.FloatType:
  23742. + fout.write('%s=%.16g\n' % (path,value))
  23743. + elif value is True:
  23744. + fout.write('%s=true\n' % path)
  23745. + elif value is False:
  23746. + fout.write('%s=false\n' % path)
  23747. + elif value is None:
  23748. + fout.write('%s=null\n' % path)
  23749. + else:
  23750. + assert False and "Unexpected value type"
  23751. +
  23752. +def parseAndSaveValueTree(input, actual_path):
  23753. + root = json.loads(input)
  23754. + fout = file(actual_path, 'wt')
  23755. + valueTreeToString(fout, root)
  23756. + fout.close()
  23757. + return root
  23758. +
  23759. +def rewriteValueTree(value, rewrite_path):
  23760. + rewrite = json.dumps(value)
  23761. + #rewrite = rewrite[1:-1] # Somehow the string is quoted ! jsonpy bug ?
  23762. + file(rewrite_path, 'wt').write(rewrite + '\n')
  23763. + return rewrite
  23764. +
  23765. +input = file(input_path, 'rt').read()
  23766. +root = parseAndSaveValueTree(input, actual_path)
  23767. +rewrite = rewriteValueTree(json.write(root), rewrite_path)
  23768. +rewrite_root = parseAndSaveValueTree(rewrite, rewrite_actual_path)
  23769. +
  23770. +sys.exit(0)
  23771. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/runjsontests.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/runjsontests.py
  23772. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/runjsontests.py 1970-01-01 02:00:00.000000000 +0200
  23773. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/runjsontests.py 2017-12-03 19:05:22.000000000 +0300
  23774. @@ -0,0 +1,174 @@
  23775. +# Copyright 2007 Baptiste Lepilleur
  23776. +# Distributed under MIT license, or public domain if desired and
  23777. +# recognized in your jurisdiction.
  23778. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  23779. +
  23780. +from __future__ import print_function
  23781. +from __future__ import unicode_literals
  23782. +from io import open
  23783. +from glob import glob
  23784. +import sys
  23785. +import os
  23786. +import os.path
  23787. +import optparse
  23788. +
  23789. +VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes '
  23790. +
  23791. +def getStatusOutput(cmd):
  23792. + """
  23793. + Return int, unicode (for both Python 2 and 3).
  23794. + Note: os.popen().close() would return None for 0.
  23795. + """
  23796. + print(cmd, file=sys.stderr)
  23797. + pipe = os.popen(cmd)
  23798. + process_output = pipe.read()
  23799. + try:
  23800. + # We have been using os.popen(). When we read() the result
  23801. + # we get 'str' (bytes) in py2, and 'str' (unicode) in py3.
  23802. + # Ugh! There must be a better way to handle this.
  23803. + process_output = process_output.decode('utf-8')
  23804. + except AttributeError:
  23805. + pass # python3
  23806. + status = pipe.close()
  23807. + return status, process_output
  23808. +def compareOutputs(expected, actual, message):
  23809. + expected = expected.strip().replace('\r','').split('\n')
  23810. + actual = actual.strip().replace('\r','').split('\n')
  23811. + diff_line = 0
  23812. + max_line_to_compare = min(len(expected), len(actual))
  23813. + for index in range(0,max_line_to_compare):
  23814. + if expected[index].strip() != actual[index].strip():
  23815. + diff_line = index + 1
  23816. + break
  23817. + if diff_line == 0 and len(expected) != len(actual):
  23818. + diff_line = max_line_to_compare+1
  23819. + if diff_line == 0:
  23820. + return None
  23821. + def safeGetLine(lines, index):
  23822. + index += -1
  23823. + if index >= len(lines):
  23824. + return ''
  23825. + return lines[index].strip()
  23826. + return """ Difference in %s at line %d:
  23827. + Expected: '%s'
  23828. + Actual: '%s'
  23829. +""" % (message, diff_line,
  23830. + safeGetLine(expected,diff_line),
  23831. + safeGetLine(actual,diff_line))
  23832. +
  23833. +def safeReadFile(path):
  23834. + try:
  23835. + return open(path, 'rt', encoding = 'utf-8').read()
  23836. + except IOError as e:
  23837. + return '<File "%s" is missing: %s>' % (path,e)
  23838. +
  23839. +def runAllTests(jsontest_executable_path, input_dir = None,
  23840. + use_valgrind=False, with_json_checker=False,
  23841. + writerClass='StyledWriter'):
  23842. + if not input_dir:
  23843. + input_dir = os.path.join(os.getcwd(), 'data')
  23844. + tests = glob(os.path.join(input_dir, '*.json'))
  23845. + if with_json_checker:
  23846. + test_jsonchecker = glob(os.path.join(input_dir, '../jsonchecker', '*.json'))
  23847. + else:
  23848. + test_jsonchecker = []
  23849. + failed_tests = []
  23850. + valgrind_path = use_valgrind and VALGRIND_CMD or ''
  23851. + for input_path in tests + test_jsonchecker:
  23852. + expect_failure = os.path.basename(input_path).startswith('fail')
  23853. + is_json_checker_test = (input_path in test_jsonchecker) or expect_failure
  23854. + print('TESTING:', input_path, end=' ')
  23855. + options = is_json_checker_test and '--json-checker' or ''
  23856. + options += ' --json-writer %s'%writerClass
  23857. + cmd = '%s%s %s "%s"' % ( valgrind_path, jsontest_executable_path, options,
  23858. + input_path)
  23859. + status, process_output = getStatusOutput(cmd)
  23860. + if is_json_checker_test:
  23861. + if expect_failure:
  23862. + if not status:
  23863. + print('FAILED')
  23864. + failed_tests.append((input_path, 'Parsing should have failed:\n%s' %
  23865. + safeReadFile(input_path)))
  23866. + else:
  23867. + print('OK')
  23868. + else:
  23869. + if status:
  23870. + print('FAILED')
  23871. + failed_tests.append((input_path, 'Parsing failed:\n' + process_output))
  23872. + else:
  23873. + print('OK')
  23874. + else:
  23875. + base_path = os.path.splitext(input_path)[0]
  23876. + actual_output = safeReadFile(base_path + '.actual')
  23877. + actual_rewrite_output = safeReadFile(base_path + '.actual-rewrite')
  23878. + open(base_path + '.process-output', 'wt', encoding = 'utf-8').write(process_output)
  23879. + if status:
  23880. + print('parsing failed')
  23881. + failed_tests.append((input_path, 'Parsing failed:\n' + process_output))
  23882. + else:
  23883. + expected_output_path = os.path.splitext(input_path)[0] + '.expected'
  23884. + expected_output = open(expected_output_path, 'rt', encoding = 'utf-8').read()
  23885. + detail = (compareOutputs(expected_output, actual_output, 'input')
  23886. + or compareOutputs(expected_output, actual_rewrite_output, 'rewrite'))
  23887. + if detail:
  23888. + print('FAILED')
  23889. + failed_tests.append((input_path, detail))
  23890. + else:
  23891. + print('OK')
  23892. +
  23893. + if failed_tests:
  23894. + print()
  23895. + print('Failure details:')
  23896. + for failed_test in failed_tests:
  23897. + print('* Test', failed_test[0])
  23898. + print(failed_test[1])
  23899. + print()
  23900. + print('Test results: %d passed, %d failed.' % (len(tests)-len(failed_tests),
  23901. + len(failed_tests)))
  23902. + return 1
  23903. + else:
  23904. + print('All %d tests passed.' % len(tests))
  23905. + return 0
  23906. +
  23907. +def main():
  23908. + from optparse import OptionParser
  23909. + parser = OptionParser(usage="%prog [options] <path to jsontestrunner.exe> [test case directory]")
  23910. + parser.add_option("--valgrind",
  23911. + action="store_true", dest="valgrind", default=False,
  23912. + help="run all the tests using valgrind to detect memory leaks")
  23913. + parser.add_option("-c", "--with-json-checker",
  23914. + action="store_true", dest="with_json_checker", default=False,
  23915. + help="run all the tests from the official JSONChecker test suite of json.org")
  23916. + parser.enable_interspersed_args()
  23917. + options, args = parser.parse_args()
  23918. +
  23919. + if len(args) < 1 or len(args) > 2:
  23920. + parser.error('Must provides at least path to jsontestrunner executable.')
  23921. + sys.exit(1)
  23922. +
  23923. + jsontest_executable_path = os.path.normpath(os.path.abspath(args[0]))
  23924. + if len(args) > 1:
  23925. + input_path = os.path.normpath(os.path.abspath(args[1]))
  23926. + else:
  23927. + input_path = None
  23928. + status = runAllTests(jsontest_executable_path, input_path,
  23929. + use_valgrind=options.valgrind,
  23930. + with_json_checker=options.with_json_checker,
  23931. + writerClass='StyledWriter')
  23932. + if status:
  23933. + sys.exit(status)
  23934. + status = runAllTests(jsontest_executable_path, input_path,
  23935. + use_valgrind=options.valgrind,
  23936. + with_json_checker=options.with_json_checker,
  23937. + writerClass='StyledStreamWriter')
  23938. + if status:
  23939. + sys.exit(status)
  23940. + status = runAllTests(jsontest_executable_path, input_path,
  23941. + use_valgrind=options.valgrind,
  23942. + with_json_checker=options.with_json_checker,
  23943. + writerClass='BuiltStyledStreamWriter')
  23944. + if status:
  23945. + sys.exit(status)
  23946. +
  23947. +if __name__ == '__main__':
  23948. + main()
  23949. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/rununittests.py polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/rununittests.py
  23950. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/rununittests.py 1970-01-01 02:00:00.000000000 +0200
  23951. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/test/rununittests.py 2017-12-03 19:05:22.000000000 +0300
  23952. @@ -0,0 +1,84 @@
  23953. +# Copyright 2009 Baptiste Lepilleur
  23954. +# Distributed under MIT license, or public domain if desired and
  23955. +# recognized in your jurisdiction.
  23956. +# See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
  23957. +
  23958. +from __future__ import print_function
  23959. +from __future__ import unicode_literals
  23960. +from io import open
  23961. +from glob import glob
  23962. +import sys
  23963. +import os
  23964. +import os.path
  23965. +import subprocess
  23966. +import optparse
  23967. +
  23968. +VALGRIND_CMD = 'valgrind --tool=memcheck --leak-check=yes --undef-value-errors=yes'
  23969. +
  23970. +class TestProxy(object):
  23971. + def __init__(self, test_exe_path, use_valgrind=False):
  23972. + self.test_exe_path = os.path.normpath(os.path.abspath(test_exe_path))
  23973. + self.use_valgrind = use_valgrind
  23974. +
  23975. + def run(self, options):
  23976. + if self.use_valgrind:
  23977. + cmd = VALGRIND_CMD.split()
  23978. + else:
  23979. + cmd = []
  23980. + cmd.extend([self.test_exe_path, '--test-auto'] + options)
  23981. + try:
  23982. + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  23983. + except:
  23984. + print(cmd)
  23985. + raise
  23986. + stdout = process.communicate()[0]
  23987. + if process.returncode:
  23988. + return False, stdout
  23989. + return True, stdout
  23990. +
  23991. +def runAllTests(exe_path, use_valgrind=False):
  23992. + test_proxy = TestProxy(exe_path, use_valgrind=use_valgrind)
  23993. + status, test_names = test_proxy.run(['--list-tests'])
  23994. + if not status:
  23995. + print("Failed to obtain unit tests list:\n" + test_names, file=sys.stderr)
  23996. + return 1
  23997. + test_names = [name.strip() for name in test_names.decode('utf-8').strip().split('\n')]
  23998. + failures = []
  23999. + for name in test_names:
  24000. + print('TESTING %s:' % name, end=' ')
  24001. + succeed, result = test_proxy.run(['--test', name])
  24002. + if succeed:
  24003. + print('OK')
  24004. + else:
  24005. + failures.append((name, result))
  24006. + print('FAILED')
  24007. + failed_count = len(failures)
  24008. + pass_count = len(test_names) - failed_count
  24009. + if failed_count:
  24010. + print()
  24011. + for name, result in failures:
  24012. + print(result)
  24013. + print('%d/%d tests passed (%d failure(s))' % ( pass_count, len(test_names), failed_count))
  24014. + return 1
  24015. + else:
  24016. + print('All %d tests passed' % len(test_names))
  24017. + return 0
  24018. +
  24019. +def main():
  24020. + from optparse import OptionParser
  24021. + parser = OptionParser(usage="%prog [options] <path to test_lib_json.exe>")
  24022. + parser.add_option("--valgrind",
  24023. + action="store_true", dest="valgrind", default=False,
  24024. + help="run all the tests using valgrind to detect memory leaks")
  24025. + parser.enable_interspersed_args()
  24026. + options, args = parser.parse_args()
  24027. +
  24028. + if len(args) != 1:
  24029. + parser.error('Must provides at least path to test_lib_json executable.')
  24030. + sys.exit(1)
  24031. +
  24032. + exit_code = runAllTests(args[0], use_valgrind=options.valgrind)
  24033. + sys.exit(exit_code)
  24034. +
  24035. +if __name__ == '__main__':
  24036. + main()
  24037. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/travis.sh polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/travis.sh
  24038. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/travis.sh 1970-01-01 02:00:00.000000000 +0200
  24039. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/travis.sh 2017-12-03 19:05:22.000000000 +0300
  24040. @@ -0,0 +1,31 @@
  24041. +#!/usr/bin/env sh
  24042. +# This is called by `.travis.yml` via Travis CI.
  24043. +# Travis supplies $TRAVIS_OS_NAME.
  24044. +# http://docs.travis-ci.com/user/multi-os/
  24045. +# Our .travis.yml also defines:
  24046. +# - SHARED_LIB=ON/OFF
  24047. +# - STATIC_LIB=ON/OFF
  24048. +# - CMAKE_PKG=ON/OFF
  24049. +# - BUILD_TYPE=release/debug
  24050. +# - VERBOSE_MAKE=false/true
  24051. +# - VERBOSE (set or not)
  24052. +
  24053. +# -e: fail on error
  24054. +# -v: show commands
  24055. +# -x: show expanded commands
  24056. +set -vex
  24057. +
  24058. +env | sort
  24059. +
  24060. +cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE .
  24061. +make
  24062. +cmake -DJSONCPP_WITH_CMAKE_PACKAGE=$CMAKE_PKG -DBUILD_SHARED_LIBS=$SHARED_LIB -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_VERBOSE_MAKEFILE=$VERBOSE_MAKE -DJSONCPP_USE_SECURE_MEMORY=1 .
  24063. +make
  24064. +
  24065. +# Python is not available in Travis for osx.
  24066. +# https://github.com/travis-ci/travis-ci/issues/2320
  24067. +if [ "$TRAVIS_OS_NAME" != "osx" ]
  24068. +then
  24069. + make jsoncpp_check
  24070. + valgrind --error-exitcode=42 --leak-check=full ./src/test_lib_json/jsoncpp_test
  24071. +fi
  24072. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.travis.yml polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.travis.yml
  24073. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/.travis.yml 1970-01-01 02:00:00.000000000 +0200
  24074. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/.travis.yml 2017-12-03 19:05:22.000000000 +0300
  24075. @@ -0,0 +1,43 @@
  24076. +# Build matrix / environment variable are explained on:
  24077. +# http://about.travis-ci.org/docs/user/build-configuration/
  24078. +# This file can be validated on:
  24079. +# http://lint.travis-ci.org/
  24080. +# See also
  24081. +# http://stackoverflow.com/questions/22111549/travis-ci-with-clang-3-4-and-c11/30925448#30925448
  24082. +# to allow C++11, though we are not yet building with -std=c++11
  24083. +
  24084. +install:
  24085. +# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
  24086. +- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
  24087. +# /usr/bin/clang is our version already, and clang-X.Y does not exist.
  24088. +#- if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
  24089. +- echo ${PATH}
  24090. +- ls /usr/local
  24091. +- ls /usr/local/bin
  24092. +- export PATH=/usr/local/bin:/usr/bin:${PATH}
  24093. +- echo ${CXX}
  24094. +- ${CXX} --version
  24095. +- which valgrind
  24096. +addons:
  24097. + apt:
  24098. + sources:
  24099. + - ubuntu-toolchain-r-test
  24100. + packages:
  24101. + - gcc-4.9
  24102. + - g++-4.9
  24103. + - clang
  24104. + - valgrind
  24105. +os:
  24106. + - linux
  24107. +language: cpp
  24108. +compiler:
  24109. + - gcc
  24110. + - clang
  24111. +script: ./travis.sh
  24112. +env:
  24113. + matrix:
  24114. + - SHARED_LIB=ON STATIC_LIB=ON CMAKE_PKG=ON BUILD_TYPE=release VERBOSE_MAKE=false
  24115. + - SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug VERBOSE_MAKE=true VERBOSE
  24116. +notifications:
  24117. + email: false
  24118. +sudo: false
  24119. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/version polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/version
  24120. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/version 1970-01-01 02:00:00.000000000 +0200
  24121. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/version 2017-12-03 19:05:22.000000000 +0300
  24122. @@ -0,0 +1 @@
  24123. +1.7.7
  24124. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/version.in polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/version.in
  24125. --- polybar-3.2.1.orig/lib/i3ipcpp/libs/jsoncpp-1.7.7/version.in 1970-01-01 02:00:00.000000000 +0200
  24126. +++ polybar-3.2.1/lib/i3ipcpp/libs/jsoncpp-1.7.7/version.in 2017-12-03 19:05:22.000000000 +0300
  24127. @@ -0,0 +1 @@
  24128. +@JSONCPP_VERSION@
  24129. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/README.md polybar-3.2.1/lib/i3ipcpp/README.md
  24130. --- polybar-3.2.1.orig/lib/i3ipcpp/README.md 1970-01-01 02:00:00.000000000 +0200
  24131. +++ polybar-3.2.1/lib/i3ipcpp/README.md 2017-12-03 19:05:22.000000000 +0300
  24132. @@ -0,0 +1,129 @@
  24133. +[![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org)
  24134. +
  24135. +i3ipc++
  24136. +=======
  24137. +An implementation of i3 IPC in C++11.
  24138. +
  24139. +## Requirements
  24140. +
  24141. +* cmake (>= 3.0)
  24142. +* C++11 compiler
  24143. +* sigc++ 2.0
  24144. +* jsoncpp
  24145. +
  24146. +## Using
  24147. +Yet the only way of using is to add this repo as a submodule
  24148. +
  24149. +```bash
  24150. +git submodule add https://github.com/drmgc/i3ipcpp.git ./i3ipc++/
  24151. +```
  24152. +
  24153. +Then just type this in your `CMakeLists.txt`:
  24154. +
  24155. +```cmake
  24156. +...
  24157. +add_subdirectory(i3ipc++)
  24158. +
  24159. +include_directories(${I3IPCpp_INCLUDE_DIRS})
  24160. +link_directories(${I3IPCpp_LIBRARY_DIRS})
  24161. +...
  24162. +```
  24163. +
  24164. +And then just link:
  24165. +
  24166. +```cmake
  24167. +...
  24168. +target_link_libraries(someapp ${I3IPCpp_LIBRARIES})
  24169. +...
  24170. +```
  24171. +
  24172. +## Usage
  24173. +
  24174. +See also examples in `examples/` directory.
  24175. +
  24176. +### Connecting
  24177. +
  24178. +```c++
  24179. +#include <i3ipc++/ipc.hpp>
  24180. +
  24181. +i3ipc::connection conn;
  24182. +```
  24183. +
  24184. +The connection will be established automaticly.
  24185. +
  24186. +### Event handling
  24187. +
  24188. +First of all you need to declare the events you want to handle. As example we want to handle an binding and workspace events:
  24189. +```c++
  24190. +conn.subscribe(i3ipc::ET_WORKSPACE | i3ipc::ET_BINDING);
  24191. +```
  24192. +
  24193. +Then we need to connect to the signal handlers:
  24194. +```c++
  24195. +// Handler of WORKSPACE EVENT
  24196. +conn.signal_workspace_event.connect([](const i3ipc::workspace_event_t& ev) {
  24197. + std::cout << "workspace_event: " << (char)ev.type << std::endl;
  24198. + if (ev.current) {
  24199. + std::cout << "\tSwitched to #" << ev.current->num << " - \"" << ev.current->name << '"' << std::endl;
  24200. + }
  24201. +});
  24202. +
  24203. +// Handler of binding event
  24204. +conn.signal_binding_event.connect([](const i3ipc::binding_t& b) {
  24205. + std::cout << "binding_event:" << std::endl
  24206. + << "\tcommand = \"" << b.command << '"' << std::endl
  24207. + << "\tinput_code = " << b.input_code << std::endl
  24208. + << "\tsymbol = " << b.symbol << std::endl
  24209. + << "\tinput_type = " << static_cast<char>(b.input_type) << std::endl
  24210. + << "\tevent_state_mask =" << std::endl;
  24211. + for (const std::string& s : b.event_state_mask) {
  24212. + std::cout << "\t\t\"" << s << '"' << std::endl;
  24213. + }
  24214. +});
  24215. +```
  24216. +
  24217. +Then we starting the event-handling loop
  24218. +```c++
  24219. +while (true) {
  24220. + conn.handle_event();
  24221. +}
  24222. +```
  24223. +
  24224. +**Note:** If you want to interract with event_socket or just want to prepare manually you can call `conn.connect_event_socket()` (if you want to reconnect `conn.connect_event_socket(true)`), but if by default `connect_event_socket()` called on first `handle_event()` call.
  24225. +
  24226. +### Requesting
  24227. +
  24228. +Also you can request some data from i3, as example barconfigs:
  24229. +```c++
  24230. +std::vector<std::string> bar_configs = conn.get_bar_configs_list();
  24231. +```
  24232. +
  24233. +And then do with them something:
  24234. +```c++
  24235. +for (auto& name : bar_configs) {
  24236. + std::shared_ptr<i3ipc::bar_config_t> bc = conn.get_bar_config(name);
  24237. +
  24238. + // ... handling
  24239. +}
  24240. +```
  24241. +
  24242. +### Sending commands
  24243. +
  24244. +And, of course, you can command i3:
  24245. +```c++
  24246. +if (!conn.send_command("exit")) {
  24247. + throw std::string("Failed to exit via command");
  24248. +}
  24249. +```
  24250. +
  24251. +## Version i3 support
  24252. +It is written according to the *current* specification, so some of new features in IPC can be not-implemented. If there is some of them, please notice at issues page.
  24253. +
  24254. +## Documentation
  24255. +The latest documentation you can find [**here**](http://drmgc.github.io/docs/api-ref/i3ipc++/latest/)
  24256. +
  24257. +## Licensing
  24258. +This library is licensed under under the MIT license, but it also uses [`JsonCpp`](https://github.com/open-source-parsers/jsoncpp) (*only for parsing i3's replies*) and my header-only library [`auss`](https://github.com/drmgc/auss)
  24259. +
  24260. +## Backward compatibility note
  24261. +While version is `0.x` there can be a lack of backward compatibility between minor releases, please see release notes.
  24262. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/src/ipc.cpp polybar-3.2.1/lib/i3ipcpp/src/ipc.cpp
  24263. --- polybar-3.2.1.orig/lib/i3ipcpp/src/ipc.cpp 1970-01-01 02:00:00.000000000 +0200
  24264. +++ polybar-3.2.1/lib/i3ipcpp/src/ipc.cpp 2017-12-03 19:05:22.000000000 +0300
  24265. @@ -0,0 +1,630 @@
  24266. +#include <cstdio>
  24267. +#include <cstring>
  24268. +#include <stdexcept>
  24269. +#include <iostream>
  24270. +
  24271. +#include <json/json.h>
  24272. +#include <auss.hpp>
  24273. +
  24274. +#include "i3ipc++/ipc-util.hpp"
  24275. +#include "i3ipc++/ipc.hpp"
  24276. +#include "i3ipc++/log.hpp"
  24277. +
  24278. +namespace i3ipc {
  24279. +
  24280. +// For log.hpp
  24281. +std::vector<std::ostream*> g_logging_outs = {
  24282. + &std::cout,
  24283. +};
  24284. +std::vector<std::ostream*> g_logging_err_outs = {
  24285. + &std::cerr,
  24286. +};
  24287. +
  24288. +#define IPC_JSON_READ(ROOT) \
  24289. +{ \
  24290. + Json::CharReaderBuilder b; \
  24291. + Json::CharReader* reader(b.newCharReader()); \
  24292. + JSONCPP_STRING error; \
  24293. + if(!reader->parse(buf->payload, buf->payload + buf->header->size, &ROOT, &error)) { \
  24294. + throw invalid_reply_payload_error(auss_t() << "Failed to parse reply on \"" i3IPC_TYPE_STR "\": " << error); \
  24295. + } \
  24296. +}
  24297. +
  24298. +#define IPC_JSON_ASSERT_TYPE(OBJ, OBJ_DESCR, TYPE_CHECK, TYPE_NAME) \
  24299. + {\
  24300. + if (!(OBJ).TYPE_CHECK()) { \
  24301. + throw invalid_reply_payload_error(auss_t() << "Failed to parse reply on \"" i3IPC_TYPE_STR "\": " OBJ_DESCR " expected to be " TYPE_NAME); \
  24302. + } \
  24303. + }
  24304. +#define IPC_JSON_ASSERT_TYPE_OBJECT(OBJ, OBJ_DESCR) IPC_JSON_ASSERT_TYPE(OBJ, OBJ_DESCR, isObject, "an object")
  24305. +#define IPC_JSON_ASSERT_TYPE_ARRAY(OBJ, OBJ_DESCR) IPC_JSON_ASSERT_TYPE(OBJ, OBJ_DESCR, isArray, "an array")
  24306. +#define IPC_JSON_ASSERT_TYPE_BOOL(OBJ, OBJ_DESCR) IPC_JSON_ASSERT_TYPE(OBJ, OBJ_DESCR, isBool, "a bool")
  24307. +#define IPC_JSON_ASSERT_TYPE_INT(OBJ, OBJ_DESCR) IPC_JSON_ASSERT_TYPE(OBJ, OBJ_DESCR, isInt, "an integer")
  24308. +
  24309. +
  24310. +inline rect_t parse_rect_from_json(const Json::Value& value) {
  24311. + rect_t r{};
  24312. + r.x = value["x"].asUInt();
  24313. + r.y = value["y"].asUInt();
  24314. + r.width = value["width"].asUInt();
  24315. + r.height = value["height"].asUInt();
  24316. + return r;
  24317. +}
  24318. +
  24319. +
  24320. +static std::shared_ptr<container_t> parse_container_from_json(const Json::Value& o) {
  24321. +#define i3IPC_TYPE_STR "PARSE CONTAINER FROM JSON"
  24322. + if (o.isNull())
  24323. + return std::shared_ptr<container_t>();
  24324. + std::shared_ptr<container_t> container (new container_t());
  24325. + IPC_JSON_ASSERT_TYPE_OBJECT(o, "o")
  24326. +
  24327. + container->id = o["id"].asUInt64();
  24328. + container->xwindow_id= o["window"].asUInt64();
  24329. + container->name = o["name"].asString();
  24330. + container->type = o["type"].asString();
  24331. + container->current_border_width = o["current_border_width"].asInt();
  24332. + container->percent = o["percent"].asFloat();
  24333. + container->rect = parse_rect_from_json(o["rect"]);
  24334. + container->window_rect = parse_rect_from_json(o["window_rect"]);
  24335. + container->deco_rect = parse_rect_from_json(o["deco_rect"]);
  24336. + container->geometry = parse_rect_from_json(o["geometry"]);
  24337. + container->urgent = o["urgent"].asBool();
  24338. + container->focused = o["focused"].asBool();
  24339. +
  24340. + container->border = BorderStyle::UNKNOWN;
  24341. + std::string border = o["border"].asString();
  24342. + if (border == "normal") {
  24343. + container->border = BorderStyle::NORMAL;
  24344. + } else if (border == "none") {
  24345. + container->border = BorderStyle::NONE;
  24346. + } else if (border == "pixel") {
  24347. + container->border = BorderStyle::PIXEL;
  24348. + } else if (border == "1pixel") {
  24349. + container->border = BorderStyle::ONE_PIXEL;
  24350. + } else {
  24351. + container->border_raw = border;
  24352. + I3IPC_WARN("Got a unknown \"border\" property: \"" << border << "\". Perhaps its neccessary to update i3ipc++. If you are using latest, note maintainer about this")
  24353. + }
  24354. +
  24355. + container->layout = ContainerLayout::UNKNOWN;
  24356. + std::string layout = o["layout"].asString();
  24357. +
  24358. + if (layout == "splith") {
  24359. + container->layout = ContainerLayout::SPLIT_H;
  24360. + } else if (layout == "splitv") {
  24361. + container->layout = ContainerLayout::SPLIT_V;
  24362. + } else if (layout == "stacked") {
  24363. + container->layout = ContainerLayout::STACKED;
  24364. + } else if (layout == "tabbed") {
  24365. + container->layout = ContainerLayout::TABBED;
  24366. + } else if (layout == "dockarea") {
  24367. + container->layout = ContainerLayout::DOCKAREA;
  24368. + } else if (layout == "output") {
  24369. + container->layout = ContainerLayout::OUTPUT;
  24370. + } else {
  24371. + container->layout_raw = border;
  24372. + I3IPC_WARN("Got a unknown \"layout\" property: \"" << layout << "\". Perhaps its neccessary to update i3ipc++. If you are using latest, note maintainer about this")
  24373. + }
  24374. +
  24375. + Json::Value nodes = o["nodes"];
  24376. + if (!nodes.isNull()) {
  24377. + IPC_JSON_ASSERT_TYPE_ARRAY(nodes, "nodes")
  24378. + for (Json::ArrayIndex i = 0; i < nodes.size(); i++) {
  24379. + container->nodes.push_back(parse_container_from_json(nodes[i]));
  24380. + }
  24381. + }
  24382. +
  24383. + return container;
  24384. +#undef i3IPC_TYPE_STR
  24385. +}
  24386. +
  24387. +static std::shared_ptr<workspace_t> parse_workspace_from_json(const Json::Value& value) {
  24388. + if (value.isNull())
  24389. + return std::shared_ptr<workspace_t>();
  24390. + Json::Value num = value["num"];
  24391. + Json::Value name = value["name"];
  24392. + Json::Value visible = value["visible"];
  24393. + Json::Value focused = value["focused"];
  24394. + Json::Value urgent = value["urgent"];
  24395. + Json::Value rect = value["rect"];
  24396. + Json::Value output = value["output"];
  24397. +
  24398. + std::shared_ptr<workspace_t> p (new workspace_t());
  24399. + p->num = num.asInt();
  24400. + p->name = name.asString();
  24401. + p->visible = visible.asBool();
  24402. + p->focused = focused.asBool();
  24403. + p->urgent = urgent.asBool();
  24404. + p->rect = parse_rect_from_json(rect);
  24405. + p->output = output.asString();
  24406. + return p;
  24407. +}
  24408. +
  24409. +static std::shared_ptr<output_t> parse_output_from_json(const Json::Value& value) {
  24410. + if (value.isNull())
  24411. + return std::shared_ptr<output_t>();
  24412. + Json::Value name = value["name"];
  24413. + Json::Value active = value["active"];
  24414. + Json::Value current_workspace = value["current_workspace"];
  24415. + Json::Value rect = value["rect"];
  24416. +
  24417. + std::shared_ptr<output_t> p (new output_t());
  24418. + p->name = name.asString();
  24419. + p->active = active.asBool();
  24420. + p->current_workspace = (current_workspace.isNull() ? std::string() : current_workspace.asString());
  24421. + p->rect = parse_rect_from_json(rect);
  24422. + return p;
  24423. +}
  24424. +
  24425. +static std::shared_ptr<binding_t> parse_binding_from_json(const Json::Value& value) {
  24426. +#define i3IPC_TYPE_STR "PARSE BINDING FROM JSON"
  24427. + if (value.isNull())
  24428. + return std::shared_ptr<binding_t>();
  24429. + IPC_JSON_ASSERT_TYPE_OBJECT(value, "binding")
  24430. + std::shared_ptr<binding_t> b (new binding_t());
  24431. +
  24432. + b->command = value["command"].asString();
  24433. + b->symbol = value["symbol"].asString();
  24434. + b->input_code = value["input_code"].asInt();
  24435. +
  24436. + Json::Value input_type = value["input_type"].asString();
  24437. + if (input_type == "keyboard") {
  24438. + b->input_type = InputType::KEYBOARD;
  24439. + } else if (input_type == "mouse") {
  24440. + b->input_type = InputType::MOUSE;
  24441. + } else {
  24442. + b->input_type = InputType::UNKNOWN;
  24443. + }
  24444. +
  24445. + Json::Value esm_arr = value["event_state_mask"];
  24446. + IPC_JSON_ASSERT_TYPE_ARRAY(esm_arr, "event_state_mask")
  24447. +
  24448. + b->event_state_mask.resize(esm_arr.size());
  24449. +
  24450. + for (Json::ArrayIndex i = 0; i < esm_arr.size(); i++) {
  24451. + b->event_state_mask[i] = esm_arr[i].asString();
  24452. + }
  24453. +
  24454. + return b;
  24455. +#undef i3IPC_TYPE_STR
  24456. +}
  24457. +
  24458. +static std::shared_ptr<mode_t> parse_mode_from_json(const Json::Value& value) {
  24459. + if (value.isNull())
  24460. + return std::shared_ptr<mode_t>();
  24461. + Json::Value change = value["change"];
  24462. + Json::Value pango_markup = value["pango_markup"];
  24463. +
  24464. + std::shared_ptr<mode_t> p (new mode_t());
  24465. + p->change = change.asString();
  24466. + p->pango_markup = pango_markup.asBool();
  24467. + return p;
  24468. +}
  24469. +
  24470. +
  24471. +static std::shared_ptr<bar_config_t> parse_bar_config_from_json(const Json::Value& value) {
  24472. +#define i3IPC_TYPE_STR "PARSE BAR CONFIG FROM JSON"
  24473. + if (value.isNull())
  24474. + return std::shared_ptr<bar_config_t>();
  24475. + IPC_JSON_ASSERT_TYPE_OBJECT(value, "(root)")
  24476. + std::shared_ptr<bar_config_t> bc (new bar_config_t());
  24477. +
  24478. + bc->id = value["id"].asString();
  24479. + bc->status_command = value["status_command"].asString();
  24480. + bc->font = value["font"].asString();
  24481. + bc->workspace_buttons = value["workspace_buttons"].asBool();
  24482. + bc->binding_mode_indicator = value["binding_mode_indicator"].asBool();
  24483. + bc->verbose = value["verbose"].asBool();
  24484. +
  24485. + std::string mode = value["mode"].asString();
  24486. + if (mode == "dock") {
  24487. + bc->mode = BarMode::DOCK;
  24488. + } else if (mode == "hide") {
  24489. + bc->mode = BarMode::HIDE;
  24490. + } else {
  24491. + bc->mode = BarMode::UNKNOWN;
  24492. + I3IPC_WARN("Got a unknown \"mode\" property: \"" << mode << "\". Perhaps its neccessary to update i3ipc++. If you are using latest, note maintainer about this")
  24493. + }
  24494. +
  24495. + std::string position = value["position"].asString();
  24496. + if (position == "top") {
  24497. + bc->position = Position::TOP;
  24498. + } else if (mode == "bottom") {
  24499. + bc->position = Position::BOTTOM;
  24500. + } else {
  24501. + bc->position = Position::UNKNOWN;
  24502. + I3IPC_WARN("Got a unknown \"position\" property: \"" << position << "\". Perhaps its neccessary to update i3ipc++. If you are using latest, note maintainer about this")
  24503. + }
  24504. +
  24505. + Json::Value colors = value["colors"];
  24506. + IPC_JSON_ASSERT_TYPE_OBJECT(value, "colors")
  24507. + auto colors_list = colors.getMemberNames();
  24508. + for (auto& m : colors_list) {
  24509. + bc->colors[m] = std::stoul(colors[m].asString().substr(1), nullptr, 16);
  24510. + }
  24511. +
  24512. + return bc;
  24513. +#undef i3IPC_TYPE_STR
  24514. +}
  24515. +
  24516. +
  24517. +std::string get_socketpath() {
  24518. + std::string str;
  24519. + {
  24520. + auss_t str_buf;
  24521. + FILE* in;
  24522. + char buf[512] = {0};
  24523. + if (!(in = popen("i3 --get-socketpath", "r"))) {
  24524. + throw errno_error("Failed to get socket path");
  24525. + }
  24526. +
  24527. + while (fgets(buf, sizeof(buf), in) != nullptr) {
  24528. + str_buf << buf;
  24529. + }
  24530. + pclose(in);
  24531. + str = str_buf;
  24532. + }
  24533. + if (str.back() == '\n') {
  24534. + str.pop_back();
  24535. + }
  24536. + return str;
  24537. +}
  24538. +
  24539. +
  24540. +connection::connection(const std::string& socket_path) : m_main_socket(i3_connect(socket_path)), m_event_socket(-1), m_subscriptions(0), m_socket_path(socket_path) {
  24541. +#define i3IPC_TYPE_STR "i3's event"
  24542. + on_event = [this](EventType event_type, const std::shared_ptr<const buf_t>& buf) {
  24543. + switch (event_type) {
  24544. + case ET_WORKSPACE: {
  24545. + workspace_event_t ev;
  24546. + Json::Value root;
  24547. + IPC_JSON_READ(root);
  24548. + std::string change = root["change"].asString();
  24549. + if (change == "focus") {
  24550. + ev.type = WorkspaceEventType::FOCUS;
  24551. + } else if (change == "init") {
  24552. + ev.type = WorkspaceEventType::INIT;
  24553. + } else if (change == "empty") {
  24554. + ev.type = WorkspaceEventType::EMPTY;
  24555. + } else if (change == "urgent") {
  24556. + ev.type = WorkspaceEventType::URGENT;
  24557. + } else if (change == "rename") {
  24558. + ev.type = WorkspaceEventType::RENAME;
  24559. + } else if (change == "reload") {
  24560. + ev.type = WorkspaceEventType::RELOAD;
  24561. + } else if (change == "restored") {
  24562. + ev.type = WorkspaceEventType::RESTORED;
  24563. + } else {
  24564. + I3IPC_WARN("Unknown workspace event type " << change)
  24565. + break;
  24566. + }
  24567. + I3IPC_DEBUG("WORKSPACE " << change)
  24568. +
  24569. + Json::Value current = root["current"];
  24570. + Json::Value old = root["old"];
  24571. +
  24572. + if (!current.isNull()) {
  24573. + ev.current = parse_workspace_from_json(current);
  24574. + }
  24575. + if (!old.isNull()) {
  24576. + ev.old = parse_workspace_from_json(old);
  24577. + }
  24578. +
  24579. + if (on_workspace_event) {
  24580. + on_workspace_event(ev);
  24581. + }
  24582. + break;
  24583. + }
  24584. + case ET_OUTPUT:
  24585. + I3IPC_DEBUG("OUTPUT")
  24586. + if (on_output_event) {
  24587. + on_output_event();
  24588. + }
  24589. + break;
  24590. + case ET_MODE: {
  24591. + I3IPC_DEBUG("MODE")
  24592. + Json::Value root;
  24593. + IPC_JSON_READ(root);
  24594. + std::shared_ptr<mode_t> mode_data = parse_mode_from_json(root);
  24595. + if (on_mode_event) {
  24596. + on_mode_event(*mode_data);
  24597. + }
  24598. + break;
  24599. + }
  24600. + case ET_WINDOW: {
  24601. + window_event_t ev;
  24602. + Json::Value root;
  24603. + IPC_JSON_READ(root);
  24604. + std::string change = root["change"].asString();
  24605. + if (change == "new") {
  24606. + ev.type = WindowEventType::NEW;
  24607. + } else if (change == "close") {
  24608. + ev.type = WindowEventType::CLOSE;
  24609. + } else if (change == "focus") {
  24610. + ev.type = WindowEventType::FOCUS;
  24611. + } else if (change == "title") {
  24612. + ev.type = WindowEventType::TITLE;
  24613. + } else if (change == "fullscreen_mode") {
  24614. + ev.type = WindowEventType::FULLSCREEN_MODE;
  24615. + } else if (change == "move") {
  24616. + ev.type = WindowEventType::MOVE;
  24617. + } else if (change == "floating") {
  24618. + ev.type = WindowEventType::FLOATING;
  24619. + } else if (change == "urgent") {
  24620. + ev.type = WindowEventType::URGENT;
  24621. + }
  24622. + I3IPC_DEBUG("WINDOW " << change)
  24623. +
  24624. + Json::Value container = root["container"];
  24625. + if (!container.isNull()) {
  24626. + ev.container = parse_container_from_json(container);
  24627. + }
  24628. +
  24629. + if (on_window_event) {
  24630. + on_window_event(ev);
  24631. + }
  24632. + break;
  24633. + }
  24634. + case ET_BARCONFIG_UPDATE: {
  24635. + I3IPC_DEBUG("BARCONFIG_UPDATE")
  24636. + Json::Value root;
  24637. + IPC_JSON_READ(root);
  24638. + std::shared_ptr<bar_config_t> barconf = parse_bar_config_from_json(root);
  24639. + if (on_barconfig_update_event) {
  24640. + on_barconfig_update_event(*barconf);
  24641. + }
  24642. + break;
  24643. + }
  24644. + case ET_BINDING: {
  24645. + Json::Value root;
  24646. + IPC_JSON_READ(root);
  24647. + std::string change = root["change"].asString();
  24648. + if (change != "run") {
  24649. + I3IPC_WARN("Got \"" << change << "\" in field \"change\" of binding_event. Expected \"run\"")
  24650. + }
  24651. +
  24652. + Json::Value binding_json = root["binding"];
  24653. + std::shared_ptr<binding_t> bptr;
  24654. + if (!binding_json.isNull()) {
  24655. + bptr = parse_binding_from_json(binding_json);
  24656. + }
  24657. +
  24658. + if (!bptr) {
  24659. + I3IPC_ERR("Failed to parse field \"binding\" from binding_event")
  24660. + } else {
  24661. + I3IPC_DEBUG("BINDING " << bptr->symbol);
  24662. + if (on_binding_event) {
  24663. + on_binding_event(*bptr);
  24664. + }
  24665. + }
  24666. + break;
  24667. + }
  24668. + };
  24669. + };
  24670. +#undef i3IPC_TYPE_STR
  24671. +}
  24672. +connection::~connection() {
  24673. + i3_disconnect(m_main_socket);
  24674. + if (m_event_socket > 0)
  24675. + this->disconnect_event_socket();
  24676. +}
  24677. +
  24678. +
  24679. +void connection::connect_event_socket(const bool reconnect) {
  24680. + if (m_event_socket > 0) {
  24681. + if (reconnect) {
  24682. + this->disconnect_event_socket();
  24683. + } else {
  24684. + I3IPC_ERR("Trying to initialize event socket secondary")
  24685. + return;
  24686. + }
  24687. + }
  24688. + m_event_socket = i3_connect(m_socket_path);
  24689. + this->subscribe(m_subscriptions);
  24690. +}
  24691. +
  24692. +
  24693. +void connection::disconnect_event_socket() {
  24694. + if (m_event_socket <= 0) {
  24695. + I3IPC_WARN("Trying to disconnect non-connected event socket")
  24696. + return;
  24697. + }
  24698. + i3_disconnect(m_event_socket);
  24699. +}
  24700. +
  24701. +
  24702. +bool connection::handle_event() {
  24703. + if (m_event_socket <= 0) {
  24704. + this->connect_event_socket();
  24705. + }
  24706. +
  24707. + auto buf = i3_recv(m_event_socket);
  24708. +
  24709. + if (buf && this->on_event) {
  24710. + this->on_event(static_cast<EventType>(1 << (buf->header->type & 0x7f)), std::static_pointer_cast<const buf_t>(buf));
  24711. + } else if (buf) {
  24712. + return true;
  24713. + }
  24714. + return false;
  24715. +}
  24716. +
  24717. +
  24718. +bool connection::subscribe(const int32_t events) {
  24719. +#define i3IPC_TYPE_STR "SUBSCRIBE"
  24720. + if (m_event_socket <= 0) {
  24721. + m_subscriptions |= events;
  24722. + return true;
  24723. + }
  24724. + std::string payload;
  24725. + {
  24726. + auss_t payload_auss;
  24727. + if (events & static_cast<int32_t>(ET_WORKSPACE)) {
  24728. + payload_auss << "\"workspace\",";
  24729. + }
  24730. + if (events & static_cast<int32_t>(ET_OUTPUT)) {
  24731. + payload_auss << "\"output\",";
  24732. + }
  24733. + if (events & static_cast<int32_t>(ET_MODE)) {
  24734. + payload_auss << "\"mode\",";
  24735. + }
  24736. + if (events & static_cast<int32_t>(ET_WINDOW)) {
  24737. + payload_auss << "\"window\",";
  24738. + }
  24739. + if (events & static_cast<int32_t>(ET_BARCONFIG_UPDATE)) {
  24740. + payload_auss << "\"barconfig_update\",";
  24741. + }
  24742. + if (events & static_cast<int32_t>(ET_BINDING)) {
  24743. + payload_auss << "\"binding\",";
  24744. + }
  24745. + payload = payload_auss;
  24746. + if (payload.empty()) {
  24747. + return true;
  24748. + }
  24749. + payload.pop_back();
  24750. + }
  24751. + I3IPC_DEBUG("i3 IPC subscriptions: " << payload)
  24752. +
  24753. + auto buf = i3_msg(m_event_socket, ClientMessageType::SUBSCRIBE, auss_t() << '[' << payload << ']');
  24754. + Json::Value root;
  24755. + IPC_JSON_READ(root)
  24756. +
  24757. + m_subscriptions |= events;
  24758. +
  24759. + return root["success"].asBool();
  24760. +#undef i3IPC_TYPE_STR
  24761. +}
  24762. +
  24763. +
  24764. +version_t connection::get_version() const {
  24765. +#define i3IPC_TYPE_STR "GET_VERSION"
  24766. + auto buf = i3_msg(m_main_socket, ClientMessageType::GET_VERSION);
  24767. + Json::Value root;
  24768. + IPC_JSON_READ(root)
  24769. + IPC_JSON_ASSERT_TYPE_OBJECT(root, "root")
  24770. +
  24771. + version_t v{};
  24772. + v.human_readable = root["human_readable"].asString();
  24773. + v.loaded_config_file_name = root["loaded_config_file_name"].asString();
  24774. + v.major = root["major"].asUInt();
  24775. + v.minor = root["minor"].asUInt();
  24776. + v.patch = root["patch"].asUInt();
  24777. + return v;
  24778. +#undef i3IPC_TYPE_STR
  24779. +}
  24780. +
  24781. +
  24782. +std::shared_ptr<container_t> connection::get_tree() const {
  24783. +#define i3IPC_TYPE_STR "GET_TREE"
  24784. + auto buf = i3_msg(m_main_socket, ClientMessageType::GET_TREE);
  24785. + Json::Value root;
  24786. + IPC_JSON_READ(root);
  24787. + return parse_container_from_json(root);
  24788. +#undef i3IPC_TYPE_STR
  24789. +}
  24790. +
  24791. +
  24792. +std::vector< std::shared_ptr<output_t> > connection::get_outputs() const {
  24793. +#define i3IPC_TYPE_STR "GET_OUTPUTS"
  24794. + auto buf = i3_msg(m_main_socket, ClientMessageType::GET_OUTPUTS);
  24795. + Json::Value root;
  24796. + IPC_JSON_READ(root)
  24797. + IPC_JSON_ASSERT_TYPE_ARRAY(root, "root")
  24798. +
  24799. + std::vector< std::shared_ptr<output_t> > outputs;
  24800. +
  24801. + for (auto w : root) {
  24802. + outputs.push_back(parse_output_from_json(w));
  24803. + }
  24804. +
  24805. + return outputs;
  24806. +#undef i3IPC_TYPE_STR
  24807. +}
  24808. +
  24809. +
  24810. +std::vector< std::shared_ptr<workspace_t> > connection::get_workspaces() const {
  24811. +#define i3IPC_TYPE_STR "GET_WORKSPACES"
  24812. + auto buf = i3_msg(m_main_socket, ClientMessageType::GET_WORKSPACES);
  24813. + Json::Value root;
  24814. + IPC_JSON_READ(root)
  24815. + IPC_JSON_ASSERT_TYPE_ARRAY(root, "root")
  24816. +
  24817. + std::vector< std::shared_ptr<workspace_t> > workspaces;
  24818. +
  24819. + for (auto w : root) {
  24820. + workspaces.push_back(parse_workspace_from_json(w));
  24821. + }
  24822. +
  24823. + return workspaces;
  24824. +#undef i3IPC_TYPE_STR
  24825. +}
  24826. +
  24827. +
  24828. +std::vector<std::string> connection::get_bar_configs_list() const {
  24829. +#define i3IPC_TYPE_STR "GET_BAR_CONFIG (get_bar_configs_list)"
  24830. + auto buf = i3_msg(m_main_socket, ClientMessageType::GET_BAR_CONFIG);
  24831. + Json::Value root;
  24832. + IPC_JSON_READ(root)
  24833. + IPC_JSON_ASSERT_TYPE_ARRAY(root, "root")
  24834. +
  24835. + std::vector<std::string> l;
  24836. +
  24837. + for (auto w : root) {
  24838. + l.push_back(w.asString());
  24839. + }
  24840. +
  24841. + return l;
  24842. +#undef i3IPC_TYPE_STR
  24843. +}
  24844. +
  24845. +
  24846. +std::shared_ptr<bar_config_t> connection::get_bar_config(const std::string& name) const {
  24847. +#define i3IPC_TYPE_STR "GET_BAR_CONFIG"
  24848. + auto buf = i3_msg(m_main_socket, ClientMessageType::GET_BAR_CONFIG, name);
  24849. + Json::Value root;
  24850. + IPC_JSON_READ(root)
  24851. + return parse_bar_config_from_json(root);
  24852. +#undef i3IPC_TYPE_STR
  24853. +}
  24854. +
  24855. +
  24856. +bool connection::send_command(const std::string& command) const {
  24857. +#define i3IPC_TYPE_STR "COMMAND"
  24858. + auto buf = i3_msg(m_main_socket, ClientMessageType::COMMAND, command);
  24859. + Json::Value root;
  24860. + IPC_JSON_READ(root)
  24861. + IPC_JSON_ASSERT_TYPE_ARRAY(root, "root")
  24862. + Json::Value payload = root[0];
  24863. + IPC_JSON_ASSERT_TYPE_OBJECT(payload, " first item of root")
  24864. +
  24865. + if (payload["success"].asBool()) {
  24866. + return true;
  24867. + } else {
  24868. + Json::Value error = payload["error"];
  24869. + if (!error.isNull()) {
  24870. + I3IPC_ERR("Failed to execute command: " << error.asString())
  24871. + }
  24872. + return false;
  24873. + }
  24874. +#undef i3IPC_TYPE_STR
  24875. +}
  24876. +
  24877. +int32_t connection::get_main_socket_fd() { return m_main_socket; }
  24878. +
  24879. +int32_t connection::get_event_socket_fd() { return m_event_socket; }
  24880. +
  24881. +
  24882. +const version_t& get_version() {
  24883. +#define I3IPC_VERSION_MAJOR 0
  24884. +#define I3IPC_VERSION_MINOR 4
  24885. +#define I3IPC_VERSION_PATCH 0
  24886. + static version_t v{};
  24887. + v.human_readable = auss_t() << I3IPC_VERSION_MAJOR << '.' << I3IPC_VERSION_MINOR << '.' << I3IPC_VERSION_PATCH;
  24888. + v.loaded_config_file_name = std::string();
  24889. + v.major = I3IPC_VERSION_MAJOR;
  24890. + v.minor = I3IPC_VERSION_MINOR;
  24891. + v.patch = I3IPC_VERSION_PATCH;
  24892. + return v;
  24893. +}
  24894. +
  24895. +}
  24896. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/src/ipc-util.cpp polybar-3.2.1/lib/i3ipcpp/src/ipc-util.cpp
  24897. --- polybar-3.2.1.orig/lib/i3ipcpp/src/ipc-util.cpp 1970-01-01 02:00:00.000000000 +0200
  24898. +++ polybar-3.2.1/lib/i3ipcpp/src/ipc-util.cpp 2017-12-03 19:05:22.000000000 +0300
  24899. @@ -0,0 +1,172 @@
  24900. +extern "C" {
  24901. +#include <sys/types.h>
  24902. +#include <sys/socket.h>
  24903. +#include <sys/un.h>
  24904. +#include <unistd.h>
  24905. +#include <fcntl.h>
  24906. +#include <sys/socket.h>
  24907. +#include <errno.h>
  24908. +}
  24909. +
  24910. +#include <cstring>
  24911. +#include <ios>
  24912. +
  24913. +#include <auss.hpp>
  24914. +
  24915. +#include "i3ipc++/ipc-util.hpp"
  24916. +
  24917. +namespace i3ipc {
  24918. +
  24919. +static std::string format_errno(const std::string& msg = std::string()) {
  24920. + auss_t a;
  24921. + if (msg.size() > 0)
  24922. + a << msg << ": ";
  24923. + a << "errno " << errno << " (" << strerror(errno) << ')';
  24924. + return a;
  24925. +}
  24926. +
  24927. +errno_error::errno_error() : ipc_error(format_errno()) {}
  24928. +errno_error::errno_error(const std::string& msg) : ipc_error(format_errno(msg)) {}
  24929. +
  24930. +static const std::string g_i3_ipc_magic = "i3-ipc";
  24931. +
  24932. +buf_t::buf_t(uint32_t payload_size) : size(sizeof(header_t) + payload_size) {
  24933. + data = new uint8_t[size];
  24934. + header = (header_t*)data;
  24935. + payload = (char*)(data + sizeof(header_t));
  24936. + strncpy(header->magic, g_i3_ipc_magic.c_str(), sizeof(header->magic));
  24937. + header->size = payload_size;
  24938. + header->type = 0x0;
  24939. +}
  24940. +buf_t::~buf_t() {
  24941. + delete[] data;
  24942. +}
  24943. +
  24944. +void buf_t::realloc_payload_to_header() {
  24945. + uint8_t* new_data = new uint8_t[sizeof(header_t) + header->size];
  24946. + memcpy(new_data, header, sizeof(header_t));
  24947. + delete[] data;
  24948. + data = new_data;
  24949. + header = (header_t*)data;
  24950. + payload = (char*)(data + sizeof(header_t));
  24951. +}
  24952. +
  24953. +
  24954. +int32_t i3_connect(const std::string& socket_path) {
  24955. + int32_t sockfd = socket(AF_LOCAL, SOCK_STREAM, 0);
  24956. + if (sockfd == -1) {
  24957. + throw errno_error("Could not create a socket");
  24958. + }
  24959. +
  24960. + (void)fcntl(sockfd, F_SETFD, FD_CLOEXEC); // What for?
  24961. +
  24962. + struct sockaddr_un addr;
  24963. + memset(&addr, 0, sizeof(struct sockaddr_un));
  24964. + addr.sun_family = AF_LOCAL;
  24965. + strncpy(addr.sun_path, socket_path.c_str(), sizeof(addr.sun_path) - 1);
  24966. + if (connect(sockfd, (const struct sockaddr*)&addr, sizeof(struct sockaddr_un)) < 0) {
  24967. + throw errno_error("Failed to connect to i3");
  24968. + }
  24969. +
  24970. + return sockfd;
  24971. +}
  24972. +
  24973. +
  24974. +void i3_disconnect(const int32_t sockfd) {
  24975. + close(sockfd);
  24976. +}
  24977. +
  24978. +
  24979. +std::shared_ptr<buf_t> i3_pack(const ClientMessageType type, const std::string& payload) {
  24980. + buf_t* buff = new buf_t(payload.length());
  24981. + buff->header->type = static_cast<uint32_t>(type);
  24982. + strncpy(buff->payload, payload.c_str(), buff->header->size);
  24983. + return std::shared_ptr<buf_t>(buff);
  24984. +}
  24985. +
  24986. +ssize_t writeall(int fd, const uint8_t* buf, size_t count) {
  24987. + size_t written = 0;
  24988. + ssize_t n = 0;
  24989. +
  24990. + while (written < count) {
  24991. + n = write(fd, buf + written, count - written);
  24992. + if (n == -1) {
  24993. + if (errno == EINTR || errno == EAGAIN)
  24994. + continue;
  24995. + return n;
  24996. + }
  24997. + written += (size_t)n;
  24998. + }
  24999. +
  25000. + return written;
  25001. +}
  25002. +
  25003. +ssize_t swrite(int fd, const uint8_t* buf, size_t count) {
  25004. + ssize_t n;
  25005. +
  25006. + n = writeall(fd, buf, count);
  25007. + if (n == -1)
  25008. + throw errno_error(auss_t() << "Failed to write " << std::hex << fd);
  25009. + else
  25010. + return n;
  25011. +}
  25012. +
  25013. +void i3_send(const int32_t sockfd, const buf_t& buff) {
  25014. + swrite(sockfd, buff.data, buff.size);
  25015. +}
  25016. +
  25017. +std::shared_ptr<buf_t> i3_recv(const int32_t sockfd) {
  25018. + auto buff = std::make_shared<buf_t>(0);
  25019. + const uint32_t header_size = sizeof(header_t);
  25020. +
  25021. + {
  25022. + uint8_t* header = (uint8_t*)buff->header;
  25023. + uint32_t readed = 0;
  25024. + while (readed < header_size) {
  25025. + int n = read(sockfd, header + readed, header_size - readed);
  25026. + if (n == -1) {
  25027. + throw errno_error(auss_t() << "Failed to read header from socket 0x" << std::hex << sockfd);
  25028. + }
  25029. + if (n == 0) {
  25030. + throw eof_error("Unexpected EOF while reading header");
  25031. + }
  25032. +
  25033. + readed += n;
  25034. + }
  25035. + }
  25036. +
  25037. + if (g_i3_ipc_magic != std::string(buff->header->magic, g_i3_ipc_magic.length())) {
  25038. + throw invalid_header_error("Invalid magic in reply");
  25039. + }
  25040. +
  25041. + buff->realloc_payload_to_header();
  25042. +
  25043. + {
  25044. + uint32_t readed = 0;
  25045. + int n;
  25046. + while (readed < buff->header->size) {
  25047. + if ((n = read(sockfd, buff->payload + readed, buff->header->size - readed)) == -1) {
  25048. + if (errno == EINTR || errno == EAGAIN)
  25049. + continue;
  25050. + throw errno_error(auss_t() << "Failed to read payload from socket 0x" << std::hex << sockfd);
  25051. + }
  25052. +
  25053. + readed += n;
  25054. + }
  25055. + }
  25056. +
  25057. + return buff;
  25058. +}
  25059. +
  25060. +
  25061. +std::shared_ptr<buf_t> i3_msg(const int32_t sockfd, const ClientMessageType type, const std::string& payload) {
  25062. + auto send_buff = i3_pack(type, payload);
  25063. + i3_send(sockfd, *send_buff);
  25064. + auto recv_buff = i3_recv(sockfd);
  25065. + if (send_buff->header->type != recv_buff->header->type) {
  25066. + throw invalid_header_error(auss_t() << "Invalid reply type: Expected 0x" << std::hex << send_buff->header->type << ", got 0x" << recv_buff->header->type);
  25067. + }
  25068. + return recv_buff;
  25069. +}
  25070. +
  25071. +}
  25072. diff -Nuar polybar-3.2.1.orig/lib/i3ipcpp/test/test_ipc.hpp polybar-3.2.1/lib/i3ipcpp/test/test_ipc.hpp
  25073. --- polybar-3.2.1.orig/lib/i3ipcpp/test/test_ipc.hpp 1970-01-01 02:00:00.000000000 +0200
  25074. +++ polybar-3.2.1/lib/i3ipcpp/test/test_ipc.hpp 2017-12-03 19:05:22.000000000 +0300
  25075. @@ -0,0 +1,28 @@
  25076. +#include <iostream>
  25077. +
  25078. +#include <auss.hpp>
  25079. +
  25080. +#include "ipc-util.hpp"
  25081. +
  25082. +#include <cxxtest/TestSuite.h>
  25083. +
  25084. +class testsuite_ipc_util : public CxxTest::TestSuite {
  25085. +public:
  25086. + void test_pack() {
  25087. + {
  25088. + using namespace i3ipc;
  25089. + auto buff = i3_pack(ClientMessageType::COMMAND, "exit");
  25090. + auss_t auss;
  25091. + auss << std::hex;
  25092. + for (uint32_t i = 0; i < buff->size; i++) {
  25093. + if (buff->data[i] < 0x10) {
  25094. + auss << '0';
  25095. + }
  25096. + auss << static_cast<uint32_t>(buff->data[i]) << ' ';
  25097. + }
  25098. + std::string str = auss;
  25099. + str.pop_back();
  25100. + TS_ASSERT_EQUALS(str, "69 33 2d 69 70 63 04 00 00 00 00 00 00 00 65 78 69 74")
  25101. + }
  25102. + }
  25103. +};
  25104. diff -Nuar polybar-3.2.1.orig/lib/xpp/cmake/FindX11_XCB.cmake polybar-3.2.1/lib/xpp/cmake/FindX11_XCB.cmake
  25105. --- polybar-3.2.1.orig/lib/xpp/cmake/FindX11_XCB.cmake 1970-01-01 02:00:00.000000000 +0200
  25106. +++ polybar-3.2.1/lib/xpp/cmake/FindX11_XCB.cmake 2017-08-30 16:02:01.000000000 +0300
  25107. @@ -0,0 +1,31 @@
  25108. +# - Try to find libX11-xcb
  25109. +# Once done this will define
  25110. +#
  25111. +# X11_XCB_FOUND - system has libX11-xcb
  25112. +# X11_XCB_LIBRARIES - Link these to use libX11-xcb
  25113. +# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir
  25114. +# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb
  25115. +
  25116. +# Copyright (c) 2011 Fredrik Höglund <fredrik@kde.org>
  25117. +# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
  25118. +# Copyright (c) 2007 Matthias Kretz, <kretz@kde.org>
  25119. +#
  25120. +# Redistribution and use is allowed according to the terms of the BSD license.
  25121. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  25122. +
  25123. +IF (NOT WIN32)
  25124. + # use pkg-config to get the directories and then use these values
  25125. + # in the FIND_PATH() and FIND_LIBRARY() calls
  25126. + FIND_PACKAGE(PkgConfig)
  25127. + PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb)
  25128. +
  25129. + SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS})
  25130. +
  25131. + FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS})
  25132. + FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS})
  25133. +
  25134. + include(FindPackageHandleStandardArgs)
  25135. + FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR)
  25136. +
  25137. + MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES)
  25138. +ENDIF (NOT WIN32)
  25139. diff -Nuar polybar-3.2.1.orig/lib/xpp/cmake/FindXCB.cmake polybar-3.2.1/lib/xpp/cmake/FindXCB.cmake
  25140. --- polybar-3.2.1.orig/lib/xpp/cmake/FindXCB.cmake 1970-01-01 02:00:00.000000000 +0200
  25141. +++ polybar-3.2.1/lib/xpp/cmake/FindXCB.cmake 2017-08-30 16:02:01.000000000 +0300
  25142. @@ -0,0 +1,250 @@
  25143. +# Try to find XCB on a Unix system
  25144. +#
  25145. +# This will define:
  25146. +#
  25147. +# XCB_FOUND - True if xcb is available
  25148. +# XCB_LIBRARIES - Link these to use xcb
  25149. +# XCB_INCLUDE_DIRS - Include directory for xcb
  25150. +# XCB_DEFINITIONS - Compiler flags for using xcb
  25151. +#
  25152. +# In addition the following more fine grained variables will be defined:
  25153. +#
  25154. +# XCB_XCB_FOUND XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARY
  25155. +# XCB_UTIL_FOUND XCB_UTIL_INCLUDE_DIR XCB_UTIL_LIBRARY
  25156. +# XCB_COMPOSITE_FOUND XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARY
  25157. +# XCB_DAMAGE_FOUND XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARY
  25158. +# XCB_XFIXES_FOUND XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARY
  25159. +# XCB_RENDER_FOUND XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARY
  25160. +# XCB_RANDR_FOUND XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARY
  25161. +# XCB_SHAPE_FOUND XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARY
  25162. +# XCB_DRI2_FOUND XCB_DRI2_INCLUDE_DIR XCB_DRI2_LIBRARY
  25163. +# XCB_GLX_FOUND XCB_GLX_INCLUDE_DIR XCB_GLX_LIBRARY
  25164. +# XCB_SHM_FOUND XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARY
  25165. +# XCB_XV_FOUND XCB_XV_INCLUDE_DIR XCB_XV_LIBRARY
  25166. +# XCB_SYNC_FOUND XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARY
  25167. +# XCB_XTEST_FOUND XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARY
  25168. +# XCB_ICCCM_FOUND XCB_ICCCM_INCLUDE_DIR XCB_ICCCM_LIBRARY
  25169. +# XCB_EWMH_FOUND XCB_EWMH_INCLUDE_DIR XCB_EWMH_LIBRARY
  25170. +# XCB_IMAGE_FOUND XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARY
  25171. +# XCB_RENDERUTIL_FOUND XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARY
  25172. +# XCB_KEYSYMS_FOUND XCB_KEYSYMS_INCLUDE_DIR XCB_KEYSYMS_LIBRARY
  25173. +#
  25174. +# Copyright (c) 2011 Fredrik Höglund <fredrik@kde.org>
  25175. +# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
  25176. +#
  25177. +# Redistribution and use is allowed according to the terms of the BSD license.
  25178. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  25179. +
  25180. +set(knownComponents XCB
  25181. + COMPOSITE
  25182. + DAMAGE
  25183. + DRI2
  25184. + EWMH
  25185. + GLX
  25186. + ICCCM
  25187. + IMAGE
  25188. + KEYSYMS
  25189. + RANDR
  25190. + RENDER
  25191. + RENDERUTIL
  25192. + SHAPE
  25193. + SHM
  25194. + SYNC
  25195. + UTIL
  25196. + XFIXES
  25197. + XTEST
  25198. + XV
  25199. + XINERAMA
  25200. + XKB)
  25201. +
  25202. +unset(unknownComponents)
  25203. +
  25204. +set(pkgConfigModules)
  25205. +set(requiredComponents)
  25206. +
  25207. +if (XCB_FIND_COMPONENTS)
  25208. + set(comps ${XCB_FIND_COMPONENTS})
  25209. +else()
  25210. + set(comps ${knownComponents})
  25211. +endif()
  25212. +
  25213. +# iterate through the list of requested components, and check that we know them all.
  25214. +# If not, fail.
  25215. +foreach(comp ${comps})
  25216. + list(FIND knownComponents ${comp} index )
  25217. + if("${index}" STREQUAL "-1")
  25218. + list(APPEND unknownComponents "${comp}")
  25219. + else()
  25220. + if("${comp}" STREQUAL "XCB")
  25221. + list(APPEND pkgConfigModules "xcb")
  25222. + elseif("${comp}" STREQUAL "COMPOSITE")
  25223. + list(APPEND pkgConfigModules "xcb-composite")
  25224. + elseif("${comp}" STREQUAL "DAMAGE")
  25225. + list(APPEND pkgConfigModules "xcb-damage")
  25226. + elseif("${comp}" STREQUAL "DRI2")
  25227. + list(APPEND pkgConfigModules "xcb-dri2")
  25228. + elseif("${comp}" STREQUAL "EWMH")
  25229. + list(APPEND pkgConfigModules "xcb-ewmh")
  25230. + elseif("${comp}" STREQUAL "GLX")
  25231. + list(APPEND pkgConfigModules "xcb-glx")
  25232. + elseif("${comp}" STREQUAL "ICCCM")
  25233. + list(APPEND pkgConfigModules "xcb-icccm")
  25234. + elseif("${comp}" STREQUAL "IMAGE")
  25235. + list(APPEND pkgConfigModules "xcb-image")
  25236. + elseif("${comp}" STREQUAL "KEYSYMS")
  25237. + list(APPEND pkgConfigModules "xcb-keysyms")
  25238. + elseif("${comp}" STREQUAL "RANDR")
  25239. + list(APPEND pkgConfigModules "xcb-randr")
  25240. + elseif("${comp}" STREQUAL "RENDER")
  25241. + list(APPEND pkgConfigModules "xcb-render")
  25242. + elseif("${comp}" STREQUAL "RENDERUTIL")
  25243. + list(APPEND pkgConfigModules "xcb-renderutil")
  25244. + elseif("${comp}" STREQUAL "SHAPE")
  25245. + list(APPEND pkgConfigModules "xcb-shape")
  25246. + elseif("${comp}" STREQUAL "SHM")
  25247. + list(APPEND pkgConfigModules "xcb-shm")
  25248. + elseif("${comp}" STREQUAL "SYNC")
  25249. + list(APPEND pkgConfigModules "xcb-sync")
  25250. + elseif("${comp}" STREQUAL "UTIL")
  25251. + list(APPEND pkgConfigModules "xcb-util")
  25252. + elseif("${comp}" STREQUAL "XFIXES")
  25253. + list(APPEND pkgConfigModules "xcb-xfixes")
  25254. + elseif("${comp}" STREQUAL "XTEST")
  25255. + list(APPEND pkgConfigModules "xcb-xtest")
  25256. + elseif("${comp}" STREQUAL "XV")
  25257. + list(APPEND pkgConfigModules "xcb-xv")
  25258. + elseif("${comp}" STREQUAL "XINERAMA")
  25259. + list(APPEND pkgConfigModules "xcb-xinerama")
  25260. + elseif("${comp}" STREQUAL "XKB")
  25261. + list(APPEND pkgConfigModules "xcb-xkb")
  25262. + endif()
  25263. + endif()
  25264. +endforeach()
  25265. +
  25266. +
  25267. +if(DEFINED unknownComponents)
  25268. + set(msgType STATUS)
  25269. + if(XCB_FIND_REQUIRED)
  25270. + set(msgType FATAL_ERROR)
  25271. + endif()
  25272. + if(NOT XCB_FIND_QUIETLY)
  25273. + message(${msgType} "XCB: requested unknown components ${unknownComponents}")
  25274. + endif()
  25275. + return()
  25276. +endif()
  25277. +
  25278. +macro(_XCB_HANDLE_COMPONENT _comp)
  25279. + set(_header )
  25280. + set(_lib )
  25281. + if("${_comp}" STREQUAL "XCB")
  25282. + set(_header "xcb/xcb.h")
  25283. + set(_lib "xcb")
  25284. + elseif("${_comp}" STREQUAL "COMPOSITE")
  25285. + set(_header "xcb/composite.h")
  25286. + set(_lib "xcb-composite")
  25287. + elseif("${_comp}" STREQUAL "DAMAGE")
  25288. + set(_header "xcb/damage.h")
  25289. + set(_lib "xcb-damage")
  25290. + elseif("${_comp}" STREQUAL "DRI2")
  25291. + set(_header "xcb/dri2.h")
  25292. + set(_lib "xcb-dri2")
  25293. + elseif("${_comp}" STREQUAL "EWMH")
  25294. + set(_header "xcb/xcb_ewmh.h")
  25295. + set(_lib "xcb-ewmh")
  25296. + elseif("${_comp}" STREQUAL "GLX")
  25297. + set(_header "xcb/glx.h")
  25298. + set(_lib "xcb-glx")
  25299. + elseif("${_comp}" STREQUAL "ICCCM")
  25300. + set(_header "xcb/xcb_icccm.h")
  25301. + set(_lib "xcb-icccm")
  25302. + elseif("${_comp}" STREQUAL "IMAGE")
  25303. + set(_header "xcb/xcb_image.h")
  25304. + set(_lib "xcb-image")
  25305. + elseif("${_comp}" STREQUAL "KEYSYMS")
  25306. + set(_header "xcb/xcb_keysyms.h")
  25307. + set(_lib "xcb-keysyms")
  25308. + elseif("${_comp}" STREQUAL "RANDR")
  25309. + set(_header "xcb/randr.h")
  25310. + set(_lib "xcb-randr")
  25311. + elseif("${_comp}" STREQUAL "RENDER")
  25312. + set(_header "xcb/render.h")
  25313. + set(_lib "xcb-render")
  25314. + elseif("${_comp}" STREQUAL "RENDERUTIL")
  25315. + set(_header "xcb/xcb_renderutil.h")
  25316. + set(_lib "xcb-render-util")
  25317. + elseif("${_comp}" STREQUAL "SHAPE")
  25318. + set(_header "xcb/shape.h")
  25319. + set(_lib "xcb-shape")
  25320. + elseif("${_comp}" STREQUAL "SHM")
  25321. + set(_header "xcb/shm.h")
  25322. + set(_lib "xcb-shm")
  25323. + elseif("${_comp}" STREQUAL "SYNC")
  25324. + set(_header "xcb/sync.h")
  25325. + set(_lib "xcb-sync")
  25326. + elseif("${_comp}" STREQUAL "UTIL")
  25327. + set(_header "xcb/xcb_util.h")
  25328. + set(_lib "xcb-util")
  25329. + elseif("${_comp}" STREQUAL "XFIXES")
  25330. + set(_header "xcb/xfixes.h")
  25331. + set(_lib "xcb-xfixes")
  25332. + elseif("${_comp}" STREQUAL "XTEST")
  25333. + set(_header "xcb/xtest.h")
  25334. + set(_lib "xcb-xtest")
  25335. + elseif("${_comp}" STREQUAL "XV")
  25336. + set(_header "xcb/xv.h")
  25337. + set(_lib "xcb-xv")
  25338. + elseif("${_comp}" STREQUAL "XINERAMA")
  25339. + set(_header "xcb/xinerama.h")
  25340. + set(_lib "xcb-xinerama")
  25341. + elseif("${_comp}" STREQUAL "XKB")
  25342. + set(_header "xcb/xkb.h")
  25343. + set(_lib "xcb-xkb")
  25344. + endif()
  25345. +
  25346. + find_path(XCB_${_comp}_INCLUDE_DIR NAMES ${_header} HINTS ${PKG_XCB_INCLUDE_DIRS})
  25347. + find_library(XCB_${_comp}_LIBRARY NAMES ${_lib} HINTS ${PKG_XCB_LIBRARY_DIRS})
  25348. +
  25349. + if(XCB_${_comp}_INCLUDE_DIR AND XCB_${_comp}_LIBRARY)
  25350. + list(APPEND XCB_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR})
  25351. + list(APPEND XCB_LIBRARIES ${XCB_${_comp}_LIBRARY})
  25352. + if (NOT XCB_FIND_QUIETLY)
  25353. + message(STATUS "XCB[${_comp}]: Found component ${_comp}")
  25354. + endif()
  25355. + endif()
  25356. +
  25357. + if(XCB_FIND_REQUIRED_${_comp})
  25358. + list(APPEND requiredComponents XCB_${_comp}_FOUND)
  25359. + endif()
  25360. +
  25361. + find_package_handle_standard_args(XCB_${_comp} DEFAULT_MSG XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR)
  25362. +
  25363. + mark_as_advanced(XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR)
  25364. +
  25365. + # compatibility for old variable naming
  25366. + set(XCB_${_comp}_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR})
  25367. + set(XCB_${_comp}_LIBRARIES ${XCB_${_comp}_LIBRARY})
  25368. +endmacro()
  25369. +
  25370. +IF (NOT WIN32)
  25371. + include(FindPackageHandleStandardArgs)
  25372. + # Use pkg-config to get the directories and then use these values
  25373. + # in the FIND_PATH() and FIND_LIBRARY() calls
  25374. + find_package(PkgConfig)
  25375. + pkg_check_modules(PKG_XCB QUIET ${pkgConfigModules})
  25376. +
  25377. + set(XCB_DEFINITIONS ${PKG_XCB_CFLAGS})
  25378. +
  25379. + foreach(comp ${comps})
  25380. + _xcb_handle_component(${comp})
  25381. + endforeach()
  25382. +
  25383. + if(XCB_INCLUDE_DIRS)
  25384. + list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS)
  25385. + endif()
  25386. +
  25387. + find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS ${requiredComponents})
  25388. +
  25389. + # compatibility for old variable naming
  25390. + set(XCB_INCLUDE_DIR ${XCB_INCLUDE_DIRS})
  25391. +
  25392. +ENDIF (NOT WIN32)
  25393. diff -Nuar polybar-3.2.1.orig/lib/xpp/CMakeLists.txt polybar-3.2.1/lib/xpp/CMakeLists.txt
  25394. --- polybar-3.2.1.orig/lib/xpp/CMakeLists.txt 1970-01-01 02:00:00.000000000 +0200
  25395. +++ polybar-3.2.1/lib/xpp/CMakeLists.txt 2017-08-30 16:02:01.000000000 +0300
  25396. @@ -0,0 +1,178 @@
  25397. +cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
  25398. +project(xpp)
  25399. +
  25400. +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
  25401. +
  25402. +#
  25403. +# Process dependencies
  25404. +#
  25405. +find_package(PkgConfig)
  25406. +pkg_check_modules(XCBPROTO REQUIRED xcb-proto)
  25407. +
  25408. +find_package(PythonInterp 2.7 REQUIRED)
  25409. +find_package(XCB REQUIRED XCB ICCCM EWMH UTIL IMAGE)
  25410. +
  25411. +if(NOT PYTHON_EXECUTABLE)
  25412. + message(FATAL_ERROR "Missing PYTHON_EXECUTABLE")
  25413. +endif()
  25414. +
  25415. +set(XPP_INCLUDE_DIRS
  25416. + ${PROJECT_SOURCE_DIR}/include
  25417. + ${XCB_XCB_INCLUDE_DIR}
  25418. + ${XCB_EWMH_INCLUDE_DIR}
  25419. + ${XCB_ICCCM_INCLUDE_DIR}
  25420. + ${XCB_UTIL_INCLUDE_DIR}
  25421. + ${XCB_IMAGE_INCLUDE_DIR})
  25422. +set(XPP_LIBRARIES
  25423. + ${XCB_XCB_LIBRARY}
  25424. + ${XCB_EWMH_LIBRARY}
  25425. + ${XCB_ICCCM_LIBRARY}
  25426. + ${XCB_UTIL_LIBRARY}
  25427. + ${XCB_IMAGE_LIBRARY})
  25428. +
  25429. +#
  25430. +# Loop through a hardcoded list of python executables to locate the python module "xcbgen"
  25431. +#
  25432. +foreach(CURRENT_EXECUTABLE python2 python3 python)
  25433. + message(STATUS "Searching for xcbgen with " ${CURRENT_EXECUTABLE})
  25434. +
  25435. + execute_process(COMMAND "${CURRENT_EXECUTABLE}" "-c"
  25436. + "import re,xcbgen;print(re.compile('/xcbgen/__init__.py.*').sub('',xcbgen.__file__))"
  25437. + RESULT_VARIABLE _xcbgen_status
  25438. + OUTPUT_VARIABLE _xcbgen_location
  25439. + ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
  25440. +
  25441. + # When a shell script returns successfully its return code is 0
  25442. + if(_xcbgen_status EQUAL 0)
  25443. + set(PYTHON_XCBGEN "${_xcbgen_location}" CACHE STRING "Location of python module: xcbgen ")
  25444. + message(STATUS "Found xcbgen in " ${PYTHON_XCBGEN})
  25445. + break()
  25446. + endif()
  25447. +
  25448. +endforeach(CURRENT_EXECUTABLE)
  25449. +
  25450. +if(NOT PYTHON_XCBGEN)
  25451. + message(FATAL_ERROR "Missing required python module: xcbgen")
  25452. +endif()
  25453. +
  25454. +#
  25455. +# Include XCB libs depending on what protos we build
  25456. +#
  25457. +if(NOT XCB_PROTOS)
  25458. + set(XCB_PROTOS
  25459. + "bigreq"
  25460. + "composite"
  25461. + "damage"
  25462. + "dpms"
  25463. + "dri2"
  25464. + "dri3"
  25465. + "glx"
  25466. + "present"
  25467. + "randr"
  25468. + "record"
  25469. + "render"
  25470. + "res"
  25471. + "screensaver"
  25472. + "shape"
  25473. + "shm"
  25474. + "sync"
  25475. + "xc_misc"
  25476. + "xevie"
  25477. + "xf86dri"
  25478. + "xfixes"
  25479. + "xinerama"
  25480. + "xinput"
  25481. + "xkb"
  25482. + "xprint"
  25483. + "xproto"
  25484. + "xselinux"
  25485. + "xtest"
  25486. + "xv"
  25487. + "xvmc")
  25488. +endif()
  25489. +
  25490. +if(";${XCB_PROTOS};" MATCHES ";randr;")
  25491. + find_package(XCB REQUIRED RANDR)
  25492. + set(XPP_INCLUDE_DIRS ${XPP_INCLUDE_DIRS} ${XCB_RANDR_INCLUDE_DIR})
  25493. + set(XPP_LIBRARIES ${XPP_LIBRARIES} ${XCB_RANDR_LIBRARY})
  25494. +endif()
  25495. +if(";${XCB_PROTOS};" MATCHES ";render;")
  25496. + find_package(XCB REQUIRED RENDER)
  25497. + set(XPP_INCLUDE_DIRS ${XPP_INCLUDE_DIRS} ${XCB_RENDER_INCLUDE_DIR})
  25498. + set(XPP_LIBRARIES ${XPP_LIBRARIES} ${XCB_RENDER_LIBRARY})
  25499. +endif()
  25500. +if(";${XCB_PROTOS};" MATCHES ";damage;")
  25501. + find_package(XCB REQUIRED DAMAGE)
  25502. + set(XPP_INCLUDE_DIRS ${XPP_INCLUDE_DIRS} ${XCB_DAMAGE_INCLUDE_DIR})
  25503. + set(XPP_LIBRARIES ${XPP_LIBRARIES} ${XCB_DAMAGE_LIBRARY})
  25504. +endif()
  25505. +if(";${XCB_PROTOS};" MATCHES ";sync;")
  25506. + find_package(XCB REQUIRED SYNC)
  25507. + set(XPP_INCLUDE_DIRS ${XPP_INCLUDE_DIRS} ${XCB_SYNC_INCLUDE_DIR})
  25508. + set(XPP_LIBRARIES ${XPP_LIBRARIES} ${XCB_SYNC_LIBRARY})
  25509. +endif()
  25510. +if(";${XCB_PROTOS};" MATCHES ";composite;")
  25511. + find_package(XCB REQUIRED COMPOSITE)
  25512. + set(XPP_INCLUDE_DIRS ${XPP_INCLUDE_DIRS} ${XCB_COMPOSITE_INCLUDE_DIR})
  25513. + set(XPP_LIBRARIES ${XPP_LIBRARIES} ${XCB_COMPOSITE_LIBRARY})
  25514. +endif()
  25515. +if(";${XCB_PROTOS};" MATCHES ";xkb;")
  25516. + find_package(XCB REQUIRED XKB)
  25517. + set(XPP_INCLUDE_DIRS ${XPP_INCLUDE_DIRS} ${XCB_XKB_INCLUDE_DIR})
  25518. + set(XPP_LIBRARIES ${XPP_LIBRARIES} ${XCB_XKB_LIBRARY})
  25519. +endif()
  25520. +
  25521. +set(PROTO_LIST)
  25522. +
  25523. +if(NOT XCBPROTO_PREFIX)
  25524. + set(XCBPROTO_PREFIX /usr)
  25525. +endif()
  25526. +file(GLOB PROTO_LIST_RAW RELATIVE ${XCBPROTO_PREFIX}/share/xcb ${XCBPROTO_PREFIX}/share/xcb/*.xml)
  25527. +
  25528. +#
  25529. +# Filter glob
  25530. +#
  25531. +foreach(PROTO_RAW ${PROTO_LIST_RAW})
  25532. + string(REGEX REPLACE "(^xf86vidmode.xml|^ge.xml|.xml)\$" "" PROTO ${PROTO_RAW})
  25533. + if(PROTO AND ";${XCB_PROTOS};" MATCHES ";${PROTO};")
  25534. + message(STATUS "${PROJECT_NAME}: including xcb proto ${PROTO_RAW}")
  25535. + set(PROTO_LIST ${PROTO_LIST} ${PROTO})
  25536. + endif()
  25537. +endforeach(PROTO_RAW)
  25538. +
  25539. +#
  25540. +# Create project lib and commands
  25541. +#
  25542. +file(GLOB_RECURSE HEADER_FILES ${PROJECT_SOURCE_DIR}/include/*.hpp)
  25543. +add_library(${PROJECT_NAME} ${HEADER_FILES})
  25544. +
  25545. +target_include_directories(${PROJECT_NAME} PUBLIC ${XPP_INCLUDE_DIRS})
  25546. +target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/include/xpp)
  25547. +target_link_libraries(${PROJECT_NAME} PRIVATE ${XPP_LIBRARIES})
  25548. +
  25549. +target_compile_options(${PROJECT_NAME} PRIVATE -std=c++14 -Wall -Wpedantic)
  25550. +target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Debug>:-g3 -DDEBUG>)
  25551. +target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Release>:-O3 -Wno-unused-variable>)
  25552. +target_compile_options(${PROJECT_NAME} PUBLIC ${X11_XCB_DEFINITIONS} ${XCB_DEFINITIONS})
  25553. +
  25554. +set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
  25555. +
  25556. +#
  25557. +# Add commands
  25558. +#
  25559. +foreach(PROTO ${PROTO_LIST})
  25560. + string(REGEX REPLACE "proto\$" "" PROTO_OUTPUT ${PROTO})
  25561. + add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
  25562. + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/generators/cpp_client.py -p "${PYTHON_XCBGEN}"
  25563. + ${XCBPROTO_PREFIX}/share/xcb/${PROTO}.xml > ${PROJECT_SOURCE_DIR}/include/xpp/proto/${PROTO_OUTPUT}.hpp)
  25564. +endforeach(PROTO)
  25565. +
  25566. +#
  25567. +# Export lists to the parent scope if there are any
  25568. +#
  25569. +get_directory_property(HAS_PARENT PARENT_DIRECTORY)
  25570. +
  25571. +if(HAS_PARENT)
  25572. + set(XPP_INCLUDE_DIRS ${XPP_INCLUDE_DIRS} PARENT_SCOPE)
  25573. + set(XPP_LIBRARIES ${PROJECT_NAME} PARENT_SCOPE)
  25574. +endif()
  25575. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/accessor.py polybar-3.2.1/lib/xpp/generators/accessor.py
  25576. --- polybar-3.2.1.orig/lib/xpp/generators/accessor.py 1970-01-01 02:00:00.000000000 +0200
  25577. +++ polybar-3.2.1/lib/xpp/generators/accessor.py 2017-08-30 16:02:01.000000000 +0300
  25578. @@ -0,0 +1,126 @@
  25579. +from resource_classes import _resource_classes
  25580. +
  25581. +_templates = {}
  25582. +
  25583. +_templates['iter_fixed'] = \
  25584. +"""\
  25585. +xpp::generic::iterator<Connection,
  25586. + %s,
  25587. + SIGNATURE(%s_%s),
  25588. + SIGNATURE(%s_%s_length)>\
  25589. +"""
  25590. +
  25591. +_templates['iter_variable'] = \
  25592. +"""\
  25593. +xpp::generic::iterator<Connection,
  25594. + %s,
  25595. + SIGNATURE(%s_next),
  25596. + SIGNATURE(%s_sizeof),
  25597. + SIGNATURE(%s_%s_iterator)>\
  25598. +"""
  25599. +
  25600. +_templates['list'] = \
  25601. +"""\
  25602. + xpp::generic::list<Connection,
  25603. + %s_reply_t,
  25604. + %s
  25605. + >
  25606. + %s(void)
  25607. + {
  25608. + return xpp::generic::list<Connection,
  25609. + %s_reply_t,
  25610. + %s
  25611. + >(%s);
  25612. + }\
  25613. +"""
  25614. +
  25615. +_templates['string_accessor'] = \
  25616. +'''\
  25617. + std::string
  25618. + %s(void)
  25619. + {
  25620. + return std::string(%s_%s(this->get().get()),
  25621. + %s_%s_length(this->get().get()));
  25622. + }
  25623. +'''
  25624. +
  25625. +def _string_accessor(member, c_name):
  25626. + return _templates['string_accessor'] % \
  25627. + (member, c_name, member, c_name, member)
  25628. +
  25629. +class Accessor(object):
  25630. + def __init__(self, is_fixed=False, is_string=False, is_variable=False, \
  25631. + member="", c_type="", return_type="", iter_name="", c_name=""):
  25632. +
  25633. + self.is_fixed = is_fixed
  25634. + self.is_string = is_string
  25635. + self.is_variable = is_variable
  25636. +
  25637. + self.member = member
  25638. + self.c_type = c_type
  25639. + self.return_type = return_type
  25640. + self.iter_name = iter_name
  25641. + self.c_name = c_name
  25642. +
  25643. + self.object_type = self.c_type.replace("xcb_", "").replace("_t", "").upper()
  25644. +
  25645. + if self.c_type == "void":
  25646. + self.return_type = "Type"
  25647. + elif self.object_type in _resource_classes:
  25648. + self.return_type = self.member.capitalize()
  25649. + else:
  25650. + self.return_type = self.c_type
  25651. +
  25652. + def __str__(self):
  25653. + if self.is_fixed:
  25654. + return self.list(self.iter_fixed())
  25655. + elif self.is_variable:
  25656. + return self.list(self.iter_variable())
  25657. + elif self.is_string:
  25658. + return self.string()
  25659. + else:
  25660. + return ""
  25661. +
  25662. +
  25663. + def iter_fixed(self):
  25664. + return_type = self.return_type
  25665. +
  25666. + return _templates['iter_fixed'] \
  25667. + % (return_type,
  25668. + self.c_name, self.member,
  25669. + self.c_name, self.member)
  25670. +
  25671. +
  25672. + def iter_variable(self):
  25673. + return _templates['iter_variable'] \
  25674. + % (self.c_type,
  25675. + self.iter_name,
  25676. + self.iter_name,
  25677. + self.c_name, self.member)
  25678. +
  25679. +
  25680. + def list(self, iterator):
  25681. + template = " template<typename Type" if self.c_type == "void" else ""
  25682. +
  25683. + # template<typename Children = xcb_window_t>
  25684. + if self.object_type in _resource_classes:
  25685. + template += ", " if template != "" else " template<typename "
  25686. + template += self.member.capitalize() + " = " + self.c_type
  25687. +
  25688. + template += ">\n" if template != "" else ""
  25689. +
  25690. + c_tor_params = "this->m_c, this->get()"
  25691. +
  25692. + fst_iterator = "\n ".join(iterator.split('\n'))
  25693. + snd_iterator = "\n ".join(iterator.split('\n'))
  25694. +
  25695. + return template + _templates['list'] \
  25696. + % (self.c_name,
  25697. + fst_iterator,
  25698. + self.member,
  25699. + self.c_name,
  25700. + snd_iterator,
  25701. + c_tor_params)
  25702. +
  25703. + def string(self):
  25704. + return _string_accessor(self.member, self.c_name)
  25705. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/cpp_client.py polybar-3.2.1/lib/xpp/generators/cpp_client.py
  25706. --- polybar-3.2.1.orig/lib/xpp/generators/cpp_client.py 1970-01-01 02:00:00.000000000 +0200
  25707. +++ polybar-3.2.1/lib/xpp/generators/cpp_client.py 2018-11-30 20:15:15.122926140 +0300
  25708. @@ -0,0 +1,3194 @@
  25709. +#!/usr/bin/env python
  25710. +# vim: set ts=4 sws=4 sw=4:
  25711. +
  25712. +from xml.etree.cElementTree import *
  25713. +from os.path import basename
  25714. +from functools import reduce
  25715. +import getopt
  25716. +import os
  25717. +import sys
  25718. +import errno
  25719. +import time
  25720. +import re
  25721. +import collections
  25722. +
  25723. +from utils import \
  25724. + get_namespace, \
  25725. + get_ext_name, \
  25726. + _n_item, \
  25727. + _ext
  25728. +
  25729. +from cppevent import CppEvent
  25730. +from cpperror import CppError
  25731. +from accessor import Accessor
  25732. +from parameter import Parameter
  25733. +from cpprequest import CppRequest
  25734. +from objectclass import ObjectClass
  25735. +from interfaceclass import InterfaceClass
  25736. +from extensionclass import ExtensionClass
  25737. +from resource_classes import _resource_classes
  25738. +
  25739. +_cpp_request_names = []
  25740. +_cpp_request_objects = {}
  25741. +
  25742. +# see c_open()
  25743. +_interface_class = InterfaceClass()
  25744. +
  25745. +_cpp_events = []
  25746. +_cpp_errors = []
  25747. +
  25748. +_object_classes = {}
  25749. +
  25750. +for i, v in enumerate(_resource_classes):
  25751. + _object_classes[i] = ObjectClass(v)
  25752. +
  25753. + # , "render" : collections.OrderedDict( \
  25754. + # {
  25755. + # } )
  25756. + # , "xinerama" : collections.OrderedDict( \
  25757. + # {
  25758. + # } )
  25759. +
  25760. +# Jump to the bottom of this file for the main routine
  25761. +
  25762. +# Some hacks to make the API more readable, and to keep backwards compability
  25763. +_cname_re = re.compile('([A-Z0-9][a-z]+|[A-Z0-9]+(?![a-z])|[a-z]+)')
  25764. +_cname_special_cases = {'DECnet':'decnet'}
  25765. +
  25766. +_extension_special_cases = ['XPrint', 'XCMisc', 'BigRequests']
  25767. +
  25768. +_xcb_includes = \
  25769. + { "xproto" : "xcb.h"
  25770. + }
  25771. +
  25772. +
  25773. +_cplusplus_annoyances = {'class' : '_class',
  25774. + 'new' : '_new',
  25775. + 'delete': '_delete',
  25776. + 'explicit': '_explicit'}
  25777. +_c_keywords = {'default' : '_default'}
  25778. +
  25779. +_hlines = []
  25780. +_hlevel = 0
  25781. +_clines = []
  25782. +_clevel = 0
  25783. +_ns = None
  25784. +
  25785. +# global variable to keep track of serializers and
  25786. +# switch data types due to weird dependencies
  25787. +finished_serializers = []
  25788. +finished_sizeof = []
  25789. +finished_switch = []
  25790. +
  25791. +# keeps enum objects so that we can refer to them when generating manpages.
  25792. +enums = {}
  25793. +
  25794. +manpaths = False
  25795. +
  25796. +def _get_xcb_include(ns):
  25797. + # return _xcb_includes.get(ns, _ns.ext_name.lower()) + ".h"
  25798. + return _xcb_includes.get(ns, _ns.file.replace(".xml", ".h"))
  25799. +
  25800. +# def get_namespace(_ns):
  25801. +# if _ns.is_ext:
  25802. +# return get_ext_name(_ns.ext_name)
  25803. +# else:
  25804. +# return "x"
  25805. +
  25806. +def _h(fmt, *args):
  25807. + '''
  25808. + Writes the given line to the header file.
  25809. + '''
  25810. + _hlines[_hlevel].append(fmt % args)
  25811. +
  25812. +def _c(fmt, *args):
  25813. + '''
  25814. + Writes the given line to the source file.
  25815. + '''
  25816. + _clines[_clevel].append(fmt % args)
  25817. +
  25818. +def _hc(fmt, *args):
  25819. + '''
  25820. + Writes the given line to both the header and source files.
  25821. + '''
  25822. + _h(fmt, *args)
  25823. + _c(fmt, *args)
  25824. +
  25825. +# XXX See if this level thing is really necessary.
  25826. +def _h_setlevel(idx):
  25827. + '''
  25828. + Changes the array that header lines are written to.
  25829. + Supports writing different sections of the header file.
  25830. + '''
  25831. + global _hlevel
  25832. + while len(_hlines) <= idx:
  25833. + _hlines.append([])
  25834. + _hlevel = idx
  25835. +
  25836. +def _c_setlevel(idx):
  25837. + '''
  25838. + Changes the array that source lines are written to.
  25839. + Supports writing to different sections of the source file.
  25840. + '''
  25841. + global _clevel
  25842. + while len(_clines) <= idx:
  25843. + _clines.append([])
  25844. + _clevel = idx
  25845. +
  25846. +
  25847. +def _cpp(str):
  25848. + '''
  25849. + Checks for certain C++ reserved words and fixes them.
  25850. + '''
  25851. + if str in _cplusplus_annoyances:
  25852. + return _cplusplus_annoyances[str]
  25853. + elif str in _c_keywords:
  25854. + return _c_keywords[str]
  25855. + else:
  25856. + return str
  25857. +
  25858. +
  25859. +def _n(list):
  25860. + '''
  25861. + Does C-name conversion on a tuple of strings.
  25862. + Different behavior depending on length of tuple, extension/not extension, etc.
  25863. + Basically C-name converts the individual pieces, then joins with underscores.
  25864. + '''
  25865. + if len(list) == 1:
  25866. + parts = list
  25867. + elif len(list) == 2:
  25868. + parts = [list[0], _n_item(list[1])]
  25869. + elif _ns.is_ext:
  25870. + parts = [list[0], _ext(list[1])] + [_n_item(i) for i in list[2:]]
  25871. + else:
  25872. + parts = [list[0]] + [_n_item(i) for i in list[1:]]
  25873. + return '_'.join(parts).lower()
  25874. +
  25875. +def _t(list):
  25876. + '''
  25877. + Does C-name conversion on a tuple of strings representing a type.
  25878. + Same as _n but adds a "_t" on the end.
  25879. + '''
  25880. + if len(list) == 1:
  25881. + parts = list
  25882. + elif len(list) == 2:
  25883. + parts = [list[0], _n_item(list[1]), 't']
  25884. + elif _ns.is_ext:
  25885. + parts = [list[0], _ext(list[1])] + [_n_item(i) for i in list[2:]] + ['t']
  25886. + else:
  25887. + parts = [list[0]] + [_n_item(i) for i in list[1:]] + ['t']
  25888. + return '_'.join(parts).lower()
  25889. +
  25890. +
  25891. +def c_open(self):
  25892. + '''
  25893. + Exported function that handles module open.
  25894. + Opens the files and writes out the auto-generated comment,
  25895. + header file includes, etc.
  25896. + '''
  25897. + global _ns
  25898. + _ns = self.namespace
  25899. + # _ns.header = "test"
  25900. + _ns.c_ext_global_name = _n(_ns.prefix + ('id',))
  25901. +
  25902. + _interface_class.set_namespace(_ns)
  25903. +
  25904. + # Build the type-name collision avoidance table used by c_enum
  25905. + build_collision_table()
  25906. +
  25907. + _h_setlevel(0)
  25908. + _c_setlevel(0)
  25909. +
  25910. + # sys.stderr.write("#include <vector>\n")
  25911. + # sys.stderr.write("#include \"../request.hpp\"\n")
  25912. + # sys.stderr.write("#include \"../iterator.hpp\"\n")
  25913. + # sys.stderr.write("#include \"../core/value_iterator.hpp\"\n")
  25914. +
  25915. + # _h('#ifndef EXPORT_%s_MIXINS', get_namespace(_ns).upper())
  25916. + _h('#ifndef XPP_%s_HPP', get_namespace(_ns).upper())
  25917. + _h('#define XPP_%s_HPP', get_namespace(_ns).upper())
  25918. + _h('')
  25919. + _h('#include <string>')
  25920. + _h('#include <vector>')
  25921. + _h('')
  25922. +
  25923. + _h('#include <xcb/' + _get_xcb_include(_ns.header.lower()) + '>')
  25924. +
  25925. + _h('')
  25926. +
  25927. + _h('#include "../generic.hpp"')
  25928. +
  25929. + # if not _ns.is_ext:
  25930. + # _h('#include "xproto-stub.hpp"')
  25931. + # _h('#include "../core/generic/resource.hpp"')
  25932. + _h('')
  25933. + _h('namespace xpp { namespace %s {' % get_namespace(_ns))
  25934. + # _h('class window;')
  25935. + # _h('namespace %s {', get_namespace(_ns))
  25936. + # _h('')
  25937. +
  25938. +def c_close(self):
  25939. + '''
  25940. + Exported function that handles module close.
  25941. + Writes out all the stored content lines, then closes the files.
  25942. + '''
  25943. +
  25944. + _h('')
  25945. + _h(ExtensionClass(_ns).make_class())
  25946. +
  25947. +
  25948. + for cpp_event in _cpp_events:
  25949. + _h(cpp_event.make_class())
  25950. +
  25951. + _h('')
  25952. +
  25953. + for cpp_error in _cpp_errors:
  25954. + _h(cpp_error.make_class())
  25955. +
  25956. + _h('')
  25957. +
  25958. + for name in _cpp_request_names:
  25959. + _h("%s", _cpp_request_objects[name].make_class())
  25960. +
  25961. + _h('')
  25962. +
  25963. + for key in _object_classes:
  25964. + _h(_object_classes[key].make_inline())
  25965. + # sys.stderr.write(_object_classes[key].make_inline())
  25966. +
  25967. +
  25968. +
  25969. + _h('')
  25970. + _h(_interface_class.make_proto())
  25971. + # sys.stderr.write(_interface_class.make_proto())
  25972. +
  25973. + _h('')
  25974. + # _h('}; // namespace xpp')
  25975. + _h("} } // namespace xpp::%s" % get_namespace(_ns))
  25976. +
  25977. + _h('')
  25978. + _h('#endif // XPP_%s_HPP', get_namespace(_ns).upper())
  25979. +
  25980. + # Write header file
  25981. + hfile = sys.stdout
  25982. + for list in _hlines:
  25983. + for line in list:
  25984. + hfile.write(line)
  25985. + hfile.write('\n')
  25986. + # hfile.close()
  25987. +
  25988. + # cfile = sys.stderr
  25989. + # for list in _clines:
  25990. + # for line in list:
  25991. + # cfile.write(line)
  25992. + # cfile.write('\n')
  25993. +
  25994. +def build_collision_table():
  25995. + global namecount
  25996. + namecount = {}
  25997. +
  25998. + for v in module.types.values():
  25999. + name = _t(v[0])
  26000. + namecount[name] = (namecount.get(name) or 0) + 1
  26001. +
  26002. +def c_enum(self, name):
  26003. + '''
  26004. + Exported function that handles enum declarations.
  26005. + '''
  26006. +
  26007. + enums[name] = self
  26008. +
  26009. + tname = _t(name)
  26010. + if namecount[tname] > 1:
  26011. + tname = _t(name + ('enum',))
  26012. +
  26013. + _h_setlevel(0)
  26014. + _h('')
  26015. + _h('typedef enum %s {', tname)
  26016. +
  26017. + count = len(self.values)
  26018. +
  26019. + for (enam, eval) in self.values:
  26020. + count = count - 1
  26021. + equals = ' = ' if eval != '' else ''
  26022. + comma = ',' if count > 0 else ''
  26023. + doc = ''
  26024. + if hasattr(self, "doc") and self.doc and enam in self.doc.fields:
  26025. + doc = '\n/**< %s */\n' % self.doc.fields[enam]
  26026. + _h(' %s%s%s%s%s', _n(name + (enam,)).upper(), equals, eval, comma, doc)
  26027. +
  26028. + _h('} %s;', tname)
  26029. +
  26030. +def _c_type_setup(self, name, postfix):
  26031. + '''
  26032. + Sets up all the C-related state by adding additional data fields to
  26033. + all Field and Type objects. Here is where we figure out most of our
  26034. + variable and function names.
  26035. +
  26036. + Recurses into child fields and list member types.
  26037. + '''
  26038. + # Do all the various names in advance
  26039. +
  26040. + self.c_type = _t(name + postfix)
  26041. + self.c_wiretype = 'char' if self.c_type == 'void' else self.c_type
  26042. +
  26043. + self.c_iterator_type = _t(name + ('iterator',))
  26044. + self.c_next_name = _n(name + ('next',))
  26045. + self.c_end_name = _n(name + ('end',))
  26046. +
  26047. + self.c_request_name = _n(name)
  26048. + self.c_checked_name = _n(name)
  26049. + self.c_unchecked_name = _n(name)
  26050. + # self.c_checked_name = _n(name + ('checked',))
  26051. + # self.c_unchecked_name = _n(name + ('unchecked',))
  26052. + self.c_reply_name = _n(name + ('reply',))
  26053. + self.c_reply_type = _t(name + ('reply',))
  26054. + self.c_cookie_type = _t(name + ('cookie',))
  26055. + self.c_reply_fds_name = _n(name + ('reply_fds',))
  26056. +
  26057. + self.need_aux = False
  26058. + self.need_serialize = False
  26059. + self.need_sizeof = False
  26060. +
  26061. + self.c_aux_name = _n(name + ('aux',))
  26062. + self.c_aux_checked_name = _n(name)
  26063. + self.c_aux_unchecked_name = _n(name)
  26064. + # self.c_aux_checked_name = _n(name + ('aux', 'checked'))
  26065. + # self.c_aux_unchecked_name = _n(name + ('aux', 'unchecked'))
  26066. + self.c_serialize_name = _n(name + ('serialize',))
  26067. + self.c_unserialize_name = _n(name + ('unserialize',))
  26068. + self.c_unpack_name = _n(name + ('unpack',))
  26069. + self.c_sizeof_name = _n(name + ('sizeof',))
  26070. +
  26071. + # special case: structs where variable size fields are followed by fixed size fields
  26072. + self.var_followed_by_fixed_fields = False
  26073. +
  26074. + if self.is_switch:
  26075. + self.need_serialize = True
  26076. + self.c_container = 'struct'
  26077. + for bitcase in self.bitcases:
  26078. + bitcase.c_field_name = _cpp(bitcase.field_name)
  26079. + bitcase_name = bitcase.field_type if bitcase.type.has_name else name
  26080. + _c_type_setup(bitcase.type, bitcase_name, ())
  26081. +
  26082. + elif self.is_container:
  26083. +
  26084. + self.c_container = 'union' if self.is_union else 'struct'
  26085. + prev_varsized_field = None
  26086. + prev_varsized_offset = 0
  26087. + first_field_after_varsized = None
  26088. +
  26089. + for field in self.fields:
  26090. + _c_type_setup(field.type, field.field_type, ())
  26091. + if field.type.is_list:
  26092. + _c_type_setup(field.type.member, field.field_type, ())
  26093. + if (field.type.nmemb is None):
  26094. + self.need_sizeof = True
  26095. +
  26096. + field.c_field_type = _t(field.field_type)
  26097. + field.c_field_const_type = ('' if field.type.nmemb == 1 else 'const ') + field.c_field_type
  26098. + field.c_field_name = _cpp(field.field_name)
  26099. + field.c_subscript = '[%d]' % field.type.nmemb if (field.type.nmemb and field.type.nmemb > 1) else ''
  26100. + field.c_pointer = ' ' if field.type.nmemb == 1 else '*'
  26101. +
  26102. + # correct the c_pointer field for variable size non-list types
  26103. + if not field.type.fixed_size() and field.c_pointer == ' ':
  26104. + field.c_pointer = '*'
  26105. + if field.type.is_list and not field.type.member.fixed_size():
  26106. + field.c_pointer = '*'
  26107. +
  26108. + if field.type.is_switch:
  26109. + field.c_pointer = '*'
  26110. + field.c_field_const_type = 'const ' + field.c_field_type
  26111. + self.need_aux = True
  26112. + elif not field.type.fixed_size() and not field.type.is_bitcase:
  26113. + self.need_sizeof = True
  26114. +
  26115. + field.c_iterator_type = _t(field.field_type + ('iterator',)) # xcb_fieldtype_iterator_t
  26116. + field.c_iterator_name = _n(name + (field.field_name, 'iterator')) # xcb_container_field_iterator
  26117. + field.c_accessor_name = _n(name + (field.field_name,)) # xcb_container_field
  26118. + field.c_length_name = _n(name + (field.field_name, 'length')) # xcb_container_field_length
  26119. + field.c_end_name = _n(name + (field.field_name, 'end')) # xcb_container_field_end
  26120. +
  26121. + field.prev_varsized_field = prev_varsized_field
  26122. + field.prev_varsized_offset = prev_varsized_offset
  26123. +
  26124. + if prev_varsized_offset == 0:
  26125. + first_field_after_varsized = field
  26126. + field.first_field_after_varsized = first_field_after_varsized
  26127. +
  26128. + if field.type.fixed_size():
  26129. + prev_varsized_offset += field.type.size
  26130. + # special case: intermixed fixed and variable size fields
  26131. + if prev_varsized_field is not None and not field.type.is_pad and field.wire:
  26132. + if not self.is_union:
  26133. + self.need_serialize = True
  26134. + self.var_followed_by_fixed_fields = True
  26135. + else:
  26136. + self.last_varsized_field = field
  26137. + prev_varsized_field = field
  26138. + prev_varsized_offset = 0
  26139. +
  26140. + if self.var_followed_by_fixed_fields:
  26141. + if field.type.fixed_size():
  26142. + field.prev_varsized_field = None
  26143. +
  26144. + if self.need_serialize:
  26145. + # when _unserialize() is wanted, create _sizeof() as well for consistency reasons
  26146. + self.need_sizeof = True
  26147. +
  26148. + # as switch does never appear at toplevel,
  26149. + # continue here with type construction
  26150. + if self.is_switch:
  26151. + if self.c_type not in finished_switch:
  26152. + finished_switch.append(self.c_type)
  26153. + # special: switch C structs get pointer fields for variable-sized members
  26154. + _c_complex(self)
  26155. + for bitcase in self.bitcases:
  26156. + bitcase_name = bitcase.type.name if bitcase.type.has_name else name
  26157. + _c_accessors(bitcase.type, bitcase_name, bitcase_name)
  26158. + # no list with switch as element, so no call to
  26159. + # _c_iterator(field.type, field_name) necessary
  26160. +
  26161. + if not self.is_bitcase:
  26162. + if self.need_serialize:
  26163. + if self.c_serialize_name not in finished_serializers:
  26164. + finished_serializers.append(self.c_serialize_name)
  26165. + _c_serialize('serialize', self)
  26166. +
  26167. + # _unpack() and _unserialize() are only needed for special cases:
  26168. + # switch -> unpack
  26169. + # special cases -> unserialize
  26170. + if self.is_switch or self.var_followed_by_fixed_fields:
  26171. + _c_serialize('unserialize', self)
  26172. +
  26173. + # if self.need_sizeof:
  26174. + # if self.c_sizeof_name not in finished_sizeof:
  26175. + # if not module.namespace.is_ext or self.name[:2] == module.namespace.prefix:
  26176. + # finished_sizeof.append(self.c_sizeof_name)
  26177. + # _c_serialize('sizeof', self)
  26178. +# _c_type_setup()
  26179. +
  26180. +def _c_helper_absolute_name(prefix, field=None):
  26181. + """
  26182. + turn prefix, which is a list of tuples (name, separator, Type obj) into a string
  26183. + representing a valid name in C (based on the context)
  26184. + if field is not None, append the field name as well
  26185. + """
  26186. + prefix_str = ''
  26187. + for name, sep, obj in prefix:
  26188. + prefix_str += name
  26189. + if '' == sep:
  26190. + sep = '->'
  26191. + if ((obj.is_bitcase and obj.has_name) or # named bitcase
  26192. + (obj.is_switch and len(obj.parents)>1)):
  26193. + sep = '.'
  26194. + prefix_str += sep
  26195. + if field is not None:
  26196. + prefix_str += _cpp(field.field_name)
  26197. + return prefix_str
  26198. +# _c_absolute_name
  26199. +
  26200. +def _c_helper_field_mapping(complex_type, prefix, flat=False):
  26201. + """
  26202. + generate absolute names, based on prefix, for all fields starting from complex_type
  26203. + if flat == True, nested complex types are not taken into account
  26204. + """
  26205. + all_fields = {}
  26206. + if complex_type.is_switch:
  26207. + for b in complex_type.bitcases:
  26208. + if b.type.has_name:
  26209. + switch_name, switch_sep, switch_type = prefix[-1]
  26210. + bitcase_prefix = prefix + [(b.type.name[-1], '.', b.type)]
  26211. + else:
  26212. + bitcase_prefix = prefix
  26213. +
  26214. + if (True==flat and not b.type.has_name) or False==flat:
  26215. + all_fields.update(_c_helper_field_mapping(b.type, bitcase_prefix, flat))
  26216. + else:
  26217. + for f in complex_type.fields:
  26218. + fname = _c_helper_absolute_name(prefix, f)
  26219. + if f.field_name in all_fields:
  26220. + raise Exception("field name %s has been registered before" % f.field_name)
  26221. +
  26222. + all_fields[f.field_name] = (fname, f)
  26223. + if f.type.is_container and flat==False:
  26224. + if f.type.is_bitcase and not f.type.has_name:
  26225. + new_prefix = prefix
  26226. + elif f.type.is_switch and len(f.type.parents)>1:
  26227. + # nested switch gets another separator
  26228. + new_prefix = prefix+[(f.c_field_name, '.', f.type)]
  26229. + else:
  26230. + new_prefix = prefix+[(f.c_field_name, '->', f.type)]
  26231. + all_fields.update(_c_helper_field_mapping(f.type, new_prefix, flat))
  26232. +
  26233. + return all_fields
  26234. +# _c_field_mapping()
  26235. +
  26236. +def _c_helper_resolve_field_names (prefix):
  26237. + """
  26238. + get field names for all objects in the prefix array
  26239. + """
  26240. + all_fields = {}
  26241. + tmp_prefix = []
  26242. + # look for fields in the remaining containers
  26243. + for idx, p in enumerate(prefix):
  26244. + name, sep, obj = p
  26245. + if ''==sep:
  26246. + # sep can be preset in prefix, if not, make a sensible guess
  26247. + sep = '.' if (obj.is_switch or obj.is_bitcase) else '->'
  26248. + # exception: 'toplevel' object (switch as well!) always have sep '->'
  26249. + sep = '->' if idx<1 else sep
  26250. + if not obj.is_bitcase or (obj.is_bitcase and obj.has_name):
  26251. + tmp_prefix.append((name, sep, obj))
  26252. + all_fields.update(_c_helper_field_mapping(obj, tmp_prefix, flat=True))
  26253. +
  26254. + return all_fields
  26255. +# _c_helper_resolve_field_names
  26256. +
  26257. +def get_expr_fields(self):
  26258. + """
  26259. + get the Fields referenced by switch or list expression
  26260. + """
  26261. + def get_expr_field_names(expr):
  26262. + if expr.op is None:
  26263. + if expr.lenfield_name is not None:
  26264. + return [expr.lenfield_name]
  26265. + else:
  26266. + # constant value expr
  26267. + return []
  26268. + else:
  26269. + if expr.op == '~':
  26270. + return get_expr_field_names(expr.rhs)
  26271. + elif expr.op == 'popcount':
  26272. + return get_expr_field_names(expr.rhs)
  26273. + elif expr.op == 'sumof':
  26274. + # sumof expr references another list,
  26275. + # we need that list's length field here
  26276. + field = None
  26277. + for f in expr.lenfield_parent.fields:
  26278. + if f.field_name == expr.lenfield_name:
  26279. + field = f
  26280. + break
  26281. + if field is None:
  26282. + raise Exception("list field '%s' referenced by sumof not found" % expr.lenfield_name)
  26283. + # referenced list + its length field
  26284. + return [expr.lenfield_name] + get_expr_field_names(field.type.expr)
  26285. + elif expr.op == 'enumref':
  26286. + return []
  26287. + else:
  26288. + return get_expr_field_names(expr.lhs) + get_expr_field_names(expr.rhs)
  26289. + # get_expr_field_names()
  26290. +
  26291. + # resolve the field names with the parent structure(s)
  26292. + unresolved_fields_names = get_expr_field_names(self.expr)
  26293. +
  26294. + # construct prefix from self
  26295. + prefix = [('', '', p) for p in self.parents]
  26296. + if self.is_container:
  26297. + prefix.append(('', '', self))
  26298. +
  26299. + all_fields = _c_helper_resolve_field_names (prefix)
  26300. + resolved_fields_names = list(filter(lambda x: x in all_fields.keys(), unresolved_fields_names))
  26301. + if len(unresolved_fields_names) != len(resolved_fields_names):
  26302. + raise Exception("could not resolve all fields for %s" % self.name)
  26303. +
  26304. + resolved_fields = [all_fields[n][1] for n in resolved_fields_names]
  26305. + return resolved_fields
  26306. +# get_expr_fields()
  26307. +
  26308. +def resolve_expr_fields(complex_obj):
  26309. + """
  26310. + find expr fields appearing in complex_obj and descendents that cannot be resolved within complex_obj
  26311. + these are normally fields that need to be given as function parameters
  26312. + """
  26313. + all_fields = []
  26314. + expr_fields = []
  26315. + unresolved = []
  26316. +
  26317. + for field in complex_obj.fields:
  26318. + all_fields.append(field)
  26319. + if field.type.is_switch or field.type.is_list:
  26320. + expr_fields += get_expr_fields(field.type)
  26321. + if field.type.is_container:
  26322. + expr_fields += resolve_expr_fields(field.type)
  26323. +
  26324. + # try to resolve expr fields
  26325. + for e in expr_fields:
  26326. + if e not in all_fields and e not in unresolved:
  26327. + unresolved.append(e)
  26328. + return unresolved
  26329. +# resolve_expr_fields()
  26330. +
  26331. +def get_serialize_params(context, self, buffer_var='_buffer', aux_var='_aux'):
  26332. + """
  26333. + functions like _serialize(), _unserialize(), and _unpack() sometimes need additional parameters:
  26334. + E.g. in order to unpack switch, extra parameters might be needed to evaluate the switch
  26335. + expression. This function tries to resolve all fields within a structure, and returns the
  26336. + unresolved fields as the list of external parameters.
  26337. + """
  26338. + def add_param(params, param):
  26339. + if param not in params:
  26340. + params.append(param)
  26341. +
  26342. + # collect all fields into param_fields
  26343. + param_fields = []
  26344. + wire_fields = []
  26345. +
  26346. + for field in self.fields:
  26347. + if field.visible:
  26348. + # the field should appear as a parameter in the function call
  26349. + param_fields.append(field)
  26350. + if field.wire and not field.auto:
  26351. + if field.type.fixed_size() and not self.is_switch:
  26352. + # field in the xcb_out structure
  26353. + wire_fields.append(field)
  26354. + # fields like 'pad0' are skipped!
  26355. +
  26356. + # in case of switch, parameters always contain any fields referenced in the switch expr
  26357. + # we do not need any variable size fields here, as the switch data type contains both
  26358. + # fixed and variable size fields
  26359. + if self.is_switch:
  26360. + param_fields = get_expr_fields(self)
  26361. +
  26362. + # _serialize()/_unserialize()/_unpack() function parameters
  26363. + # note: don't use set() for params, it is unsorted
  26364. + params = []
  26365. +
  26366. + # 1. the parameter for the void * buffer
  26367. + if 'serialize' == context:
  26368. + params.append(('void', '**', buffer_var))
  26369. + elif context in ('unserialize', 'unpack', 'sizeof'):
  26370. + params.append(('const void', '*', buffer_var))
  26371. +
  26372. + # 2. any expr fields that cannot be resolved within self and descendants
  26373. + unresolved_fields = resolve_expr_fields(self)
  26374. + for f in unresolved_fields:
  26375. + add_param(params, (f.c_field_type, '', f.c_field_name))
  26376. +
  26377. + # 3. param_fields contain the fields necessary to evaluate the switch expr or any other fields
  26378. + # that do not appear in the data type struct
  26379. + for p in param_fields:
  26380. + if self.is_switch:
  26381. + typespec = p.c_field_const_type
  26382. + pointerspec = p.c_pointer
  26383. + add_param(params, (typespec, pointerspec, p.c_field_name))
  26384. + else:
  26385. + if p.visible and not p.wire and not p.auto:
  26386. + typespec = p.c_field_type
  26387. + pointerspec = ''
  26388. + add_param(params, (typespec, pointerspec, p.c_field_name))
  26389. +
  26390. + # 4. aux argument
  26391. + if 'serialize' == context:
  26392. + add_param(params, ('const %s' % self.c_type, '*', aux_var))
  26393. + elif 'unserialize' == context:
  26394. + add_param(params, ('%s' % self.c_type, '**', aux_var))
  26395. + elif 'unpack' == context:
  26396. + add_param(params, ('%s' % self.c_type, '*', aux_var))
  26397. +
  26398. + # 5. switch contains all variable size fields as struct members
  26399. + # for other data types though, these have to be supplied separately
  26400. + # this is important for the special case of intermixed fixed and
  26401. + # variable size fields
  26402. + if not self.is_switch and 'serialize' == context:
  26403. + for p in param_fields:
  26404. + if not p.type.fixed_size():
  26405. + add_param(params, (p.c_field_const_type, '*', p.c_field_name))
  26406. +
  26407. + return (param_fields, wire_fields, params)
  26408. +# get_serialize_params()
  26409. +
  26410. +def _c_serialize_helper_insert_padding(context, code_lines, space, postpone):
  26411. + code_lines.append('%s /* insert padding */' % space)
  26412. + code_lines.append('%s xcb_pad = -xcb_block_len & (xcb_align_to - 1);' % space)
  26413. +# code_lines.append('%s printf("automatically inserting padding: %%%%d\\n", xcb_pad);' % space)
  26414. + code_lines.append('%s xcb_buffer_len += xcb_block_len + xcb_pad;' % space)
  26415. +
  26416. + if not postpone:
  26417. + code_lines.append('%s if (0 != xcb_pad) {' % space)
  26418. +
  26419. + if 'serialize' == context:
  26420. + code_lines.append('%s xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;' % space)
  26421. + code_lines.append('%s xcb_parts[xcb_parts_idx].iov_len = xcb_pad;' % space)
  26422. + code_lines.append('%s xcb_parts_idx++;' % space)
  26423. + elif context in ('unserialize', 'unpack', 'sizeof'):
  26424. + code_lines.append('%s xcb_tmp += xcb_pad;' % space)
  26425. +
  26426. + code_lines.append('%s xcb_pad = 0;' % space)
  26427. + code_lines.append('%s }' % space)
  26428. +
  26429. + code_lines.append('%s xcb_block_len = 0;' % space)
  26430. +
  26431. + # keep tracking of xcb_parts entries for serialize
  26432. + return 1
  26433. +# _c_serialize_helper_insert_padding()
  26434. +
  26435. +def _c_serialize_helper_switch(context, self, complex_name,
  26436. + code_lines, temp_vars,
  26437. + space, prefix):
  26438. + count = 0
  26439. + switch_expr = _c_accessor_get_expr(self.expr, None)
  26440. +
  26441. + for b in self.bitcases:
  26442. + len_expr = len(b.type.expr)
  26443. + for n, expr in enumerate(b.type.expr):
  26444. + bitcase_expr = _c_accessor_get_expr(expr, None)
  26445. + # only one <enumref> in the <bitcase>
  26446. + if len_expr == 1:
  26447. + code_lines.append(' if(%s & %s) {' % (switch_expr, bitcase_expr))
  26448. + # multiple <enumref> in the <bitcase>
  26449. + elif n == 0: # first
  26450. + code_lines.append(' if((%s & %s) ||' % (switch_expr, bitcase_expr))
  26451. + elif len_expr == (n + 1): # last
  26452. + code_lines.append(' (%s & %s)) {' % (switch_expr, bitcase_expr))
  26453. + else: # between first and last
  26454. + code_lines.append(' (%s & %s) ||' % (switch_expr, bitcase_expr))
  26455. +
  26456. + b_prefix = prefix
  26457. + if b.type.has_name:
  26458. + b_prefix = prefix + [(b.c_field_name, '.', b.type)]
  26459. +
  26460. + count += _c_serialize_helper_fields(context, b.type,
  26461. + code_lines, temp_vars,
  26462. + "%s " % space,
  26463. + b_prefix,
  26464. + is_bitcase = True)
  26465. + code_lines.append(' }')
  26466. +
  26467. +# if 'serialize' == context:
  26468. +# count += _c_serialize_helper_insert_padding(context, code_lines, space, False)
  26469. +# elif context in ('unserialize', 'unpack', 'sizeof'):
  26470. +# # padding
  26471. +# code_lines.append('%s xcb_pad = -xcb_block_len & 3;' % space)
  26472. +# code_lines.append('%s xcb_buffer_len += xcb_block_len + xcb_pad;' % space)
  26473. +
  26474. + return count
  26475. +# _c_serialize_helper_switch
  26476. +
  26477. +def _c_serialize_helper_switch_field(context, self, field, c_switch_variable, prefix):
  26478. + """
  26479. + handle switch by calling _serialize() or _unpack(), depending on context
  26480. + """
  26481. + # switch is handled by this function as a special case
  26482. + param_fields, wire_fields, params = get_serialize_params(context, self)
  26483. + field_mapping = _c_helper_field_mapping(self, prefix)
  26484. + prefix_str = _c_helper_absolute_name(prefix)
  26485. +
  26486. + # find the parameters that need to be passed to _serialize()/_unpack():
  26487. + # all switch expr fields must be given as parameters
  26488. + args = get_expr_fields(field.type)
  26489. + # length fields for variable size types in switch, normally only some of need
  26490. + # need to be passed as parameters
  26491. + switch_len_fields = resolve_expr_fields(field.type)
  26492. +
  26493. + # a switch field at this point _must_ be a bitcase field
  26494. + # we require that bitcases are "self-contiguous"
  26495. + bitcase_unresolved = resolve_expr_fields(self)
  26496. + if len(bitcase_unresolved) != 0:
  26497. + raise Exception('unresolved fields within bitcase is not supported at this point')
  26498. +
  26499. + # get the C names for the parameters
  26500. + c_field_names = ''
  26501. + for a in switch_len_fields:
  26502. + c_field_names += "%s, " % field_mapping[a.c_field_name][0]
  26503. + for a in args:
  26504. + c_field_names += "%s, " % field_mapping[a.c_field_name][0]
  26505. +
  26506. + # call _serialize()/_unpack() to determine the actual size
  26507. + if 'serialize' == context:
  26508. + length = "%s(&%s, %s&%s%s)" % (field.type.c_serialize_name, c_switch_variable,
  26509. + c_field_names, prefix_str, field.c_field_name)
  26510. + elif context in ('unserialize', 'unpack'):
  26511. + length = "%s(xcb_tmp, %s&%s%s)" % (field.type.c_unpack_name,
  26512. + c_field_names, prefix_str, field.c_field_name)
  26513. +
  26514. + return length
  26515. +# _c_serialize_helper_switch_field()
  26516. +
  26517. +def _c_serialize_helper_list_field(context, self, field,
  26518. + code_lines, temp_vars,
  26519. + space, prefix):
  26520. + """
  26521. + helper function to cope with lists of variable length
  26522. + """
  26523. + expr = field.type.expr
  26524. + prefix_str = _c_helper_absolute_name(prefix)
  26525. + param_fields, wire_fields, params = get_serialize_params('sizeof', self)
  26526. + param_names = [p[2] for p in params]
  26527. +
  26528. + expr_fields_names = [f.field_name for f in get_expr_fields(field.type)]
  26529. + resolved = list(filter(lambda x: x in param_names, expr_fields_names))
  26530. + unresolved = list(filter(lambda x: x not in param_names, expr_fields_names))
  26531. +
  26532. + field_mapping = {}
  26533. + for r in resolved:
  26534. + field_mapping[r] = (r, None)
  26535. +
  26536. + if len(unresolved)>0:
  26537. + tmp_prefix = prefix
  26538. + if len(tmp_prefix)==0:
  26539. + raise Exception("found an empty prefix while resolving expr field names for list %s",
  26540. + field.c_field_name)
  26541. +
  26542. + field_mapping.update(_c_helper_resolve_field_names(prefix))
  26543. + resolved += list(filter(lambda x: x in field_mapping, unresolved))
  26544. + unresolved = list(filter(lambda x: x not in field_mapping, unresolved))
  26545. + if len(unresolved)>0:
  26546. + raise Exception('could not resolve the length fields required for list %s' % field.c_field_name)
  26547. +
  26548. + list_length = _c_accessor_get_expr(expr, field_mapping)
  26549. +
  26550. + # default: list with fixed size elements
  26551. + length = '%s * sizeof(%s)' % (list_length, field.type.member.c_wiretype)
  26552. +
  26553. + # list with variable-sized elements
  26554. + if not field.type.member.fixed_size():
  26555. + length = ''
  26556. + if context in ('unserialize', 'sizeof', 'unpack'):
  26557. + int_i = ' unsigned int i;'
  26558. + xcb_tmp_len = ' unsigned int xcb_tmp_len;'
  26559. + if int_i not in temp_vars:
  26560. + temp_vars.append(int_i)
  26561. + if xcb_tmp_len not in temp_vars:
  26562. + temp_vars.append(xcb_tmp_len)
  26563. + # loop over all list elements and call sizeof repeatedly
  26564. + # this should be a bit faster than using the iterators
  26565. + code_lines.append("%s for(i=0; i<%s; i++) {" % (space, list_length))
  26566. + code_lines.append("%s xcb_tmp_len = %s(xcb_tmp);" %
  26567. + (space, field.type.c_sizeof_name))
  26568. + code_lines.append("%s xcb_block_len += xcb_tmp_len;" % space)
  26569. + code_lines.append("%s xcb_tmp += xcb_tmp_len;" % space)
  26570. + code_lines.append("%s }" % space)
  26571. +
  26572. + elif 'serialize' == context:
  26573. + code_lines.append('%s xcb_parts[xcb_parts_idx].iov_len = 0;' % space)
  26574. + code_lines.append('%s xcb_tmp = (char *) %s%s;' % (space, prefix_str, field.c_field_name))
  26575. + code_lines.append('%s for(i=0; i<%s; i++) { ' % (space, list_length))
  26576. + code_lines.append('%s xcb_block_len = %s(xcb_tmp);' % (space, field.type.c_sizeof_name))
  26577. + code_lines.append('%s xcb_parts[xcb_parts_idx].iov_len += xcb_block_len;' % space)
  26578. + code_lines.append('%s }' % space)
  26579. + code_lines.append('%s xcb_block_len = xcb_parts[xcb_parts_idx].iov_len;' % space)
  26580. +
  26581. + return length
  26582. +# _c_serialize_helper_list_field()
  26583. +
  26584. +def _c_serialize_helper_fields_fixed_size(context, self, field,
  26585. + code_lines, temp_vars,
  26586. + space, prefix):
  26587. + # keep the C code a bit more readable by giving the field name
  26588. + if not self.is_bitcase:
  26589. + code_lines.append('%s /* %s.%s */' % (space, self.c_type, field.c_field_name))
  26590. + else:
  26591. + scoped_name = [p[2].c_type if idx==0 else p[0] for idx, p in enumerate(prefix)]
  26592. + typename = reduce(lambda x,y: "%s.%s" % (x, y), scoped_name)
  26593. + code_lines.append('%s /* %s.%s */' % (space, typename, field.c_field_name))
  26594. +
  26595. + abs_field_name = _c_helper_absolute_name(prefix, field)
  26596. + # default for simple cases: call sizeof()
  26597. + length = "sizeof(%s)" % field.c_field_type
  26598. +
  26599. + if context in ('unserialize', 'unpack', 'sizeof'):
  26600. + # default: simple cast
  26601. + value = ' %s = *(%s *)xcb_tmp;' % (abs_field_name, field.c_field_type)
  26602. +
  26603. + # padding - we could probably just ignore it
  26604. + if field.type.is_pad and field.type.nmemb > 1:
  26605. + value = ''
  26606. + for i in range(field.type.nmemb):
  26607. + code_lines.append('%s %s[%d] = *(%s *)xcb_tmp;' %
  26608. + (space, abs_field_name, i, field.c_field_type))
  26609. + # total padding = sizeof(pad0) * nmemb
  26610. + length += " * %d" % field.type.nmemb
  26611. +
  26612. + if field.type.is_list:
  26613. + # no such case in the protocol, cannot be tested and therefore ignored for now
  26614. + raise Exception('list with fixed number of elemens unhandled in _unserialize()')
  26615. +
  26616. + elif 'serialize' == context:
  26617. + value = ' xcb_parts[xcb_parts_idx].iov_base = (char *) '
  26618. +
  26619. + if field.type.is_expr:
  26620. + # need to register a temporary variable for the expression in case we know its type
  26621. + if field.type.c_type is None:
  26622. + raise Exception("type for field '%s' (expression '%s') unkown" %
  26623. + (field.field_name, _c_accessor_get_expr(field.type.expr)))
  26624. +
  26625. + temp_vars.append(' %s xcb_expr_%s = %s;' % (field.type.c_type, _cpp(field.field_name),
  26626. + _c_accessor_get_expr(field.type.expr, prefix)))
  26627. + value += "&xcb_expr_%s;" % _cpp(field.field_name)
  26628. +
  26629. + elif field.type.is_pad:
  26630. + if field.type.nmemb == 1:
  26631. + value += "&xcb_pad;"
  26632. + else:
  26633. + # we could also set it to 0, see definition of xcb_send_request()
  26634. + value = ' xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;'
  26635. + length += "*%d" % field.type.nmemb
  26636. +
  26637. + else:
  26638. + # non-list type with fixed size
  26639. + if field.type.nmemb == 1:
  26640. + value += "&%s;" % (abs_field_name)
  26641. +
  26642. + # list with nmemb (fixed size) elements
  26643. + else:
  26644. + value += '%s;' % (abs_field_name)
  26645. + length = '%d' % field.type.nmemb
  26646. +
  26647. + return (value, length)
  26648. +# _c_serialize_helper_fields_fixed_size()
  26649. +
  26650. +def _c_serialize_helper_fields_variable_size(context, self, field,
  26651. + code_lines, temp_vars,
  26652. + space, prefix):
  26653. + prefix_str = _c_helper_absolute_name(prefix)
  26654. +
  26655. + if context in ('unserialize', 'unpack', 'sizeof'):
  26656. + value = ''
  26657. + var_field_name = 'xcb_tmp'
  26658. +
  26659. + # special case: intermixed fixed and variable size fields
  26660. + if self.var_followed_by_fixed_fields and 'unserialize' == context:
  26661. + value = ' %s = (%s *)xcb_tmp;' % (field.c_field_name, field.c_field_type)
  26662. + temp_vars.append(' %s *%s;' % (field.type.c_type, field.c_field_name))
  26663. + # special case: switch
  26664. + if 'unpack' == context:
  26665. + value = ' %s%s = (%s *)xcb_tmp;' % (prefix_str, field.c_field_name, field.c_field_type)
  26666. +
  26667. + elif 'serialize' == context:
  26668. + # variable size fields appear as parameters to _serialize() if the
  26669. + # 'toplevel' container is not a switch
  26670. + prefix_string = prefix_str if prefix[0][2].is_switch else ''
  26671. + var_field_name = "%s%s" % (prefix_string, field.c_field_name)
  26672. + value = ' xcb_parts[xcb_parts_idx].iov_base = (char *) %s;' % var_field_name
  26673. +
  26674. + length = ''
  26675. +
  26676. + code_lines.append('%s /* %s */' % (space, field.c_field_name))
  26677. +
  26678. + if field.type.is_list:
  26679. + if value != '':
  26680. + # in any context, list is already a pointer, so the default assignment is ok
  26681. + code_lines.append("%s%s" % (space, value))
  26682. + value = ''
  26683. + length = _c_serialize_helper_list_field(context, self, field,
  26684. + code_lines, temp_vars,
  26685. + space, prefix)
  26686. +
  26687. + elif field.type.is_switch:
  26688. + value = ''
  26689. + if context == 'serialize':
  26690. + # the _serialize() function allocates the correct amount memory if given a NULL pointer
  26691. + value = ' xcb_parts[xcb_parts_idx].iov_base = (char *)0;'
  26692. + length = _c_serialize_helper_switch_field(context, self, field,
  26693. + 'xcb_parts[xcb_parts_idx].iov_base',
  26694. + prefix)
  26695. +
  26696. + else:
  26697. + # in all remaining special cases - call _sizeof()
  26698. + length = "%s(%s)" % (field.type.c_sizeof_name, var_field_name)
  26699. +
  26700. + return (value, length)
  26701. +# _c_serialize_helper_fields_variable_size
  26702. +
  26703. +def _c_serialize_helper_fields(context, self,
  26704. + code_lines, temp_vars,
  26705. + space, prefix, is_bitcase):
  26706. + count = 0
  26707. + need_padding = False
  26708. + prev_field_was_variable = False
  26709. +
  26710. + for field in self.fields:
  26711. + if not field.visible:
  26712. + if not ((field.wire and not field.auto) or 'unserialize' == context):
  26713. + continue
  26714. +
  26715. + # switch/bitcase: fixed size fields must be considered explicitly
  26716. + if field.type.fixed_size():
  26717. + if self.is_bitcase or self.var_followed_by_fixed_fields:
  26718. + if prev_field_was_variable and need_padding:
  26719. + # insert padding
  26720. +# count += _c_serialize_helper_insert_padding(context, code_lines, space,
  26721. +# self.var_followed_by_fixed_fields)
  26722. + prev_field_was_variable = False
  26723. +
  26724. + # prefix for fixed size fields
  26725. + fixed_prefix = prefix
  26726. +
  26727. + value, length = _c_serialize_helper_fields_fixed_size(context, self, field,
  26728. + code_lines, temp_vars,
  26729. + space, fixed_prefix)
  26730. + else:
  26731. + continue
  26732. +
  26733. + # fields with variable size
  26734. + else:
  26735. + # switch/bitcase: always calculate padding before and after variable sized fields
  26736. + if need_padding or is_bitcase:
  26737. + count += _c_serialize_helper_insert_padding(context, code_lines, space,
  26738. + self.var_followed_by_fixed_fields)
  26739. +
  26740. + value, length = _c_serialize_helper_fields_variable_size(context, self, field,
  26741. + code_lines, temp_vars,
  26742. + space, prefix)
  26743. + prev_field_was_variable = True
  26744. +
  26745. + # save (un)serialization C code
  26746. + if '' != value:
  26747. + code_lines.append('%s%s' % (space, value))
  26748. +
  26749. + if field.type.fixed_size():
  26750. + if is_bitcase or self.var_followed_by_fixed_fields:
  26751. + # keep track of (un)serialized object's size
  26752. + code_lines.append('%s xcb_block_len += %s;' % (space, length))
  26753. + if context in ('unserialize', 'unpack', 'sizeof'):
  26754. + code_lines.append('%s xcb_tmp += %s;' % (space, length))
  26755. + else:
  26756. + # variable size objects or bitcase:
  26757. + # value & length might have been inserted earlier for special cases
  26758. + if '' != length:
  26759. + # special case: intermixed fixed and variable size fields
  26760. + if (not field.type.fixed_size() and
  26761. + self.var_followed_by_fixed_fields and 'unserialize' == context):
  26762. + temp_vars.append(' int %s_len;' % field.c_field_name)
  26763. + code_lines.append('%s %s_len = %s;' % (space, field.c_field_name, length))
  26764. + code_lines.append('%s xcb_block_len += %s_len;' % (space, field.c_field_name))
  26765. + code_lines.append('%s xcb_tmp += %s_len;' % (space, field.c_field_name))
  26766. + else:
  26767. + code_lines.append('%s xcb_block_len += %s;' % (space, length))
  26768. + # increase pointer into the byte stream accordingly
  26769. + if context in ('unserialize', 'sizeof', 'unpack'):
  26770. + code_lines.append('%s xcb_tmp += xcb_block_len;' % space)
  26771. +
  26772. + if 'serialize' == context:
  26773. + if '' != length:
  26774. + code_lines.append('%s xcb_parts[xcb_parts_idx].iov_len = %s;' % (space, length))
  26775. + code_lines.append('%s xcb_parts_idx++;' % space)
  26776. + count += 1
  26777. +
  26778. + code_lines.append('%s xcb_align_to = ALIGNOF(%s);' % (space, 'char' if field.c_field_type == 'void' else field.c_field_type))
  26779. +
  26780. + need_padding = True
  26781. + if self.var_followed_by_fixed_fields:
  26782. + need_padding = False
  26783. +
  26784. + return count
  26785. +# _c_serialize_helper_fields()
  26786. +
  26787. +def _c_serialize_helper(context, complex_type,
  26788. + code_lines, temp_vars,
  26789. + space='', prefix=[]):
  26790. + # count tracks the number of fields to serialize
  26791. + count = 0
  26792. +
  26793. + if hasattr(complex_type, 'type'):
  26794. + self = complex_type.type
  26795. + complex_name = complex_type.name
  26796. + else:
  26797. + self = complex_type
  26798. + if self.var_followed_by_fixed_fields and 'unserialize' == context:
  26799. + complex_name = 'xcb_out'
  26800. + else:
  26801. + complex_name = '_aux'
  26802. +
  26803. + # special case: switch is serialized by evaluating each bitcase separately
  26804. + if self.is_switch:
  26805. + count += _c_serialize_helper_switch(context, self, complex_name,
  26806. + code_lines, temp_vars,
  26807. + space, prefix)
  26808. +
  26809. + # all other data types can be evaluated one field a time
  26810. + else:
  26811. + # unserialize & fixed size fields: simply cast the buffer to the respective xcb_out type
  26812. + if context in ('unserialize', 'unpack', 'sizeof') and not self.var_followed_by_fixed_fields:
  26813. + code_lines.append('%s xcb_block_len += sizeof(%s);' % (space, self.c_type))
  26814. + code_lines.append('%s xcb_tmp += xcb_block_len;' % space)
  26815. + code_lines.append('%s xcb_buffer_len += xcb_block_len;' % space)
  26816. + code_lines.append('%s xcb_block_len = 0;' % space)
  26817. +
  26818. + count += _c_serialize_helper_fields(context, self,
  26819. + code_lines, temp_vars,
  26820. + space, prefix, False)
  26821. + # "final padding"
  26822. + count += _c_serialize_helper_insert_padding(context, code_lines, space, False)
  26823. +
  26824. + return count
  26825. +# _c_serialize_helper()
  26826. +
  26827. +def _c_serialize(context, self):
  26828. + """
  26829. + depending on the context variable, generate _serialize(), _unserialize(), _unpack(), or _sizeof()
  26830. + for the ComplexType variable self
  26831. + """
  26832. + _h_setlevel(1)
  26833. + _c_setlevel(1)
  26834. +
  26835. + # _hc('')
  26836. + # # _serialize() returns the buffer size
  26837. + # _hc('int')
  26838. +
  26839. + # sys.stderr.write('int')
  26840. +
  26841. +
  26842. + if self.is_switch and 'unserialize' == context:
  26843. + context = 'unpack'
  26844. +
  26845. + cases = { 'serialize' : self.c_serialize_name,
  26846. + 'unserialize' : self.c_unserialize_name,
  26847. + 'unpack' : self.c_unpack_name,
  26848. + 'sizeof' : self.c_sizeof_name }
  26849. + func_name = cases[context]
  26850. +
  26851. + param_fields, wire_fields, params = get_serialize_params(context, self)
  26852. + variable_size_fields = 0
  26853. + # maximum space required for type definition of function arguments
  26854. + maxtypelen = 0
  26855. +
  26856. + # determine N(variable_fields)
  26857. + for field in param_fields:
  26858. + # if self.is_switch, treat all fields as if they are variable sized
  26859. + if not field.type.fixed_size() or self.is_switch:
  26860. + variable_size_fields += 1
  26861. + # determine maxtypelen
  26862. + for p in params:
  26863. + maxtypelen = max(maxtypelen, len(p[0]) + len(p[1]))
  26864. +
  26865. + # write to .c/.h
  26866. + indent = ' '*(len(func_name)+2)
  26867. + param_str = []
  26868. + for p in params:
  26869. + typespec, pointerspec, field_name = p
  26870. + spacing = ' '*(maxtypelen-len(typespec)-len(pointerspec))
  26871. + param_str.append("%s%s%s %s%s /**< */" % (indent, typespec, spacing, pointerspec, field_name))
  26872. + # insert function name
  26873. + param_str[0] = "%s (%s" % (func_name, param_str[0].strip())
  26874. + param_str = list(map(lambda x: "%s," % x, param_str))
  26875. +
  26876. + # >>> THIS! <<< #
  26877. + # for s in param_str[:-1]:
  26878. + # sys.stderr.write(s)
  26879. +
  26880. + # _hc(s)
  26881. + # _h("%s);" % param_str[-1].rstrip(','))
  26882. +
  26883. + # >>> AND THAT! <<< #
  26884. + # sys.stderr.write("%s);" % param_str[-1].rstrip(','))
  26885. + # >>> AND THAT! <<< #
  26886. + _c("%s)" % param_str[-1].rstrip(','))
  26887. + _c('{')
  26888. +
  26889. + code_lines = []
  26890. + temp_vars = []
  26891. + prefix = []
  26892. +
  26893. + if 'serialize' == context:
  26894. + if not self.is_switch and not self.var_followed_by_fixed_fields:
  26895. + _c(' %s *xcb_out = *_buffer;', self.c_type)
  26896. + _c(' unsigned int xcb_out_pad = -sizeof(%s) & 3;', self.c_type)
  26897. + _c(' unsigned int xcb_buffer_len = sizeof(%s) + xcb_out_pad;', self.c_type)
  26898. + _c(' unsigned int xcb_align_to = 0;')
  26899. + else:
  26900. + _c(' char *xcb_out = *_buffer;')
  26901. + _c(' unsigned int xcb_buffer_len = 0;')
  26902. + _c(' unsigned int xcb_align_to = 0;')
  26903. + prefix = [('_aux', '->', self)]
  26904. + aux_ptr = 'xcb_out'
  26905. +
  26906. + elif context in ('unserialize', 'unpack'):
  26907. + _c(' char *xcb_tmp = (char *)_buffer;')
  26908. + if not self.is_switch:
  26909. + if not self.var_followed_by_fixed_fields:
  26910. + _c(' const %s *_aux = (%s *)_buffer;', self.c_type, self.c_type)
  26911. + prefix = [('_aux', '->', self)]
  26912. + else:
  26913. + _c(' %s xcb_out;', self.c_type)
  26914. + prefix = [('xcb_out', '.', self)]
  26915. + else:
  26916. + aux_var = '_aux' # default for unpack: single pointer
  26917. + # note: unserialize not generated for switch
  26918. + if 'unserialize' == context:
  26919. + aux_var = '(*_aux)' # unserialize: double pointer (!)
  26920. + prefix = [(aux_var, '->', self)]
  26921. + aux_ptr = '*_aux'
  26922. + _c(' unsigned int xcb_buffer_len = 0;')
  26923. + _c(' unsigned int xcb_block_len = 0;')
  26924. + _c(' unsigned int xcb_pad = 0;')
  26925. + _c(' unsigned int xcb_align_to = 0;')
  26926. +
  26927. + elif 'sizeof' == context:
  26928. + param_names = [p[2] for p in params]
  26929. + if self.is_switch:
  26930. + # switch: call _unpack()
  26931. + _c(' %s _aux;', self.c_type)
  26932. + _c(' return %s(%s, &_aux);', self.c_unpack_name, reduce(lambda x,y: "%s, %s" % (x, y), param_names))
  26933. + _c('}')
  26934. + return
  26935. + elif self.var_followed_by_fixed_fields:
  26936. + # special case: call _unserialize()
  26937. + _c(' return %s(%s, NULL);', self.c_unserialize_name, reduce(lambda x,y: "%s, %s" % (x, y), param_names))
  26938. + _c('}')
  26939. + return
  26940. + else:
  26941. + _c(' char *xcb_tmp = (char *)_buffer;')
  26942. + prefix = [('_aux', '->', self)]
  26943. +
  26944. + count = _c_serialize_helper(context, self, code_lines, temp_vars, prefix=prefix)
  26945. + # update variable size fields (only important for context=='serialize'
  26946. + variable_size_fields = count
  26947. + if 'serialize' == context:
  26948. + temp_vars.append(' unsigned int xcb_pad = 0;')
  26949. + temp_vars.append(' char xcb_pad0[3] = {0, 0, 0};')
  26950. + temp_vars.append(' struct iovec xcb_parts[%d];' % count)
  26951. + temp_vars.append(' unsigned int xcb_parts_idx = 0;')
  26952. + temp_vars.append(' unsigned int xcb_block_len = 0;')
  26953. + temp_vars.append(' unsigned int i;')
  26954. + temp_vars.append(' char *xcb_tmp;')
  26955. + elif 'sizeof' == context:
  26956. + # neither switch nor intermixed fixed and variable size fields:
  26957. + # evaluate parameters directly
  26958. + if not (self.is_switch or self.var_followed_by_fixed_fields):
  26959. +
  26960. + # look if we have to declare an '_aux' variable at all
  26961. + if len(list(filter(lambda x: x.find('_aux')!=-1, code_lines)))>0:
  26962. + if not self.var_followed_by_fixed_fields:
  26963. + _c(' const %s *_aux = (%s *)_buffer;', self.c_type, self.c_type)
  26964. + else:
  26965. + _c(' %s *_aux = malloc(sizeof(%s));', self.c_type, self.c_type)
  26966. +
  26967. + _c(' unsigned int xcb_buffer_len = 0;')
  26968. + _c(' unsigned int xcb_block_len = 0;')
  26969. + _c(' unsigned int xcb_pad = 0;')
  26970. + _c(' unsigned int xcb_align_to = 0;')
  26971. +
  26972. + _c('')
  26973. + for t in temp_vars:
  26974. + _c(t)
  26975. + _c('')
  26976. + for l in code_lines:
  26977. + _c(l)
  26978. +
  26979. + # variable sized fields have been collected, now
  26980. + # allocate memory and copy everything into a continuous memory area
  26981. + # note: this is not necessary in case of unpack
  26982. + if context in ('serialize', 'unserialize'):
  26983. + # unserialize: check for sizeof-only invocation
  26984. + if 'unserialize' == context:
  26985. + _c('')
  26986. + _c(' if (NULL == _aux)')
  26987. + _c(' return xcb_buffer_len;')
  26988. +
  26989. + _c('')
  26990. + _c(' if (NULL == %s) {', aux_ptr)
  26991. + _c(' /* allocate memory */')
  26992. + _c(' %s = malloc(xcb_buffer_len);', aux_ptr)
  26993. + if 'serialize' == context:
  26994. + _c(' *_buffer = xcb_out;')
  26995. + _c(' }')
  26996. + _c('')
  26997. +
  26998. + # serialize: handle variable size fields in a loop
  26999. + if 'serialize' == context:
  27000. + if not self.is_switch and not self.var_followed_by_fixed_fields:
  27001. + if len(wire_fields)>0:
  27002. + _c(' *xcb_out = *_aux;')
  27003. + # copy variable size fields into the buffer
  27004. + if variable_size_fields > 0:
  27005. + # xcb_out padding
  27006. + if not self.is_switch and not self.var_followed_by_fixed_fields:
  27007. + _c(' xcb_tmp = (char*)++xcb_out;')
  27008. + _c(' xcb_tmp += xcb_out_pad;')
  27009. + else:
  27010. + _c(' xcb_tmp = xcb_out;')
  27011. +
  27012. + # variable sized fields
  27013. + _c(' for(i=0; i<xcb_parts_idx; i++) {')
  27014. + _c(' if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)')
  27015. + _c(' memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);')
  27016. + _c(' if (0 != xcb_parts[i].iov_len)')
  27017. + _c(' xcb_tmp += xcb_parts[i].iov_len;')
  27018. + _c(' }')
  27019. +
  27020. + # unserialize: assign variable size fields individually
  27021. + if 'unserialize' == context:
  27022. + _c(' xcb_tmp = ((char *)*_aux)+xcb_buffer_len;')
  27023. + param_fields.reverse()
  27024. + for field in param_fields:
  27025. + if not field.type.fixed_size():
  27026. + _c(' xcb_tmp -= %s_len;', field.c_field_name)
  27027. + _c(' memmove(xcb_tmp, %s, %s_len);', field.c_field_name, field.c_field_name)
  27028. + _c(' *%s = xcb_out;', aux_ptr)
  27029. +
  27030. + _c('')
  27031. + _c(' return xcb_buffer_len;')
  27032. + _c('}')
  27033. +# _c_serialize()
  27034. +
  27035. +def _c_iterator_get_end(field, accum):
  27036. + '''
  27037. + Figures out what C code is needed to find the end of a variable-length structure field.
  27038. + For nested structures, recurses into its last variable-sized field.
  27039. + For lists, calls the end function
  27040. + '''
  27041. + if field.type.is_container:
  27042. + accum = field.c_accessor_name + '(' + accum + ')'
  27043. + return _c_iterator_get_end(field.type.last_varsized_field, accum)
  27044. + if field.type.is_list:
  27045. + # XXX we can always use the first way
  27046. + if field.type.member.is_simple:
  27047. + return field.c_end_name + '(' + accum + ')'
  27048. + else:
  27049. + return field.type.member.c_end_name + '(' + field.c_iterator_name + '(' + accum + '))'
  27050. +
  27051. +def _c_iterator(self, name):
  27052. + '''
  27053. + Declares the iterator structure and next/end functions for a given type.
  27054. + '''
  27055. + _h_setlevel(0)
  27056. + _h('')
  27057. + _h('/**')
  27058. + _h(' * @brief %s', self.c_iterator_type)
  27059. + _h(' **/')
  27060. + _h('typedef struct %s {', self.c_iterator_type)
  27061. + _h(' %s *data; /**< */', self.c_type)
  27062. + _h(' int%s rem; /**< */', ' ' * (len(self.c_type) - 2))
  27063. + _h(' int%s index; /**< */', ' ' * (len(self.c_type) - 2))
  27064. + _h('} %s;', self.c_iterator_type)
  27065. +
  27066. + _h_setlevel(1)
  27067. + _c_setlevel(1)
  27068. + _h('')
  27069. + _h('/**')
  27070. + _h(' * Get the next element of the iterator')
  27071. + _h(' * @param i Pointer to a %s', self.c_iterator_type)
  27072. + _h(' *')
  27073. + _h(' * Get the next element in the iterator. The member rem is')
  27074. + _h(' * decreased by one. The member data points to the next')
  27075. + _h(' * element. The member index is increased by sizeof(%s)', self.c_type)
  27076. + _h(' */')
  27077. + _c('')
  27078. + _hc('')
  27079. + _hc('/*****************************************************************************')
  27080. + _hc(' **')
  27081. + _hc(' ** void %s', self.c_next_name)
  27082. + _hc(' ** ')
  27083. + _hc(' ** @param %s *i', self.c_iterator_type)
  27084. + _hc(' ** @returns void')
  27085. + _hc(' **')
  27086. + _hc(' *****************************************************************************/')
  27087. + _hc(' ')
  27088. + _hc('void')
  27089. + _h('%s (%s *i /**< */);', self.c_next_name, self.c_iterator_type)
  27090. + _c('%s (%s *i /**< */)', self.c_next_name, self.c_iterator_type)
  27091. + _c('{')
  27092. +
  27093. + if not self.fixed_size():
  27094. + _c(' %s *R = i->data;', self.c_type)
  27095. +
  27096. + if self.is_union:
  27097. + # FIXME - how to determine the size of a variable size union??
  27098. + _c(' /* FIXME - determine the size of the union %s */', self.c_type)
  27099. + else:
  27100. + if self.need_sizeof:
  27101. + _c(' xcb_generic_iterator_t child;')
  27102. + _c(' child.data = (%s *)(((char *)R) + %s(R));',
  27103. + self.c_type, self.c_sizeof_name)
  27104. + _c(' i->index = (char *) child.data - (char *) i->data;')
  27105. + else:
  27106. + _c(' xcb_generic_iterator_t child = %s;', _c_iterator_get_end(self.last_varsized_field, 'R'))
  27107. + _c(' i->index = child.index;')
  27108. + _c(' --i->rem;')
  27109. + _c(' i->data = (%s *) child.data;', self.c_type)
  27110. +
  27111. + else:
  27112. + _c(' --i->rem;')
  27113. + _c(' ++i->data;')
  27114. + _c(' i->index += sizeof(%s);', self.c_type)
  27115. +
  27116. + _c('}')
  27117. +
  27118. + _h('')
  27119. + _h('/**')
  27120. + _h(' * Return the iterator pointing to the last element')
  27121. + _h(' * @param i An %s', self.c_iterator_type)
  27122. + _h(' * @return The iterator pointing to the last element')
  27123. + _h(' *')
  27124. + _h(' * Set the current element in the iterator to the last element.')
  27125. + _h(' * The member rem is set to 0. The member data points to the')
  27126. + _h(' * last element.')
  27127. + _h(' */')
  27128. + _c('')
  27129. + _hc('')
  27130. + _hc('/*****************************************************************************')
  27131. + _hc(' **')
  27132. + _hc(' ** xcb_generic_iterator_t %s', self.c_end_name)
  27133. + _hc(' ** ')
  27134. + _hc(' ** @param %s i', self.c_iterator_type)
  27135. + _hc(' ** @returns xcb_generic_iterator_t')
  27136. + _hc(' **')
  27137. + _hc(' *****************************************************************************/')
  27138. + _hc(' ')
  27139. + _hc('xcb_generic_iterator_t')
  27140. + _h('%s (%s i /**< */);', self.c_end_name, self.c_iterator_type)
  27141. + _c('%s (%s i /**< */)', self.c_end_name, self.c_iterator_type)
  27142. + _c('{')
  27143. + _c(' xcb_generic_iterator_t ret;')
  27144. +
  27145. + if self.fixed_size():
  27146. + _c(' ret.data = i.data + i.rem;')
  27147. + _c(' ret.index = i.index + ((char *) ret.data - (char *) i.data);')
  27148. + _c(' ret.rem = 0;')
  27149. + else:
  27150. + _c(' while(i.rem > 0)')
  27151. + _c(' %s(&i);', self.c_next_name)
  27152. + _c(' ret.data = i.data;')
  27153. + _c(' ret.rem = i.rem;')
  27154. + _c(' ret.index = i.index;')
  27155. +
  27156. + _c(' return ret;')
  27157. + _c('}')
  27158. +
  27159. +def _c_accessor_get_length(expr, field_mapping=None):
  27160. + '''
  27161. + Figures out what C code is needed to get a length field.
  27162. + The field_mapping parameter can be used to change the absolute name of a length field.
  27163. + For fields that follow a variable-length field, use the accessor.
  27164. + Otherwise, just reference the structure field directly.
  27165. + '''
  27166. +
  27167. + lenfield_name = expr.lenfield_name
  27168. + if lenfield_name is not None:
  27169. + if field_mapping is not None and lenfield_name in field_mapping:
  27170. + lenfield_name = field_mapping[lenfield_name][0]
  27171. +
  27172. + if expr.lenfield is not None and expr.lenfield.prev_varsized_field is not None:
  27173. + # special case: variable and fixed size fields are intermixed
  27174. + # if the lenfield is among the fixed size fields, there is no need
  27175. + # to call a special accessor function like <expr.lenfield.c_accessor_name + '(' + prefix + ')'>
  27176. + return field_mapping(expr.lenfield_name)
  27177. + elif expr.lenfield_name is not None:
  27178. + return lenfield_name
  27179. + else:
  27180. + return str(expr.nmemb)
  27181. +
  27182. +def _c_accessor_get_expr(expr, field_mapping):
  27183. + '''
  27184. + Figures out what C code is needed to get the length of a list field.
  27185. + The field_mapping parameter can be used to change the absolute name of a length field.
  27186. + Recurses for math operations.
  27187. + Returns bitcount for value-mask fields.
  27188. + Otherwise, uses the value of the length field.
  27189. + '''
  27190. + lenexp = _c_accessor_get_length(expr, field_mapping)
  27191. +
  27192. + if expr.op == '~':
  27193. + return '(' + '~' + _c_accessor_get_expr(expr.rhs, field_mapping) + ')'
  27194. + elif expr.op == 'popcount':
  27195. + return 'xcb_popcount(' + _c_accessor_get_expr(expr.rhs, field_mapping) + ')'
  27196. + elif expr.op == 'enumref':
  27197. + enum_name = expr.lenfield_type.name
  27198. + constant_name = expr.lenfield_name
  27199. + c_name = _n(enum_name + (constant_name,)).upper()
  27200. + return c_name
  27201. + elif expr.op == 'sumof':
  27202. + # locate the referenced list object
  27203. + list_obj = expr.lenfield_type
  27204. + field = None
  27205. + for f in expr.lenfield_parent.fields:
  27206. + if f.field_name == expr.lenfield_name:
  27207. + field = f
  27208. + break
  27209. +
  27210. + if field is None:
  27211. + raise Exception("list field '%s' referenced by sumof not found" % expr.lenfield_name)
  27212. + list_name = field_mapping[field.c_field_name][0]
  27213. + c_length_func = "%s(%s)" % (field.c_length_name, list_name)
  27214. + # note: xcb_sumof() has only been defined for integers
  27215. + c_length_func = _c_accessor_get_expr(field.type.expr, field_mapping)
  27216. + return 'xcb_sumof(%s, %s)' % (list_name, c_length_func)
  27217. + elif expr.op != None:
  27218. + return ('(' + _c_accessor_get_expr(expr.lhs, field_mapping) +
  27219. + ' ' + expr.op + ' ' +
  27220. + _c_accessor_get_expr(expr.rhs, field_mapping) + ')')
  27221. + elif expr.bitfield:
  27222. + return 'xcb_popcount(' + lenexp + ')'
  27223. + else:
  27224. + return lenexp
  27225. +
  27226. +def type_pad_type(type):
  27227. + if type == 'void':
  27228. + return 'char'
  27229. + return type
  27230. +
  27231. +def _c_accessors_field(self, field):
  27232. + '''
  27233. + Declares the accessor functions for a non-list field that follows a variable-length field.
  27234. + '''
  27235. + c_type = self.c_type
  27236. +
  27237. + # special case: switch
  27238. + switch_obj = self if self.is_switch else None
  27239. + if self.is_bitcase:
  27240. + switch_obj = self.parents[-1]
  27241. + if switch_obj is not None:
  27242. + c_type = switch_obj.c_type
  27243. +
  27244. + if field.type.is_simple:
  27245. + _hc('')
  27246. + _hc('')
  27247. + _hc('/*****************************************************************************')
  27248. + _hc(' ** ')
  27249. + _hc(' ** %s %s', field.c_field_type, field.c_accessor_name)
  27250. + _hc(' ** ')
  27251. + _hc(' ** @param const %s *R', c_type)
  27252. + _hc(' ** @returns %s', field.c_field_type)
  27253. + _hc(' **')
  27254. + _hc(' *****************************************************************************/')
  27255. + _hc(' ')
  27256. + _hc('%s', field.c_field_type)
  27257. + _h('%s (const %s *R /**< */);', field.c_accessor_name, c_type)
  27258. + _c('%s (const %s *R /**< */)', field.c_accessor_name, c_type)
  27259. + _c('{')
  27260. + if field.prev_varsized_field is None:
  27261. + _c(' return (%s *) (R + 1);', field.c_field_type)
  27262. + else:
  27263. + _c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
  27264. + _c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
  27265. + field.c_field_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
  27266. + _c('}')
  27267. + else:
  27268. + _hc('')
  27269. + _hc('')
  27270. + _hc('/*****************************************************************************')
  27271. + _hc(' **')
  27272. + _hc(' ** %s * %s', field.c_field_type, field.c_accessor_name)
  27273. + _hc(' ** ')
  27274. + _hc(' ** @param const %s *R', c_type)
  27275. + _hc(' ** @returns %s *', field.c_field_type)
  27276. + _hc(' **')
  27277. + _hc(' *****************************************************************************/')
  27278. + _hc(' ')
  27279. + if field.type.is_switch and switch_obj is None:
  27280. + return_type = 'void *'
  27281. + else:
  27282. + return_type = '%s *' % field.c_field_type
  27283. +
  27284. + _hc(return_type)
  27285. + _h('%s (const %s *R /**< */);', field.c_accessor_name, c_type)
  27286. + _c('%s (const %s *R /**< */)', field.c_accessor_name, c_type)
  27287. + _c('{')
  27288. + if field.prev_varsized_field is None:
  27289. + _c(' return (%s) (R + 1);', return_type)
  27290. + # note: the special case 'variable fields followed by fixed size fields'
  27291. + # is not of any consequence here, since the ordering gets
  27292. + # 'corrected' in the reply function
  27293. + else:
  27294. + _c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
  27295. + _c(' return (%s) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
  27296. + return_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
  27297. + _c('}')
  27298. +
  27299. +
  27300. +def _c_accessors_list(self, field):
  27301. + '''
  27302. + Declares the accessor functions for a list field.
  27303. + Declares a direct-accessor function only if the list members are fixed size.
  27304. + Declares length and get-iterator functions always.
  27305. + '''
  27306. + list = field.type
  27307. + c_type = self.c_type
  27308. +
  27309. + # special case: switch
  27310. + # in case of switch, 2 params have to be supplied to certain accessor functions:
  27311. + # 1. the anchestor object (request or reply)
  27312. + # 2. the (anchestor) switch object
  27313. + # the reason is that switch is either a child of a request/reply or nested in another switch,
  27314. + # so whenever we need to access a length field, we might need to refer to some anchestor type
  27315. + switch_obj = self if self.is_switch else None
  27316. + if self.is_bitcase:
  27317. + switch_obj = self.parents[-1]
  27318. + if switch_obj is not None:
  27319. + c_type = switch_obj.c_type
  27320. +
  27321. + params = []
  27322. + fields = {}
  27323. + parents = self.parents if hasattr(self, 'parents') else [self]
  27324. + # 'R': parents[0] is always the 'toplevel' container type
  27325. + params.append(('const %s *R' % parents[0].c_type, parents[0]))
  27326. + fields.update(_c_helper_field_mapping(parents[0], [('R', '->', parents[0])], flat=True))
  27327. + # auxiliary object for 'R' parameters
  27328. + R_obj = parents[0]
  27329. +
  27330. + if switch_obj is not None:
  27331. + # now look where the fields are defined that are needed to evaluate
  27332. + # the switch expr, and store the parent objects in accessor_params and
  27333. + # the fields in switch_fields
  27334. +
  27335. + # 'S': name for the 'toplevel' switch
  27336. + toplevel_switch = parents[1]
  27337. + params.append(('const %s *S' % toplevel_switch.c_type, toplevel_switch))
  27338. + fields.update(_c_helper_field_mapping(toplevel_switch, [('S', '->', toplevel_switch)], flat=True))
  27339. +
  27340. + # initialize prefix for everything "below" S
  27341. + prefix_str = '/* %s */ S' % toplevel_switch.name[-1]
  27342. + prefix = [(prefix_str, '->', toplevel_switch)]
  27343. +
  27344. + # look for fields in the remaining containers
  27345. + for p in parents[2:] + [self]:
  27346. + # the separator between parent and child is always '.' here,
  27347. + # because of nested switch statements
  27348. + if not p.is_bitcase or (p.is_bitcase and p.has_name):
  27349. + prefix.append((p.name[-1], '.', p))
  27350. + fields.update(_c_helper_field_mapping(p, prefix, flat=True))
  27351. +
  27352. + # auxiliary object for 'S' parameter
  27353. + S_obj = parents[1]
  27354. +
  27355. + _h_setlevel(1)
  27356. +
  27357. + if list.member.fixed_size():
  27358. + idx = 1 if switch_obj is not None else 0
  27359. +
  27360. + if switch_obj is not None:
  27361. + spacing = ' '*(len(field.c_length_name)+2)
  27362. + length = _c_accessor_get_expr(field.type.expr, fields)
  27363. + else:
  27364. + length = _c_accessor_get_expr(field.type.expr, fields)
  27365. +
  27366. + request_name = _ext(_n_item(self.name[-1]))
  27367. +
  27368. + if not request_name in _cpp_request_objects:
  27369. + # print >> sys.stderr, 'WARN: Skipping undefined _cpp_request_object %s' % (request_name,)
  27370. + return
  27371. +
  27372. + if list.member.fixed_size() and not self.is_bitcase:
  27373. + if field.c_field_type == "char":
  27374. + _cpp_request_objects[request_name].accessors.append( \
  27375. + Accessor(is_string=True,
  27376. + member=_ext(_n_item(field.field_name)),
  27377. + c_name=_n(self.name))
  27378. + )
  27379. +
  27380. + else:
  27381. + _cpp_request_objects[request_name].accessors.append( \
  27382. + Accessor(is_fixed=True,
  27383. + member=_ext(_n_item(field.field_name)),
  27384. + c_type=field.c_field_type,
  27385. + return_type="", # 'Type' if field.c_field_type == 'void' else field.c_field_type,
  27386. + iter_name="",
  27387. + c_name=_n(self.name))
  27388. + )
  27389. +
  27390. + else:
  27391. +
  27392. + # sys.stderr.write('request_name: %s\n' % request_name)
  27393. + # sys.stderr.write('c_iterator_name:\n%s;\nc_end_name:\n%s\n' \
  27394. + # % (field.c_iterator_name, field.c_end_name))
  27395. + # sys.stderr.write('field: %s\n' % (field))
  27396. + # sys.stderr.write('\n\n')
  27397. +
  27398. + if not self.is_bitcase:
  27399. + _cpp_request_objects[request_name].accessors.append( \
  27400. + Accessor(is_variable=True,
  27401. + member=_ext(_n_item(field.field_name)),
  27402. + c_type=field.c_field_type,
  27403. + return_type='Type' if field.c_field_type == 'void' else field.c_field_type,
  27404. + iter_name=_n(field.type.name),
  27405. + c_name=_n(self.name))
  27406. + )
  27407. +
  27408. + # sys.stderr.write('c_iterator_name:\n%s;\nc_end_name:\n%s\n' % (field.c_iterator_name,
  27409. + # field.c_end_name))
  27410. + # sys.stderr.write('field: %s\n' % (field))
  27411. + # sys.stderr.write('\n\n')
  27412. +
  27413. +def _c_accessors(self, name, base):
  27414. + '''
  27415. + Declares the accessor functions for the fields of a structure.
  27416. + '''
  27417. + # no accessors for switch itself -
  27418. + # switch always needs to be unpacked explicitly
  27419. +
  27420. + for field in self.fields:
  27421. + if field.type.is_list and not field.type.fixed_size():
  27422. + _c_accessors_list(self, field)
  27423. + elif field.prev_varsized_field is not None or not field.type.fixed_size():
  27424. + pass
  27425. + # _c_accessors_field(self, field)
  27426. + # sys.stderr.write("c_accessors_field(%s, %s)\n" % (self, field))
  27427. +
  27428. +def c_simple(self, name):
  27429. + '''
  27430. + Exported function that handles cardinal type declarations.
  27431. + These are types which are typedef'd to one of the CARDx's, char, float, etc.
  27432. + '''
  27433. + _c_type_setup(self, name, ())
  27434. +
  27435. + if (self.name != name):
  27436. + # Typedef
  27437. + _h_setlevel(0)
  27438. + my_name = _t(name)
  27439. + # _h('')
  27440. + # _h('typedef %s %s;', _t(self.name), my_name)
  27441. + # if field.type.is_simple:
  27442. + # if len(name) == 2:
  27443. + # _h('NS_HEAD(type)')
  27444. + # _h("TYPE_CLASS(%s)", _ext(_n_item(name[-1])))
  27445. + # _h('NS_TAIL(type)')
  27446. + # sys.stderr.write('type: %s, name: %s\n' % (field.field_type, field.field_name))
  27447. + # sys.stderr.write('simple: %s\n' % (field))
  27448. +
  27449. + # Iterator
  27450. + # _c_iterator(self, name)
  27451. +
  27452. +def _c_complex(self):
  27453. + '''
  27454. + Helper function for handling all structure types.
  27455. + Called for all structs, requests, replies, events, errors.
  27456. + '''
  27457. +
  27458. + '''
  27459. + _h_setlevel(0)
  27460. + _h('')
  27461. + _h('/**')
  27462. + _h(' * @brief %s', self.c_type)
  27463. + _h(' **/')
  27464. + _h('typedef %s %s {', self.c_container, self.c_type)
  27465. + '''
  27466. +
  27467. + struct_fields = []
  27468. + maxtypelen = 0
  27469. +
  27470. + varfield = None
  27471. + for field in self.fields:
  27472. + if not field.type.fixed_size() and not self.is_switch and not self.is_union:
  27473. + varfield = field.c_field_name
  27474. + continue
  27475. + if field.wire:
  27476. + struct_fields.append(field)
  27477. +
  27478. + for field in struct_fields:
  27479. + length = len(field.c_field_type)
  27480. + # account for '*' pointer_spec
  27481. + if not field.type.fixed_size() and not self.is_union:
  27482. + length += 1
  27483. + maxtypelen = max(maxtypelen, length)
  27484. +
  27485. + ### TODO: serialization(?)
  27486. + def _c_complex_field(self, field, space=''):
  27487. + if (field.type.fixed_size() or self.is_union or
  27488. + # in case of switch with switch children, don't make the field a pointer
  27489. + # necessary for unserialize to work
  27490. + (self.is_switch and field.type.is_switch)):
  27491. + spacing = ' ' * (maxtypelen - len(field.c_field_type))
  27492. + # _h('%s %s%s %s%s; /**< */', space, field.c_field_type, spacing, field.c_field_name, field.c_subscript)
  27493. + # _h("%s %s" % (field.field_type, field.field_name))
  27494. + # sys.stderr.write("serialize: %s, %s\n" % (field.field_type, field.field_name))
  27495. + else:
  27496. + spacing = ' ' * (maxtypelen - (len(field.c_field_type) + 1))
  27497. + # _h('%s %s%s *%s%s; /**< */', space, field.c_field_type, spacing, field.c_field_name, field.c_subscript)
  27498. +
  27499. + if not self.is_switch:
  27500. + for field in struct_fields:
  27501. + _c_complex_field(self, field)
  27502. + else:
  27503. + for b in self.bitcases:
  27504. + space = ''
  27505. + if b.type.has_name:
  27506. + # _h(' struct _%s {', b.c_field_name)
  27507. + space = ' '
  27508. + for field in b.type.fields:
  27509. + _c_complex_field(self, field, space)
  27510. + # if b.type.has_name:
  27511. + # _h(' } %s;', b.c_field_name)
  27512. +
  27513. + # _h('} %s;', self.c_type)
  27514. +
  27515. +def c_struct(self, name):
  27516. + '''
  27517. + Exported function that handles structure declarations.
  27518. + '''
  27519. + _c_type_setup(self, name, ())
  27520. + _c_complex(self)
  27521. + _c_accessors(self, name, name)
  27522. + _c_iterator(self, name)
  27523. +
  27524. +def c_union(self, name):
  27525. + '''
  27526. + Exported function that handles union declarations.
  27527. + '''
  27528. + _c_type_setup(self, name, ())
  27529. + _c_complex(self)
  27530. + _c_iterator(self, name)
  27531. +
  27532. +def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_fds=False):
  27533. + '''
  27534. + Declares a request function.
  27535. + '''
  27536. +
  27537. + # Four stunningly confusing possibilities here:
  27538. + #
  27539. + # Void Non-void
  27540. + # ------------------------------
  27541. + # "req" "req"
  27542. + # 0 flag CHECKED flag Normal Mode
  27543. + # void_cookie req_cookie
  27544. + # ------------------------------
  27545. + # "req_checked" "req_unchecked"
  27546. + # CHECKED flag 0 flag Abnormal Mode
  27547. + # void_cookie req_cookie
  27548. + # ------------------------------
  27549. +
  27550. +
  27551. + # Whether we are _checked or _unchecked
  27552. + checked = void and not regular
  27553. + unchecked = not void and not regular
  27554. +
  27555. + # What kind of cookie we return
  27556. + func_cookie = 'xcb_void_cookie_t' if void else self.c_cookie_type
  27557. +
  27558. + # What flag is passed to xcb_request
  27559. + func_flags = '0' if (void and regular) or (not void and not regular) else 'XCB_REQUEST_CHECKED'
  27560. +
  27561. + if reply_fds:
  27562. + if func_flags == '0':
  27563. + func_flags = 'XCB_REQUEST_REPLY_FDS'
  27564. + else:
  27565. + func_flags = func_flags + '|XCB_REQUEST_REPLY_FDS'
  27566. +
  27567. + # Global extension id variable or NULL for xproto
  27568. + func_ext_global = '&' + _ns.c_ext_global_name if _ns.is_ext else '0'
  27569. +
  27570. + # What our function name is
  27571. + func_name = self.c_request_name if not aux else self.c_aux_name
  27572. + if checked:
  27573. + func_name = self.c_checked_name if not aux else self.c_aux_checked_name
  27574. + if unchecked:
  27575. + func_name = self.c_unchecked_name if not aux else self.c_aux_unchecked_name
  27576. +
  27577. + param_fields = []
  27578. + wire_fields = []
  27579. + maxtypelen = len('xcb_connection_t')
  27580. + serial_fields = []
  27581. + # special case: list with variable size elements
  27582. + list_with_var_size_elems = False
  27583. +
  27584. + for field in self.fields:
  27585. + if field.visible:
  27586. + # The field should appear as a call parameter
  27587. + param_fields.append(field)
  27588. + if field.wire and not field.auto:
  27589. + # We need to set the field up in the structure
  27590. + wire_fields.append(field)
  27591. + if field.type.need_serialize or field.type.need_sizeof:
  27592. + serial_fields.append(field)
  27593. +
  27594. + for field in param_fields:
  27595. + c_field_const_type = field.c_field_const_type
  27596. + if field.type.need_serialize and not aux:
  27597. + c_field_const_type = "const void"
  27598. + if len(c_field_const_type) > maxtypelen:
  27599. + maxtypelen = len(c_field_const_type)
  27600. + if field.type.is_list and not field.type.member.fixed_size():
  27601. + list_with_var_size_elems = True
  27602. +
  27603. + _h_setlevel(1)
  27604. + _c_setlevel(1)
  27605. + # _h('')
  27606. + # _h('/**')
  27607. + # if hasattr(self, "doc") and self.doc:
  27608. + # if self.doc.brief:
  27609. + # _h(' * @brief ' + self.doc.brief)
  27610. + # else:
  27611. + # _h(' * No brief doc yet')
  27612. +
  27613. + # _h(' *')
  27614. + # _h(' * @param c The connection')
  27615. + param_names = [f.c_field_name for f in param_fields]
  27616. + if hasattr(self, "doc") and self.doc:
  27617. + for field in param_fields:
  27618. + # XXX: hard-coded until we fix xproto.xml
  27619. + base_func_name = self.c_request_name if not aux else self.c_aux_name
  27620. + if base_func_name == 'xcb_change_gc' and field.c_field_name == 'value_mask':
  27621. + field.enum = 'GC'
  27622. + elif base_func_name == 'xcb_change_window_attributes' and field.c_field_name == 'value_mask':
  27623. + field.enum = 'CW'
  27624. + elif base_func_name == 'xcb_create_window' and field.c_field_name == 'value_mask':
  27625. + field.enum = 'CW'
  27626. + if field.enum:
  27627. + # XXX: why the 'xcb' prefix?
  27628. + key = ('xcb', field.enum)
  27629. +
  27630. + tname = _t(key)
  27631. + if namecount[tname] > 1:
  27632. + tname = _t(key + ('enum',))
  27633. + # _h(' * @param %s A bitmask of #%s values.' % (field.c_field_name, tname))
  27634. +
  27635. + if self.doc and field.field_name in self.doc.fields:
  27636. + desc = self.doc.fields[field.field_name]
  27637. + for name in param_names:
  27638. + desc = desc.replace('`%s`' % name, '\\a %s' % (name))
  27639. + desc = desc.split("\n")
  27640. + desc = [line if line != '' else '\\n' for line in desc]
  27641. + # _h(' * @param %s %s' % (field.c_field_name, "\n * ".join(desc)))
  27642. + # If there is no documentation yet, we simply don't generate an
  27643. + # @param tag. Doxygen will then warn about missing documentation.
  27644. +
  27645. + # _h(' * @return A cookie')
  27646. + # _h(' *')
  27647. +
  27648. + # if hasattr(self, "doc") and self.doc:
  27649. + # if self.doc.description:
  27650. + # desc = self.doc.description
  27651. + # for name in param_names:
  27652. + # desc = desc.replace('`%s`' % name, '\\a %s' % (name))
  27653. + # desc = desc.split("\n")
  27654. + # _h(' * ' + "\n * ".join(desc))
  27655. + # else:
  27656. + # _h(' * No description yet')
  27657. + # else:
  27658. + # _h(' * Delivers a request to the X server.')
  27659. + # _h(' * ')
  27660. + # if checked:
  27661. + # _h(' * This form can be used only if the request will not cause')
  27662. + # _h(' * a reply to be generated. Any returned error will be')
  27663. + # _h(' * saved for handling by xcb_request_check().')
  27664. + # if unchecked:
  27665. + # _h(' * This form can be used only if the request will cause')
  27666. + # _h(' * a reply to be generated. Any returned error will be')
  27667. + # _h(' * placed in the event queue.')
  27668. + # _h(' */')
  27669. + # _c('')
  27670. + # _hc('')
  27671. + # _hc('/*****************************************************************************')
  27672. + # _hc(' **')
  27673. + # _hc(' ** %s %s', cookie_type, func_name)
  27674. + # _hc(' ** ')
  27675. +
  27676. + spacing = ' ' * (maxtypelen - len('xcb_connection_t'))
  27677. + _c(' ** @param xcb_connection_t%s *c', spacing)
  27678. +
  27679. + for field in param_fields:
  27680. + c_field_const_type = field.c_field_const_type
  27681. + if field.type.need_serialize and not aux:
  27682. + c_field_const_type = "const void"
  27683. + spacing = ' ' * (maxtypelen - len(c_field_const_type))
  27684. + _c(' ** @param %s%s %s%s', c_field_const_type, spacing, field.c_pointer, field.c_field_name)
  27685. +
  27686. + _c(' ** @returns %s', cookie_type)
  27687. + _c(' **')
  27688. + _c(' *****************************************************************************/')
  27689. + _c(' ')
  27690. + _c('%s', cookie_type)
  27691. +
  27692. + spacing = ' ' * (maxtypelen - len('xcb_connection_t'))
  27693. + comma = ',' if len(param_fields) else ');'
  27694. + # _h('%s (xcb_connection_t%s *c /**< */%s', func_name, spacing, comma)
  27695. + comma = ',' if len(param_fields) else ')'
  27696. + _c('%s (xcb_connection_t%s *c /**< */%s', func_name, spacing, comma)
  27697. +
  27698. + func_spacing = ' ' * (len(func_name) + 2)
  27699. + count = len(param_fields)
  27700. + for field in param_fields:
  27701. + count = count - 1
  27702. + c_field_const_type = field.c_field_const_type
  27703. + c_pointer = field.c_pointer
  27704. + if field.type.need_serialize and not aux:
  27705. + c_field_const_type = "const void"
  27706. + c_pointer = '*'
  27707. + spacing = ' ' * (maxtypelen - len(c_field_const_type))
  27708. + comma = ',' if count else ');'
  27709. + # _h('%s%s%s %s%s /**< */%s', func_spacing, c_field_const_type,
  27710. + # spacing, c_pointer, field.c_field_name, comma)
  27711. + comma = ',' if count else ')'
  27712. + _c('%s%s%s %s%s /**< */%s', func_spacing, c_field_const_type,
  27713. + spacing, c_pointer, field.c_field_name, comma)
  27714. +
  27715. + count = 2
  27716. + if not self.var_followed_by_fixed_fields:
  27717. + for field in param_fields:
  27718. + if not field.type.fixed_size():
  27719. + count = count + 2
  27720. + if field.type.need_serialize:
  27721. + # _serialize() keeps track of padding automatically
  27722. + count -= 1
  27723. + dimension = count + 2
  27724. +
  27725. + _c('{')
  27726. + _c(' static const xcb_protocol_request_t xcb_req = {')
  27727. + _c(' /* count */ %d,', count)
  27728. + _c(' /* ext */ %s,', func_ext_global)
  27729. + _c(' /* opcode */ %s,', self.c_request_name.upper())
  27730. + _c(' /* isvoid */ %d', 1 if void else 0)
  27731. + _c(' };')
  27732. + _c(' ')
  27733. +
  27734. + _c(' struct iovec xcb_parts[%d];', dimension)
  27735. + _c(' %s xcb_ret;', func_cookie)
  27736. + _c(' %s xcb_out;', self.c_type)
  27737. + if self.var_followed_by_fixed_fields:
  27738. + _c(' /* in the protocol description, variable size fields are followed by fixed size fields */')
  27739. + _c(' void *xcb_aux = 0;')
  27740. +
  27741. +
  27742. + for idx, f in enumerate(serial_fields):
  27743. + if aux:
  27744. + _c(' void *xcb_aux%d = 0;' % (idx))
  27745. + if list_with_var_size_elems:
  27746. + _c(' unsigned int i;')
  27747. + _c(' unsigned int xcb_tmp_len;')
  27748. + _c(' char *xcb_tmp;')
  27749. + _c(' ')
  27750. + # simple request call tracing
  27751. +# _c(' printf("in function %s\\n");' % func_name)
  27752. +
  27753. + # fixed size fields
  27754. + for field in wire_fields:
  27755. + if field.type.fixed_size():
  27756. + if field.type.is_expr:
  27757. + _c(' xcb_out.%s = %s;', field.c_field_name, _c_accessor_get_expr(field.type.expr, None))
  27758. + elif field.type.is_pad:
  27759. + if field.type.nmemb == 1:
  27760. + _c(' xcb_out.%s = 0;', field.c_field_name)
  27761. + else:
  27762. + _c(' memset(xcb_out.%s, 0, %d);', field.c_field_name, field.type.nmemb)
  27763. + else:
  27764. + if field.type.nmemb == 1:
  27765. + _c(' xcb_out.%s = %s;', field.c_field_name, field.c_field_name)
  27766. + else:
  27767. + _c(' memcpy(xcb_out.%s, %s, %d);', field.c_field_name, field.c_field_name, field.type.nmemb)
  27768. +
  27769. + def get_serialize_args(type_obj, c_field_name, aux_var, context='serialize'):
  27770. + serialize_args = get_serialize_params(context, type_obj,
  27771. + c_field_name,
  27772. + aux_var)[2]
  27773. + return reduce(lambda x,y: "%s, %s" % (x,y), [a[2] for a in serialize_args])
  27774. +
  27775. + # calls in order to free dyn. all. memory
  27776. + free_calls = []
  27777. +
  27778. + _c(' ')
  27779. + if not self.var_followed_by_fixed_fields:
  27780. + _c(' xcb_parts[2].iov_base = (char *) &xcb_out;')
  27781. + _c(' xcb_parts[2].iov_len = sizeof(xcb_out);')
  27782. + _c(' xcb_parts[3].iov_base = 0;')
  27783. + _c(' xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;')
  27784. +
  27785. + count = 4
  27786. +
  27787. + for field in param_fields:
  27788. + if not field.type.fixed_size():
  27789. + _c(' /* %s %s */', field.type.c_type, field.c_field_name)
  27790. + # default: simple cast to char *
  27791. + if not field.type.need_serialize and not field.type.need_sizeof:
  27792. + _c(' xcb_parts[%d].iov_base = (char *) %s;', count, field.c_field_name)
  27793. + if field.type.is_list:
  27794. + # _c("IS_LIST")
  27795. + if field.type.member.fixed_size():
  27796. + _c(' xcb_parts[%d].iov_len = %s * sizeof(%s);', count,
  27797. + _c_accessor_get_expr(field.type.expr, None),
  27798. + field.type.member.c_wiretype)
  27799. + else:
  27800. + list_length = _c_accessor_get_expr(field.type.expr, None)
  27801. +
  27802. + length = ''
  27803. + _c(" xcb_parts[%d].iov_len = 0;" % count)
  27804. + _c(" xcb_tmp = (char *)%s;", field.c_field_name)
  27805. + _c(" for(i=0; i<%s; i++) {" % list_length)
  27806. + _c(" xcb_tmp_len = %s(xcb_tmp);" %
  27807. + (field.type.c_sizeof_name))
  27808. + _c(" xcb_parts[%d].iov_len += xcb_tmp_len;" % count)
  27809. + _c(" xcb_tmp += xcb_tmp_len;")
  27810. + _c(" }")
  27811. + else:
  27812. + # not supposed to happen
  27813. + raise Exception("unhandled variable size field %s" % field.c_field_name)
  27814. + else:
  27815. + if not aux:
  27816. + _c(' xcb_parts[%d].iov_base = (char *) %s;', count, field.c_field_name)
  27817. + idx = serial_fields.index(field)
  27818. + aux_var = '&xcb_aux%d' % idx
  27819. + context = 'serialize' if aux else 'sizeof'
  27820. + _c(' xcb_parts[%d].iov_len = ', count)
  27821. + if aux:
  27822. + serialize_args = get_serialize_args(field.type, aux_var, field.c_field_name, context)
  27823. + _c(' %s (%s);', field.type.c_serialize_name, serialize_args)
  27824. + _c(' xcb_parts[%d].iov_base = xcb_aux%d;' % (count, idx))
  27825. + free_calls.append(' free(xcb_aux%d);' % idx)
  27826. + else:
  27827. + serialize_args = get_serialize_args(field.type, field.c_field_name, aux_var, context)
  27828. + func_name = field.type.c_sizeof_name
  27829. + _c(' %s (%s);', func_name, serialize_args)
  27830. +
  27831. + count += 1
  27832. + if not (field.type.need_serialize or field.type.need_sizeof):
  27833. + # the _serialize() function keeps track of padding automatically
  27834. + _c(' xcb_parts[%d].iov_base = 0;', count)
  27835. + _c(' xcb_parts[%d].iov_len = -xcb_parts[%d].iov_len & 3;', count, count-1)
  27836. + count += 1
  27837. +
  27838. + # elif self.var_followed_by_fixed_fields:
  27839. + else:
  27840. + _c(' xcb_parts[2].iov_base = (char *) &xcb_out;')
  27841. + # request header: opcodes + length
  27842. + _c(' xcb_parts[2].iov_len = 2*sizeof(uint8_t) + sizeof(uint16_t);')
  27843. + count += 1
  27844. + # call _serialize()
  27845. + buffer_var = '&xcb_aux'
  27846. + serialize_args = get_serialize_args(self, buffer_var, '&xcb_out', 'serialize')
  27847. + _c(' xcb_parts[%d].iov_len = %s (%s);', count, self.c_serialize_name, serialize_args)
  27848. + _c(' xcb_parts[%d].iov_base = (char *) xcb_aux;', count)
  27849. + free_calls.append(' free(xcb_aux);')
  27850. + # no padding necessary - _serialize() keeps track of padding automatically
  27851. +
  27852. + _c(' ')
  27853. + for field in param_fields:
  27854. + if field.isfd:
  27855. + _c(' xcb_send_fd(c, %s);', field.c_field_name)
  27856. +
  27857. + _c(' xcb_ret.sequence = xcb_send_request(c, %s, xcb_parts + 2, &xcb_req);', func_flags)
  27858. +
  27859. + # free dyn. all. data, if any
  27860. + for f in free_calls:
  27861. + _c(f)
  27862. + _c(' return xcb_ret;')
  27863. + _c('}')
  27864. +
  27865. +def _cpp_request_helper(self, name, is_void):
  27866. + '''
  27867. + Declares a request function.
  27868. + '''
  27869. +
  27870. + request_name = _ext(_n_item(self.name[-1]))
  27871. + c_func_name = _n(self.name)
  27872. +
  27873. + param_fields = []
  27874. +
  27875. + for field in self.fields:
  27876. + if field.visible:
  27877. + param_fields.append(field)
  27878. +
  27879. + for field in param_fields:
  27880. + c_field_const_type = field.c_field_const_type
  27881. + if field.type.need_serialize:
  27882. + c_field_const_type = "const void"
  27883. +
  27884. + _cpp_request_names.append(request_name)
  27885. + # self == request
  27886. + _cpp_request_objects[request_name] = CppRequest(self, request_name, is_void, _ns, self.reply)
  27887. +
  27888. + # is_obj_func = False
  27889. + # if (len(param_fields) > 0 and len(param_fields[0].field_type) > 1):
  27890. + # # e.g.: DRAWABLE in { "DRAWABLE" : [], .. }
  27891. + # obj_name = param_fields[0].field_type[-1]
  27892. + # is_obj_func = obj_name in _type_objects[get_namespace(_ns)]
  27893. +
  27894. + generate_request_specialization = False
  27895. + for field in param_fields:
  27896. + c_field_const_type = field.c_field_const_type
  27897. +
  27898. + if field.c_pointer == " ": c_pointer = ""
  27899. + else: c_pointer = " " + field.c_pointer
  27900. +
  27901. + if field.type.need_serialize:
  27902. + c_field_const_type = "const void"
  27903. + c_pointer = ' *'
  27904. +
  27905. + param = Parameter(field) # , verbose=request_name=="set_screen_config")
  27906. +
  27907. + _cpp_request_objects[request_name].add(param)
  27908. +
  27909. + if (param.is_const and param.is_pointer
  27910. + and param.c_type == 'void'):
  27911. + generate_request_specialization = True
  27912. +
  27913. + _cpp_request_objects[request_name].make_wrapped()
  27914. +
  27915. + _interface_class.add(_cpp_request_objects[request_name])
  27916. +
  27917. + for key in _object_classes:
  27918. + _object_classes[key].set_namespace(_ns)
  27919. + _object_classes[key].add(_cpp_request_objects[request_name])
  27920. +
  27921. + ### C CODE ###
  27922. +
  27923. + # if generate_request_specialization:
  27924. + # if self.reply:
  27925. + # # _c_type_setup(self.reply, name, ('reply',))
  27926. + # # Reply structure definition
  27927. + # # _c_complex(self.reply)
  27928. + # # Request prototypes
  27929. + # has_fds = _c_reply_has_fds(self.reply)
  27930. + # _c_request_helper(self, name, self.c_cookie_type, False, True, False, has_fds)
  27931. + # _c_request_helper(self, name, self.c_cookie_type, False, False, False, has_fds)
  27932. + # if self.need_aux:
  27933. + # _c_request_helper(self, name, self.c_cookie_type, False, True, True, has_fds)
  27934. + # _c_request_helper(self, name, self.c_cookie_type, False, False, True, has_fds)
  27935. + # # Reply accessors
  27936. + # # _c_accessors(self.reply, name + ('reply',), name)
  27937. + # # _c_reply(self, name)
  27938. + # # if has_fds:
  27939. + # # _c_reply_fds(self, name)
  27940. + # else:
  27941. + # # Request prototypes
  27942. + # _c_request_helper(self, name, 'xcb_void_cookie_t', True, False)
  27943. + # _c_request_helper(self, name, 'xcb_void_cookie_t', True, True)
  27944. + # if self.need_aux:
  27945. + # _c_request_helper(self, name, 'xcb_void_cookie_t', True, False, True)
  27946. + # _c_request_helper(self, name, 'xcb_void_cookie_t', True, True, True)
  27947. +
  27948. + ### C CODE ###
  27949. +
  27950. +def _c_reply(self, name):
  27951. + '''
  27952. + Declares the function that returns the reply structure.
  27953. + '''
  27954. + spacing1 = ' ' * (len(self.c_cookie_type) - len('xcb_connection_t'))
  27955. + spacing2 = ' ' * (len(self.c_cookie_type) - len('xcb_generic_error_t'))
  27956. + spacing3 = ' ' * (len(self.c_reply_name) + 2)
  27957. +
  27958. + # check if _unserialize() has to be called for any field
  27959. + def look_for_special_cases(complex_obj):
  27960. + unserialize_fields = []
  27961. + # no unserialize call in case of switch
  27962. + if not complex_obj.is_switch:
  27963. + for field in complex_obj.fields:
  27964. + # three cases: 1. field with special case
  27965. + # 2. container that contains special case field
  27966. + # 3. list with special case elements
  27967. + if field.type.var_followed_by_fixed_fields:
  27968. + unserialize_fields.append(field)
  27969. + elif field.type.is_container:
  27970. + unserialize_fields += look_for_special_cases(field.type)
  27971. + elif field.type.is_list:
  27972. + if field.type.member.var_followed_by_fixed_fields:
  27973. + unserialize_fields.append(field)
  27974. + if field.type.member.is_container:
  27975. + unserialize_fields += look_for_special_cases(field.type.member)
  27976. + return unserialize_fields
  27977. +
  27978. + unserialize_fields = look_for_special_cases(self.reply)
  27979. +
  27980. + '''
  27981. + _h('')
  27982. + _h('/**')
  27983. + _h(' * Return the reply')
  27984. + _h(' * @param c The connection')
  27985. + _h(' * @param cookie The cookie')
  27986. + _h(' * @param e The xcb_generic_error_t supplied')
  27987. + _h(' *')
  27988. + _h(' * Returns the reply of the request asked by')
  27989. + _h(' * ')
  27990. + _h(' * The parameter @p e supplied to this function must be NULL if')
  27991. + _h(' * %s(). is used.', self.c_unchecked_name)
  27992. + _h(' * Otherwise, it stores the error if any.')
  27993. + _h(' *')
  27994. + _h(' * The returned value must be freed by the caller using free().')
  27995. + _h(' */')
  27996. + _c('')
  27997. + _hc('')
  27998. + _hc('/*****************************************************************************')
  27999. + _hc(' **')
  28000. + _hc(' ** %s * %s', self.c_reply_type, self.c_reply_name)
  28001. + _hc(' ** ')
  28002. + _hc(' ** @param xcb_connection_t%s *c', spacing1)
  28003. + _hc(' ** @param %s cookie', self.c_cookie_type)
  28004. + _hc(' ** @param xcb_generic_error_t%s **e', spacing2)
  28005. + _hc(' ** @returns %s *', self.c_reply_type)
  28006. + _hc(' **')
  28007. + _hc(' *****************************************************************************/')
  28008. + '''
  28009. +
  28010. + _hc(' ')
  28011. + _hc('%s *', self.c_reply_type)
  28012. + _hc('%s (xcb_connection_t%s *c /**< */,', self.c_reply_name, spacing1)
  28013. + _hc('%s%s cookie /**< */,', spacing3, self.c_cookie_type)
  28014. + _h('%sxcb_generic_error_t%s **e /**< */);', spacing3, spacing2)
  28015. + _c('%sxcb_generic_error_t%s **e /**< */)', spacing3, spacing2)
  28016. + _c('{')
  28017. +
  28018. + if len(unserialize_fields)>0:
  28019. + # certain variable size fields need to be unserialized explicitly
  28020. + _c(' %s *reply = (%s *) xcb_wait_for_reply(c, cookie.sequence, e);',
  28021. + self.c_reply_type, self.c_reply_type)
  28022. + _c(' int i;')
  28023. + for field in unserialize_fields:
  28024. + if field.type.is_list:
  28025. + _c(' %s %s_iter = %s(reply);', field.c_iterator_type, field.c_field_name, field.c_iterator_name)
  28026. + _c(' int %s_len = %s(reply);', field.c_field_name, field.c_length_name)
  28027. + _c(' %s *%s_data;', field.c_field_type, field.c_field_name)
  28028. + else:
  28029. + raise Exception('not implemented: call _unserialize() in reply for non-list type %s', field.c_field_type)
  28030. + # call _unserialize(), using the reply as source and target buffer
  28031. + _c(' /* special cases: transform parts of the reply to match XCB data structures */')
  28032. + for field in unserialize_fields:
  28033. + if field.type.is_list:
  28034. + _c(' for(i=0; i<%s_len; i++) {', field.c_field_name)
  28035. + _c(' %s_data = %s_iter.data;', field.c_field_name, field.c_field_name)
  28036. + _c(' %s((const void *)%s_data, &%s_data);', field.type.c_unserialize_name,
  28037. + field.c_field_name, field.c_field_name)
  28038. + _c(' %s(&%s_iter);', field.type.c_next_name, field.c_field_name)
  28039. + _c(' }')
  28040. + # return the transformed reply
  28041. + _c(' return reply;')
  28042. +
  28043. + else:
  28044. + _c(' return (%s *) xcb_wait_for_reply(c, cookie.sequence, e);', self.c_reply_type)
  28045. +
  28046. + _c('}')
  28047. +
  28048. +def _c_reply_has_fds(self):
  28049. + for field in self.fields:
  28050. + if field.isfd:
  28051. + return True
  28052. + return False
  28053. +
  28054. +def _c_reply_fds(self, name):
  28055. + '''
  28056. + Declares the function that returns fds related to the reply.
  28057. + '''
  28058. + spacing1 = ' ' * (len(self.c_reply_type) - len('xcb_connection_t'))
  28059. + spacing3 = ' ' * (len(self.c_reply_fds_name) + 2)
  28060. + _h('')
  28061. + _h('/**')
  28062. + _h(' * Return the reply fds')
  28063. + _h(' * @param c The connection')
  28064. + _h(' * @param reply The reply')
  28065. + _h(' *')
  28066. + _h(' * Returns the array of reply fds of the request asked by')
  28067. + _h(' * ')
  28068. + _h(' * The returned value must be freed by the caller using free().')
  28069. + _h(' */')
  28070. + _c('')
  28071. + _hc('')
  28072. + _hc('/*****************************************************************************')
  28073. + _hc(' **')
  28074. + _hc(' ** int * %s', self.c_reply_fds_name)
  28075. + _hc(' ** ')
  28076. + _hc(' ** @param xcb_connection_t%s *c', spacing1)
  28077. + _hc(' ** @param %s *reply', self.c_reply_type)
  28078. + _hc(' ** @returns int *')
  28079. + _hc(' **')
  28080. + _hc(' *****************************************************************************/')
  28081. + _hc(' ')
  28082. + _hc('int *')
  28083. + _hc('%s (xcb_connection_t%s *c /**< */,', self.c_reply_fds_name, spacing1)
  28084. + _h('%s%s *reply /**< */);', spacing3, self.c_reply_type)
  28085. + _c('%s%s *reply /**< */)', spacing3, self.c_reply_type)
  28086. + _c('{')
  28087. +
  28088. + _c(' return xcb_get_reply_fds(c, reply, sizeof(%s) + 4 * reply->length);', self.c_reply_type)
  28089. +
  28090. + _c('}')
  28091. +
  28092. +
  28093. +def _c_opcode(name, opcode):
  28094. + '''
  28095. + Declares the opcode define for requests, events, and errors.
  28096. + '''
  28097. + _h_setlevel(0)
  28098. + _h('')
  28099. + _h('/** Opcode for %s. */', _n(name))
  28100. + _h('#define %s %s', _n(name).upper(), opcode)
  28101. +
  28102. +def _c_cookie(self, name):
  28103. + '''
  28104. + Declares the cookie type for a non-void request.
  28105. + '''
  28106. + _h_setlevel(0)
  28107. + _h('')
  28108. + _h('/**')
  28109. + _h(' * @brief %s', self.c_cookie_type)
  28110. + _h(' **/')
  28111. + _h('typedef struct %s {', self.c_cookie_type)
  28112. + _h(' unsigned int sequence; /**< */')
  28113. + _h('} %s;', self.c_cookie_type)
  28114. +
  28115. +def _man_request(self, name, cookie_type, void, aux):
  28116. + param_fields = [f for f in self.fields if f.visible]
  28117. +
  28118. + func_name = self.c_request_name if not aux else self.c_aux_name
  28119. +
  28120. + def create_link(linkname):
  28121. + name = 'man/%s.3' % linkname
  28122. + if manpaths:
  28123. + sys.stdout.write(name)
  28124. + f = open(name, 'w')
  28125. + f.write('.so man3/%s.3' % func_name)
  28126. + f.close()
  28127. +
  28128. + if manpaths:
  28129. + sys.stdout.write('man/%s.3 ' % func_name)
  28130. + # Our CWD is src/, so this will end up in src/man/
  28131. + f = open('man/%s.3' % func_name, 'w')
  28132. + f.write('.TH %s 3 %s "XCB" "XCB Requests"\n' % (func_name, today))
  28133. + # Left-adjust instead of adjusting to both sides
  28134. + f.write('.ad l\n')
  28135. + f.write('.SH NAME\n')
  28136. + brief = self.doc.brief if hasattr(self, "doc") and self.doc else ''
  28137. + f.write('%s \\- %s\n' % (func_name, brief))
  28138. + f.write('.SH SYNOPSIS\n')
  28139. + # Don't split words (hyphenate)
  28140. + f.write('.hy 0\n')
  28141. + f.write('.B #include <xcb/%s.h>\n' % _ns.header)
  28142. +
  28143. + # function prototypes
  28144. + prototype = ''
  28145. + count = len(param_fields)
  28146. + for field in param_fields:
  28147. + count = count - 1
  28148. + c_field_const_type = field.c_field_const_type
  28149. + c_pointer = field.c_pointer
  28150. + if c_pointer == ' ':
  28151. + c_pointer = ''
  28152. + if field.type.need_serialize and not aux:
  28153. + c_field_const_type = "const void"
  28154. + c_pointer = '*'
  28155. + comma = ', ' if count else ');'
  28156. + prototype += '%s\\ %s\\fI%s\\fP%s' % (c_field_const_type, c_pointer, field.c_field_name, comma)
  28157. +
  28158. + f.write('.SS Request function\n')
  28159. + f.write('.HP\n')
  28160. + base_func_name = self.c_request_name if not aux else self.c_aux_name
  28161. + f.write('%s \\fB%s\\fP(xcb_connection_t\\ *\\fIconn\\fP, %s\n' % (cookie_type, base_func_name, prototype))
  28162. + create_link('%s_%s' % (base_func_name, ('checked' if void else 'unchecked')))
  28163. + if not void:
  28164. + f.write('.PP\n')
  28165. + f.write('.SS Reply datastructure\n')
  28166. + f.write('.nf\n')
  28167. + f.write('.sp\n')
  28168. + f.write('typedef %s %s {\n' % (self.reply.c_container, self.reply.c_type))
  28169. + struct_fields = []
  28170. + maxtypelen = 0
  28171. +
  28172. + for field in self.reply.fields:
  28173. + if not field.type.fixed_size() and not self.is_switch and not self.is_union:
  28174. + continue
  28175. + if field.wire:
  28176. + struct_fields.append(field)
  28177. +
  28178. + for field in struct_fields:
  28179. + length = len(field.c_field_type)
  28180. + # account for '*' pointer_spec
  28181. + if not field.type.fixed_size():
  28182. + length += 1
  28183. + maxtypelen = max(maxtypelen, length)
  28184. +
  28185. + def _c_complex_field(self, field, space=''):
  28186. + if (field.type.fixed_size() or
  28187. + # in case of switch with switch children, don't make the field a pointer
  28188. + # necessary for unserialize to work
  28189. + (self.is_switch and field.type.is_switch)):
  28190. + spacing = ' ' * (maxtypelen - len(field.c_field_type))
  28191. + f.write('%s %s%s \\fI%s\\fP%s;\n' % (space, field.c_field_type, spacing, field.c_field_name, field.c_subscript))
  28192. + else:
  28193. + spacing = ' ' * (maxtypelen - (len(field.c_field_type) + 1))
  28194. + f.write('ELSE %s = %s\n' % (field.c_field_type, field.c_field_name))
  28195. + #_h('%s %s%s *%s%s; /**< */', space, field.c_field_type, spacing, field.c_field_name, field.c_subscript)
  28196. +
  28197. + if not self.is_switch:
  28198. + for field in struct_fields:
  28199. + _c_complex_field(self, field)
  28200. + else:
  28201. + for b in self.bitcases:
  28202. + space = ''
  28203. + if b.type.has_name:
  28204. + space = ' '
  28205. + for field in b.type.fields:
  28206. + _c_complex_field(self, field, space)
  28207. + if b.type.has_name:
  28208. + print >> sys.stderr, 'ERROR: New unhandled documentation case'
  28209. + pass
  28210. +
  28211. + f.write('} \\fB%s\\fP;\n' % self.reply.c_type)
  28212. + f.write('.fi\n')
  28213. +
  28214. + f.write('.SS Reply function\n')
  28215. + f.write('.HP\n')
  28216. + f.write(('%s *\\fB%s\\fP(xcb_connection_t\\ *\\fIconn\\fP, %s\\ '
  28217. + '\\fIcookie\\fP, xcb_generic_error_t\\ **\\fIe\\fP);\n') %
  28218. + (self.c_reply_type, self.c_reply_name, self.c_cookie_type))
  28219. + create_link('%s' % self.c_reply_name)
  28220. +
  28221. + has_accessors = False
  28222. + for field in self.reply.fields:
  28223. + if field.type.is_list and not field.type.fixed_size():
  28224. + has_accessors = True
  28225. + elif field.prev_varsized_field is not None or not field.type.fixed_size():
  28226. + has_accessors = True
  28227. +
  28228. + if has_accessors:
  28229. + f.write('.SS Reply accessors\n')
  28230. +
  28231. + def _c_accessors_field(self, field):
  28232. + '''
  28233. + Declares the accessor functions for a non-list field that follows a variable-length field.
  28234. + '''
  28235. + c_type = self.c_type
  28236. +
  28237. + # special case: switch
  28238. + switch_obj = self if self.is_switch else None
  28239. + if self.is_bitcase:
  28240. + switch_obj = self.parents[-1]
  28241. + if switch_obj is not None:
  28242. + c_type = switch_obj.c_type
  28243. +
  28244. + if field.type.is_simple:
  28245. + f.write('%s %s (const %s *reply)\n' % (field.c_field_type, field.c_accessor_name, c_type))
  28246. + create_link('%s' % field.c_accessor_name)
  28247. + else:
  28248. + f.write('%s *%s (const %s *reply)\n' % (field.c_field_type, field.c_accessor_name, c_type))
  28249. + create_link('%s' % field.c_accessor_name)
  28250. +
  28251. + def _c_accessors_list(self, field):
  28252. + '''
  28253. + Declares the accessor functions for a list field.
  28254. + Declares a direct-accessor function only if the list members are fixed size.
  28255. + Declares length and get-iterator functions always.
  28256. + '''
  28257. + list = field.type
  28258. + c_type = self.reply.c_type
  28259. +
  28260. + # special case: switch
  28261. + # in case of switch, 2 params have to be supplied to certain accessor functions:
  28262. + # 1. the anchestor object (request or reply)
  28263. + # 2. the (anchestor) switch object
  28264. + # the reason is that switch is either a child of a request/reply or nested in another switch,
  28265. + # so whenever we need to access a length field, we might need to refer to some anchestor type
  28266. + switch_obj = self if self.is_switch else None
  28267. + if self.is_bitcase:
  28268. + switch_obj = self.parents[-1]
  28269. + if switch_obj is not None:
  28270. + c_type = switch_obj.c_type
  28271. +
  28272. + params = []
  28273. + fields = {}
  28274. + parents = self.parents if hasattr(self, 'parents') else [self]
  28275. + # 'R': parents[0] is always the 'toplevel' container type
  28276. + params.append(('const %s *\\fIreply\\fP' % parents[0].c_type, parents[0]))
  28277. + fields.update(_c_helper_field_mapping(parents[0], [('R', '->', parents[0])], flat=True))
  28278. + # auxiliary object for 'R' parameters
  28279. + R_obj = parents[0]
  28280. +
  28281. + if switch_obj is not None:
  28282. + # now look where the fields are defined that are needed to evaluate
  28283. + # the switch expr, and store the parent objects in accessor_params and
  28284. + # the fields in switch_fields
  28285. +
  28286. + # 'S': name for the 'toplevel' switch
  28287. + toplevel_switch = parents[1]
  28288. + params.append(('const %s *S' % toplevel_switch.c_type, toplevel_switch))
  28289. + fields.update(_c_helper_field_mapping(toplevel_switch, [('S', '->', toplevel_switch)], flat=True))
  28290. +
  28291. + # initialize prefix for everything "below" S
  28292. + prefix_str = '/* %s */ S' % toplevel_switch.name[-1]
  28293. + prefix = [(prefix_str, '->', toplevel_switch)]
  28294. +
  28295. + # look for fields in the remaining containers
  28296. + for p in parents[2:] + [self]:
  28297. + # the separator between parent and child is always '.' here,
  28298. + # because of nested switch statements
  28299. + if not p.is_bitcase or (p.is_bitcase and p.has_name):
  28300. + prefix.append((p.name[-1], '.', p))
  28301. + fields.update(_c_helper_field_mapping(p, prefix, flat=True))
  28302. +
  28303. + # auxiliary object for 'S' parameter
  28304. + S_obj = parents[1]
  28305. +
  28306. + if list.member.fixed_size():
  28307. + idx = 1 if switch_obj is not None else 0
  28308. + f.write('.HP\n')
  28309. + f.write('%s *\\fB%s\\fP(%s);\n' %
  28310. + (field.c_field_type, field.c_accessor_name, params[idx][0]))
  28311. + create_link('%s' % field.c_accessor_name)
  28312. +
  28313. + f.write('.HP\n')
  28314. + f.write('int \\fB%s\\fP(const %s *\\fIreply\\fP);\n' %
  28315. + (field.c_length_name, c_type))
  28316. + create_link('%s' % field.c_length_name)
  28317. +
  28318. + if field.type.member.is_simple:
  28319. + f.write('.HP\n')
  28320. + f.write('xcb_generic_iterator_t \\fB%s\\fP(const %s *\\fIreply\\fP);\n' %
  28321. + (field.c_end_name, c_type))
  28322. + create_link('%s' % field.c_end_name)
  28323. + else:
  28324. + f.write('.HP\n')
  28325. + f.write('%s \\fB%s\\fP(const %s *\\fIreply\\fP);\n' %
  28326. + (field.c_iterator_type, field.c_iterator_name,
  28327. + c_type))
  28328. + create_link('%s' % field.c_iterator_name)
  28329. +
  28330. + for field in self.reply.fields:
  28331. + if field.type.is_list and not field.type.fixed_size():
  28332. + _c_accessors_list(self, field)
  28333. + elif field.prev_varsized_field is not None or not field.type.fixed_size():
  28334. + _c_accessors_field(self, field)
  28335. +
  28336. +
  28337. + f.write('.br\n')
  28338. + # Re-enable hyphenation and adjusting to both sides
  28339. + f.write('.hy 1\n')
  28340. +
  28341. + # argument reference
  28342. + f.write('.SH REQUEST ARGUMENTS\n')
  28343. + f.write('.IP \\fI%s\\fP 1i\n' % 'conn')
  28344. + f.write('The XCB connection to X11.\n')
  28345. + for field in param_fields:
  28346. + f.write('.IP \\fI%s\\fP 1i\n' % (field.c_field_name))
  28347. + printed_enum = False
  28348. + # XXX: hard-coded until we fix xproto.xml
  28349. + if base_func_name == 'xcb_change_gc' and field.c_field_name == 'value_mask':
  28350. + field.enum = 'GC'
  28351. + elif base_func_name == 'xcb_change_window_attributes' and field.c_field_name == 'value_mask':
  28352. + field.enum = 'CW'
  28353. + elif base_func_name == 'xcb_create_window' and field.c_field_name == 'value_mask':
  28354. + field.enum = 'CW'
  28355. + if hasattr(field, "enum") and field.enum:
  28356. + # XXX: why the 'xcb' prefix?
  28357. + key = ('xcb', field.enum)
  28358. + if key in enums:
  28359. + f.write('One of the following values:\n')
  28360. + f.write('.RS 1i\n')
  28361. + enum = enums[key]
  28362. + count = len(enum.values)
  28363. + for (enam, eval) in enum.values:
  28364. + count = count - 1
  28365. + f.write('.IP \\fI%s\\fP 1i\n' % (_n(key + (enam,)).upper()))
  28366. + if hasattr(enum, "doc") and enum.doc and enam in enum.doc.fields:
  28367. + desc = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', enum.doc.fields[enam])
  28368. + f.write('%s\n' % desc)
  28369. + else:
  28370. + f.write('TODO: NOT YET DOCUMENTED.\n')
  28371. + f.write('.RE\n')
  28372. + f.write('.RS 1i\n')
  28373. + printed_enum = True
  28374. +
  28375. + if hasattr(self, "doc") and self.doc and field.field_name in self.doc.fields:
  28376. + desc = self.doc.fields[field.field_name]
  28377. + desc = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', desc)
  28378. + if printed_enum:
  28379. + f.write('\n')
  28380. + f.write('%s\n' % desc)
  28381. + else:
  28382. + f.write('TODO: NOT YET DOCUMENTED.\n')
  28383. + if printed_enum:
  28384. + f.write('.RE\n')
  28385. +
  28386. + # Reply reference
  28387. + if not void:
  28388. + f.write('.SH REPLY FIELDS\n')
  28389. + # These fields are present in every reply:
  28390. + f.write('.IP \\fI%s\\fP 1i\n' % 'response_type')
  28391. + f.write(('The type of this reply, in this case \\fI%s\\fP. This field '
  28392. + 'is also present in the \\fIxcb_generic_reply_t\\fP and can '
  28393. + 'be used to tell replies apart from each other.\n') %
  28394. + _n(self.reply.name).upper())
  28395. + f.write('.IP \\fI%s\\fP 1i\n' % 'sequence')
  28396. + f.write('The sequence number of the last request processed by the X11 server.\n')
  28397. + f.write('.IP \\fI%s\\fP 1i\n' % 'length')
  28398. + f.write('The length of the reply, in words (a word is 4 bytes).\n')
  28399. + for field in self.reply.fields:
  28400. + if (field.c_field_name in frozenset(['response_type', 'sequence', 'length']) or
  28401. + field.c_field_name.startswith('pad')):
  28402. + continue
  28403. +
  28404. + if field.type.is_list and not field.type.fixed_size():
  28405. + continue
  28406. + elif field.prev_varsized_field is not None or not field.type.fixed_size():
  28407. + continue
  28408. + f.write('.IP \\fI%s\\fP 1i\n' % (field.c_field_name))
  28409. + printed_enum = False
  28410. + if hasattr(field, "enum") and field.enum:
  28411. + # XXX: why the 'xcb' prefix?
  28412. + key = ('xcb', field.enum)
  28413. + if key in enums:
  28414. + f.write('One of the following values:\n')
  28415. + f.write('.RS 1i\n')
  28416. + enum = enums[key]
  28417. + count = len(enum.values)
  28418. + for (enam, eval) in enum.values:
  28419. + count = count - 1
  28420. + f.write('.IP \\fI%s\\fP 1i\n' % (_n(key + (enam,)).upper()))
  28421. + if enum.doc and enam in enum.doc.fields:
  28422. + desc = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', enum.doc.fields[enam])
  28423. + f.write('%s\n' % desc)
  28424. + else:
  28425. + f.write('TODO: NOT YET DOCUMENTED.\n')
  28426. + f.write('.RE\n')
  28427. + f.write('.RS 1i\n')
  28428. + printed_enum = True
  28429. +
  28430. + if hasattr(self.reply, "doc") and self.reply.doc and field.field_name in self.reply.doc.fields:
  28431. + desc = self.reply.doc.fields[field.field_name]
  28432. + desc = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', desc)
  28433. + if printed_enum:
  28434. + f.write('\n')
  28435. + f.write('%s\n' % desc)
  28436. + else:
  28437. + f.write('TODO: NOT YET DOCUMENTED.\n')
  28438. + if printed_enum:
  28439. + f.write('.RE\n')
  28440. +
  28441. +
  28442. +
  28443. + # text description
  28444. + f.write('.SH DESCRIPTION\n')
  28445. + if hasattr(self, "doc") and self.doc and self.doc.description:
  28446. + desc = self.doc.description
  28447. + desc = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', desc)
  28448. + lines = desc.split('\n')
  28449. + f.write('\n'.join(lines) + '\n')
  28450. +
  28451. + f.write('.SH RETURN VALUE\n')
  28452. + if void:
  28453. + f.write(('Returns an \\fIxcb_void_cookie_t\\fP. Errors (if any) '
  28454. + 'have to be handled in the event loop.\n\nIf you want to '
  28455. + 'handle errors directly with \\fIxcb_request_check\\fP '
  28456. + 'instead, use \\fI%s_checked\\fP. See '
  28457. + '\\fBxcb-requests(3)\\fP for details.\n') % (base_func_name))
  28458. + else:
  28459. + f.write(('Returns an \\fI%s\\fP. Errors have to be handled when '
  28460. + 'calling the reply function \\fI%s\\fP.\n\nIf you want to '
  28461. + 'handle errors in the event loop instead, use '
  28462. + '\\fI%s_unchecked\\fP. See \\fBxcb-requests(3)\\fP for '
  28463. + 'details.\n') %
  28464. + (cookie_type, self.c_reply_name, base_func_name))
  28465. + f.write('.SH ERRORS\n')
  28466. + if hasattr(self, "doc") and self.doc:
  28467. + for errtype, errtext in self.doc.errors.items():
  28468. + f.write('.IP \\fI%s\\fP 1i\n' % (_t(('xcb', errtype, 'error'))))
  28469. + errtext = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', errtext)
  28470. + f.write('%s\n' % (errtext))
  28471. + if not hasattr(self, "doc") or not self.doc or len(self.doc.errors) == 0:
  28472. + f.write('This request does never generate any errors.\n')
  28473. + if hasattr(self, "doc") and self.doc and self.doc.example:
  28474. + f.write('.SH EXAMPLE\n')
  28475. + f.write('.nf\n')
  28476. + f.write('.sp\n')
  28477. + lines = self.doc.example.split('\n')
  28478. + f.write('\n'.join(lines) + '\n')
  28479. + f.write('.fi\n')
  28480. + f.write('.SH SEE ALSO\n')
  28481. + if hasattr(self, "doc") and self.doc:
  28482. + see = ['.BR %s (3)' % 'xcb-requests']
  28483. + if self.doc.example:
  28484. + see.append('.BR %s (3)' % 'xcb-examples')
  28485. + for seename, seetype in self.doc.see.items():
  28486. + if seetype == 'program':
  28487. + see.append('.BR %s (1)' % seename)
  28488. + elif seetype == 'event':
  28489. + see.append('.BR %s (3)' % _t(('xcb', seename, 'event')))
  28490. + elif seetype == 'request':
  28491. + see.append('.BR %s (3)' % _n(('xcb', seename)))
  28492. + elif seetype == 'function':
  28493. + see.append('.BR %s (3)' % seename)
  28494. + else:
  28495. + see.append('TODO: %s (type %s)' % (seename, seetype))
  28496. + f.write(',\n'.join(see) + '\n')
  28497. + f.write('.SH AUTHOR\n')
  28498. + f.write('Generated from %s.xml. Contact xcb@lists.freedesktop.org for corrections and improvements.\n' % _ns.header)
  28499. + f.close()
  28500. +
  28501. +def _man_event(self, name):
  28502. + if manpaths:
  28503. + sys.stdout.write('man/%s.3 ' % self.c_type)
  28504. + # Our CWD is src/, so this will end up in src/man/
  28505. + f = open('man/%s.3' % self.c_type, 'w')
  28506. + f.write('.TH %s 3 %s "XCB" "XCB Events"\n' % (self.c_type, today))
  28507. + # Left-adjust instead of adjusting to both sides
  28508. + f.write('.ad l\n')
  28509. + f.write('.SH NAME\n')
  28510. + brief = self.doc.brief if hasattr(self, "doc") and self.doc else ''
  28511. + f.write('%s \\- %s\n' % (self.c_type, brief))
  28512. + f.write('.SH SYNOPSIS\n')
  28513. + # Don't split words (hyphenate)
  28514. + f.write('.hy 0\n')
  28515. + f.write('.B #include <xcb/%s.h>\n' % _ns.header)
  28516. +
  28517. + f.write('.PP\n')
  28518. + f.write('.SS Event datastructure\n')
  28519. + f.write('.nf\n')
  28520. + f.write('.sp\n')
  28521. + f.write('typedef %s %s {\n' % (self.c_container, self.c_type))
  28522. + struct_fields = []
  28523. + maxtypelen = 0
  28524. +
  28525. + for field in self.fields:
  28526. + if not field.type.fixed_size() and not self.is_switch and not self.is_union:
  28527. + continue
  28528. + if field.wire:
  28529. + struct_fields.append(field)
  28530. +
  28531. + for field in struct_fields:
  28532. + length = len(field.c_field_type)
  28533. + # account for '*' pointer_spec
  28534. + if not field.type.fixed_size():
  28535. + length += 1
  28536. + maxtypelen = max(maxtypelen, length)
  28537. +
  28538. + def _c_complex_field(self, field, space=''):
  28539. + if (field.type.fixed_size() or
  28540. + # in case of switch with switch children, don't make the field a pointer
  28541. + # necessary for unserialize to work
  28542. + (self.is_switch and field.type.is_switch)):
  28543. + spacing = ' ' * (maxtypelen - len(field.c_field_type))
  28544. + f.write('%s %s%s \\fI%s\\fP%s;\n' % (space, field.c_field_type, spacing, field.c_field_name, field.c_subscript))
  28545. + else:
  28546. + print >> sys.stderr, 'ERROR: New unhandled documentation case'
  28547. +
  28548. + if not self.is_switch:
  28549. + for field in struct_fields:
  28550. + _c_complex_field(self, field)
  28551. + else:
  28552. + for b in self.bitcases:
  28553. + space = ''
  28554. + if b.type.has_name:
  28555. + space = ' '
  28556. + for field in b.type.fields:
  28557. + _c_complex_field(self, field, space)
  28558. + if b.type.has_name:
  28559. + print >> sys.stderr, 'ERROR: New unhandled documentation case'
  28560. + pass
  28561. +
  28562. + f.write('} \\fB%s\\fP;\n' % self.c_type)
  28563. + f.write('.fi\n')
  28564. +
  28565. +
  28566. + f.write('.br\n')
  28567. + # Re-enable hyphenation and adjusting to both sides
  28568. + f.write('.hy 1\n')
  28569. +
  28570. + # argument reference
  28571. + f.write('.SH EVENT FIELDS\n')
  28572. + f.write('.IP \\fI%s\\fP 1i\n' % 'response_type')
  28573. + f.write(('The type of this event, in this case \\fI%s\\fP. This field is '
  28574. + 'also present in the \\fIxcb_generic_event_t\\fP and can be used '
  28575. + 'to tell events apart from each other.\n') % _n(name).upper())
  28576. + f.write('.IP \\fI%s\\fP 1i\n' % 'sequence')
  28577. + f.write('The sequence number of the last request processed by the X11 server.\n')
  28578. +
  28579. + if not self.is_switch:
  28580. + for field in struct_fields:
  28581. + # Skip the fields which every event has, we already documented
  28582. + # them (see above).
  28583. + if field.c_field_name in ('response_type', 'sequence'):
  28584. + continue
  28585. + if isinstance(field.type, PadType):
  28586. + continue
  28587. + f.write('.IP \\fI%s\\fP 1i\n' % (field.c_field_name))
  28588. + if hasattr(self, "doc") and self.doc and field.field_name in self.doc.fields:
  28589. + desc = self.doc.fields[field.field_name]
  28590. + desc = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', desc)
  28591. + f.write('%s\n' % desc)
  28592. + else:
  28593. + f.write('NOT YET DOCUMENTED.\n')
  28594. +
  28595. + # text description
  28596. + f.write('.SH DESCRIPTION\n')
  28597. + if hasattr(self, "doc") and self.doc and self.doc.description:
  28598. + desc = self.doc.description
  28599. + desc = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', desc)
  28600. + lines = desc.split('\n')
  28601. + f.write('\n'.join(lines) + '\n')
  28602. +
  28603. + if hasattr(self, "doc") and self.doc and self.doc.example:
  28604. + f.write('.SH EXAMPLE\n')
  28605. + f.write('.nf\n')
  28606. + f.write('.sp\n')
  28607. + lines = self.doc.example.split('\n')
  28608. + f.write('\n'.join(lines) + '\n')
  28609. + f.write('.fi\n')
  28610. + f.write('.SH SEE ALSO\n')
  28611. + if hasattr(self, "doc") and self.doc:
  28612. + see = ['.BR %s (3)' % 'xcb_generic_event_t']
  28613. + if self.doc.example:
  28614. + see.append('.BR %s (3)' % 'xcb-examples')
  28615. + for seename, seetype in self.doc.see.items():
  28616. + if seetype == 'program':
  28617. + see.append('.BR %s (1)' % seename)
  28618. + elif seetype == 'event':
  28619. + see.append('.BR %s (3)' % _t(('xcb', seename, 'event')))
  28620. + elif seetype == 'request':
  28621. + see.append('.BR %s (3)' % _n(('xcb', seename)))
  28622. + elif seetype == 'function':
  28623. + see.append('.BR %s (3)' % seename)
  28624. + else:
  28625. + see.append('TODO: %s (type %s)' % (seename, seetype))
  28626. + f.write(',\n'.join(see) + '\n')
  28627. + f.write('.SH AUTHOR\n')
  28628. + f.write('Generated from %s.xml. Contact xcb@lists.freedesktop.org for corrections and improvements.\n' % _ns.header)
  28629. + f.close()
  28630. +
  28631. +
  28632. +def c_request(self, name):
  28633. + '''
  28634. + Exported function that handles request declarations.
  28635. + '''
  28636. +
  28637. + _c_type_setup(self, name, ('request',))
  28638. +
  28639. + # Request structure declaration
  28640. + # _c_complex(self)
  28641. +
  28642. + request_name = _ext(_n_item(self.name[-1]))
  28643. + c_func_name = _n(self.name)
  28644. +
  28645. + if self.reply:
  28646. +
  28647. + _c_type_setup(self.reply, name, ('reply',))
  28648. + # Reply structure definition
  28649. + # _c_complex(self.reply)
  28650. +
  28651. + # Request prototypes
  28652. + _cpp_request_helper(self, name, False)
  28653. +
  28654. + # Reply accessors
  28655. + _c_accessors(self.reply, name + ('reply',), name)
  28656. +
  28657. + else:
  28658. + # Request prototypes
  28659. + _cpp_request_helper(self, name, True)
  28660. +
  28661. + # We generate the manpage afterwards because _c_type_setup has been called.
  28662. + # TODO: what about aux helpers?
  28663. + # cookie_type = self.c_cookie_type if self.reply else 'xcb_void_cookie_t'
  28664. + # _man_request(self, name, cookie_type, not self.reply, False)
  28665. +
  28666. +def c_event(self, name):
  28667. + '''
  28668. + Exported function that handles event declarations.
  28669. + '''
  28670. +
  28671. + # The generic event structure xcb_ge_event_t has the full_sequence field
  28672. + # at the 32byte boundary. That's why we've to inject this field into GE
  28673. + # events while generating the structure for them. Otherwise we would read
  28674. + # garbage (the internal full_sequence) when accessing normal event fields
  28675. + # there.
  28676. + if hasattr(self, 'is_ge_event') and self.is_ge_event and self.name == name:
  28677. + event_size = 0
  28678. + for field in self.fields:
  28679. + if field.type.size != None and field.type.nmemb != None:
  28680. + event_size += field.type.size * field.type.nmemb
  28681. + if event_size == 32:
  28682. + full_sequence = Field(tcard32, tcard32.name, 'full_sequence', False, True, True)
  28683. + idx = self.fields.index(field)
  28684. + self.fields.insert(idx + 1, full_sequence)
  28685. + break
  28686. +
  28687. + _c_type_setup(self, name, ('event',))
  28688. +
  28689. + # Opcode define
  28690. + # _c_opcode(name, self.opcodes[name])
  28691. +
  28692. + _h('typedef %s %s;', _t(self.name + ('event',)), _t(name + ('event',)))
  28693. + if self.name == name:
  28694. + pass
  28695. + # Structure definition
  28696. + # _c_complex(self)
  28697. + else:
  28698. + pass
  28699. + # Typedef
  28700. + # _h('')
  28701. + # _h('typedef %s %s;', _t(self.name + ('event',)), _t(name + ('event',)))
  28702. +
  28703. + # _man_event(self, name)
  28704. +
  28705. +def cpp_event(self, name):
  28706. + '''
  28707. + Exported function that handles event declarations.
  28708. + '''
  28709. +
  28710. + _c_type_setup(self, name, ('event',))
  28711. +
  28712. + opcode = _n(name).upper()
  28713. + c_name = _t(self.name + ('event',))
  28714. +
  28715. + cpp_event = CppEvent(self.opcodes[name], opcode, c_name, _ns, name, self.fields)
  28716. + _cpp_events.append(cpp_event)
  28717. + _interface_class.add_event(cpp_event)
  28718. +
  28719. +def c_error(self, name):
  28720. + '''
  28721. + Exported function that handles error declarations.
  28722. + '''
  28723. + _c_type_setup(self, name, ('error',))
  28724. +
  28725. + # Opcode define
  28726. + _c_opcode(name, self.opcodes[name])
  28727. +
  28728. + if self.name == name:
  28729. + # Structure definition
  28730. + _c_complex(self)
  28731. + else:
  28732. + # Typedef
  28733. + _h('')
  28734. + _h('typedef %s %s;', _t(self.name + ('error',)), _t(name + ('error',)))
  28735. +
  28736. +def cpp_error(self, name):
  28737. + '''
  28738. + Exported function that handles error declarations.
  28739. + '''
  28740. + _c_type_setup(self, name, ('error',))
  28741. +
  28742. + # Opcode define
  28743. + # _c_opcode(name, self.opcodes[name])
  28744. +
  28745. + # sys.stderr.write("error declaration: %s\n" % str(self))
  28746. + # sys.stderr.write("opcode: %s\n" % self.opcodes[name])
  28747. + # sys.stderr.write('typedef %s %s;\n\n' % ( _t(self.name + ('error',)), _t(name + ('error',))))
  28748. +
  28749. + opcode_name = _n(name).upper()
  28750. + c_name = _t(self.name + ('error',))
  28751. + cpp_error = CppError(self, _ns, name, c_name, self.opcodes[name], opcode_name)
  28752. + _cpp_errors.append(cpp_error)
  28753. + _interface_class.add_error(cpp_error)
  28754. +
  28755. + # if self.name == name:
  28756. + # # Structure definition
  28757. + # _c_complex(self)
  28758. + # else:
  28759. + # # Typedef
  28760. + # _h('')
  28761. + # _h('typedef %s %s;', _t(self.name + ('error',)), _t(name + ('error',)))
  28762. +
  28763. +def cpp_prototypes():
  28764. + _h("namespace request {")
  28765. + for request in _request_classes:
  28766. + _h(" class %s;", request)
  28767. + _h("} // namespace request")
  28768. + _h("")
  28769. +
  28770. + def ctor(name, type):
  28771. + return """\
  28772. + %s(const xcb_%s_t & %s)
  28773. + : m_%s(%s)
  28774. + {}\
  28775. +""" % (name, type, name, name, name)
  28776. +
  28777. + for key in _type_objects[get_namespace(_ns)].keys():
  28778. + name = _ext(_n_item(key))
  28779. + type = ("" if get_namespace(_ns) == "xproto" else get_namespace(_ns) + "_") + name
  28780. +
  28781. + if len(_type_objects[get_namespace(_ns)][key]) > 0:
  28782. + _h("class %s {", name)
  28783. + _h(" public:")
  28784. + _h(ctor(name, type))
  28785. + _h("")
  28786. + _h(" const xcb_%s_t & operator*(void)", type)
  28787. + _h(" {")
  28788. + _h(" return m_%s;", name)
  28789. + _h(" }")
  28790. + _h("")
  28791. +
  28792. + for (proto, body) in _type_objects[get_namespace(_ns)][key]:
  28793. + _h("%s", proto)
  28794. + _h("")
  28795. +
  28796. + _h(" private:")
  28797. + _h(" connection m_c;")
  28798. + _h(" xcb_%s_t m_%s;", type, name)
  28799. + _h("}; // class %s", name)
  28800. + _h("")
  28801. +
  28802. +def cpp_type_classes():
  28803. + for key in _type_objects[get_namespace(_ns)].keys():
  28804. + type = _ext(_n_item(key))
  28805. + if len(_type_objects[get_namespace(_ns)][key]) > 0:
  28806. + # _h("")
  28807. + # _h("class %s {", type)
  28808. + # _h(" public:")
  28809. + # _h(" const xcb_%s_t & operator*(void)", type)
  28810. + # _h(" {")
  28811. + # _h(" return m_%s;", type)
  28812. + # _h(" }")
  28813. + # _h("")
  28814. +
  28815. + for (proto, body) in _type_objects[get_namespace(_ns)][key]:
  28816. + # _h("%s", proto)
  28817. + _h("%s", body)
  28818. + _h("")
  28819. +
  28820. + # _h(" private:")
  28821. + # _h(" connection m_c;")
  28822. + # _h(" xcb_%s_t m_%s;", type, type)
  28823. + # _h("}; // class %s", type)
  28824. + # _h("")
  28825. +
  28826. +# Main routine starts here
  28827. +
  28828. +# # Must create an "output" dictionary before any xcbgen imports.
  28829. +# output = {'open' : c_open,
  28830. +# 'close' : c_close,
  28831. +# 'simple' : c_simple,
  28832. +# 'enum' : c_enum,
  28833. +# 'struct' : c_struct,
  28834. +# 'union' : c_union,
  28835. +# 'request' : c_request,
  28836. +# 'event' : c_event,
  28837. +# 'error' : c_error,
  28838. +# }
  28839. +
  28840. +# Must create an "output" dictionary before any xcbgen imports.
  28841. +output = {'open' : c_open,
  28842. + 'close' : c_close,
  28843. + 'simple' : c_simple, # lambda x, y: None,
  28844. + 'enum' : lambda x, y: None,
  28845. + 'struct' : lambda x, y: None,
  28846. + 'union' : lambda x, y: None,
  28847. + 'request' : c_request,
  28848. + 'event' : cpp_event,
  28849. + 'error' : cpp_error,
  28850. + 'eventstruct' : lambda x, y: None,
  28851. + 'eventstruct' : lambda x, y: None,
  28852. + }
  28853. +
  28854. +# Boilerplate below this point
  28855. +
  28856. +# Check for the argument that specifies path to the xcbgen python package.
  28857. +try:
  28858. + opts, args = getopt.getopt(sys.argv[1:], 'p:m')
  28859. +except getopt.GetoptError as err:
  28860. + print(err)
  28861. + print('Usage: c_client.py [-p path] file.xml')
  28862. + sys.exit(1)
  28863. +
  28864. +for (opt, arg) in opts:
  28865. + if opt == '-p':
  28866. + sys.path.insert(1, arg)
  28867. + elif opt == '-m':
  28868. + manpaths = True
  28869. + sys.stdout.write('man_MANS = ')
  28870. +
  28871. +# Import the module class
  28872. +try:
  28873. + from xcbgen.state import Module
  28874. + from xcbgen.xtypes import *
  28875. +except ImportError:
  28876. + print('''
  28877. +Failed to load the xcbgen Python package!
  28878. +Make sure that xcb/proto installed it on your Python path.
  28879. +If not, you will need to create a .pth file or define $PYTHONPATH
  28880. +to extend the path.
  28881. +Refer to the README file in xcb/proto for more info.
  28882. +''')
  28883. + raise
  28884. +
  28885. +# Ensure the man subdirectory exists
  28886. +try:
  28887. + os.mkdir('man')
  28888. +except OSError as e:
  28889. + if e.errno != errno.EEXIST:
  28890. + raise
  28891. +
  28892. +today = time.strftime('%Y-%m-%d', time.gmtime(os.path.getmtime(args[0])))
  28893. +
  28894. +# Parse the xml header
  28895. +module = Module(args[0], output)
  28896. +
  28897. +# Build type-registry and resolve type dependencies
  28898. +module.register()
  28899. +module.resolve()
  28900. +
  28901. +# Output the code
  28902. +module.generate()
  28903. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/cppcookie.py polybar-3.2.1/lib/xpp/generators/cppcookie.py
  28904. --- polybar-3.2.1.orig/lib/xpp/generators/cppcookie.py 1970-01-01 02:00:00.000000000 +0200
  28905. +++ polybar-3.2.1/lib/xpp/generators/cppcookie.py 2017-08-30 16:02:01.000000000 +0300
  28906. @@ -0,0 +1,202 @@
  28907. +from utils import _n, _ext, _n_item, get_namespace
  28908. +
  28909. +_templates = {}
  28910. +
  28911. +_templates['void_cookie_function'] = \
  28912. +'''\
  28913. +%s\
  28914. +void
  28915. +%s_checked(Connection && c%s)
  28916. +{%s\
  28917. + xpp::generic::check<Connection, xpp::%s::error::dispatcher>(
  28918. + std::forward<Connection>(c),
  28919. + %s_checked(std::forward<Connection>(c)%s));
  28920. +}
  28921. +
  28922. +%s\
  28923. +void
  28924. +%s(Connection && c%s)
  28925. +{%s\
  28926. + %s(std::forward<Connection>(c)%s);
  28927. +}
  28928. +'''
  28929. +
  28930. +def _void_cookie_function(ns, name, c_name, template, return_value, protos, calls, initializer):
  28931. + if len(template) == 0: template = "template<typename Connection>\n"
  28932. + return _templates['void_cookie_function'] % \
  28933. + ( template
  28934. + , name
  28935. + , protos
  28936. + , initializer
  28937. + , ns
  28938. + , c_name
  28939. + , calls
  28940. + , template
  28941. + , name
  28942. + , protos
  28943. + , initializer
  28944. + , c_name
  28945. + , calls
  28946. + )
  28947. +
  28948. +_templates['cookie_static_getter'] = \
  28949. +'''\
  28950. +%s\
  28951. + static
  28952. + %s
  28953. + cookie(xcb_connection_t * const c%s)
  28954. + {%s\
  28955. + return base::cookie(c%s);
  28956. + }
  28957. +'''
  28958. +
  28959. +def _cookie_static_getter(template, return_value, protos, calls, initializer):
  28960. + return _templates['cookie_static_getter'] % \
  28961. + ( template
  28962. + , return_value
  28963. + , protos
  28964. + , initializer
  28965. + , calls
  28966. + )
  28967. +
  28968. +class CppCookie(object):
  28969. + def __init__(self, namespace, is_void, name, reply, parameter_list):
  28970. + self.namespace = namespace
  28971. + self.is_void = is_void
  28972. + self.name = name
  28973. + self.reply = reply
  28974. + self.parameter_list = parameter_list
  28975. + self.request_name = _ext(_n_item(self.name[-1]))
  28976. + self.c_name = "xcb" \
  28977. + + (("_" + get_namespace(namespace)) if namespace.is_ext else "") \
  28978. + + "_" + self.request_name
  28979. +
  28980. + def comma(self):
  28981. + return self.parameter_list.comma()
  28982. +
  28983. + def calls(self, sort):
  28984. + return self.parameter_list.calls(sort)
  28985. +
  28986. + def protos(self, sort, defaults):
  28987. + return self.parameter_list.protos(sort, defaults)
  28988. +
  28989. + def iterator_template(self, indent=" ", tail="\n"):
  28990. + prefix = "template<typename " + ("Connection, typename " if self.is_void else "")
  28991. + return indent + prefix \
  28992. + + ", typename ".join(self.parameter_list.iterator_templates \
  28993. + + self.parameter_list.templates) \
  28994. + + ">" + tail \
  28995. + if len(self.parameter_list.iterator_templates) > 0 \
  28996. + else ""
  28997. +
  28998. + def iterator_calls(self, sort):
  28999. + return self.parameter_list.iterator_calls(sort)
  29000. +
  29001. + def iterator_protos(self, sort, defaults):
  29002. + return self.parameter_list.iterator_protos(sort, defaults)
  29003. +
  29004. + def iterator_initializers(self):
  29005. + return self.parameter_list.iterator_initializers()
  29006. +
  29007. + def void_functions(self, protos, calls, template="", initializer=[]):
  29008. + inits = "" if len(initializer) > 0 else "\n"
  29009. + for i in initializer:
  29010. + inits += "\n"
  29011. + for line in i.split('\n'):
  29012. + inits += " " + line + "\n"
  29013. +
  29014. + return_value = "xcb_void_cookie_t"
  29015. +
  29016. + return _void_cookie_function(get_namespace(self.namespace),
  29017. + self.request_name,
  29018. + self.c_name,
  29019. + template,
  29020. + return_value,
  29021. + self.comma() + protos,
  29022. + self.comma() + calls,
  29023. + inits)
  29024. +
  29025. +
  29026. + def static_reply_methods(self, protos, calls, template="", initializer=[]):
  29027. + inits = "" if len(initializer) > 0 else "\n"
  29028. + for i in initializer:
  29029. + inits += "\n"
  29030. + for line in i.split('\n'):
  29031. + inits += " " + line + "\n"
  29032. +
  29033. + if self.is_void: return_value = "xcb_void_cookie_t"
  29034. + else: return_value = self.c_name + "_cookie_t"
  29035. +
  29036. + return _cookie_static_getter(template,
  29037. + return_value,
  29038. + self.comma() + protos,
  29039. + self.comma() + calls,
  29040. + inits)
  29041. +
  29042. +
  29043. + def make_static_getter(self):
  29044. + default = self.static_reply_methods(self.protos(False, False), self.calls(False))
  29045. +
  29046. + if self.parameter_list.has_defaults:
  29047. + default = self.static_reply_methods(self.protos(True, True), self.calls(False))
  29048. +
  29049. + wrapped = ""
  29050. + if self.parameter_list.want_wrap:
  29051. + wrapped = \
  29052. + self.static_reply_methods(self.iterator_protos(True, True),
  29053. + self.iterator_calls(False), self.iterator_template(),
  29054. + self.iterator_initializers())
  29055. +
  29056. + default_args = ""
  29057. + if self.parameter_list.is_reordered():
  29058. + default_args = \
  29059. + self.static_reply_methods(self.protos(True, True), self.calls(False))
  29060. +
  29061. + result = ""
  29062. +
  29063. + if (self.parameter_list.has_defaults
  29064. + or self.parameter_list.is_reordered()
  29065. + or self.parameter_list.want_wrap):
  29066. + result += default
  29067. +
  29068. + if self.parameter_list.is_reordered():
  29069. + result += "\n" + default_args
  29070. +
  29071. + if self.parameter_list.want_wrap:
  29072. + result += "\n" + wrapped
  29073. +
  29074. + return result
  29075. +
  29076. + def make_void_functions(self):
  29077. + default = self.void_functions(self.protos(False, False), self.calls(False))
  29078. +
  29079. + if self.parameter_list.has_defaults:
  29080. + default = self.void_functions(self.protos(True, True), self.calls(False))
  29081. +
  29082. + wrapped = ""
  29083. + if self.parameter_list.want_wrap:
  29084. + wrapped = \
  29085. + self.void_functions(self.iterator_protos(True, True),
  29086. + self.iterator_calls(False),
  29087. + self.iterator_template(indent=""),
  29088. + self.iterator_initializers())
  29089. +
  29090. + default_args = ""
  29091. + if self.parameter_list.is_reordered():
  29092. + default_args = \
  29093. + self.void_functions(self.protos(True, True), self.calls(False))
  29094. +
  29095. + result = ""
  29096. +
  29097. + if (self.parameter_list.has_defaults
  29098. + or self.parameter_list.is_reordered()
  29099. + or self.parameter_list.want_wrap):
  29100. + result += default
  29101. +
  29102. + if self.parameter_list.is_reordered():
  29103. + result += "\n" + default_args
  29104. +
  29105. + if self.parameter_list.want_wrap:
  29106. + result += "\n" + wrapped
  29107. +
  29108. + return result
  29109. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/cpperror.py polybar-3.2.1/lib/xpp/generators/cpperror.py
  29110. --- polybar-3.2.1.orig/lib/xpp/generators/cpperror.py 1970-01-01 02:00:00.000000000 +0200
  29111. +++ polybar-3.2.1/lib/xpp/generators/cpperror.py 2017-08-30 16:02:01.000000000 +0300
  29112. @@ -0,0 +1,221 @@
  29113. +from utils import \
  29114. + get_namespace, \
  29115. + get_ext_name, \
  29116. + _n_item, \
  29117. + _ext, \
  29118. + _reserved_keywords
  29119. +
  29120. +_templates = {}
  29121. +
  29122. +_templates['error_dispatcher_class'] = \
  29123. +'''\
  29124. +namespace error {
  29125. +
  29126. +class dispatcher
  29127. +{
  29128. + public:
  29129. +%s\
  29130. +%s\
  29131. +
  29132. + void
  29133. + operator()(const std::shared_ptr<xcb_generic_error_t> &%s) const
  29134. + {
  29135. +%s\
  29136. + }
  29137. +
  29138. +%s\
  29139. +}; // class dispatcher
  29140. +
  29141. +} // namespace error
  29142. +'''
  29143. +
  29144. +def _error_dispatcher_class(typedef, ctors, switch, members, has_errors):
  29145. + return _templates['error_dispatcher_class'] % \
  29146. + ( typedef
  29147. + , ctors
  29148. + , " error" if has_errors else ""
  29149. + , switch if has_errors else ""
  29150. + , members
  29151. + )
  29152. +
  29153. +
  29154. +def error_dispatcher_class(namespace, cpperrors):
  29155. + ns = get_namespace(namespace)
  29156. +
  29157. + ctor_name = "dispatcher"
  29158. +
  29159. + typedef = []
  29160. + ctors = []
  29161. + members = []
  29162. + opcode_switch = "error->error_code"
  29163. +
  29164. + typedef = [ "typedef xpp::%s::extension extension;\n" % ns ]
  29165. +
  29166. + # >>> if begin <<<
  29167. + if namespace.is_ext:
  29168. + opcode_switch = "error->error_code - m_first_error"
  29169. +
  29170. + members += \
  29171. + [ "protected:"
  29172. + , " uint8_t m_first_error;"
  29173. + ]
  29174. +
  29175. + ctors = \
  29176. + [ "%s(uint8_t first_error)" % (ctor_name)
  29177. + , " : m_first_error(first_error)"
  29178. + , "{}"
  29179. + , ""
  29180. + , "%s(const xpp::%s::extension & extension)" % (ctor_name, ns)
  29181. + , " : %s(extension->first_error)" % ctor_name
  29182. + , "{}"
  29183. + ]
  29184. +
  29185. + # >>> if end <<<
  29186. +
  29187. + if len(typedef) > 0:
  29188. + typedef = "\n".join(map(lambda s: " " + s, typedef)) + "\n"
  29189. + else:
  29190. + typedef = ""
  29191. +
  29192. + if len(ctors) > 0:
  29193. + ctors = "\n".join(map(lambda s: (" " if len(s) > 0 else "") + s, ctors)) + "\n"
  29194. + else:
  29195. + ctors = ""
  29196. +
  29197. + if len(members) > 0:
  29198. + members = "\n".join(map(lambda s: " " + s, members)) + "\n"
  29199. + else:
  29200. + members = ""
  29201. +
  29202. + switch = error_switch_cases(cpperrors, opcode_switch, "error")
  29203. + return _error_dispatcher_class(typedef,
  29204. + ctors,
  29205. + switch,
  29206. + members,
  29207. + len(cpperrors) > 0)
  29208. +
  29209. +def error_switch_cases(cpperrors, arg_switch, arg_error):
  29210. + cases = ""
  29211. + errors = cpperrors
  29212. + templ = [ " case %s: // %s"
  29213. + , " throw %s" + "(%s);" % arg_error
  29214. + , ""
  29215. + , ""
  29216. + ]
  29217. +
  29218. + cases += " switch (%s) {\n\n" % arg_switch
  29219. + for e in errors:
  29220. + cases += "\n".join(templ) % (e.opcode_name, e.opcode, e.scoped_name())
  29221. + cases += " };\n"
  29222. +
  29223. + return cases
  29224. +
  29225. +
  29226. +class CppError(object):
  29227. + def __init__(self, error, namespace, name, c_name, opcode, opcode_name):
  29228. + self.error = error
  29229. + self.namespace = namespace
  29230. + self.c_name = c_name
  29231. + self.opcode = opcode
  29232. + self.opcode_name = opcode_name
  29233. +
  29234. + self.names = map(str.lower, _n_item(name[-1], True))
  29235. + self.name = "_".join(map(str.lower, self.names))
  29236. +
  29237. + self.nssopen = ""
  29238. + self.nssclose = ""
  29239. + self.scope = []
  29240. + for name in self.names[0:-1]:
  29241. + if name in _reserved_keywords: name += "_"
  29242. + self.nssopen += " namespace %s {" % name
  29243. + self.nssclose += " }"
  29244. + self.scope.append(name)
  29245. +
  29246. + def get_name(self):
  29247. + return _reserved_keywords.get(self.name, self.name)
  29248. +
  29249. +
  29250. + def scoped_name(self):
  29251. + ns = get_namespace(self.namespace)
  29252. + return "xpp::" + ns + "::error::" + self.get_name()
  29253. +
  29254. + def make_class(self):
  29255. + ns = get_namespace(self.namespace)
  29256. + typedef = []
  29257. + members = []
  29258. +
  29259. + opcode_accessor = \
  29260. + [ "static uint8_t opcode(void)"
  29261. + , "{"
  29262. + , " return %s;" % self.opcode_name
  29263. + , "}"
  29264. + ]
  29265. +
  29266. + if self.namespace.is_ext:
  29267. + opcode_accessor += \
  29268. + [ ""
  29269. + , "static uint8_t opcode(uint8_t first_error)"
  29270. + , "{"
  29271. + , " return first_error + opcode();"
  29272. + , "}"
  29273. + , ""
  29274. + , "static uint8_t opcode(const xpp::%s::extension & extension)" % ns
  29275. + , "{"
  29276. + , " return opcode(extension->first_error);"
  29277. + , "}"
  29278. + ]
  29279. +
  29280. + members = \
  29281. + [ "protected:"
  29282. + , " uint8_t m_first_error;"
  29283. + ]
  29284. +
  29285. + if len(opcode_accessor) > 0:
  29286. + opcode_accessor = "\n".join(map(lambda s: " " + s, opcode_accessor)) + "\n"
  29287. + else:
  29288. + opcode_accessor = ""
  29289. +
  29290. + if len(members) > 0:
  29291. + members = "\n" + "\n".join(map(lambda s: " " + s, members)) + "\n"
  29292. + else:
  29293. + members = ""
  29294. +
  29295. + if len(typedef) > 0:
  29296. + typedef = "\n".join(map(lambda s: " " + s, typedef)) + "\n\n"
  29297. + else:
  29298. + typedef = ""
  29299. +
  29300. + name = self.name
  29301. + if self.name in _reserved_keywords: name = self.name + "_"
  29302. +
  29303. + return \
  29304. +'''
  29305. +namespace error {
  29306. +class %s
  29307. + : public xpp::generic::error<%s,
  29308. + %s>
  29309. +{
  29310. + public:
  29311. +%s\
  29312. + using xpp::generic::error<%s, %s>::error;
  29313. +
  29314. + virtual ~%s(void) {}
  29315. +
  29316. +%s
  29317. + static std::string description(void)
  29318. + {
  29319. + return std::string("%s");
  29320. + }
  29321. +%s\
  29322. +}; // class %s
  29323. +} // namespace error
  29324. +''' % (self.get_name(), # class %s
  29325. + self.get_name(), # : public xpp::generic::error<%s,
  29326. + self.c_name, # %s>
  29327. + typedef,
  29328. + self.get_name(), self.c_name, # using xpp::generic::error<%s, %s>::error;
  29329. + self.get_name(), # virtual ~%s(void) {}
  29330. + opcode_accessor,
  29331. + self.opcode_name, # static constexpr const char * opcode_literal
  29332. + members,
  29333. + self.get_name()) # // class %s
  29334. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/cppevent.py polybar-3.2.1/lib/xpp/generators/cppevent.py
  29335. --- polybar-3.2.1.orig/lib/xpp/generators/cppevent.py 1970-01-01 02:00:00.000000000 +0200
  29336. +++ polybar-3.2.1/lib/xpp/generators/cppevent.py 2017-08-30 16:02:01.000000000 +0300
  29337. @@ -0,0 +1,380 @@
  29338. +import sys # stderr
  29339. +
  29340. +from utils import \
  29341. + get_namespace, \
  29342. + get_ext_name, \
  29343. + _n_item, \
  29344. + _ext, \
  29345. + _reserved_keywords
  29346. +
  29347. +from resource_classes import _resource_classes
  29348. +
  29349. +_field_accessor_template_specialization = \
  29350. +'''\
  29351. +template<typename Connection>
  29352. +template<>
  29353. +%s
  29354. +%s<Connection>::%s<%s>(void) const
  29355. +{
  29356. + return %s;
  29357. +}\
  29358. +'''
  29359. +
  29360. +_templates = {}
  29361. +
  29362. +_templates['field_accessor_template'] = \
  29363. +'''\
  29364. + template<typename ReturnType = %s, typename ... Parameter>
  29365. + ReturnType
  29366. + %s(Parameter && ... parameter) const
  29367. + {
  29368. + using make = xpp::generic::factory::make<Connection,
  29369. + decltype((*this)->%s),
  29370. + ReturnType,
  29371. + Parameter ...>;
  29372. + return make()(this->m_c,
  29373. + (*this)->%s,
  29374. + std::forward<Parameter>(parameter) ...);
  29375. + }\
  29376. +'''
  29377. +
  29378. +def _field_accessor_template(c_type, method_name, member):
  29379. + return _templates['field_accessor_template'] % \
  29380. + ( c_type
  29381. + , method_name
  29382. + , member
  29383. + , member
  29384. + )
  29385. +
  29386. +_templates['event_dispatcher_class'] = \
  29387. +'''\
  29388. +namespace event {
  29389. +
  29390. +template<typename Connection>
  29391. +class dispatcher
  29392. +{
  29393. + public:
  29394. +%s\
  29395. +%s\
  29396. +
  29397. + template<typename Handler>
  29398. + bool
  29399. + operator()(Handler%s,
  29400. + const std::shared_ptr<xcb_generic_event_t> &%s) const
  29401. + {\
  29402. +%s
  29403. + return false;
  29404. + }
  29405. +
  29406. +%s\
  29407. +}; // class dispatcher
  29408. +
  29409. +} // namespace event
  29410. +'''
  29411. +
  29412. +def _event_dispatcher_class(typedef, ctors, switch, members, has_events):
  29413. + return _templates['event_dispatcher_class'] % \
  29414. + ( typedef
  29415. + , ctors
  29416. + , " handler" if has_events else ""
  29417. + , " event" if has_events else ""
  29418. + , switch if has_events else ""
  29419. + , members
  29420. + )
  29421. +
  29422. +def event_dispatcher_class(namespace, cppevents):
  29423. + ns = get_namespace(namespace)
  29424. +
  29425. + ctor_name = "dispatcher"
  29426. +
  29427. + typedef = []
  29428. + ctors = []
  29429. + members = []
  29430. +
  29431. + opcode_switch = "event->response_type & ~0x80"
  29432. + typedef = [ "typedef xpp::%s::extension extension;\n" % ns ]
  29433. +
  29434. + members = \
  29435. + [ "protected:"
  29436. + , " Connection m_c;"
  29437. + ]
  29438. +
  29439. + ctors = \
  29440. + [ "template<typename C>"
  29441. + , "%s(C && c)" % ctor_name
  29442. + , " : m_c(std::forward<C>(c))"
  29443. + , "{}"
  29444. + ]
  29445. +
  29446. + # >>> if begin <<<
  29447. + if namespace.is_ext:
  29448. + # XXX: The xkb extension contains the sub-event in the member pad0
  29449. + if ns == "xkb":
  29450. + opcode_switch = "event->pad0"
  29451. + else:
  29452. + opcode_switch = "(event->response_type & ~0x80) - m_first_event"
  29453. +
  29454. + members += [ " uint8_t m_first_event;" ]
  29455. +
  29456. + ctors = \
  29457. + [ "template<typename C>"
  29458. + , "%s(C && c, uint8_t first_event)" % (ctor_name)
  29459. + , " : m_c(std::forward<C>(c))"
  29460. + , " , m_first_event(first_event)"
  29461. + , "{}"
  29462. + , ""
  29463. + , "template<typename C>"
  29464. + , "%s(C && c, const xpp::%s::extension & extension)" % (ctor_name, ns)
  29465. + , " : %s(std::forward<C>(c), extension->first_event)" % ctor_name
  29466. + , "{}"
  29467. + ]
  29468. +
  29469. + # >>> if end <<<
  29470. +
  29471. + if len(typedef) > 0:
  29472. + typedef = "\n".join(map(lambda s: " " + s, typedef)) + "\n"
  29473. + else:
  29474. + typedef = ""
  29475. +
  29476. + if len(ctors) > 0:
  29477. + ctors = "\n".join(map(lambda s: (" " if len(s) > 0 else "") + s, ctors)) + "\n"
  29478. + else:
  29479. + ctors = ""
  29480. +
  29481. + if len(members) > 0:
  29482. + members = "\n".join(map(lambda s: " " + s, members)) + "\n"
  29483. + else:
  29484. + members = ""
  29485. +
  29486. + switch = event_switch_cases(cppevents, opcode_switch, "handler", "event", namespace)
  29487. +
  29488. + return _event_dispatcher_class(typedef,
  29489. + ctors,
  29490. + switch,
  29491. + members,
  29492. + len(cppevents) > 0)
  29493. +
  29494. +def event_switch_cases(cppevents, arg_switch, arg_handler, arg_event, ns):
  29495. + cases = ""
  29496. + first_event_arg = ", m_first_event" if ns.is_ext else ""
  29497. + templ = [ " case %s:"
  29498. + , " %s(" % arg_handler + "%s<Connection>" + "(m_c%s, %s));" % (first_event_arg, arg_event)
  29499. + , " return true;"
  29500. + , ""
  29501. + , ""
  29502. + ]
  29503. +
  29504. + distinct_events = [[]]
  29505. + for e in cppevents:
  29506. + done = False
  29507. + for l in distinct_events:
  29508. + if e in l:
  29509. + continue
  29510. + else:
  29511. + l.append(e)
  29512. + done = True
  29513. + break
  29514. +
  29515. + if not done:
  29516. + distinct_events.append([e])
  29517. + else:
  29518. + continue
  29519. +
  29520. + for l in distinct_events:
  29521. + cases += "\n switch (%s) {\n\n" % arg_switch
  29522. + for e in l:
  29523. + cases += "\n".join(templ) % (e.opcode_name, e.scoped_name())
  29524. + cases += " };\n"
  29525. +
  29526. + return cases if len(cppevents) > 0 else ""
  29527. +
  29528. +########## EVENT ##########
  29529. +
  29530. +class CppEvent(object):
  29531. + def __init__(self, opcode, opcode_name, c_name, namespace, name, fields):
  29532. + self.opcode = opcode
  29533. + self.opcode_name = opcode_name
  29534. + self.c_name = c_name
  29535. + self.namespace = namespace
  29536. + self.fields = fields
  29537. +
  29538. + self.names = map(str.lower, _n_item(name[-1], True))
  29539. + self.name = "_".join(map(str.lower, self.names))
  29540. +
  29541. + self.nssopen = ""
  29542. + self.nssclose = ""
  29543. + self.scope = []
  29544. + for name in self.names[0:-1]:
  29545. + if name in _reserved_keywords: name += "_"
  29546. + self.nssopen += " namespace %s {" % name
  29547. + self.nssclose += " };"
  29548. + self.scope.append(name)
  29549. +
  29550. + def __cmp__(self, other):
  29551. + if self.opcode == other.opcode:
  29552. + return 0
  29553. + elif self.opcode < other.opcode:
  29554. + return -1
  29555. + else:
  29556. + return 1
  29557. +
  29558. + def get_name(self):
  29559. + return _reserved_keywords.get(self.name, self.name)
  29560. +
  29561. +
  29562. + def scoped_name(self):
  29563. + ns = get_namespace(self.namespace)
  29564. + return "xpp::" + ns + "::event::" + self.get_name()
  29565. +
  29566. + def make_class(self):
  29567. + member_accessors = []
  29568. + member_accessors_special = []
  29569. + for field in self.fields:
  29570. + if field.field_type[-1] in _resource_classes:
  29571. + template_name = field.field_name.capitalize()
  29572. + c_type = field.c_field_type
  29573. + method_name = field.field_name.lower()
  29574. + if (method_name == self.get_name()
  29575. + or method_name in _reserved_keywords):
  29576. + method_name += "_"
  29577. + member = field.c_field_name
  29578. +
  29579. + member_accessors.append(_field_accessor_template(c_type, method_name, member))
  29580. +
  29581. + ns = get_namespace(self.namespace)
  29582. +
  29583. + extension = "xpp::%s::extension" % ns
  29584. +
  29585. + ctor = \
  29586. + [ "template<typename C>"
  29587. + , "%s(C && c," % self.get_name()
  29588. + , (" " * len(self.get_name())) + " const std::shared_ptr<xcb_generic_event_t> & event)"
  29589. + , " : base(event)"
  29590. + , " , m_c(std::forward<C>(c))"
  29591. + , "{}"
  29592. + ]
  29593. +
  29594. + m_first_event = ""
  29595. +
  29596. + typedef = [ "typedef xpp::%s::extension extension;" % ns ]
  29597. +
  29598. + description = \
  29599. + [ "static std::string description(void)"
  29600. + , "{"
  29601. + , " return std::string(\"%s\");" % self.opcode_name
  29602. + , "}"
  29603. + ]
  29604. +
  29605. + opcode_accessor = \
  29606. + [ "static uint8_t opcode(void)"
  29607. + , "{"
  29608. + , " return %s;" % self.opcode_name
  29609. + , "}"
  29610. + ]
  29611. +
  29612. + first_event = []
  29613. +
  29614. + if self.namespace.is_ext:
  29615. + opcode_accessor += \
  29616. + [ ""
  29617. + , "static uint8_t opcode(uint8_t first_event)"
  29618. + , "{"
  29619. + , " return first_event + opcode();"
  29620. + , "}"
  29621. + , ""
  29622. + , "static uint8_t opcode(const xpp::%s::extension & extension)" % ns
  29623. + , "{"
  29624. + , " return opcode(extension->first_event);"
  29625. + , "}"
  29626. + ]
  29627. +
  29628. + first_event = \
  29629. + [ "uint8_t first_event(void)"
  29630. + , "{"
  29631. + , " return m_first_event;"
  29632. + , "}"
  29633. + ]
  29634. +
  29635. + ctor = \
  29636. + [ "template<typename C>"
  29637. + , "%s(C && c," % self.get_name()
  29638. + , (" " * len(self.get_name())) + " uint8_t first_event,"
  29639. + , (" " * len(self.get_name())) + " const std::shared_ptr<xcb_generic_event_t> & event)"
  29640. + , " : base(event)"
  29641. + , " , m_c(std::forward<C>(c))"
  29642. + , " , m_first_event(first_event)"
  29643. + , "{}"
  29644. + ]
  29645. +
  29646. + m_first_event = " const uint8_t m_first_event;\n"
  29647. +
  29648. + if len(opcode_accessor) > 0:
  29649. + opcode_accessor = "\n".join(map(lambda s: " " + s, opcode_accessor)) + "\n"
  29650. + else:
  29651. + opcode_accessor = ""
  29652. +
  29653. + if len(ctor) > 0:
  29654. + ctor = "\n".join(map(lambda s: " " + s, ctor)) + "\n"
  29655. + else:
  29656. + ctor = ""
  29657. +
  29658. + if len(typedef) > 0:
  29659. + typedef = "\n".join(map(lambda s: " " + s, typedef)) + "\n\n"
  29660. + else:
  29661. + typedef = ""
  29662. +
  29663. + if len(member_accessors) > 0:
  29664. + member_accessors = "\n" + "\n\n".join(member_accessors) + "\n\n"
  29665. + member_accessors_special = "\n" + "\n\n".join(member_accessors_special) + "\n\n"
  29666. + else:
  29667. + member_accessors = ""
  29668. + member_accessors_special = ""
  29669. +
  29670. + if len(description) > 0:
  29671. + description = "\n" + "\n".join(map(lambda s: " " + s, description)) + "\n"
  29672. + else:
  29673. + description = ""
  29674. +
  29675. + if len(first_event) > 0:
  29676. + first_event = "\n" + "\n".join(map(lambda s: " " + s, first_event)) + "\n"
  29677. + else:
  29678. + first_event = ""
  29679. +
  29680. + return \
  29681. +'''
  29682. +namespace event {
  29683. +template<typename Connection>
  29684. +class %s
  29685. + : public xpp::generic::event<%s>
  29686. +{
  29687. + public:
  29688. +%s\
  29689. + typedef xpp::generic::event<%s> base;
  29690. +
  29691. +%s\
  29692. +
  29693. + virtual ~%s(void) {}
  29694. +
  29695. +%s\
  29696. +%s\
  29697. +%s\
  29698. +%s\
  29699. + protected:
  29700. + Connection m_c;
  29701. +%s\
  29702. +}; // class %s
  29703. +%s\
  29704. +} // namespace event
  29705. +''' % (self.get_name(), # class %s
  29706. + self.c_name, # %s>
  29707. + typedef,
  29708. + self.c_name, # typedef xpp::generic::event<%s>::base;
  29709. + ctor,
  29710. + self.get_name(), # virtual ~%s(void) {}
  29711. + opcode_accessor,
  29712. + description,
  29713. + first_event,
  29714. + member_accessors,
  29715. + m_first_event,
  29716. + self.get_name(), # // class %s
  29717. + member_accessors_special)
  29718. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/cppreply.py polybar-3.2.1/lib/xpp/generators/cppreply.py
  29719. --- polybar-3.2.1.orig/lib/xpp/generators/cppreply.py 1970-01-01 02:00:00.000000000 +0200
  29720. +++ polybar-3.2.1/lib/xpp/generators/cppreply.py 2017-08-30 16:02:01.000000000 +0300
  29721. @@ -0,0 +1,138 @@
  29722. +from utils import _n, _ext, _n_item, get_namespace
  29723. +from resource_classes import _resource_classes
  29724. +
  29725. +_templates = {}
  29726. +
  29727. +_templates['reply_class'] = \
  29728. +'''\
  29729. +namespace reply {
  29730. +
  29731. +namespace detail {
  29732. +
  29733. +template<typename Connection,
  29734. + typename Check,
  29735. + typename CookieFunction>
  29736. +class %s
  29737. + : public xpp::generic::reply<%s<Connection, Check, CookieFunction>,
  29738. + Connection,
  29739. + Check,
  29740. + SIGNATURE(%s_reply),
  29741. + CookieFunction>
  29742. +{
  29743. + public:
  29744. + typedef xpp::generic::reply<%s<Connection, Check, CookieFunction>,
  29745. + Connection,
  29746. + Check,
  29747. + SIGNATURE(%s_reply),
  29748. + CookieFunction>
  29749. + base;
  29750. +
  29751. + template<typename C, typename ... Parameter>
  29752. + %s(C && c, Parameter && ... parameter)
  29753. + : base(std::forward<C>(c), std::forward<Parameter>(parameter) ...)
  29754. + {}
  29755. +
  29756. +%s\
  29757. +%s\
  29758. +}; // class %s
  29759. +
  29760. +} // namespace detail
  29761. +
  29762. +namespace checked {
  29763. +template<typename Connection>
  29764. +using %s = detail::%s<
  29765. + Connection, xpp::generic::checked_tag,
  29766. + SIGNATURE(%s)>;
  29767. +} // namespace checked
  29768. +
  29769. +namespace unchecked {
  29770. +template<typename Connection>
  29771. +using %s = detail::%s<
  29772. + Connection, xpp::generic::unchecked_tag,
  29773. + SIGNATURE(%s_unchecked)>;
  29774. +} // namespace unchecked
  29775. +
  29776. +} // namespace reply
  29777. +'''
  29778. +
  29779. +def _reply_class(name, c_name, ns, cookie, accessors):
  29780. + return _templates['reply_class'] % \
  29781. + ( name
  29782. + , name # base class
  29783. + , c_name # %s_reply
  29784. + , name # typedef
  29785. + , c_name # %s_reply
  29786. + , name # c'tor
  29787. + , cookie.make_static_getter()
  29788. + , accessors
  29789. + , name # // class %s
  29790. + , name # checked { using %s =
  29791. + , name # checked { detail::%s
  29792. + , c_name # checked { SIGNATURE
  29793. + , name # unchecked { using %s =
  29794. + , name # unchecked { detail::%s
  29795. + , c_name # unchecked { SIGNATURE
  29796. + )
  29797. +
  29798. +_templates['reply_member_accessor'] = \
  29799. +'''\
  29800. + template<typename ReturnType = %s, typename ... Parameter>
  29801. + ReturnType
  29802. + %s(Parameter && ... parameter)
  29803. + {
  29804. + using make = xpp::generic::factory::make<Connection,
  29805. + decltype(this->get()->%s),
  29806. + ReturnType,
  29807. + Parameter ...>;
  29808. + return make()(this->m_c,
  29809. + this->get()->%s,
  29810. + std::forward<Parameter>(parameter) ...);
  29811. + }
  29812. +'''
  29813. +
  29814. +def _reply_member_accessor(request_name, name, c_type, template_type):
  29815. + return _templates['reply_member_accessor'] % \
  29816. + ( c_type
  29817. + , name
  29818. + , name
  29819. + , name
  29820. + )
  29821. +
  29822. +class CppReply(object):
  29823. + def __init__(self, namespace, name, cookie, reply, accessors, parameter_list):
  29824. + self.namespace = namespace
  29825. + self.name = name
  29826. + self.reply = reply
  29827. + self.cookie = cookie
  29828. + self.accessors = accessors
  29829. + self.parameter_list = parameter_list
  29830. + self.request_name = _ext(_n_item(self.name[-1]))
  29831. + self.c_name = "xcb" \
  29832. + + (("_" + get_namespace(namespace)) if namespace.is_ext else "") \
  29833. + + "_" + self.request_name
  29834. +
  29835. + def make_accessors(self):
  29836. + return "\n".join(map(lambda a: "\n%s\n" % a, self.accessors))
  29837. +
  29838. + def make(self):
  29839. + accessors = [self.make_accessors()]
  29840. + naccessors = len(self.accessors)
  29841. +
  29842. + for field in self.reply.fields:
  29843. + if (field.field_type[-1] in _resource_classes
  29844. + and not field.type.is_list
  29845. + and not field.type.is_container):
  29846. +
  29847. + naccessors = naccessors + 1
  29848. +
  29849. + name = field.field_name.lower()
  29850. + c_type = field.c_field_type
  29851. + template_type = field.field_name.capitalize()
  29852. +
  29853. + accessors.append(_reply_member_accessor(self.request_name, name, c_type, template_type))
  29854. +
  29855. + result = ""
  29856. + result += _reply_class(
  29857. + self.request_name, self.c_name, get_namespace(self.namespace),
  29858. + self.cookie, "\n".join(accessors))
  29859. + return result
  29860. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/cpprequest.py polybar-3.2.1/lib/xpp/generators/cpprequest.py
  29861. --- polybar-3.2.1.orig/lib/xpp/generators/cpprequest.py 1970-01-01 02:00:00.000000000 +0200
  29862. +++ polybar-3.2.1/lib/xpp/generators/cpprequest.py 2017-08-30 16:02:01.000000000 +0300
  29863. @@ -0,0 +1,197 @@
  29864. +# vim: set ts=4 sws=4 sw=4:
  29865. +
  29866. +# from utils import *
  29867. +from utils import _n, _ext, _n_item, get_namespace
  29868. +from parameter import *
  29869. +from resource_classes import _resource_classes
  29870. +from cppreply import CppReply
  29871. +from cppcookie import CppCookie
  29872. +
  29873. +_templates = {}
  29874. +
  29875. +_templates['void_request_function'] = \
  29876. +'''\
  29877. +template<typename Connection, typename ... Parameter>
  29878. +void
  29879. +%s_checked(Connection && c, Parameter && ... parameter)
  29880. +{
  29881. + xpp::generic::check<Connection, xpp::%s::error::dispatcher>(
  29882. + std::forward<Connection>(c),
  29883. + %s_checked(
  29884. + std::forward<Connection>(c),
  29885. + std::forward<Parameter>(parameter) ...));
  29886. +}
  29887. +
  29888. +template<typename ... Parameter>
  29889. +void
  29890. +%s(Parameter && ... parameter)
  29891. +{
  29892. + %s(std::forward<Parameter>(parameter) ...);
  29893. +}
  29894. +'''
  29895. +
  29896. +def _void_request_function(ns, name, c_name):
  29897. + return _templates['void_request_function'] % \
  29898. + ( name
  29899. + , ns
  29900. + , c_name
  29901. + , name
  29902. + , c_name
  29903. + )
  29904. +
  29905. +_templates['reply_request_function'] = \
  29906. +'''\
  29907. +template<typename Connection, typename ... Parameter>
  29908. +reply::checked::%s<Connection>
  29909. +%s(Connection && c, Parameter && ... parameter)
  29910. +{
  29911. + return reply::checked::%s<Connection>(
  29912. + std::forward<Connection>(c), std::forward<Parameter>(parameter) ...);
  29913. +}
  29914. +
  29915. +template<typename Connection, typename ... Parameter>
  29916. +reply::unchecked::%s<Connection>
  29917. +%s_unchecked(Connection && c, Parameter && ... parameter)
  29918. +{
  29919. + return reply::unchecked::%s<Connection>(
  29920. + std::forward<Connection>(c), std::forward<Parameter>(parameter) ...);
  29921. +}
  29922. +'''
  29923. +
  29924. +def _reply_request_function(name):
  29925. + return _templates['reply_request_function'] % \
  29926. + ( name
  29927. + , name
  29928. + , name
  29929. + , name
  29930. + , name
  29931. + , name)
  29932. +
  29933. +_templates['inline_reply_class'] = \
  29934. +'''\
  29935. + template<typename ... Parameter>
  29936. + auto
  29937. + %s(Parameter && ... parameter) const
  29938. + -> reply::checked::%s<Connection>
  29939. + {
  29940. + return xpp::%s::%s(
  29941. + connection(),
  29942. + %s\
  29943. + std::forward<Parameter>(parameter) ...);
  29944. + }
  29945. +
  29946. + template<typename ... Parameter>
  29947. + auto
  29948. + %s_unchecked(Parameter && ... parameter) const
  29949. + -> reply::unchecked::%s<Connection>
  29950. + {
  29951. + return xpp::%s::%s_unchecked(
  29952. + connection(),
  29953. + %s\
  29954. + std::forward<Parameter>(parameter) ...);
  29955. + }
  29956. +'''
  29957. +
  29958. +def _inline_reply_class(request_name, method_name, member, ns):
  29959. + return _templates['inline_reply_class'] % \
  29960. + ( method_name
  29961. + , request_name
  29962. + , ns
  29963. + , request_name
  29964. + , member
  29965. + , method_name
  29966. + , request_name
  29967. + , ns
  29968. + , request_name
  29969. + , member
  29970. + )
  29971. +
  29972. +_templates['inline_void_class'] = \
  29973. +'''\
  29974. + template<typename ... Parameter>
  29975. + void
  29976. + %s_checked(Parameter && ... parameter) const
  29977. + {
  29978. + xpp::%s::%s_checked(connection(),
  29979. + %s\
  29980. + std::forward<Parameter>(parameter) ...);
  29981. + }
  29982. +
  29983. + template<typename ... Parameter>
  29984. + void
  29985. + %s(Parameter && ... parameter) const
  29986. + {
  29987. + xpp::%s::%s(connection(),
  29988. + %s\
  29989. + std::forward<Parameter>(parameter) ...);
  29990. + }
  29991. +'''
  29992. +
  29993. +def _inline_void_class(request_name, method_name, member, ns):
  29994. + return _templates['inline_void_class'] % \
  29995. + ( method_name
  29996. + , ns
  29997. + , request_name
  29998. + , member
  29999. + , method_name
  30000. + , ns
  30001. + , request_name
  30002. + , member
  30003. + )
  30004. +
  30005. +_replace_special_classes = \
  30006. + { "gcontext" : "gc" }
  30007. +
  30008. +def replace_class(method, class_name):
  30009. + cn = _replace_special_classes.get(class_name, class_name)
  30010. + return method.replace("_" + cn, "")
  30011. +
  30012. +class CppRequest(object):
  30013. + def __init__(self, request, name, is_void, namespace, reply):
  30014. + self.request = request
  30015. + self.name = name
  30016. + self.request_name = _ext(_n_item(self.request.name[-1]))
  30017. + self.is_void = is_void
  30018. + self.namespace = namespace
  30019. + self.reply = reply
  30020. + self.c_namespace = \
  30021. + "" if namespace.header.lower() == "xproto" \
  30022. + else get_namespace(namespace)
  30023. + self.accessors = []
  30024. + self.parameter_list = ParameterList()
  30025. +
  30026. + self.c_name = "xcb" \
  30027. + + (("_" + get_namespace(namespace)) if namespace.is_ext else "") \
  30028. + + "_" + self.request_name
  30029. +
  30030. + def add(self, param):
  30031. + self.parameter_list.add(param)
  30032. +
  30033. + def make_wrapped(self):
  30034. + self.parameter_list.make_wrapped()
  30035. +
  30036. + def make_class(self):
  30037. + cppcookie = CppCookie(self.namespace, self.is_void, self.request.name, self.reply, self.parameter_list)
  30038. +
  30039. + if self.is_void:
  30040. + void_functions = cppcookie.make_void_functions()
  30041. + if len(void_functions) > 0:
  30042. + return void_functions
  30043. + else:
  30044. + return _void_request_function(get_namespace(self.namespace), self.request_name, self.c_name)
  30045. +
  30046. + else:
  30047. + cppreply = CppReply(self.namespace, self.request.name, cppcookie, self.reply, self.accessors, self.parameter_list)
  30048. + return cppreply.make() + "\n\n" + _reply_request_function(self.request_name)
  30049. +
  30050. + def make_object_class_inline(self, is_connection, class_name=""):
  30051. + member = ""
  30052. + method_name = self.name
  30053. + if not is_connection:
  30054. + member = "resource(),\n"
  30055. + method_name = replace_class(method_name, class_name)
  30056. +
  30057. + if self.is_void:
  30058. + return _inline_void_class(self.request_name, method_name, member, get_namespace(self.namespace))
  30059. + else:
  30060. + return _inline_reply_class(self.request_name, method_name, member, get_namespace(self.namespace))
  30061. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/extensionclass.py polybar-3.2.1/lib/xpp/generators/extensionclass.py
  30062. --- polybar-3.2.1.orig/lib/xpp/generators/extensionclass.py 1970-01-01 02:00:00.000000000 +0200
  30063. +++ polybar-3.2.1/lib/xpp/generators/extensionclass.py 2017-08-30 16:02:01.000000000 +0300
  30064. @@ -0,0 +1,45 @@
  30065. +from utils import \
  30066. + get_namespace, \
  30067. + get_ext_name, \
  30068. + _n_item, \
  30069. + _ext
  30070. +
  30071. +class ExtensionClass(object):
  30072. + def __init__(self, namespace):
  30073. + self.namespace = namespace
  30074. +
  30075. + def make_class(self):
  30076. + # if not self.namespace.is_ext:
  30077. + # return ""
  30078. + # else:
  30079. + ns = get_namespace(self.namespace)
  30080. + if self.namespace.is_ext:
  30081. + base = "\n : public xpp::generic::extension<extension, &xcb_%s_id>\n" % ns
  30082. + ctor = " using base = xpp::generic::extension<extension, &xcb_%s_id>;\n" % ns + \
  30083. + " using base::base;\n"
  30084. + else:
  30085. + base = " "
  30086. + ctor = ""
  30087. +
  30088. + return \
  30089. +'''\
  30090. +template<typename Derived, typename Connection>
  30091. +class interface;
  30092. +
  30093. +namespace event { template<typename Connection> class dispatcher; }
  30094. +namespace error { class dispatcher; }
  30095. +
  30096. +class extension%s{
  30097. + public:
  30098. +%s\
  30099. + template<typename Derived, typename Connection>
  30100. + using interface = xpp::%s::interface<Derived, Connection>;
  30101. + template<typename Connection>
  30102. + using event_dispatcher = xpp::%s::event::dispatcher<Connection>;
  30103. + using error_dispatcher = xpp::%s::error::dispatcher;
  30104. +};\
  30105. +''' % (base,
  30106. + ctor,
  30107. + ns, # typedef xpp::interface::%s interface;
  30108. + ns, # typedef xpp::event::dispatcher::%s dispatcher;
  30109. + ns) # typedef xpp::error::dispatcher::%s dispatcher;
  30110. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/interfaceclass.py polybar-3.2.1/lib/xpp/generators/interfaceclass.py
  30111. --- polybar-3.2.1.orig/lib/xpp/generators/interfaceclass.py 1970-01-01 02:00:00.000000000 +0200
  30112. +++ polybar-3.2.1/lib/xpp/generators/interfaceclass.py 2017-08-30 16:02:01.000000000 +0300
  30113. @@ -0,0 +1,86 @@
  30114. +# vim: set ts=4 sws=4 sw=4:
  30115. +
  30116. +from utils import \
  30117. + get_namespace, \
  30118. + get_ext_name, \
  30119. + _n_item, \
  30120. + _ext
  30121. +
  30122. +from cppevent import event_dispatcher_class
  30123. +from cpperror import error_dispatcher_class
  30124. +
  30125. +_templates = {}
  30126. +
  30127. +_templates['interface_class'] = \
  30128. +"""\
  30129. +template<typename Derived, typename Connection>
  30130. +class interface
  30131. +{
  30132. + protected:
  30133. + Connection
  30134. + connection(void) const
  30135. + {
  30136. + return static_cast<const Derived *>(this)->connection();
  30137. + }
  30138. +
  30139. + public:
  30140. +%s\
  30141. +
  30142. + virtual ~interface(void) {}
  30143. +
  30144. + const interface<Derived, Connection> &
  30145. + %s(void)
  30146. + {
  30147. + return *this;
  30148. + }
  30149. +
  30150. +%s\
  30151. +}; // class interface
  30152. +"""
  30153. +
  30154. +_ignore_events = \
  30155. + { "XCB_PRESENT_GENERIC" }
  30156. +
  30157. +########## INTERFACECLASS ##########
  30158. +
  30159. +class InterfaceClass(object):
  30160. + def __init__(self):
  30161. + self.requests = []
  30162. + self.events = []
  30163. + self.errors = []
  30164. +
  30165. + def add(self, request):
  30166. + self.requests.append(request)
  30167. +
  30168. + def add_event(self, event):
  30169. + if event.opcode_name not in _ignore_events:
  30170. + self.events.append(event)
  30171. +
  30172. + def add_error(self, error):
  30173. + self.errors.append(error)
  30174. +
  30175. + def set_namespace(self, namespace):
  30176. + self.namespace = namespace
  30177. +
  30178. + def make_proto(self):
  30179. + ns = get_namespace(self.namespace)
  30180. + methods = ""
  30181. + for request in self.requests:
  30182. + methods += request.make_object_class_inline(True) + "\n\n"
  30183. +
  30184. + typedef = []
  30185. + if self.namespace.is_ext:
  30186. + typedef = [ "typedef xpp::%s::extension extension;" % ns ]
  30187. +
  30188. + if len(typedef) > 0:
  30189. + typedef = "".join(map(lambda s: " " + s, typedef)) + "\n\n"
  30190. + else:
  30191. + typedef = ""
  30192. +
  30193. +
  30194. + return (_templates['interface_class'] \
  30195. + % (typedef, ns, methods)) + \
  30196. + '\n' + event_dispatcher_class(self.namespace, self.events) + \
  30197. + '\n' + error_dispatcher_class(self.namespace, self.errors)
  30198. +
  30199. +########## INTERFACECLASS ##########
  30200. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/Makefile polybar-3.2.1/lib/xpp/generators/Makefile
  30201. --- polybar-3.2.1.orig/lib/xpp/generators/Makefile 1970-01-01 02:00:00.000000000 +0200
  30202. +++ polybar-3.2.1/lib/xpp/generators/Makefile 2017-08-30 16:02:01.000000000 +0300
  30203. @@ -0,0 +1,60 @@
  30204. +include ../flags.makefile
  30205. +
  30206. +# find ${PROTODIR} -iname '*.xml' -exec basename {} .xml \;
  30207. +# without ge, xf86vidmode
  30208. +PROTOS= \
  30209. + present \
  30210. + dpms \
  30211. + shm \
  30212. + damage \
  30213. + dri3 \
  30214. + render \
  30215. + xfixes \
  30216. + screensaver \
  30217. + bigreq \
  30218. + xprint \
  30219. + xinerama \
  30220. + xkb \
  30221. + xc_misc \
  30222. + record \
  30223. + xproto \
  30224. + xvmc \
  30225. + dri2 \
  30226. + xinput \
  30227. + sync \
  30228. + randr \
  30229. + xtest \
  30230. + res \
  30231. + shape \
  30232. + xevie \
  30233. + glx \
  30234. + xv \
  30235. + xselinux \
  30236. + xf86dri \
  30237. + composite
  30238. +
  30239. +PYTHON=python2
  30240. +CLIENT=cpp_client.py
  30241. +XCBGEN=/usr/lib/python2.7/site-packages
  30242. +PROTODIR=/usr/share/xcb
  30243. +XMLPROTOS=$(PROTOS:%=%.xml)
  30244. +HPPPROTOS=$(XMLPROTOS:%.xml=%.hpp)
  30245. +
  30246. +all: ${XMLPROTOS}
  30247. +
  30248. +gch: ${HPPPROTOS}
  30249. +
  30250. +${HPPPROTOS}:
  30251. + -${CXX} ${CXXFLAGS} ${LDFLAGS} -c $(if $(filter $@,xproto.hpp),x.hpp,$(@))
  30252. +
  30253. +${XMLPROTOS}:
  30254. + -${PYTHON} ${CLIENT} -p ${XCBGEN} ${PROTODIR}/$@ > $(if $(filter $@,xproto.xml),x.hpp,$(@:%.xml=%.hpp))
  30255. +
  30256. +find:
  30257. + @ find ${PROTODIR} -iname '*.xml' -exec basename {} .xml \;
  30258. +
  30259. +clean:
  30260. + rm -f ${PROTOS:%=%.hpp}
  30261. + rm -f $(PROTOS:%=%.hpp.gch)
  30262. +
  30263. +.PHONY: clean find ${XMLPROTOS} ${HPPPROTOS}
  30264. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/objectclass.py polybar-3.2.1/lib/xpp/generators/objectclass.py
  30265. --- polybar-3.2.1.orig/lib/xpp/generators/objectclass.py 1970-01-01 02:00:00.000000000 +0200
  30266. +++ polybar-3.2.1/lib/xpp/generators/objectclass.py 2017-08-30 16:02:01.000000000 +0300
  30267. @@ -0,0 +1,69 @@
  30268. +# vim: set ts=4 sws=4 sw=4:
  30269. +
  30270. +import sys # stderr
  30271. +import copy # deepcopy
  30272. +
  30273. +from utils import \
  30274. + get_namespace, \
  30275. + get_ext_name, \
  30276. + _n_item, \
  30277. + _ext
  30278. +
  30279. +class ObjectClass(object):
  30280. + def __init__(self, name):
  30281. + self.name = name
  30282. + self.requests = []
  30283. +
  30284. + def add(self, request):
  30285. + if (len(request.parameter_list.parameter) > 0
  30286. + and request.parameter_list.parameter[0].c_type == self.c_name):
  30287. + request_copy = copy.deepcopy(request)
  30288. + request_copy.parameter_list.parameter.pop(0)
  30289. + request_copy.make_wrapped()
  30290. + self.requests.append(request_copy)
  30291. +
  30292. + def set_namespace(self, namespace):
  30293. + self.namespace = namespace
  30294. + name = (get_namespace(namespace) + "_") if namespace.is_ext else ""
  30295. + self.c_name = "xcb_%s_t" % (name + self.name.lower())
  30296. +
  30297. + def make_inline(self):
  30298. + ns = get_namespace(self.namespace)
  30299. + name = self.name.lower()
  30300. + c_name = self.c_name
  30301. + methods = ""
  30302. +
  30303. + for request in self.requests:
  30304. + methods += request.make_object_class_inline(False, self.name.lower()) + "\n\n"
  30305. +
  30306. + if methods == "":
  30307. + return ""
  30308. + else:
  30309. + return \
  30310. +"""\
  30311. +template<typename Derived, typename Connection>
  30312. +class %s
  30313. +{
  30314. + protected:
  30315. + Connection
  30316. + connection(void) const
  30317. + {
  30318. + return static_cast<const Derived *>(this)->connection();
  30319. + }
  30320. +
  30321. + const %s &
  30322. + resource(void) const
  30323. + {
  30324. + return static_cast<const Derived *>(this)->resource();
  30325. + }
  30326. +
  30327. + public:
  30328. + virtual ~%s(void) {}
  30329. +
  30330. +%s
  30331. +}; // class %s
  30332. +""" % (name, # class %s
  30333. + c_name, # %s resource(void) { ... }
  30334. + name, # virtual ~%s(void)
  30335. + methods,
  30336. + name) # }; // class %s
  30337. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/parameter.py polybar-3.2.1/lib/xpp/generators/parameter.py
  30338. --- polybar-3.2.1.orig/lib/xpp/generators/parameter.py 1970-01-01 02:00:00.000000000 +0200
  30339. +++ polybar-3.2.1/lib/xpp/generators/parameter.py 2017-08-30 16:02:01.000000000 +0300
  30340. @@ -0,0 +1,269 @@
  30341. +# vim: set ts=4 sws=4 sw=4:
  30342. +
  30343. +import sys # stderr
  30344. +
  30345. +_templates = {}
  30346. +
  30347. +_templates['initializer'] = \
  30348. +'''\
  30349. +typedef typename value_type<%s, ! std::is_pointer<%s>::value>::type
  30350. + vector_type;
  30351. +std::vector<vector_type> %s =
  30352. + { value_iterator<%s>(%s), value_iterator<%s>(%s) };
  30353. +'''
  30354. +
  30355. +def _initializer(iter_type, c_name, iter_begin, iter_end):
  30356. + return _templates['initializer'] % \
  30357. + ( iter_type
  30358. + , iter_type
  30359. + , c_name
  30360. + , iter_type
  30361. + , iter_begin
  30362. + , iter_type
  30363. + , iter_end
  30364. + )
  30365. +
  30366. +class ParameterList(object):
  30367. + def __init__(self):
  30368. + self.want_wrap = False
  30369. + self.has_defaults = False
  30370. + self.parameter = []
  30371. + self.wrap_calls = []
  30372. + self.wrap_protos = []
  30373. + self.iter_calls = []
  30374. + self.iter_2nd_lvl_calls = []
  30375. + self.iter_protos = []
  30376. + self.templates = []
  30377. + self.iterator_templates = []
  30378. + self.initializer = []
  30379. +
  30380. + def add(self, param):
  30381. + self.has_defaults = param.default != None
  30382. + self.parameter.append(param)
  30383. +
  30384. + def comma(self):
  30385. + return "" if len(self.parameter) == 0 else ", "
  30386. +
  30387. + def is_reordered(self):
  30388. + tmp = sorted(self.parameter, cmp=lambda p1, p2: cmp(p1.default, p2.default))
  30389. + return tmp != self.parameter
  30390. +
  30391. + def calls(self, sort, params=None):
  30392. + ps = self.parameter if params == None else params
  30393. + if sort:
  30394. + tmp = sorted(ps, cmp=lambda p1, p2: cmp(p1.default, p2.default))
  30395. + ps = tmp
  30396. + calls = map(lambda p: p.call(), ps)
  30397. + return "" if len(calls) == 0 else ", ".join(calls)
  30398. +
  30399. + def protos(self, sort, defaults, params=None):
  30400. + if defaults: sort = True
  30401. + ps = self.parameter if params == None else params
  30402. + if sort:
  30403. + tmp = sorted(ps, cmp=lambda p1, p2: cmp(p1.default, p2.default))
  30404. + ps = tmp
  30405. + protos = map(lambda p: p.proto(defaults), ps)
  30406. + return "" if len(protos) == 0 else ", ".join(protos)
  30407. +
  30408. + def iterator_initializers(self):
  30409. + return self.initializer
  30410. +
  30411. + def make_wrapped(self):
  30412. + self.wrap_calls = []
  30413. + self.wrap_protos = []
  30414. + self.iter_calls = []
  30415. + self.iter_2nd_lvl_calls = []
  30416. + self.iter_protos = []
  30417. + self.initializer = []
  30418. + self.templates = []
  30419. + self.iterator_templates = []
  30420. +
  30421. + lenfields = {}
  30422. + # if a parameter is removed, take reduced parameter size into account
  30423. + adjust = 0
  30424. + for index, param in enumerate(self.parameter):
  30425. + prev = index - adjust - 1
  30426. +
  30427. + if param.field.type.is_list:
  30428. + name = param.field.type.expr.lenfield_name
  30429. + if lenfields.has_key(name):
  30430. + lenfields[name].append(param.c_name)
  30431. + else:
  30432. + lenfields[name] = [ param.c_name ]
  30433. +
  30434. + # sys.stderr.write("list: %s %s\n\n"
  30435. + # % ( param.field.type.expr.lenfield_type
  30436. + # , param.field.type.expr.lenfield_name
  30437. + # ))
  30438. +
  30439. + # SetGamma: takes 1 size, but 3 value lists
  30440. + # if param.field.type.is_list and prev >= 0:
  30441. + if (param.is_const and param.is_pointer
  30442. + and prev >= 0
  30443. + and self.parameter[prev].c_name == param.c_name + "_len"):
  30444. +
  30445. + adjust = adjust + 1
  30446. + self.want_wrap = True
  30447. + self.wrap_calls.pop(prev)
  30448. + self.wrap_protos.pop(prev)
  30449. + self.iter_calls.pop(prev)
  30450. + self.iter_2nd_lvl_calls.pop(prev)
  30451. + self.iter_protos.pop(prev)
  30452. +
  30453. + prev_type = self.parameter[prev].c_type
  30454. + if param.c_type == 'char':
  30455. +
  30456. + def append_proto_string(list):
  30457. + list.append(Parameter(None, \
  30458. + c_type='const std::string &',
  30459. + c_name=param.c_name))
  30460. +
  30461. + def append_call_string(list):
  30462. + list.append(Parameter(None, \
  30463. + c_name="static_cast<" + prev_type + ">(" \
  30464. + + param.c_name + '.length())'))
  30465. +
  30466. + list.append(Parameter(None, \
  30467. + c_name=param.c_name + '.c_str()'))
  30468. +
  30469. + append_proto_string(self.wrap_protos)
  30470. + append_proto_string(self.iter_protos)
  30471. + append_call_string(self.wrap_calls)
  30472. + append_call_string(self.iter_calls)
  30473. + append_call_string(self.iter_2nd_lvl_calls)
  30474. +
  30475. + else:
  30476. + param_type = param.c_type
  30477. + if param_type == "void":
  30478. + param_type = "Type_" + str(index)
  30479. + self.templates.append(param_type)
  30480. +
  30481. + prev_type = self.parameter[prev].c_type
  30482. +
  30483. + ### std::vector
  30484. + self.wrap_protos.append(Parameter(None, \
  30485. + c_type='const std::vector<' + param_type + '> &',
  30486. + c_name=param.c_name))
  30487. +
  30488. + self.wrap_calls.append(Parameter(None, \
  30489. + c_name="static_cast<" + prev_type + ">(" \
  30490. + + param.c_name + '.size())'))
  30491. +
  30492. + self.wrap_calls.append(Parameter(None, \
  30493. + c_name=param.c_name + '.data()'))
  30494. +
  30495. + ### Iterator
  30496. + iter_type = param.c_name.capitalize() + "_Iterator"
  30497. + iter_begin = param.c_name + "_begin"
  30498. + iter_end = param.c_name + "_end"
  30499. +
  30500. + if len(self.templates) > 0:
  30501. + self.templates[-1] += " = typename " + iter_type + "::value_type"
  30502. + self.iterator_templates.append(iter_type)
  30503. +
  30504. + self.iter_protos.append(Parameter(None, \
  30505. + c_type=iter_type,
  30506. + c_name=iter_begin))
  30507. +
  30508. + self.iter_protos.append(Parameter(None, \
  30509. + c_type=iter_type,
  30510. + c_name=iter_end))
  30511. +
  30512. + self.iter_calls.append(Parameter(None, \
  30513. + c_name="static_cast<" + prev_type + ">(" \
  30514. + + param.c_name + '.size())'))
  30515. +
  30516. + self.iter_calls.append(Parameter(None, \
  30517. + c_name='const_cast<const vector_type *>(' \
  30518. + + param.c_name + '.data())'))
  30519. +
  30520. + self.iter_2nd_lvl_calls.append(Parameter(None, \
  30521. + c_name=iter_begin))
  30522. +
  30523. + self.iter_2nd_lvl_calls.append(Parameter(None, \
  30524. + c_name=iter_end))
  30525. +
  30526. +# vector_type = \
  30527. +# '''\
  30528. +# typename value_type<%s,
  30529. +# ! std::is_pointer<%s>::value
  30530. +# >::type\
  30531. +# ''' % (iter_type, iter_type)
  30532. +
  30533. + # self.initializer.append( \
  30534. + # "std::vector<%s> %s = { value_iterator<%s>(%s), \
  30535. + # value_iterator<%s>(%s) };" \
  30536. + # % (vector_type, param.c_name,
  30537. + # iter_type, iter_begin,
  30538. + # iter_type, iter_end))
  30539. +
  30540. + self.initializer.append(
  30541. + _initializer(iter_type, param.c_name, iter_begin, iter_end))
  30542. +
  30543. + else:
  30544. + self.wrap_calls.append(param)
  30545. + self.wrap_protos.append(param)
  30546. + self.iter_calls.append(param)
  30547. + self.iter_2nd_lvl_calls.append(param)
  30548. + self.iter_protos.append(param)
  30549. +
  30550. + # end: for index, param in enumerate(self.parameter):
  30551. +
  30552. + for k, v in lenfields.items():
  30553. + if len(v) > 1:
  30554. + sys.stderr.write("list: %s, %s\n" % (k, v))
  30555. +
  30556. +
  30557. + def wrapped_calls(self, sort):
  30558. + return self.calls(sort, params=self.wrap_calls)
  30559. +
  30560. + def wrapped_protos(self, sort, defaults):
  30561. + return self.protos(sort, defaults, params=self.wrap_protos)
  30562. +
  30563. + def iterator_calls(self, sort):
  30564. + return self.calls(sort, params=self.iter_calls)
  30565. +
  30566. + def iterator_2nd_lvl_calls(self, sort):
  30567. + return self.calls(sort, params=self.iter_2nd_lvl_calls)
  30568. +
  30569. + def iterator_protos(self, sort, defaults):
  30570. + return self.protos(sort, defaults, params=self.iter_protos)
  30571. +
  30572. +
  30573. +
  30574. +_default_parameter_values = \
  30575. + { "xcb_timestamp_t" : "XCB_TIME_CURRENT_TIME" }
  30576. +
  30577. +class Parameter(object):
  30578. + def __init__(self, field, c_type="", c_name="", verbose=False):
  30579. + self.field = field
  30580. + if field != None:
  30581. + self.c_type = field.c_field_type
  30582. + self.c_name = field.c_field_name
  30583. + self.is_const = field.c_field_const_type == "const " + field.c_field_type
  30584. + self.is_pointer = field.c_pointer != " "
  30585. + # self.serialize = field.type.need_serialize
  30586. + self.default = _default_parameter_values.get(self.c_type)
  30587. + self.with_default = True
  30588. + if verbose:
  30589. + sys.stderr.write("c_type: %s; c_name: %s; default: %s\n" \
  30590. + % (self.c_type, self.c_name, self.default))
  30591. +
  30592. + else:
  30593. + self.c_type = c_type
  30594. + self.c_name = c_name
  30595. + self.is_const = False
  30596. + self.is_pointer = False
  30597. + # self.serialize = field.type.need_serialize
  30598. + self.default = _default_parameter_values.get(self.c_type)
  30599. + self.with_default = True
  30600. +
  30601. + def call(self):
  30602. + return self.c_name
  30603. +
  30604. + def proto(self, with_default):
  30605. + c_type = ("const " if self.is_const else "") \
  30606. + + self.c_type \
  30607. + + (" *" if self.is_pointer else "")
  30608. + param = " = " + self.default if with_default and self.default != None else ""
  30609. + return c_type + " " + self.c_name + param
  30610. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/resource_classes.py polybar-3.2.1/lib/xpp/generators/resource_classes.py
  30611. --- polybar-3.2.1.orig/lib/xpp/generators/resource_classes.py 1970-01-01 02:00:00.000000000 +0200
  30612. +++ polybar-3.2.1/lib/xpp/generators/resource_classes.py 2017-08-30 16:02:01.000000000 +0300
  30613. @@ -0,0 +1,81 @@
  30614. +_resource_classes = \
  30615. + {
  30616. + ### XPROTO ###
  30617. + "WINDOW"
  30618. + , "PIXMAP"
  30619. + , "CURSOR"
  30620. + , "FONT"
  30621. + , "GCONTEXT"
  30622. + , "COLORMAP"
  30623. + , "ATOM"
  30624. + , "DRAWABLE"
  30625. + , "FONTABLE"
  30626. + ### XPROTO ###
  30627. +
  30628. + ### DAMAGE ###
  30629. + , "DAMAGE"
  30630. + ### DAMAGE ###
  30631. +
  30632. + ### GLX, RECORD, XVMC ###
  30633. + , "CONTEXT"
  30634. + ### GLX, RECORD, XVMC ###
  30635. +
  30636. + ### GLX ###
  30637. + # , "PIXMAP" # already in XPROTO
  30638. + # , "CONTEXT"
  30639. + , "PBUFFER"
  30640. + # , "WINDOW" # already in XPROTO
  30641. + , "FBCONFIG"
  30642. + ### GLX ###
  30643. +
  30644. + ### PRESENT ###
  30645. + , "EVENT"
  30646. + ### PRESENT ###
  30647. +
  30648. + ### RANDR ###
  30649. + , "MODE"
  30650. + , "CRTC"
  30651. + , "OUTPUT"
  30652. + , "PROVIDER"
  30653. + ### RANDR ###
  30654. +
  30655. + ### RECORD ###
  30656. + # , "CONTEXT"
  30657. + ### RECORD ###
  30658. +
  30659. + ### RENDER ###
  30660. + , "GLYPHSET"
  30661. + , "PICTURE"
  30662. + , "PICTFORMAT"
  30663. + ### RENDER ###
  30664. +
  30665. + ### SHM ###
  30666. + , "SEG"
  30667. + ### SHM ###
  30668. +
  30669. + ### SYNC ###
  30670. + , "ALARM"
  30671. + , "COUNTER"
  30672. + , "FENCE"
  30673. + ### SYNC ###
  30674. +
  30675. + ### XFIXES ###
  30676. + , "REGION"
  30677. + , "BARRIER"
  30678. + ### XFIXES ###
  30679. +
  30680. + ### XPRINT ###
  30681. + , "PCONTEXT"
  30682. + ### XPRINT ###
  30683. +
  30684. + ### XVMC ###
  30685. + # , "CONTEXT"
  30686. + , "SURFACE"
  30687. + , "SUBPICTURE"
  30688. + ### XVMC ###
  30689. +
  30690. + ### XV ###
  30691. + , "PORT"
  30692. + , "ENCODING"
  30693. + ### XV ###
  30694. + }
  30695. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/TODO polybar-3.2.1/lib/xpp/generators/TODO
  30696. --- polybar-3.2.1.orig/lib/xpp/generators/TODO 1970-01-01 02:00:00.000000000 +0200
  30697. +++ polybar-3.2.1/lib/xpp/generators/TODO 2017-08-30 16:02:01.000000000 +0300
  30698. @@ -0,0 +1,53 @@
  30699. +TODO:
  30700. +
  30701. +* Build with python 3
  30702. +
  30703. +* valueparams
  30704. +
  30705. +* serialized fields (e.g. xcb_sync_create_alarm_value_list_serialize)
  30706. + (is this necessary?)
  30707. +
  30708. +* specialize iterator for non-vector data structures:
  30709. + Instead of converting to vector, check if it is possible to send the data
  30710. + directly through the socket (e.g. map { key, value }:
  30711. + for (k,v : map) { socket_send(v); } ...
  30712. +
  30713. +* XInput Event handling: Am I doing this right? (Multiple switches etc.)
  30714. +
  30715. +* Adapter classes for drawable, window, pixmap, atom, font, etc.
  30716. +
  30717. +$ grep xidtype *.xml
  30718. +damage.xml: <xidtype name="DAMAGE" />
  30719. +glx.xml: <xidtype name="PIXMAP" />
  30720. +glx.xml: <xidtype name="CONTEXT" />
  30721. +glx.xml: <xidtype name="PBUFFER" />
  30722. +glx.xml: <xidtype name="WINDOW" />
  30723. +glx.xml: <xidtype name="FBCONFIG" />
  30724. +present.xml: <xidtype name="EVENT"/>
  30725. +randr.xml: <xidtype name="MODE" />
  30726. +randr.xml: <xidtype name="CRTC" />
  30727. +randr.xml: <xidtype name="OUTPUT" />
  30728. +randr.xml: <xidtype name="PROVIDER" />
  30729. +record.xml: <xidtype name="CONTEXT" />
  30730. +render.xml: <xidtype name="GLYPHSET" />
  30731. +render.xml: <xidtype name="PICTURE" />
  30732. +render.xml: <xidtype name="PICTFORMAT" />
  30733. +shm.xml: <xidtype name="SEG" />
  30734. +sync.xml: <xidtype name="ALARM" />
  30735. +sync.xml: <xidtype name="COUNTER" />
  30736. +sync.xml: <xidtype name="FENCE" />
  30737. +xfixes.xml: <xidtype name="REGION" />
  30738. +xfixes.xml: <xidtype name="BARRIER" />
  30739. +xprint.xml: <xidtype name="PCONTEXT" />
  30740. +xproto.xml: <xidtype name="WINDOW" />
  30741. +xproto.xml: <xidtype name="PIXMAP" />
  30742. +xproto.xml: <xidtype name="CURSOR" />
  30743. +xproto.xml: <xidtype name="FONT" />
  30744. +xproto.xml: <xidtype name="GCONTEXT" />
  30745. +xproto.xml: <xidtype name="COLORMAP" />
  30746. +xproto.xml: <xidtype name="ATOM" />
  30747. +xvmc.xml: <xidtype name="CONTEXT" />
  30748. +xvmc.xml: <xidtype name="SURFACE" />
  30749. +xvmc.xml: <xidtype name="SUBPICTURE" />
  30750. +xv.xml: <xidtype name="PORT" />
  30751. +xv.xml: <xidtype name="ENCODING" />
  30752. diff -Nuar polybar-3.2.1.orig/lib/xpp/generators/utils.py polybar-3.2.1/lib/xpp/generators/utils.py
  30753. --- polybar-3.2.1.orig/lib/xpp/generators/utils.py 1970-01-01 02:00:00.000000000 +0200
  30754. +++ polybar-3.2.1/lib/xpp/generators/utils.py 2017-08-30 16:02:01.000000000 +0300
  30755. @@ -0,0 +1,63 @@
  30756. +import re # compile
  30757. +
  30758. +_reserved_keywords = {'class' : '_class',
  30759. + 'new' : '_new',
  30760. + 'delete': '_delete',
  30761. + 'default' : '_default',
  30762. + 'private' : '_private',
  30763. + 'explicit': '_explicit'}
  30764. +
  30765. +def get_namespace(namespace):
  30766. + if namespace.is_ext:
  30767. + return get_ext_name(namespace.ext_name)
  30768. + else:
  30769. + return "x"
  30770. +
  30771. +def get_ext_name(str):
  30772. + return _ext(str)
  30773. +
  30774. +_cname_re = re.compile('([A-Z0-9][a-z]+|[A-Z0-9]+(?![a-z])|[a-z]+)')
  30775. +_cname_special_cases = {'DECnet':'decnet'}
  30776. +
  30777. +def _n_item(str, parts=False):
  30778. + '''
  30779. + Does C-name conversion on a single string fragment.
  30780. + Uses a regexp with some hard-coded special cases.
  30781. + '''
  30782. + if str in _cname_special_cases:
  30783. + return _cname_special_cases[str]
  30784. + else:
  30785. + split = _cname_re.finditer(str)
  30786. + name_parts = [match.group(0) for match in split]
  30787. + if parts:
  30788. + return name_parts
  30789. + else:
  30790. + return '_'.join(name_parts)
  30791. +
  30792. +_extension_special_cases = ['XPrint', 'XCMisc', 'BigRequests']
  30793. +
  30794. +def _ext(str):
  30795. + '''
  30796. + Does C-name conversion on an extension name.
  30797. + Has some additional special cases on top of _n_item.
  30798. + '''
  30799. + if str in _extension_special_cases:
  30800. + return _n_item(str).lower()
  30801. + else:
  30802. + return str.lower()
  30803. +
  30804. +def _n(list, namespace):
  30805. + '''
  30806. + Does C-name conversion on a tuple of strings.
  30807. + Different behavior depending on length of tuple, extension/not extension, etc.
  30808. + Basically C-name converts the individual pieces, then joins with underscores.
  30809. + '''
  30810. + if len(list) == 1:
  30811. + parts = list
  30812. + elif len(list) == 2:
  30813. + parts = [list[0], _n_item(list[1])]
  30814. + elif namespace.is_ext:
  30815. + parts = [list[0], _ext(list[1])] + [_n_item(i) for i in list[2:]]
  30816. + else:
  30817. + parts = [list[0]] + [_n_item(i) for i in list[1:]]
  30818. + return '_'.join(parts).lower()
  30819. diff -Nuar polybar-3.2.1.orig/lib/xpp/.gitignore polybar-3.2.1/lib/xpp/.gitignore
  30820. --- polybar-3.2.1.orig/lib/xpp/.gitignore 1970-01-01 02:00:00.000000000 +0200
  30821. +++ polybar-3.2.1/lib/xpp/.gitignore 2017-08-30 16:02:01.000000000 +0300
  30822. @@ -0,0 +1,7 @@
  30823. +build
  30824. +.clang_complete
  30825. +*.o
  30826. +*.swp
  30827. +*.gch
  30828. +*.d
  30829. +*.pyc
  30830. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/atom.hpp polybar-3.2.1/lib/xpp/include/xpp/atom.hpp
  30831. --- polybar-3.2.1.orig/lib/xpp/include/xpp/atom.hpp 1970-01-01 02:00:00.000000000 +0200
  30832. +++ polybar-3.2.1/lib/xpp/include/xpp/atom.hpp 2017-08-30 16:02:01.000000000 +0300
  30833. @@ -0,0 +1,34 @@
  30834. +#ifndef XPP_ATOM_HPP
  30835. +#define XPP_ATOM_HPP
  30836. +
  30837. +#include "proto/x.hpp"
  30838. +#include "generic/resource.hpp"
  30839. +
  30840. +namespace xpp {
  30841. +
  30842. +template<typename Connection, template<typename, typename> class ... Interfaces>
  30843. +class atom
  30844. + : public xpp::generic::resource<Connection, xcb_atom_t,
  30845. + xpp::x::atom, Interfaces ...>
  30846. +{
  30847. + protected:
  30848. + using base = xpp::generic::resource<Connection, xcb_atom_t, Interfaces ...>;
  30849. +
  30850. + public:
  30851. + using base::base;
  30852. + using base::operator=;
  30853. +};
  30854. +
  30855. +namespace generic {
  30856. +
  30857. +template<typename Connection, template<typename, typename> class ... Interfaces>
  30858. +struct traits<xpp::atom<Connection, Interfaces ...>>
  30859. +{
  30860. + typedef xcb_atom_t type;
  30861. +};
  30862. +
  30863. +} // namespace generic
  30864. +
  30865. +} // namespace xpp
  30866. +
  30867. +#endif // XPP_ATOM_HPP
  30868. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/colormap.hpp polybar-3.2.1/lib/xpp/include/xpp/colormap.hpp
  30869. --- polybar-3.2.1.orig/lib/xpp/include/xpp/colormap.hpp 1970-01-01 02:00:00.000000000 +0200
  30870. +++ polybar-3.2.1/lib/xpp/include/xpp/colormap.hpp 2017-08-30 16:02:01.000000000 +0300
  30871. @@ -0,0 +1,77 @@
  30872. +#ifndef XPP_COLORMAP_HPP
  30873. +#define XPP_COLORMAP_HPP
  30874. +
  30875. +#include "proto/x.hpp"
  30876. +#include "generic/resource.hpp"
  30877. +
  30878. +namespace xpp {
  30879. +
  30880. +template<typename Connection, template<typename, typename> class ... Interfaces>
  30881. +class colormap
  30882. + : public xpp::generic::resource<Connection, xcb_colormap_t,
  30883. + xpp::x::colormap, Interfaces ...>
  30884. +{
  30885. + protected:
  30886. + using base = xpp::generic::resource<Connection, xcb_colormap_t,
  30887. + xpp::x::colormap, Interfaces ...>;
  30888. +
  30889. + template<typename C, typename Create, typename Destroy>
  30890. + colormap(C && c, Create && create, Destroy && destroy)
  30891. + : base(base::make(std::forward<C>(c),
  30892. + std::forward<Create>(create),
  30893. + std::forward<Destroy>(destroy)))
  30894. + {}
  30895. +
  30896. + public:
  30897. + using base::base;
  30898. + using base::operator=;
  30899. +
  30900. + template<typename C>
  30901. + static
  30902. + colormap<Connection, Interfaces ...>
  30903. + create(C && c, uint8_t alloc, xcb_window_t window, xcb_visualid_t visual)
  30904. + {
  30905. + return colormap(
  30906. + std::forward<C>(c),
  30907. + [&](const Connection & c, const xcb_colormap_t & colormap)
  30908. + {
  30909. + xpp::x::create_colormap(c, alloc, colormap, window, visual);
  30910. + },
  30911. + [&](const Connection & c, const xcb_colormap_t & colormap)
  30912. + {
  30913. + xpp::x::free_colormap(c, colormap);
  30914. + });
  30915. + }
  30916. +
  30917. + template<typename C>
  30918. + static
  30919. + colormap<Connection, Interfaces ...>
  30920. + create_checked(C && c, uint8_t alloc,
  30921. + xcb_window_t window, xcb_visualid_t visual)
  30922. + {
  30923. + return colormap(
  30924. + std::forward<C>(c),
  30925. + [&](const Connection & c, const xcb_colormap_t & colormap)
  30926. + {
  30927. + xpp::x::create_colormap_checked(c, alloc, colormap, window, visual);
  30928. + },
  30929. + [&](const Connection & c, const xcb_colormap_t & colormap)
  30930. + {
  30931. + xpp::x::free_colormap_checked(c, colormap);
  30932. + });
  30933. + }
  30934. +};
  30935. +
  30936. +namespace generic {
  30937. +
  30938. +template<typename Connection, template<typename, typename> class ... Interfaces>
  30939. +struct traits<xpp::colormap<Connection, Interfaces ...>>
  30940. +{
  30941. + typedef xcb_colormap_t type;
  30942. +};
  30943. +
  30944. +} // namespace generic
  30945. +
  30946. +} // namespace xpp
  30947. +
  30948. +#endif // XPP_COLORMAP_HPP
  30949. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/connection.hpp polybar-3.2.1/lib/xpp/include/xpp/connection.hpp
  30950. --- polybar-3.2.1.orig/lib/xpp/include/xpp/connection.hpp 1970-01-01 02:00:00.000000000 +0200
  30951. +++ polybar-3.2.1/lib/xpp/include/xpp/connection.hpp 2017-08-30 16:02:01.000000000 +0300
  30952. @@ -0,0 +1,157 @@
  30953. +#ifndef XPP_CONNECTION_HPP
  30954. +#define XPP_CONNECTION_HPP
  30955. +
  30956. +#include "core.hpp"
  30957. +#include "generic/factory.hpp"
  30958. +
  30959. +#include "proto/x.hpp"
  30960. +
  30961. +namespace xpp {
  30962. +
  30963. +namespace detail {
  30964. +
  30965. +template<typename Connection, typename ... Extensions>
  30966. +class interfaces
  30967. + : public xpp::x::extension::interface<interfaces<Connection, Extensions ...>, Connection>
  30968. + , public Extensions::template interface<interfaces<Connection, Extensions ...>, Connection> ...
  30969. +{
  30970. + public:
  30971. + Connection
  30972. + connection(void) const
  30973. + {
  30974. + return static_cast<const Connection &>(*this);
  30975. + }
  30976. +}; // class interfaces
  30977. +
  30978. +} // namespace detail
  30979. +
  30980. +template<typename ... Extensions>
  30981. +class connection
  30982. + : public xpp::core
  30983. + , public xpp::generic::error_dispatcher
  30984. + , public detail::interfaces<connection<Extensions ...>, Extensions ...>
  30985. + // private interfaces: extensions and error_dispatcher
  30986. + , private xpp::x::extension
  30987. + , private xpp::x::extension::error_dispatcher
  30988. + , private Extensions ...
  30989. + , private Extensions::error_dispatcher ...
  30990. +{
  30991. + protected:
  30992. + typedef connection<Extensions ...> self;
  30993. +
  30994. +
  30995. + public:
  30996. + template<typename ... Parameters>
  30997. + explicit
  30998. + connection(Parameters && ... parameters)
  30999. + : xpp::core::core(std::forward<Parameters>(parameters) ...)
  31000. + , detail::interfaces<connection<Extensions ...>, Extensions ...>(*this)
  31001. + , Extensions(static_cast<xcb_connection_t *>(*this)) ...
  31002. + , Extensions::error_dispatcher(static_cast<Extensions &>(*this).get()) ...
  31003. + {
  31004. + m_root_window = screen_of_display(default_screen())->root;
  31005. + }
  31006. +
  31007. + virtual
  31008. + ~connection(void)
  31009. + {}
  31010. +
  31011. + virtual
  31012. + operator xcb_connection_t *(void) const
  31013. + {
  31014. + return *(static_cast<const core &>(*this));
  31015. + }
  31016. +
  31017. + void
  31018. + operator()(const std::shared_ptr<xcb_generic_error_t> & error) const
  31019. + {
  31020. + check<xpp::x::extension, Extensions ...>(error);
  31021. + }
  31022. +
  31023. + template<typename Extension>
  31024. + const Extension &
  31025. + extension(void) const
  31026. + {
  31027. + return static_cast<const Extension &>(*this);
  31028. + }
  31029. +
  31030. + // TODO
  31031. + // virtual operator Display * const(void) const
  31032. + // {
  31033. + // }
  31034. +
  31035. + template<typename Window = xcb_window_t>
  31036. + Window
  31037. + root(void)
  31038. + {
  31039. + using make = xpp::generic::factory::make<self, xcb_window_t, Window>;
  31040. + return make()(*this, m_root_window);
  31041. + }
  31042. +
  31043. + template<typename Window = xcb_window_t>
  31044. + Window
  31045. + root(void) const
  31046. + {
  31047. + using make = xpp::generic::factory::make<self, xcb_window_t, Window>;
  31048. + return make()(*this, m_root_window);
  31049. + }
  31050. +
  31051. + virtual
  31052. + shared_generic_event_ptr
  31053. + wait_for_event(void) const
  31054. + {
  31055. + try {
  31056. + return core::wait_for_event();
  31057. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  31058. + check<xpp::x::extension, Extensions ...>(error);
  31059. + }
  31060. + // re-throw any exception caused by wait_for_event
  31061. + throw;
  31062. + }
  31063. +
  31064. + virtual
  31065. + shared_generic_event_ptr
  31066. + wait_for_special_event(xcb_special_event_t * se) const
  31067. + {
  31068. + try {
  31069. + return core::wait_for_special_event(se);
  31070. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  31071. + check<xpp::x::extension, Extensions ...>(error);
  31072. + }
  31073. + // re-throw any exception caused by wait_for_special_event
  31074. + throw;
  31075. + }
  31076. +
  31077. + private:
  31078. + xcb_window_t m_root_window;
  31079. +
  31080. + template<typename Extension, typename Next, typename ... Rest>
  31081. + void
  31082. + check(const std::shared_ptr<xcb_generic_error_t> & error) const
  31083. + {
  31084. + check<Extension>(error);
  31085. + check<Next, Rest ...>(error);
  31086. + }
  31087. +
  31088. + template<typename Extension>
  31089. + void
  31090. + check(const std::shared_ptr<xcb_generic_error_t> & error) const
  31091. + {
  31092. + using error_dispatcher = typename Extension::error_dispatcher;
  31093. + auto & dispatcher = static_cast<const error_dispatcher &>(*this);
  31094. + dispatcher(error);
  31095. + }
  31096. +}; // class connection
  31097. +
  31098. +template<>
  31099. +template<typename ... Parameters>
  31100. +connection<>::connection(Parameters && ... parameters)
  31101. + : xpp::core::core(std::forward<Parameters>(parameters) ...)
  31102. + , detail::interfaces<connection<>>(*this)
  31103. +{
  31104. + m_root_window = screen_of_display(static_cast<core &>(*this).default_screen())->root;
  31105. +}
  31106. +
  31107. +} // namespace xpp
  31108. +
  31109. +#endif // XPP_CONNECTION_HPP
  31110. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/core.hpp polybar-3.2.1/lib/xpp/include/xpp/core.hpp
  31111. --- polybar-3.2.1.orig/lib/xpp/include/xpp/core.hpp 1970-01-01 02:00:00.000000000 +0200
  31112. +++ polybar-3.2.1/lib/xpp/include/xpp/core.hpp 2017-08-30 16:02:01.000000000 +0300
  31113. @@ -0,0 +1,339 @@
  31114. +#ifndef XPP_CORE_HPP
  31115. +#define XPP_CORE_HPP
  31116. +
  31117. +#include <string>
  31118. +#include <memory>
  31119. +#include <xcb/xcb.h>
  31120. +
  31121. +namespace xpp {
  31122. +
  31123. +class connection_error
  31124. + : public std::runtime_error
  31125. +{
  31126. + public:
  31127. + connection_error(uint8_t code, const std::string & description)
  31128. + : std::runtime_error(description + "(" + std::to_string(code) + ")")
  31129. + , m_code(code)
  31130. + , m_description(description)
  31131. + {}
  31132. +
  31133. + uint8_t
  31134. + code(void)
  31135. + {
  31136. + return m_code;
  31137. + }
  31138. +
  31139. + std::string
  31140. + description(void)
  31141. + {
  31142. + return m_description;
  31143. + }
  31144. +
  31145. + protected:
  31146. + uint8_t m_code;
  31147. + std::string m_description;
  31148. +};
  31149. +
  31150. +class core
  31151. +{
  31152. + protected:
  31153. + using shared_generic_event_ptr = std::shared_ptr<xcb_generic_event_t>;
  31154. +
  31155. + int m_screen = 0;
  31156. + // reference counting for xcb_connection_t
  31157. + std::shared_ptr<xcb_connection_t> m_c;
  31158. +
  31159. + shared_generic_event_ptr
  31160. + dispatch(const std::string & producer, xcb_generic_event_t * event) const
  31161. + {
  31162. + if (event) {
  31163. + if (event->response_type == 0) {
  31164. + throw std::shared_ptr<xcb_generic_error_t>(
  31165. + reinterpret_cast<xcb_generic_error_t *>(event));
  31166. + }
  31167. +
  31168. + return shared_generic_event_ptr(event, std::free);
  31169. + }
  31170. +
  31171. + check_connection();
  31172. + throw std::runtime_error(producer + " failed");
  31173. + }
  31174. +
  31175. + public:
  31176. + explicit
  31177. + core(xcb_connection_t * c)
  31178. + : m_c(std::shared_ptr<xcb_connection_t>(c, [](...) {}))
  31179. + {}
  31180. +
  31181. + template<typename ... ConnectionParameter>
  31182. + explicit
  31183. + core(xcb_connection_t * (*Connect)(ConnectionParameter ...),
  31184. + ConnectionParameter ... connection_parameter)
  31185. + : m_c(std::shared_ptr<xcb_connection_t>(
  31186. + Connect(connection_parameter ...),
  31187. + [&](void *) { disconnect(); }))
  31188. + {}
  31189. +
  31190. + // xcb_connect (const char *displayname, int *screenp)
  31191. + explicit
  31192. + core(const std::string & displayname = "")
  31193. + : core(xcb_connect, displayname.c_str(), &m_screen)
  31194. + {}
  31195. +
  31196. + // xcb_connect_to_fd (int fd, xcb_auth_info_t *auth_info)
  31197. + explicit
  31198. + core(int fd, xcb_auth_info_t * auth_info)
  31199. + : core(xcb_connect_to_fd, fd, auth_info)
  31200. + {}
  31201. +
  31202. + // xcb_connect_to_display_with_auth_info (
  31203. + // const char *display, xcb_auth_info_t *auth, int *screen)
  31204. + explicit
  31205. + core(const std::string & display, xcb_auth_info_t * auth)
  31206. + : core(xcb_connect_to_display_with_auth_info,
  31207. + display.c_str(), auth, &m_screen)
  31208. + {}
  31209. +
  31210. + virtual
  31211. + ~core(void)
  31212. + {}
  31213. +
  31214. + virtual
  31215. + xcb_connection_t *
  31216. + operator*(void) const
  31217. + {
  31218. + return m_c.get();
  31219. + }
  31220. +
  31221. + virtual
  31222. + operator xcb_connection_t *(void) const
  31223. + {
  31224. + return m_c.get();
  31225. + }
  31226. +
  31227. + virtual
  31228. + int
  31229. + default_screen(void) const
  31230. + {
  31231. + return m_screen;
  31232. + }
  31233. +
  31234. + virtual
  31235. + int
  31236. + flush(void) const
  31237. + {
  31238. + return xcb_flush(m_c.get());
  31239. + }
  31240. +
  31241. + virtual
  31242. + uint32_t
  31243. + get_maximum_request_length(void) const
  31244. + {
  31245. + return xcb_get_maximum_request_length(m_c.get());
  31246. + }
  31247. +
  31248. + virtual
  31249. + void
  31250. + prefetch_maximum_request_length(void) const
  31251. + {
  31252. + xcb_prefetch_maximum_request_length(m_c.get());
  31253. + }
  31254. +
  31255. + virtual
  31256. + shared_generic_event_ptr
  31257. + wait_for_event(void) const
  31258. + {
  31259. + return dispatch("wait_for_event", xcb_wait_for_event(m_c.get()));
  31260. + }
  31261. +
  31262. + virtual
  31263. + shared_generic_event_ptr
  31264. + poll_for_event(void) const
  31265. + {
  31266. + return shared_generic_event_ptr(xcb_poll_for_event(m_c.get()));
  31267. + }
  31268. +
  31269. + virtual
  31270. + shared_generic_event_ptr
  31271. + poll_for_queued_event(void) const
  31272. + {
  31273. + return shared_generic_event_ptr(xcb_poll_for_queued_event(m_c.get()));
  31274. + }
  31275. +
  31276. + virtual
  31277. + shared_generic_event_ptr
  31278. + poll_for_special_event(xcb_special_event_t * se) const
  31279. + {
  31280. + return shared_generic_event_ptr(xcb_poll_for_special_event(m_c.get(), se));
  31281. + }
  31282. +
  31283. + // virtual
  31284. + // shared_generic_event_ptr
  31285. + // poll_for_special_event(const std::shared_ptr<xcb_special_event_t> & se) const
  31286. + // {
  31287. + // return poll_for_special_event(se.get());
  31288. + // }
  31289. +
  31290. + virtual
  31291. + shared_generic_event_ptr
  31292. + wait_for_special_event(xcb_special_event_t * se) const
  31293. + {
  31294. + return dispatch("wait_for_special_event",
  31295. + xcb_wait_for_special_event(m_c.get(), se));
  31296. + }
  31297. +
  31298. + // virtual
  31299. + // shared_generic_event_ptr
  31300. + // wait_for_special_event(const std::shared_ptr<xcb_special_event_t> & se) const
  31301. + // {
  31302. + // return wait_for_special_event(se.get());
  31303. + // }
  31304. +
  31305. + // xcb_special_event_t has incomplete type -> no std::shared_ptr
  31306. + virtual
  31307. + xcb_special_event_t *
  31308. + register_for_special_xge(xcb_extension_t * ext,
  31309. + uint32_t eid,
  31310. + uint32_t * stamp) const
  31311. + {
  31312. + return xcb_register_for_special_xge(m_c.get(), ext, eid, stamp);
  31313. + }
  31314. +
  31315. + virtual
  31316. + void
  31317. + unregister_for_special_event(xcb_special_event_t * se) const
  31318. + {
  31319. + xcb_unregister_for_special_event(m_c.get(), se);
  31320. + }
  31321. +
  31322. + virtual
  31323. + std::shared_ptr<xcb_generic_error_t>
  31324. + request_check(xcb_void_cookie_t cookie) const
  31325. + {
  31326. + return std::shared_ptr<xcb_generic_error_t>(
  31327. + xcb_request_check(m_c.get(), cookie));
  31328. + }
  31329. +
  31330. + virtual
  31331. + void
  31332. + discard_reply(unsigned int sequence) const
  31333. + {
  31334. + xcb_discard_reply(m_c.get(), sequence);
  31335. + }
  31336. +
  31337. + // The result must not be freed.
  31338. + // This storage is managed by the cache itself.
  31339. + virtual
  31340. + const xcb_query_extension_reply_t *
  31341. + get_extension_data(xcb_extension_t * ext) const
  31342. + {
  31343. + return xcb_get_extension_data(m_c.get(), ext);
  31344. + }
  31345. +
  31346. + virtual
  31347. + void
  31348. + prefetch_extension_data(xcb_extension_t * ext) const
  31349. + {
  31350. + xcb_prefetch_extension_data(m_c.get(), ext);
  31351. + }
  31352. +
  31353. + virtual
  31354. + const xcb_setup_t *
  31355. + get_setup(void) const
  31356. + {
  31357. + return xcb_get_setup(m_c.get());
  31358. + }
  31359. +
  31360. + virtual
  31361. + int
  31362. + get_file_descriptor(void) const
  31363. + {
  31364. + return xcb_get_file_descriptor(m_c.get());
  31365. + }
  31366. +
  31367. + virtual
  31368. + int
  31369. + connection_has_error(void) const
  31370. + {
  31371. + return xcb_connection_has_error(m_c.get());
  31372. + }
  31373. +
  31374. + virtual
  31375. + void
  31376. + disconnect(void) const
  31377. + {
  31378. + xcb_disconnect(m_c.get());
  31379. + }
  31380. +
  31381. + // hostname, display, screen
  31382. + virtual
  31383. + std::tuple<std::string, int, int>
  31384. + parse_display(const std::string & name) const
  31385. + {
  31386. + int screen = 0;
  31387. + int display = 0;
  31388. + char * host = NULL;
  31389. + std::string hostname;
  31390. +
  31391. + xcb_parse_display(name.c_str(), &host, &display, &screen);
  31392. + if (host != NULL) {
  31393. + hostname = std::string(host);
  31394. + }
  31395. +
  31396. + return std::make_tuple(hostname, display, screen);
  31397. + }
  31398. +
  31399. + virtual
  31400. + uint32_t
  31401. + generate_id(void) const
  31402. + {
  31403. + return xcb_generate_id(m_c.get());
  31404. + }
  31405. +
  31406. + xcb_screen_t *
  31407. + screen_of_display(int screen)
  31408. + {
  31409. + xcb_screen_iterator_t iter;
  31410. +
  31411. + iter = xcb_setup_roots_iterator(xcb_get_setup(m_c.get()));
  31412. + for (; iter.rem; --screen, xcb_screen_next(&iter))
  31413. + if (screen == 0)
  31414. + return iter.data;
  31415. +
  31416. + return NULL;
  31417. + }
  31418. +
  31419. + void
  31420. + check_connection(void) const
  31421. + {
  31422. + switch (xcb_connection_has_error(m_c.get())) {
  31423. + case XCB_CONN_ERROR:
  31424. + throw(connection_error(
  31425. + XCB_CONN_ERROR, "XCB_CONN_ERROR"));
  31426. +
  31427. + case XCB_CONN_CLOSED_EXT_NOTSUPPORTED:
  31428. + throw(connection_error(XCB_CONN_CLOSED_EXT_NOTSUPPORTED,
  31429. + "XCB_CONN_CLOSED_EXT_NOTSUPPORTED"));
  31430. +
  31431. + case XCB_CONN_CLOSED_MEM_INSUFFICIENT:
  31432. + throw(connection_error(XCB_CONN_CLOSED_MEM_INSUFFICIENT,
  31433. + "XCB_CONN_CLOSED_MEM_INSUFFICIENT"));
  31434. +
  31435. + case XCB_CONN_CLOSED_REQ_LEN_EXCEED:
  31436. + throw(connection_error(XCB_CONN_CLOSED_REQ_LEN_EXCEED,
  31437. + "XCB_CONN_CLOSED_REQ_LEN_EXCEED"));
  31438. +
  31439. + case XCB_CONN_CLOSED_PARSE_ERR:
  31440. + throw(connection_error(XCB_CONN_CLOSED_PARSE_ERR,
  31441. + "XCB_CONN_CLOSED_PARSE_ERR"));
  31442. +
  31443. + case XCB_CONN_CLOSED_INVALID_SCREEN:
  31444. + throw(connection_error(XCB_CONN_CLOSED_INVALID_SCREEN,
  31445. + "XCB_CONN_CLOSED_INVALID_SCREEN"));
  31446. + };
  31447. + }
  31448. +}; // class core
  31449. +
  31450. +} // namespace xpp
  31451. +
  31452. +#endif // XPP_CORE_HPP
  31453. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/cursor.hpp polybar-3.2.1/lib/xpp/include/xpp/cursor.hpp
  31454. --- polybar-3.2.1.orig/lib/xpp/include/xpp/cursor.hpp 1970-01-01 02:00:00.000000000 +0200
  31455. +++ polybar-3.2.1/lib/xpp/include/xpp/cursor.hpp 2017-08-30 16:02:01.000000000 +0300
  31456. @@ -0,0 +1,142 @@
  31457. +#ifndef XPP_CURSOR_HPP
  31458. +#define XPP_CURSOR_HPP
  31459. +
  31460. +#include "proto/x.hpp"
  31461. +#include "generic/resource.hpp"
  31462. +
  31463. +namespace xpp {
  31464. +
  31465. +template<typename Connection, template<typename, typename> class ... Interfaces>
  31466. +class cursor
  31467. + : public xpp::generic::resource<Connection, xcb_cursor_t,
  31468. + xpp::x::cursor, Interfaces ...>
  31469. +{
  31470. + protected:
  31471. + using base = xpp::generic::resource<Connection, xcb_cursor_t,
  31472. + xpp::x::cursor, Interfaces ...>;
  31473. +
  31474. + template<typename C, typename Create, typename Destroy>
  31475. + cursor(C && c, Create && create, Destroy && destroy)
  31476. + : base(base::make(std::forward<C>(c),
  31477. + std::forward<Create>(create),
  31478. + std::forward<Destroy>(destroy)))
  31479. + {}
  31480. +
  31481. + public:
  31482. + using base::base;
  31483. + using base::operator=;
  31484. +
  31485. + template<typename C>
  31486. + static
  31487. + cursor<Connection, Interfaces ...>
  31488. + create(C && c,
  31489. + xcb_pixmap_t source, xcb_pixmap_t mask,
  31490. + uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue,
  31491. + uint16_t back_red, uint16_t back_green, uint16_t back_blue,
  31492. + uint16_t x, uint16_t y)
  31493. + {
  31494. + return cursor(
  31495. + std::forward<C>(c),
  31496. + [&](Connection & c, const xcb_cursor_t & cursor)
  31497. + {
  31498. + xpp::x::create_cursor(c, cursor,
  31499. + source, mask,
  31500. + fore_red, fore_green, fore_blue,
  31501. + back_red, back_green, back_blue,
  31502. + x, y);
  31503. + },
  31504. + [&](Connection & c, const xcb_cursor_t & cursor)
  31505. + {
  31506. + xpp::x::free_cursor(c, cursor);
  31507. + });
  31508. + }
  31509. +
  31510. + template<typename C>
  31511. + static
  31512. + cursor<Connection, Interfaces ...>
  31513. + create_checked(C && c,
  31514. + xcb_pixmap_t source, xcb_pixmap_t mask,
  31515. + uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue,
  31516. + uint16_t back_red, uint16_t back_green, uint16_t back_blue,
  31517. + uint16_t x, uint16_t y)
  31518. + {
  31519. + return cursor(
  31520. + std::forward<C>(c),
  31521. + [&](Connection & c, const xcb_cursor_t & cursor)
  31522. + {
  31523. + xpp::x::create_cursor_checked(c, cursor,
  31524. + source, mask,
  31525. + fore_red, fore_green, fore_blue,
  31526. + back_red, back_green, back_blue,
  31527. + x, y);
  31528. + },
  31529. + [&](Connection & c, const xcb_cursor_t & cursor)
  31530. + {
  31531. + xpp::x::free_cursor_checked(c, cursor);
  31532. + });
  31533. + }
  31534. +
  31535. + template<typename C>
  31536. + static
  31537. + cursor<Connection, Interfaces ...>
  31538. + create_glyph(C && c,
  31539. + xcb_font_t source_font, xcb_font_t mask_font,
  31540. + uint16_t source_char, uint16_t mask_char,
  31541. + uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue,
  31542. + uint16_t back_red, uint16_t back_green, uint16_t back_blue)
  31543. + {
  31544. + return cursor(
  31545. + std::forward<C>(c),
  31546. + [&](Connection & c, const xcb_cursor_t & cursor)
  31547. + {
  31548. + xpp::x::create_glyph_cursor(c, cursor,
  31549. + source_font, mask_font,
  31550. + source_char, mask_char,
  31551. + fore_red, fore_green, fore_blue,
  31552. + back_red, back_green, back_blue);
  31553. + },
  31554. + [](Connection & c, const xcb_cursor_t & cursor)
  31555. + {
  31556. + xpp::x::free_cursor(c, cursor);
  31557. + });
  31558. + }
  31559. +
  31560. + template<typename C>
  31561. + static
  31562. + cursor<Connection, Interfaces ...>
  31563. + create_glyph_checked(C && c,
  31564. + xcb_font_t source_font, xcb_font_t mask_font,
  31565. + uint16_t source_char, uint16_t mask_char,
  31566. + uint16_t fore_red, uint16_t fore_green, uint16_t fore_blue,
  31567. + uint16_t back_red, uint16_t back_green, uint16_t back_blue)
  31568. + {
  31569. + return cursor(
  31570. + std::forward<C>(c),
  31571. + [&](Connection & c, const xcb_cursor_t & cursor)
  31572. + {
  31573. + xpp::x::create_glyph_cursor_checked(c, cursor,
  31574. + source_font, mask_font,
  31575. + source_char, mask_char,
  31576. + fore_red, fore_green, fore_blue,
  31577. + back_red, back_green, back_blue);
  31578. + },
  31579. + [](Connection & c, const xcb_cursor_t & cursor)
  31580. + {
  31581. + xpp::x::free_cursor_checked(c, cursor);
  31582. + });
  31583. + }
  31584. +};
  31585. +
  31586. +namespace generic {
  31587. +
  31588. +template<typename Connection, template<typename, typename> class ... Interfaces>
  31589. +struct traits<xpp::cursor<Connection, Interfaces ...>>
  31590. +{
  31591. + typedef xcb_cursor_t type;
  31592. +};
  31593. +
  31594. +} // namespace generic
  31595. +
  31596. +} // namespace xpp
  31597. +
  31598. +#endif // XPP_CURSOR_HPP
  31599. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/drawable.hpp polybar-3.2.1/lib/xpp/include/xpp/drawable.hpp
  31600. --- polybar-3.2.1.orig/lib/xpp/include/xpp/drawable.hpp 1970-01-01 02:00:00.000000000 +0200
  31601. +++ polybar-3.2.1/lib/xpp/include/xpp/drawable.hpp 2017-08-30 16:02:01.000000000 +0300
  31602. @@ -0,0 +1,35 @@
  31603. +#ifndef XPP_DRAWABLE_HPP
  31604. +#define XPP_DRAWABLE_HPP
  31605. +
  31606. +#include "proto/x.hpp"
  31607. +#include "generic/resource.hpp"
  31608. +
  31609. +namespace xpp {
  31610. +
  31611. +template<typename Connection, template<typename, typename> class ... Interfaces>
  31612. +class drawable
  31613. + : public xpp::generic::resource<Connection, xcb_drawable_t,
  31614. + xpp::x::drawable, Interfaces ...>
  31615. +{
  31616. + protected:
  31617. + using base = xpp::generic::resource<Connection, xcb_drawable_t,
  31618. + xpp::x::drawable, Interfaces ...>;
  31619. +
  31620. + public:
  31621. + using base::base;
  31622. + using base::operator=;
  31623. +};
  31624. +
  31625. +namespace generic {
  31626. +
  31627. +template<typename Connection, template<typename, typename> class ... Interfaces>
  31628. +struct traits<xpp::drawable<Connection, Interfaces ...>>
  31629. +{
  31630. + typedef xcb_drawable_t type;
  31631. +};
  31632. +
  31633. +} // namespace generic
  31634. +
  31635. +} // namespace xpp
  31636. +
  31637. +#endif // XPP_DRAWABLE_HPP
  31638. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/event.hpp polybar-3.2.1/lib/xpp/include/xpp/event.hpp
  31639. --- polybar-3.2.1.orig/lib/xpp/include/xpp/event.hpp 1970-01-01 02:00:00.000000000 +0200
  31640. +++ polybar-3.2.1/lib/xpp/include/xpp/event.hpp 2017-08-30 16:02:01.000000000 +0300
  31641. @@ -0,0 +1,210 @@
  31642. +#ifndef XPP_EVENT_HPP
  31643. +#define XPP_EVENT_HPP
  31644. +
  31645. +#include <climits>
  31646. +#include <map>
  31647. +#include <vector>
  31648. +#include <unordered_map>
  31649. +
  31650. +#include "proto/x.hpp"
  31651. +
  31652. +#define MAX_PRIORITY UINT32_MAX
  31653. +
  31654. +namespace xpp {
  31655. +
  31656. +namespace event {
  31657. +
  31658. +namespace detail {
  31659. +
  31660. +class dispatcher {
  31661. + public:
  31662. + virtual ~dispatcher(void) {}
  31663. + template<typename Event> void dispatch(const Event & e);
  31664. +}; // class dispatcher
  31665. +
  31666. +template<typename Event>
  31667. +class sink : virtual public dispatcher
  31668. +{
  31669. + public:
  31670. + virtual ~sink(void) {}
  31671. + virtual void handle(const Event &) = 0;
  31672. +};
  31673. +
  31674. +} // namespace detail
  31675. +
  31676. +template<typename Event, typename ... Events>
  31677. +class sink
  31678. + : public detail::sink<Event>
  31679. + , public detail::sink<Events> ...
  31680. +{};
  31681. +
  31682. +template<typename Connection, typename ... Extensions>
  31683. +class registry
  31684. + : public xpp::x::event::dispatcher<Connection>
  31685. + , public Extensions::template event_dispatcher<Connection> ...
  31686. +{
  31687. + public:
  31688. + typedef unsigned int priority;
  31689. +
  31690. + template<typename C>
  31691. + explicit
  31692. + registry(C && c)
  31693. + : xpp::x::event::dispatcher<Connection>(std::forward<C>(c))
  31694. + , Extensions::template event_dispatcher<Connection>(
  31695. + std::forward<C>(c), c.template extension<Extensions>()) ...
  31696. + , m_c(std::forward<C>(c))
  31697. + {}
  31698. +
  31699. + bool
  31700. + dispatch(const std::shared_ptr<xcb_generic_event_t> & event) const
  31701. + {
  31702. + return dispatch<xpp::x::extension, Extensions ...>(event);
  31703. + }
  31704. +
  31705. + template<typename Event, typename ... Rest>
  31706. + void
  31707. + attach(priority p, sink<Event, Rest ...> * s)
  31708. + {
  31709. + attach<sink<Event, Rest ...>, Event, Rest ...>(p, s);
  31710. + }
  31711. +
  31712. + template<typename Event, typename ... Rest>
  31713. + void
  31714. + detach(priority p, sink<Event, Rest ...> * s)
  31715. + {
  31716. + detach<sink<Event, Rest ...>, Event, Rest ...>(p, s);
  31717. + }
  31718. +
  31719. + private:
  31720. + typedef std::multimap<priority, detail::dispatcher *> priority_map;
  31721. +
  31722. + Connection m_c;
  31723. + std::unordered_map<uint8_t, priority_map> m_dispatchers;
  31724. +
  31725. + template<typename Event>
  31726. + uint8_t opcode(const xpp::x::extension &) const
  31727. + {
  31728. + return Event::opcode();
  31729. + }
  31730. +
  31731. + template<typename Event, typename Extension>
  31732. + uint8_t opcode(const Extension & extension) const
  31733. + {
  31734. + return Event::opcode(extension);
  31735. + }
  31736. +
  31737. + template<typename Event>
  31738. + uint8_t opcode(void) const
  31739. + {
  31740. + return opcode<Event>(m_c.template extension<typename Event::extension>());
  31741. + }
  31742. +
  31743. + template<typename Event>
  31744. + void
  31745. + handle(const Event & event) const
  31746. + {
  31747. + try {
  31748. + for (auto & item : m_dispatchers.at(opcode<Event>())) {
  31749. + item.second->dispatch(event);
  31750. + }
  31751. + } catch (...) {}
  31752. + }
  31753. +
  31754. + struct handler {
  31755. + handler(const registry<Connection, Extensions ...> & registry)
  31756. + : m_registry(registry)
  31757. + {}
  31758. +
  31759. + const registry<Connection, Extensions ...> & m_registry;
  31760. +
  31761. + template<typename Event>
  31762. + void
  31763. + operator()(const Event & event) const
  31764. + {
  31765. + m_registry.handle(event);
  31766. + }
  31767. + };
  31768. +
  31769. + template<typename Extension>
  31770. + bool
  31771. + dispatch(const std::shared_ptr<xcb_generic_event_t> & event) const
  31772. + {
  31773. + typedef const typename Extension::template event_dispatcher<Connection> & dispatcher;
  31774. + return static_cast<dispatcher>(*this)(handler(*this), event);
  31775. + }
  31776. +
  31777. + template<typename Extension, typename Next, typename ... Rest>
  31778. + bool
  31779. + dispatch(const std::shared_ptr<xcb_generic_event_t> & event) const
  31780. + {
  31781. + dispatch<Extension>(event);
  31782. + return dispatch<Next, Rest ...>(event);
  31783. + }
  31784. +
  31785. + template<typename Sink, typename Event>
  31786. + void
  31787. + attach(priority p, Sink * s)
  31788. + {
  31789. + attach(p, s, opcode<Event>());
  31790. + }
  31791. +
  31792. + template<typename Sink, typename Event, typename Next, typename ... Rest>
  31793. + void
  31794. + attach(priority p, Sink * s)
  31795. + {
  31796. + attach(p, s, opcode<Event>());
  31797. + attach<Sink, Next, Rest ...>(p, s);
  31798. + }
  31799. +
  31800. + void attach(priority p, detail::dispatcher * d, uint8_t opcode)
  31801. + {
  31802. + m_dispatchers[opcode].emplace(p, d);
  31803. + }
  31804. +
  31805. + template<typename Sink, typename Event>
  31806. + void
  31807. + detach(priority p, Sink * s)
  31808. + {
  31809. + detach(p, s, opcode<Event>());
  31810. + }
  31811. +
  31812. + template<typename Sink, typename Event, typename Next, typename ... Rest>
  31813. + void
  31814. + detach(priority p, Sink * s)
  31815. + {
  31816. + detach(p, s, opcode<Event>());
  31817. + detach<Sink, Next, Rest ...>(p, s);
  31818. + }
  31819. +
  31820. + void
  31821. + detach(priority p, detail::dispatcher * d, uint8_t opcode)
  31822. + {
  31823. + try {
  31824. + auto & prio_map = m_dispatchers.at(opcode);
  31825. + const auto & prio_sink_pair = prio_map.equal_range(p);
  31826. + for (auto it = prio_sink_pair.first; it != prio_sink_pair.second; ) {
  31827. + if (d == it->second) {
  31828. + it = prio_map.erase(it);
  31829. + } else {
  31830. + ++it;
  31831. + }
  31832. + }
  31833. + } catch (...) {}
  31834. + }
  31835. +
  31836. +}; // xpp::event::source
  31837. +
  31838. +} // namespace event
  31839. +
  31840. +} // namespace xpp
  31841. +
  31842. +template<typename Event>
  31843. +void xpp::event::detail::dispatcher::dispatch(const Event & e)
  31844. +{
  31845. + auto event_sink = dynamic_cast<xpp::event::detail::sink<Event> *>(this);
  31846. + if (event_sink != nullptr) {
  31847. + event_sink->handle(e);
  31848. + }
  31849. +}
  31850. +
  31851. +#endif // XPP_EVENT_HPP
  31852. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/flags.makefile polybar-3.2.1/lib/xpp/include/xpp/flags.makefile
  31853. --- polybar-3.2.1.orig/lib/xpp/include/xpp/flags.makefile 1970-01-01 02:00:00.000000000 +0200
  31854. +++ polybar-3.2.1/lib/xpp/include/xpp/flags.makefile 2017-08-30 16:02:01.000000000 +0300
  31855. @@ -0,0 +1,40 @@
  31856. +LIBS=x11 \
  31857. + xcb \
  31858. + xcb-icccm \
  31859. + xcb-sync \
  31860. + xcb-xf86dri \
  31861. + xcb-xprint \
  31862. + xcb-xinput \
  31863. + xcb-shape \
  31864. + xcb-shm \
  31865. + xcb-render \
  31866. + xcb-proto \
  31867. + xcb-event \
  31868. + xcb-xfixes \
  31869. + xcb-xkb \
  31870. + xcb-dri3 \
  31871. + xcb-ewmh \
  31872. + xcb-util \
  31873. + xcb-renderutil \
  31874. + xcb-xtest \
  31875. + xcb-xevie \
  31876. + xcb-keysyms \
  31877. + xcb-image \
  31878. + xcb-composite \
  31879. + xcb-randr \
  31880. + xcb-present \
  31881. + xcb-xv \
  31882. + xcb-aux \
  31883. + xcb-record \
  31884. + xcb-dpms \
  31885. + xcb-glx \
  31886. + xcb-atom \
  31887. + xcb-damage \
  31888. + xcb-screensaver \
  31889. + xcb-xvmc \
  31890. + xcb-res \
  31891. + xcb-xinerama \
  31892. + xcb-dri2
  31893. +
  31894. +CXXFLAGS=-std=c++11 -Wall -O0 $(shell pkg-config --cflags ${LIBS})
  31895. +LDFLAGS=$(shell pkg-config --libs ${LIBS})
  31896. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/fontable.hpp polybar-3.2.1/lib/xpp/include/xpp/fontable.hpp
  31897. --- polybar-3.2.1.orig/lib/xpp/include/xpp/fontable.hpp 1970-01-01 02:00:00.000000000 +0200
  31898. +++ polybar-3.2.1/lib/xpp/include/xpp/fontable.hpp 2017-08-30 16:02:01.000000000 +0300
  31899. @@ -0,0 +1,35 @@
  31900. +#ifndef XPP_FONTABLE_HPP
  31901. +#define XPP_FONTABLE_HPP
  31902. +
  31903. +#include "proto/x.hpp"
  31904. +#include "generic/resource.hpp"
  31905. +
  31906. +namespace xpp {
  31907. +
  31908. +template<typename Connection, template<typename, typename> class ... Interfaces>
  31909. +class fontable
  31910. + : public xpp::generic::resource<Connection, xcb_fontable_t,
  31911. + xpp::x::fontable, Interfaces ...>
  31912. +{
  31913. + protected:
  31914. + using base = xpp::generic::resource<Connection, xcb_fontable_t,
  31915. + xpp::x::fontable, Interfaces ...>;
  31916. +
  31917. + public:
  31918. + using base::base;
  31919. + using base::operator=;
  31920. +};
  31921. +
  31922. +namespace generic {
  31923. +
  31924. +template<typename Connection, template<typename, typename> class ... Interfaces>
  31925. +struct traits<xpp::fontable<Connection, Interfaces ...>>
  31926. +{
  31927. + typedef xcb_fontable_t type;
  31928. +};
  31929. +
  31930. +} // namespace generic
  31931. +
  31932. +} // namespace xpp
  31933. +
  31934. +#endif // XPP_FONTABLE_HPP
  31935. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/font.hpp polybar-3.2.1/lib/xpp/include/xpp/font.hpp
  31936. --- polybar-3.2.1.orig/lib/xpp/include/xpp/font.hpp 1970-01-01 02:00:00.000000000 +0200
  31937. +++ polybar-3.2.1/lib/xpp/include/xpp/font.hpp 2017-08-30 16:02:01.000000000 +0300
  31938. @@ -0,0 +1,74 @@
  31939. +#ifndef XPP_FONT_HPP
  31940. +#define XPP_FONT_HPP
  31941. +
  31942. +#include "proto/x.hpp"
  31943. +#include "generic/resource.hpp"
  31944. +
  31945. +namespace xpp {
  31946. +
  31947. +template<typename Connection, template<typename, typename> class ... Interfaces>
  31948. +class font
  31949. + : public xpp::generic::resource<Connection, xcb_font_t,
  31950. + xpp::x::font, Interfaces ...>
  31951. +{
  31952. + protected:
  31953. + using base = xpp::generic::resource<Connection, xcb_font_t,
  31954. + xpp::x::font, Interfaces ...>;
  31955. +
  31956. + template<typename C, typename Create, typename Destroy>
  31957. + font(C && c, Create && create, Destroy && destroy)
  31958. + : base(base::make(std::forward<C>(c),
  31959. + std::forward<Create>(create),
  31960. + std::forward<Destroy>(destroy)))
  31961. + {}
  31962. +
  31963. + public:
  31964. + using base::base;
  31965. + using base::operator=;
  31966. +
  31967. + template<typename C>
  31968. + static
  31969. + font<Connection, Interfaces ...>
  31970. + open(C && c, const std::string & name) noexcept
  31971. + {
  31972. + return font(std::forward<C>(c),
  31973. + [&](const Connection & c, const xcb_font_t & font)
  31974. + {
  31975. + xpp::x::open_font(c, font, name);
  31976. + },
  31977. + [&](const Connection & c, const xcb_font_t & font)
  31978. + {
  31979. + xpp::x::close_font(c, font);
  31980. + });
  31981. + }
  31982. +
  31983. + template<typename C>
  31984. + static
  31985. + font<Connection, Interfaces ...>
  31986. + open_checked(C && c, const std::string & name)
  31987. + {
  31988. + return font(std::forward<C>(c),
  31989. + [&](const Connection & c, const xcb_font_t & font)
  31990. + {
  31991. + xpp::x::open_font_checked(c, font, name);
  31992. + },
  31993. + [&](const Connection & c, const xcb_font_t & font)
  31994. + {
  31995. + xpp::x::close_font_checked(c, font);
  31996. + });
  31997. + }
  31998. +};
  31999. +
  32000. +namespace generic {
  32001. +
  32002. +template<typename Connection, template<typename, typename> class ... Interfaces>
  32003. +struct traits<xpp::font<Connection, Interfaces ...>>
  32004. +{
  32005. + typedef xcb_font_t type;
  32006. +};
  32007. +
  32008. +} // namespace generic
  32009. +
  32010. +} // namespace xpp
  32011. +
  32012. +#endif // XPP_FONT_HPP
  32013. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/gcontext.hpp polybar-3.2.1/lib/xpp/include/xpp/gcontext.hpp
  32014. --- polybar-3.2.1.orig/lib/xpp/include/xpp/gcontext.hpp 1970-01-01 02:00:00.000000000 +0200
  32015. +++ polybar-3.2.1/lib/xpp/include/xpp/gcontext.hpp 2017-08-30 16:02:01.000000000 +0300
  32016. @@ -0,0 +1,114 @@
  32017. +#ifndef XPP_GCONTEXT_HPP
  32018. +#define XPP_GCONTEXT_HPP
  32019. +
  32020. +#include "proto/x.hpp"
  32021. +#include "generic/resource.hpp"
  32022. +
  32023. +namespace xpp {
  32024. +
  32025. +template<typename Connection, template<typename, typename> class ... Interfaces>
  32026. +class gcontext
  32027. + : public xpp::generic::resource<Connection, xcb_gcontext_t,
  32028. + xpp::x::gcontext, Interfaces ...>
  32029. +{
  32030. + protected:
  32031. + using base = xpp::generic::resource<Connection, xcb_gcontext_t,
  32032. + xpp::x::gcontext, Interfaces ...>;
  32033. +
  32034. + template<typename C, typename Create, typename Destroy>
  32035. + gcontext(C && c, Create && create, Destroy && destroy)
  32036. + : base(base::make(std::forward<C>(c),
  32037. + std::forward<Create>(create),
  32038. + std::forward<Destroy>(destroy)))
  32039. + {}
  32040. +
  32041. + public:
  32042. + using base::base;
  32043. + using base::operator=;
  32044. +
  32045. + template<typename C>
  32046. + static
  32047. + gcontext<Connection, Interfaces ...>
  32048. + create(C && c, xcb_drawable_t drawable,
  32049. + uint32_t value_mask, const uint32_t * value_list)
  32050. + {
  32051. + return gcontext(
  32052. + std::forward<C>(c),
  32053. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32054. + {
  32055. + xpp::x::create_gc(c, gcontext, drawable, value_mask, value_list);
  32056. + },
  32057. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32058. + {
  32059. + xpp::x::free_gc(c, gcontext);
  32060. + });
  32061. + }
  32062. +
  32063. + template<typename C>
  32064. + static
  32065. + gcontext<Connection, Interfaces ...>
  32066. + create_checked(C && c, xcb_drawable_t drawable,
  32067. + uint32_t value_mask, const uint32_t * value_list)
  32068. + {
  32069. + return gcontext(
  32070. + std::forward<C>(c),
  32071. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32072. + {
  32073. + xpp::x::create_gc_checked(c, gcontext, drawable,
  32074. + value_mask, value_list);
  32075. + },
  32076. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32077. + {
  32078. + xpp::x::free_gc_checked(c, gcontext);
  32079. + });
  32080. + }
  32081. +
  32082. + template<typename C>
  32083. + static
  32084. + gcontext<Connection, Interfaces ...>
  32085. + copy(C && c, xcb_gcontext_t src_gc, uint32_t value_mask)
  32086. + {
  32087. + return gcontext(
  32088. + std::forward<C>(c),
  32089. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32090. + {
  32091. + xpp::x::copy_gc(c, src_gc, gcontext, value_mask);
  32092. + },
  32093. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32094. + {
  32095. + xpp::x::free_gc(c, gcontext);
  32096. + });
  32097. + }
  32098. +
  32099. +
  32100. + template<typename C>
  32101. + static
  32102. + gcontext<Connection, Interfaces ...>
  32103. + copy_checked(C && c, xcb_gcontext_t src_gc, uint32_t value_mask)
  32104. + {
  32105. + return gcontext(
  32106. + std::forward<C>(c),
  32107. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32108. + {
  32109. + xpp::x::copy_gc_checked(c, src_gc, gcontext, value_mask);
  32110. + },
  32111. + [&](const Connection & c, const xcb_gcontext_t & gcontext)
  32112. + {
  32113. + xpp::x::free_gc_checked(c, gcontext);
  32114. + });
  32115. + }
  32116. +};
  32117. +
  32118. +namespace generic {
  32119. +
  32120. +template<typename Connection, template<typename, typename> class ... Interfaces>
  32121. +struct traits<xpp::gcontext<Connection, Interfaces ...>>
  32122. +{
  32123. + typedef xcb_gcontext_t type;
  32124. +};
  32125. +
  32126. +} // namespace generic
  32127. +
  32128. +} // namespace xpp
  32129. +
  32130. +#endif // XPP_GCONTEXT_HPP
  32131. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/error.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/error.hpp
  32132. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/error.hpp 1970-01-01 02:00:00.000000000 +0200
  32133. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/error.hpp 2017-08-30 16:02:01.000000000 +0300
  32134. @@ -0,0 +1,96 @@
  32135. +#ifndef XPP_GENERIC_ERROR_HPP
  32136. +#define XPP_GENERIC_ERROR_HPP
  32137. +
  32138. +#include <iostream> // shared_ptr
  32139. +#include <memory> // shared_ptr
  32140. +#include <xcb/xcb.h> // xcb_generic_error_t
  32141. +
  32142. +namespace xpp { namespace generic {
  32143. +
  32144. +class error_dispatcher {
  32145. + public:
  32146. + virtual
  32147. + void operator()(const std::shared_ptr<xcb_generic_error_t> &) const = 0;
  32148. +};
  32149. +
  32150. +namespace detail {
  32151. +
  32152. +template<typename Object>
  32153. +void
  32154. +dispatch(const Object & object,
  32155. + const std::shared_ptr<xcb_generic_error_t> & error,
  32156. + std::true_type)
  32157. +{
  32158. + static_cast<const xpp::generic::error_dispatcher &>(object)(error);
  32159. +}
  32160. +
  32161. +template<typename Object>
  32162. +void
  32163. +dispatch(const Object &,
  32164. + const std::shared_ptr<xcb_generic_error_t> & error,
  32165. + std::false_type)
  32166. +{
  32167. + throw error;
  32168. +}
  32169. +
  32170. +} // namespace detail
  32171. +
  32172. +template<typename Object>
  32173. +void
  32174. +dispatch(const Object & object,
  32175. + const std::shared_ptr<xcb_generic_error_t> & error)
  32176. +{
  32177. + detail::dispatch(object,
  32178. + error,
  32179. + std::is_base_of<xpp::generic::error_dispatcher, Object>());
  32180. +}
  32181. +
  32182. +template<typename Derived, typename Error>
  32183. +class error
  32184. + : public std::runtime_error
  32185. +{
  32186. + public:
  32187. + error(const std::shared_ptr<xcb_generic_error_t> & error)
  32188. + : runtime_error(get_error_description(error.get()))
  32189. + , m_error(error)
  32190. + {}
  32191. +
  32192. + virtual
  32193. + ~error(void)
  32194. + {}
  32195. +
  32196. + virtual
  32197. + operator const Error &(void) const
  32198. + {
  32199. + return reinterpret_cast<const Error &>(*m_error);
  32200. + }
  32201. +
  32202. + virtual
  32203. + const Error &
  32204. + operator*(void) const
  32205. + {
  32206. + return reinterpret_cast<const Error &>(*m_error);
  32207. + }
  32208. +
  32209. + virtual
  32210. + Error *
  32211. + operator->(void) const
  32212. + {
  32213. + return reinterpret_cast<Error * const>(m_error.get());
  32214. + }
  32215. +
  32216. + protected:
  32217. + virtual
  32218. + std::string
  32219. + get_error_description(xcb_generic_error_t * error) const
  32220. + {
  32221. + return std::string(Derived::description())
  32222. + + " (" + std::to_string(error->error_code) + ")";
  32223. + }
  32224. +
  32225. + std::shared_ptr<xcb_generic_error_t> m_error;
  32226. +}; // class error
  32227. +
  32228. +} } // xpp::generic
  32229. +
  32230. +#endif // XPP_GENERIC_ERROR_HPP
  32231. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/event.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/event.hpp
  32232. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/event.hpp 1970-01-01 02:00:00.000000000 +0200
  32233. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/event.hpp 2017-08-30 16:02:01.000000000 +0300
  32234. @@ -0,0 +1,45 @@
  32235. +#ifndef XPP_GENERIC_EVENT_HPP
  32236. +#define XPP_GENERIC_EVENT_HPP
  32237. +
  32238. +#include <memory> // shared_ptr
  32239. +#include <xcb/xcb.h> // xcb_generic_event_t
  32240. +
  32241. +namespace xpp { namespace generic {
  32242. +
  32243. +template<typename Event>
  32244. +class event {
  32245. + public:
  32246. + event(const std::shared_ptr<xcb_generic_event_t> & event)
  32247. + : m_event(event)
  32248. + {}
  32249. +
  32250. + virtual
  32251. + ~event(void) {}
  32252. +
  32253. + virtual
  32254. + operator const Event &(void) const
  32255. + {
  32256. + return reinterpret_cast<const Event &>(*m_event);
  32257. + }
  32258. +
  32259. + virtual
  32260. + const Event &
  32261. + operator*(void) const
  32262. + {
  32263. + return reinterpret_cast<const Event &>(*m_event);
  32264. + }
  32265. +
  32266. + virtual
  32267. + Event *
  32268. + operator->(void) const
  32269. + {
  32270. + return reinterpret_cast<Event * const>(m_event.get());
  32271. + }
  32272. +
  32273. + protected:
  32274. + std::shared_ptr<xcb_generic_event_t> m_event;
  32275. +}; // class event
  32276. +
  32277. +} } // namespace xpp::generic
  32278. +
  32279. +#endif // XPP_GENERIC_EVENT_HPP
  32280. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/extension.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/extension.hpp
  32281. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/extension.hpp 1970-01-01 02:00:00.000000000 +0200
  32282. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/extension.hpp 2017-08-30 16:02:01.000000000 +0300
  32283. @@ -0,0 +1,59 @@
  32284. +#ifndef XPP_GENERIC_EXTENSION_HPP
  32285. +#define XPP_GENERIC_EXTENSION_HPP
  32286. +
  32287. +// #include <iostream>
  32288. +#include <xcb/xcb.h>
  32289. +
  32290. +namespace xpp { namespace generic {
  32291. +
  32292. +template<typename Derived, xcb_extension_t * Id>
  32293. +class extension
  32294. +{
  32295. + public:
  32296. + extension(xcb_connection_t * const c)
  32297. + : m_c(c)
  32298. + {
  32299. + prefetch();
  32300. + }
  32301. +
  32302. + const xcb_query_extension_reply_t &
  32303. + operator*(void) const
  32304. + {
  32305. + return *m_extension;
  32306. + }
  32307. +
  32308. + const xcb_query_extension_reply_t *
  32309. + operator->(void) const
  32310. + {
  32311. + return m_extension;
  32312. + }
  32313. +
  32314. + operator const xcb_query_extension_reply_t *(void) const
  32315. + {
  32316. + return m_extension;
  32317. + }
  32318. +
  32319. + Derived &
  32320. + get(void)
  32321. + {
  32322. + m_extension = xcb_get_extension_data(m_c, Id);
  32323. + return static_cast<Derived &>(*this);
  32324. + }
  32325. +
  32326. + Derived &
  32327. + prefetch(void)
  32328. + {
  32329. + xcb_prefetch_extension_data(m_c, Id);
  32330. + return static_cast<Derived &>(*this);
  32331. + }
  32332. +
  32333. + private:
  32334. + xcb_connection_t * m_c = nullptr;
  32335. + // The result must not be freed.
  32336. + // This storage is managed by the cache itself.
  32337. + const xcb_query_extension_reply_t * m_extension = nullptr;
  32338. +}; // class extension
  32339. +
  32340. +} } // namespace xpp::generic
  32341. +
  32342. +#endif // XPP_GENERIC_EXTENSION_HPP
  32343. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/factory.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/factory.hpp
  32344. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/factory.hpp 1970-01-01 02:00:00.000000000 +0200
  32345. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/factory.hpp 2017-08-30 16:02:01.000000000 +0300
  32346. @@ -0,0 +1,92 @@
  32347. +#ifndef XPP_GENERIC_FACTORY_HPP
  32348. +#define XPP_GENERIC_FACTORY_HPP
  32349. +
  32350. +#include <utility> // std::forward
  32351. +
  32352. +namespace xpp { namespace generic {
  32353. +
  32354. +namespace factory {
  32355. +
  32356. +template<typename ReturnType>
  32357. +class make_object
  32358. +{
  32359. + public:
  32360. + template<typename Connection, typename ... Parameter>
  32361. + ReturnType
  32362. + operator()(Connection &&, Parameter && ... parameter) const
  32363. + {
  32364. + return ReturnType { std::forward<Parameter>(parameter) ... };
  32365. + }
  32366. +};
  32367. +
  32368. +template<typename ReturnType>
  32369. +class make_object_with_member
  32370. +{
  32371. + public:
  32372. + template<typename Member, typename Connection, typename ... Parameter>
  32373. + ReturnType
  32374. + operator()(Connection && c, Member && member, Parameter && ... parameter) const
  32375. + {
  32376. + return ReturnType { std::forward<Member>(member)
  32377. + , std::forward<Connection>(c)
  32378. + , std::forward<Parameter>(parameter) ...
  32379. + };
  32380. + }
  32381. +};
  32382. +
  32383. +template<typename ReturnType>
  32384. +class make_object_with_connection
  32385. +{
  32386. + public:
  32387. + template<typename Connection, typename ... Parameter>
  32388. + ReturnType
  32389. + operator()(Connection && c, Parameter && ... parameter) const
  32390. + {
  32391. + return ReturnType { std::forward<Connection>(c)
  32392. + , std::forward<Parameter>(parameter) ...
  32393. + };
  32394. + }
  32395. +};
  32396. +
  32397. +template<typename ReturnType>
  32398. +class make_fundamental {
  32399. + public:
  32400. + template<typename Connection, typename Member, typename ... Parameter>
  32401. + ReturnType
  32402. + operator()(Connection &&, Member && member) const
  32403. + {
  32404. + return std::forward<Member>(member);
  32405. + }
  32406. +};
  32407. +
  32408. +template<typename Connection,
  32409. + typename MemberType,
  32410. + typename ReturnType,
  32411. + typename ... Parameter>
  32412. +class make
  32413. + : public std::conditional<
  32414. + std::is_constructible<ReturnType, MemberType>::value,
  32415. + make_fundamental<ReturnType>,
  32416. + typename std::conditional<
  32417. + std::is_constructible<ReturnType,
  32418. + MemberType,
  32419. + Connection,
  32420. + Parameter ...>::value,
  32421. + make_object_with_member<ReturnType>,
  32422. + typename std::conditional<
  32423. + std::is_constructible<ReturnType,
  32424. + Connection,
  32425. + MemberType,
  32426. + Parameter ...>::value,
  32427. + make_object_with_connection<ReturnType>,
  32428. + make_object<ReturnType>
  32429. + >::type
  32430. + >::type
  32431. + >::type
  32432. +{};
  32433. +
  32434. +} // namespace factory
  32435. +
  32436. +} } // xpp::generic
  32437. +
  32438. +#endif // XPP_GENERIC_FACTORY_HPP
  32439. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/input_iterator_adapter.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/input_iterator_adapter.hpp
  32440. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/input_iterator_adapter.hpp 1970-01-01 02:00:00.000000000 +0200
  32441. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/input_iterator_adapter.hpp 2017-08-30 16:02:01.000000000 +0300
  32442. @@ -0,0 +1,163 @@
  32443. +#ifndef XPP_GENERIC_INPUT_ITERATOR_ADAPTER_HPP
  32444. +#define XPP_GENERIC_INPUT_ITERATOR_ADAPTER_HPP
  32445. +
  32446. +#include <utility>
  32447. +#include <iterator>
  32448. +#include <type_traits>
  32449. +
  32450. +#define GENERATE_HAS_MEMBER(member) \
  32451. + \
  32452. +template<typename T, bool B> \
  32453. +class HasMember_##member { \
  32454. + private: \
  32455. + using Yes = char[2]; \
  32456. + using No = char[1]; \
  32457. + \
  32458. + struct Fallback { int member; }; \
  32459. + struct Derived : T, Fallback {}; \
  32460. + \
  32461. + template<typename U> \
  32462. + static No& test(decltype(U::member)*); \
  32463. + template<typename U> \
  32464. + static Yes& test(U*); \
  32465. + \
  32466. + public: \
  32467. + static constexpr bool RESULT = sizeof(test<Derived>(nullptr)) == sizeof(Yes); \
  32468. +}; \
  32469. + \
  32470. +template<typename T> \
  32471. +class HasMember_##member<T, false> { \
  32472. + public: \
  32473. + static constexpr bool RESULT = false; \
  32474. +}; \
  32475. + \
  32476. +template<typename T> \
  32477. +struct has_member_##member \
  32478. + : public std::integral_constant< \
  32479. + bool, \
  32480. + HasMember_##member<T, std::is_class<T>::value>::RESULT \
  32481. + > \
  32482. +{};
  32483. +
  32484. +GENERATE_HAS_MEMBER(first)
  32485. +GENERATE_HAS_MEMBER(second)
  32486. +
  32487. +// namespace iterator {
  32488. +
  32489. +template<typename Iterator>
  32490. +struct value_iterator_base {
  32491. + value_iterator_base(const Iterator & iterator)
  32492. + : m_iterator(iterator)
  32493. + {}
  32494. +
  32495. + bool
  32496. + operator==(const value_iterator_base & other)
  32497. + {
  32498. + return m_iterator == other.m_iterator;
  32499. + }
  32500. +
  32501. + bool
  32502. + operator!=(const value_iterator_base & other)
  32503. + {
  32504. + return m_iterator != other.m_iterator;
  32505. + }
  32506. +
  32507. + void
  32508. + operator++(void)
  32509. + {
  32510. + ++m_iterator;
  32511. + }
  32512. +
  32513. + template<typename Key, typename Value>
  32514. + const Value &
  32515. + get_value(const std::pair<Key, Value> & pair)
  32516. + {
  32517. + return pair.second;
  32518. + }
  32519. +
  32520. + template<typename Value>
  32521. + const Value &
  32522. + get_value(const Value & v)
  32523. + {
  32524. + return v;
  32525. + }
  32526. +
  32527. + Iterator m_iterator;
  32528. +};
  32529. +
  32530. +template<typename Iterator>
  32531. +struct value_iterator_pair
  32532. + : public value_iterator_base<Iterator>
  32533. + , public std::iterator<typename std::input_iterator_tag,
  32534. + // value_type
  32535. + typename Iterator::value_type::second_type,
  32536. + typename std::iterator_traits<Iterator>::difference_type,
  32537. + // pointer
  32538. + typename Iterator::value_type::second_type *,
  32539. + // reference
  32540. + const typename Iterator::value_type::second_type &>
  32541. +{
  32542. + typedef value_iterator_base<Iterator> base;
  32543. + using base::base;
  32544. +
  32545. + const typename Iterator::value_type::second_type &
  32546. + operator*(void)
  32547. + {
  32548. + return base::get_value(*base::m_iterator);
  32549. + }
  32550. +};
  32551. +
  32552. +template<typename Iterator>
  32553. +struct value_iterator_integral
  32554. + : public value_iterator_base<Iterator>
  32555. + , public std::iterator<typename std::input_iterator_tag,
  32556. + typename std::iterator_traits<Iterator>::value_type,
  32557. + typename std::iterator_traits<Iterator>::difference_type,
  32558. + typename std::iterator_traits<Iterator>::pointer,
  32559. + typename std::iterator_traits<Iterator>::reference>
  32560. +{
  32561. + typedef value_iterator_base<Iterator> base;
  32562. + using base::base;
  32563. +
  32564. + const typename Iterator::value_type &
  32565. + operator*(void)
  32566. + {
  32567. + return base::get_value(*base::m_iterator);
  32568. + }
  32569. +};
  32570. +
  32571. +template<typename Iterator>
  32572. +struct value_iterator
  32573. + : public std::conditional<
  32574. + has_member_first<typename Iterator::value_type>::value
  32575. + && has_member_second<typename Iterator::value_type>::value,
  32576. + value_iterator_pair<Iterator>,
  32577. + value_iterator_integral<Iterator>
  32578. + >::type
  32579. +{
  32580. + typedef typename std::conditional<
  32581. + has_member_first<typename Iterator::value_type>::value
  32582. + && has_member_second<typename Iterator::value_type>::value,
  32583. + value_iterator_pair<Iterator>,
  32584. + value_iterator_integral<Iterator>
  32585. + >::type base;
  32586. + using base::base;
  32587. +};
  32588. +
  32589. +template<typename T, bool B = true>
  32590. +struct value_type {
  32591. + typedef typename std::conditional<
  32592. + has_member_second<typename T::value_type>::value,
  32593. + typename T::value_type::second_type,
  32594. + typename T::value_type>::type
  32595. + type;
  32596. +};
  32597. +
  32598. +template<typename T>
  32599. +struct value_type<T, false> {
  32600. + typedef typename std::remove_const<
  32601. + typename std::remove_pointer<T>::type
  32602. + >::type type;
  32603. +};
  32604. +
  32605. +#endif // XPP_GENERIC_INPUT_ITERATOR_ADAPTER_HPP
  32606. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/iterator_traits.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/iterator_traits.hpp
  32607. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/iterator_traits.hpp 1970-01-01 02:00:00.000000000 +0200
  32608. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/iterator_traits.hpp 2017-08-30 16:02:01.000000000 +0300
  32609. @@ -0,0 +1,24 @@
  32610. +#ifndef XPP_GENERIC_ITERATOR_TRAITS_HPP
  32611. +#define XPP_GENERIC_ITERATOR_TRAITS_HPP
  32612. +
  32613. +namespace xpp {
  32614. +
  32615. +namespace generic {
  32616. +
  32617. +template<typename T>
  32618. +struct traits
  32619. +{
  32620. + typedef T type;
  32621. +};
  32622. +
  32623. +template<typename Object>
  32624. +struct conversion_type
  32625. +{
  32626. + using type = typename traits<Object>::type;
  32627. +};
  32628. +
  32629. +} // namespace generic
  32630. +
  32631. +}
  32632. +
  32633. +#endif // XPP_GENERIC_ITERATOR_TRAITS_HPP
  32634. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/reply_iterator.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/reply_iterator.hpp
  32635. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/reply_iterator.hpp 1970-01-01 02:00:00.000000000 +0200
  32636. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/reply_iterator.hpp 2017-08-30 16:02:01.000000000 +0300
  32637. @@ -0,0 +1,376 @@
  32638. +#ifndef XPP_GENERIC_REPLY_ITERATOR_HPP
  32639. +#define XPP_GENERIC_REPLY_ITERATOR_HPP
  32640. +
  32641. +#include <cstdlib> // size_t
  32642. +#include <memory>
  32643. +#include <stack>
  32644. +#include <xcb/xcb.h> // xcb_str_*
  32645. +#include "factory.hpp"
  32646. +#include "signature.hpp"
  32647. +#include "iterator_traits.hpp"
  32648. +
  32649. +#define NEXT_TEMPLATE \
  32650. + void (&Next)(XcbIterator *)
  32651. +
  32652. +#define NEXT_SIGNATURE \
  32653. + xpp::generic::signature<void (XcbIterator *), Next>
  32654. +
  32655. +#define SIZEOF_TEMPLATE \
  32656. + int (&SizeOf)(const void *)
  32657. +
  32658. +#define SIZEOF_SIGNATURE \
  32659. + xpp::generic::signature<int (const void *), SizeOf>
  32660. +
  32661. +#define GETITERATOR_TEMPLATE \
  32662. + XcbIterator (&GetIterator)(const Reply *)
  32663. +
  32664. +#define GETITERATOR_SIGNATURE \
  32665. + xpp::generic::signature<XcbIterator (const Reply *), GetIterator>
  32666. +
  32667. +#define ACCESSOR_TEMPLATE \
  32668. + Data * (&Accessor)(const Reply *)
  32669. +
  32670. +#define ACCESSOR_SIGNATURE \
  32671. + xpp::generic::signature<Data * (const Reply *), Accessor>
  32672. +
  32673. +#define LENGTH_TEMPLATE \
  32674. + int (&Length)(const Reply *)
  32675. +
  32676. +#define LENGTH_SIGNATURE \
  32677. + xpp::generic::signature<int (const Reply *), Length>
  32678. +
  32679. +namespace xpp {
  32680. +
  32681. +namespace generic {
  32682. +
  32683. +template<typename Data>
  32684. +class get
  32685. +{
  32686. + public:
  32687. + Data
  32688. + operator()(Data * const data)
  32689. + {
  32690. + return *data;
  32691. + }
  32692. +};
  32693. +
  32694. +template<>
  32695. +class get<xcb_str_t>
  32696. +{
  32697. + public:
  32698. + std::string
  32699. + operator()(xcb_str_t * const data)
  32700. + {
  32701. + return std::string(xcb_str_name(data),
  32702. + xcb_str_name_length(data));
  32703. + }
  32704. +};
  32705. +
  32706. +namespace detail
  32707. +{
  32708. +
  32709. +template<typename F>
  32710. +struct function_traits;
  32711. +
  32712. +template<typename Signature, Signature& S>
  32713. +struct function_traits<signature<Signature, S>> : function_traits<Signature> {};
  32714. +
  32715. +template<typename R, typename... Args>
  32716. +struct function_traits<R(*)(Args...)> : function_traits<R(Args...)> {};
  32717. +
  32718. +template<typename R, typename... Args>
  32719. +struct function_traits<R(Args...)>
  32720. +{
  32721. + using result_type = R;
  32722. + const static std::size_t arity = sizeof...(Args);
  32723. +
  32724. + template <std::size_t I>
  32725. + struct argument
  32726. + {
  32727. + static_assert(I < arity, "invalid argument index");
  32728. + using type = typename std::tuple_element<I, std::tuple<Args...>>::type;
  32729. + };
  32730. +};
  32731. +}
  32732. +
  32733. +// iterator for variable size data fields
  32734. +
  32735. +template<typename ... Types>
  32736. +class iterator;
  32737. +
  32738. +template<typename Connection,
  32739. + typename Object,
  32740. + typename NextTemplate,
  32741. + NextTemplate& Next,
  32742. + typename SizeOfTemplate,
  32743. + SizeOfTemplate& SizeOf,
  32744. + typename GetIteratorTemplate,
  32745. + GetIteratorTemplate& GetIterator>
  32746. +class iterator<Connection,
  32747. + Object,
  32748. + xpp::generic::signature<NextTemplate, Next>,
  32749. + xpp::generic::signature<SizeOfTemplate, SizeOf>,
  32750. + xpp::generic::signature<GetIteratorTemplate, GetIterator>>
  32751. + : public std::iterator<typename std::input_iterator_tag,
  32752. + Object,
  32753. + typename std::size_t,
  32754. + Object *,
  32755. + const Object &>
  32756. +{
  32757. + protected:
  32758. + using self = iterator<Connection,
  32759. + Object,
  32760. + xpp::generic::signature<NextTemplate, Next>,
  32761. + xpp::generic::signature<SizeOfTemplate, SizeOf>,
  32762. + xpp::generic::signature<GetIteratorTemplate, GetIterator>>;
  32763. +
  32764. + using get_iterator_traits = detail::function_traits<GetIteratorTemplate>;
  32765. + using const_reply_ptr = typename get_iterator_traits::template argument<0>::type;
  32766. + using Reply = typename std::remove_pointer<typename std::remove_const<const_reply_ptr>::type>::type;
  32767. + using XcbIterator = typename get_iterator_traits::result_type;
  32768. +
  32769. + Connection m_c;
  32770. + std::shared_ptr<Reply> m_reply;
  32771. + std::stack<std::size_t> m_lengths;
  32772. + XcbIterator m_iterator;
  32773. +
  32774. + public:
  32775. + iterator(void) {}
  32776. +
  32777. + template<typename C>
  32778. + iterator(C && c, const std::shared_ptr<Reply> & reply)
  32779. + : m_c(std::forward<C>(c))
  32780. + , m_reply(reply)
  32781. + , m_iterator(GetIterator(reply.get()))
  32782. + {}
  32783. +
  32784. + bool
  32785. + operator==(const iterator & other)
  32786. + {
  32787. + return m_iterator.rem == other.m_iterator.rem;
  32788. + }
  32789. +
  32790. + bool
  32791. + operator!=(const iterator & other)
  32792. + {
  32793. + return ! (*this == other);
  32794. + }
  32795. +
  32796. + auto
  32797. + operator*(void) -> decltype(get<Object>()(this->m_iterator.data))
  32798. + {
  32799. + return get<Object>()(m_iterator.data);
  32800. + }
  32801. +
  32802. + // prefix
  32803. + self &
  32804. + operator++(void)
  32805. + {
  32806. + m_lengths.push(SizeOf(m_iterator.data));
  32807. + Next(&m_iterator);
  32808. + return *this;
  32809. + }
  32810. +
  32811. + // postfix
  32812. + self
  32813. + operator++(int)
  32814. + {
  32815. + auto copy = *this;
  32816. + ++(*this);
  32817. + return copy;
  32818. + }
  32819. +
  32820. + // prefix
  32821. + self &
  32822. + operator--(void)
  32823. + {
  32824. + typedef typename std::remove_pointer<decltype(m_iterator.data)>::type data_t;
  32825. + if (m_lengths.empty()) {
  32826. + data_t * data = m_iterator.data;
  32827. + data_t * prev = data - m_lengths.top();
  32828. + m_lengths.pop();
  32829. + m_iterator.index = (char *)m_iterator.data - (char *)prev;
  32830. + m_iterator.data = prev;
  32831. + ++m_iterator.rem;
  32832. + }
  32833. + return *this;
  32834. + }
  32835. +
  32836. + // postfix
  32837. + self
  32838. + operator--(int)
  32839. + {
  32840. + auto copy = *this;
  32841. + --(*this);
  32842. + return copy;
  32843. + }
  32844. +
  32845. + template<typename C>
  32846. + static
  32847. + self
  32848. + begin(C && c, const std::shared_ptr<Reply> & reply)
  32849. + {
  32850. + return self { std::forward<C>(c), reply };
  32851. + }
  32852. +
  32853. + template<typename C>
  32854. + static
  32855. + self
  32856. + end(C && c, const std::shared_ptr<Reply> & reply)
  32857. + {
  32858. + auto it = self { std::forward<C>(c), reply };
  32859. + it.m_iterator.rem = 0;
  32860. + return it;
  32861. + }
  32862. +}; // class iterator
  32863. +
  32864. +// iterator for fixed size data fields
  32865. +
  32866. +template<typename Connection,
  32867. + typename Object,
  32868. + typename AccessorTemplate,
  32869. + AccessorTemplate& Accessor,
  32870. + typename LengthTemplate,
  32871. + LengthTemplate& Length>
  32872. +class iterator<Connection,
  32873. + Object,
  32874. + signature<AccessorTemplate, Accessor>,
  32875. + signature<LengthTemplate, Length>>
  32876. + : public std::iterator<typename std::input_iterator_tag,
  32877. + Object,
  32878. + typename std::size_t,
  32879. + Object *,
  32880. + const Object &>
  32881. +{
  32882. + protected:
  32883. +
  32884. + using accessor_traits = detail::function_traits<AccessorTemplate>;
  32885. + using Data = typename std::remove_pointer<typename accessor_traits::result_type>::type;
  32886. + using const_reply_ptr = typename accessor_traits::template argument<0>::type;
  32887. + using Reply = typename std::remove_pointer<typename std::remove_const<const_reply_ptr>::type>::type;
  32888. +
  32889. + using data_t = typename std::conditional<std::is_void<Data>::value,
  32890. + typename xpp::generic::conversion_type<Object>::type, Data>::type;
  32891. + using make = xpp::generic::factory::make<Connection, data_t, Object>;
  32892. +
  32893. + Connection m_c;
  32894. + std::size_t m_index = 0;
  32895. + std::shared_ptr<Reply> m_reply;
  32896. +
  32897. + public:
  32898. + typedef iterator<Connection,
  32899. + Object,
  32900. + signature<AccessorTemplate, Accessor>,
  32901. + signature<LengthTemplate, Length>>
  32902. + self;
  32903. +
  32904. + iterator(void) {}
  32905. +
  32906. + template<typename C>
  32907. + iterator(C && c,
  32908. + const std::shared_ptr<Reply> & reply,
  32909. + std::size_t index)
  32910. + : m_c(c)
  32911. + , m_index(index)
  32912. + , m_reply(reply)
  32913. + {
  32914. + if (std::is_void<Data>::value) {
  32915. + m_index /= sizeof(data_t);
  32916. + }
  32917. + }
  32918. +
  32919. + bool operator==(const iterator & other)
  32920. + {
  32921. + return m_index == other.m_index;
  32922. + }
  32923. +
  32924. + bool operator!=(const iterator & other)
  32925. + {
  32926. + return ! (*this == other);
  32927. + }
  32928. +
  32929. + Object operator*(void)
  32930. + {
  32931. + return make()(m_c, static_cast<data_t *>(Accessor(m_reply.get()))[m_index]);
  32932. + }
  32933. +
  32934. + // prefix
  32935. + self & operator++(void)
  32936. + {
  32937. + ++m_index;
  32938. + return *this;
  32939. + }
  32940. +
  32941. + // postfix
  32942. + self operator++(int)
  32943. + {
  32944. + auto copy = *this;
  32945. + ++(*this);
  32946. + return copy;
  32947. + }
  32948. +
  32949. + // prefix
  32950. + self & operator--(void)
  32951. + {
  32952. + --m_index;
  32953. + return *this;
  32954. + }
  32955. +
  32956. + // postfix
  32957. + self operator--(int)
  32958. + {
  32959. + auto copy = *this;
  32960. + --(*this);
  32961. + return copy;
  32962. + }
  32963. +
  32964. + template<typename C>
  32965. + static
  32966. + self
  32967. + begin(C && c, const std::shared_ptr<Reply> & reply)
  32968. + {
  32969. + return self { std::forward<C>(c), reply, 0 };
  32970. + }
  32971. +
  32972. + template<typename C>
  32973. + static
  32974. + self
  32975. + end(C && c, const std::shared_ptr<Reply> & reply)
  32976. + {
  32977. + return self { std::forward<C>(c),
  32978. + reply,
  32979. + static_cast<std::size_t>(Length(reply.get())) };
  32980. + }
  32981. +}; // class iterator
  32982. +
  32983. +template<typename Connection, typename Reply, typename Iterator>
  32984. +class list {
  32985. + private:
  32986. + // before public part, to make decltype in begin() & end() work!
  32987. + Connection m_c;
  32988. + std::shared_ptr<Reply> m_reply;
  32989. +
  32990. + public:
  32991. + template<typename C>
  32992. + list(C && c, const std::shared_ptr<Reply> & reply)
  32993. + : m_c(std::forward<C>(c)), m_reply(reply)
  32994. + {}
  32995. +
  32996. + auto
  32997. + begin(void) -> decltype(Iterator::begin(this->m_c, this->m_reply))
  32998. + {
  32999. + return Iterator::begin(m_c, m_reply);
  33000. + }
  33001. +
  33002. + auto
  33003. + end(void) -> decltype(Iterator::end(this->m_c, this->m_reply))
  33004. + {
  33005. + return Iterator::end(m_c, m_reply);
  33006. + }
  33007. +}; // class list
  33008. +
  33009. +} // namespace generic
  33010. +
  33011. +} // namespace xpp
  33012. +
  33013. +#endif // XPP_GENERIC_REPLY_ITERATOR_HPP
  33014. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/request.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/request.hpp
  33015. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/request.hpp 1970-01-01 02:00:00.000000000 +0200
  33016. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/request.hpp 2017-08-30 16:02:01.000000000 +0300
  33017. @@ -0,0 +1,129 @@
  33018. +#ifndef XPP_GENERIC_REQUEST_HPP
  33019. +#define XPP_GENERIC_REQUEST_HPP
  33020. +
  33021. +#include <array>
  33022. +#include <memory>
  33023. +#include <cstdlib>
  33024. +#include <xcb/xcb.h>
  33025. +#include "error.hpp"
  33026. +#include "signature.hpp"
  33027. +
  33028. +#define REPLY_TEMPLATE \
  33029. + typename Reply, \
  33030. + typename Cookie, \
  33031. + Reply *(&ReplyFunction)(xcb_connection_t *, Cookie, xcb_generic_error_t **)
  33032. +
  33033. +#define REPLY_SIGNATURE \
  33034. + xpp::generic::signature<Reply *(xcb_connection_t *, \
  33035. + Cookie, \
  33036. + xcb_generic_error_t **), \
  33037. + ReplyFunction>
  33038. +
  33039. +#define REPLY_COOKIE_TEMPLATE \
  33040. + typename ... CookieParameter, \
  33041. + Cookie(&CookieFunction)(CookieParameter ...)
  33042. +
  33043. +#define REPLY_COOKIE_SIGNATURE \
  33044. + xpp::generic::signature<Cookie(CookieParameter ...), CookieFunction>
  33045. +
  33046. +namespace xpp { namespace generic {
  33047. +
  33048. +template<typename Connection, typename Dispatcher>
  33049. +void
  33050. +check(Connection && c, const xcb_void_cookie_t & cookie)
  33051. +{
  33052. + xcb_generic_error_t * error =
  33053. + xcb_request_check(std::forward<Connection>(c), cookie);
  33054. + if (error) {
  33055. + dispatch(std::forward<Connection>(c),
  33056. + std::shared_ptr<xcb_generic_error_t>(error, std::free));
  33057. + }
  33058. +}
  33059. +
  33060. +struct checked_tag {};
  33061. +struct unchecked_tag {};
  33062. +
  33063. +template<typename ... Types>
  33064. +class reply;
  33065. +
  33066. +template<typename Derived,
  33067. + typename Connection,
  33068. + typename Check,
  33069. + REPLY_TEMPLATE,
  33070. + REPLY_COOKIE_TEMPLATE>
  33071. +class reply<Derived,
  33072. + Connection,
  33073. + Check,
  33074. + REPLY_SIGNATURE,
  33075. + REPLY_COOKIE_SIGNATURE>
  33076. +{
  33077. + public:
  33078. + template<typename C, typename ... Parameter>
  33079. + reply(C && c, Parameter && ... parameter)
  33080. + : m_c(std::forward<C>(c))
  33081. + , m_cookie(Derived::cookie(std::forward<C>(c),
  33082. + std::forward<Parameter>(parameter) ...))
  33083. + {}
  33084. +
  33085. + operator bool(void)
  33086. + {
  33087. + return m_reply.operator bool();
  33088. + }
  33089. +
  33090. + const Reply &
  33091. + operator*(void)
  33092. + {
  33093. + return *get();
  33094. + }
  33095. +
  33096. + Reply *
  33097. + operator->(void)
  33098. + {
  33099. + return get().get();
  33100. + }
  33101. +
  33102. + const std::shared_ptr<Reply> &
  33103. + get(void)
  33104. + {
  33105. + if (! m_reply) {
  33106. + m_reply = get(Check());
  33107. + }
  33108. + return m_reply;
  33109. + }
  33110. +
  33111. + template<typename ... Parameter>
  33112. + static
  33113. + Cookie
  33114. + cookie(Parameter && ... parameter)
  33115. + {
  33116. + return CookieFunction(std::forward<Parameter>(parameter) ...);
  33117. + }
  33118. +
  33119. + protected:
  33120. + Connection m_c;
  33121. + Cookie m_cookie;
  33122. + std::shared_ptr<Reply> m_reply;
  33123. +
  33124. + std::shared_ptr<Reply>
  33125. + get(checked_tag)
  33126. + {
  33127. + xcb_generic_error_t * error = nullptr;
  33128. + auto reply = std::shared_ptr<Reply>(ReplyFunction(m_c, m_cookie, &error),
  33129. + std::free);
  33130. + if (error) {
  33131. + dispatch(m_c, std::shared_ptr<xcb_generic_error_t>(error, std::free));
  33132. + }
  33133. + return reply;
  33134. + }
  33135. +
  33136. + std::shared_ptr<Reply>
  33137. + get(unchecked_tag)
  33138. + {
  33139. + return std::shared_ptr<Reply>(ReplyFunction(m_c, m_cookie, nullptr),
  33140. + std::free);
  33141. + }
  33142. +};
  33143. +
  33144. +} } // namespace xpp::generic
  33145. +
  33146. +#endif // XPP_GENERIC_REQUEST_HPP
  33147. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/resource.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/resource.hpp
  33148. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/resource.hpp 1970-01-01 02:00:00.000000000 +0200
  33149. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/resource.hpp 2017-08-30 16:02:01.000000000 +0300
  33150. @@ -0,0 +1,142 @@
  33151. +#ifndef XPP_GENERIC_RESOURCE_HPP
  33152. +#define XPP_GENERIC_RESOURCE_HPP
  33153. +
  33154. +#include <iostream> // std::{hex,dec}
  33155. +#include <memory> // std::shared_ptr
  33156. +#include "iterator_traits.hpp"
  33157. +
  33158. +#include <xcb/xcb.h> // xcb_generate_id
  33159. +
  33160. +namespace xpp {
  33161. +
  33162. +namespace generic {
  33163. +
  33164. +namespace detail {
  33165. +
  33166. +template<typename Connection, typename Resource, typename ResourceId,
  33167. + template<typename, typename> class ... Interfaces>
  33168. +class interfaces
  33169. + : public Interfaces<interfaces<Connection, Resource, ResourceId, Interfaces ...>,
  33170. + Connection> ...
  33171. +{
  33172. + public:
  33173. + const ResourceId &
  33174. + resource(void) const
  33175. + {
  33176. + return *static_cast<const Resource &>(*this);
  33177. + }
  33178. +
  33179. + Connection
  33180. + connection(void) const
  33181. + {
  33182. + return static_cast<const Resource &>(*this).connection();
  33183. + }
  33184. +}; // class interfaces
  33185. +
  33186. +}
  33187. +
  33188. +template<typename Connection, typename ResourceId,
  33189. + template<typename, typename> class ... Interfaces>
  33190. +class resource
  33191. + : public detail::interfaces<Connection,
  33192. + resource<Connection, ResourceId, Interfaces ...>,
  33193. + ResourceId, Interfaces ...>
  33194. +{
  33195. + protected:
  33196. + using self = resource<Connection, ResourceId, Interfaces ...>;
  33197. +
  33198. + Connection m_c;
  33199. + // reference counting for Resource object
  33200. + std::shared_ptr<ResourceId> m_resource;
  33201. +
  33202. + resource(Connection c)
  33203. + : m_c(c)
  33204. + {}
  33205. +
  33206. + template<typename C, typename Create, typename Destroy>
  33207. + static
  33208. + self
  33209. + make(C && c, Create create, Destroy destroy)
  33210. + {
  33211. + self resource(std::forward<C>(c));
  33212. +
  33213. + auto xid = xcb_generate_id(std::forward<C>(c));
  33214. +
  33215. + // class create before instatiating the shared_ptr
  33216. + // create might fail and throw an error, hence shared_ptr would hold an
  33217. + // invalid xid, causing possibly another exception in destroy()
  33218. + // when create() throws, then the shared_ptr will not be created
  33219. + create(std::forward<C>(c), xid);
  33220. +
  33221. + resource.m_resource =
  33222. + std::shared_ptr<ResourceId>(new ResourceId(xid),
  33223. + [&](ResourceId * r)
  33224. + {
  33225. + destroy(resource.m_c, *r);
  33226. + delete r;
  33227. + });
  33228. +
  33229. + return resource;
  33230. + }
  33231. +
  33232. + public:
  33233. + template<typename C>
  33234. + resource(C && c, const ResourceId & resource_id)
  33235. + : m_c(std::forward<C>(c))
  33236. + , m_resource(std::make_shared<ResourceId>(resource_id))
  33237. + {}
  33238. +
  33239. + resource(const resource<Connection, ResourceId, Interfaces ...> & other)
  33240. + : m_c(other.m_c)
  33241. + , m_resource(other.m_resource)
  33242. + {}
  33243. +
  33244. + virtual
  33245. + void
  33246. + operator=(const resource<Connection, ResourceId, Interfaces ...> & other)
  33247. + {
  33248. + m_c = other.m_c;
  33249. + m_resource = other.m_resource;
  33250. + }
  33251. +
  33252. + virtual
  33253. + void
  33254. + operator=(const ResourceId & resource)
  33255. + {
  33256. + m_resource = std::make_shared<ResourceId>(resource);
  33257. + }
  33258. +
  33259. + virtual
  33260. + const ResourceId &
  33261. + operator*(void) const
  33262. + {
  33263. + return *m_resource;
  33264. + }
  33265. +
  33266. + virtual
  33267. + operator const ResourceId &(void) const
  33268. + {
  33269. + return *m_resource;
  33270. + }
  33271. +
  33272. + Connection
  33273. + connection(void) const
  33274. + {
  33275. + return m_c;
  33276. + }
  33277. +}; // class resource
  33278. +
  33279. +template<typename Connection, typename ResourceId,
  33280. + template<typename, typename> class ... Interfaces>
  33281. +std::ostream &
  33282. +operator<<(std::ostream & os,
  33283. + const resource<Connection, ResourceId, Interfaces ...> & resource)
  33284. +{
  33285. + return os << std::hex << "0x" << *resource << std::dec;
  33286. +}
  33287. +
  33288. +} // namespace generic
  33289. +
  33290. +} // namespace xpp
  33291. +
  33292. +#endif // XPP_GENERIC_RESOURCE_HPP
  33293. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic/signature.hpp polybar-3.2.1/lib/xpp/include/xpp/generic/signature.hpp
  33294. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic/signature.hpp 1970-01-01 02:00:00.000000000 +0200
  33295. +++ polybar-3.2.1/lib/xpp/include/xpp/generic/signature.hpp 2017-08-30 16:02:01.000000000 +0300
  33296. @@ -0,0 +1,16 @@
  33297. +#ifndef XPP_GENERIC_SIGNATURE_HPP
  33298. +#define XPP_GENERIC_SIGNATURE_HPP
  33299. +
  33300. +#define SIGNATURE(NAME) \
  33301. + xpp::generic::signature<decltype(NAME), NAME>
  33302. +
  33303. +namespace xpp
  33304. +{
  33305. + namespace generic
  33306. + {
  33307. + template<typename Signature, Signature & S>
  33308. + class signature;
  33309. + }
  33310. +}
  33311. +
  33312. +#endif // XPP_GENERIC_SIGNATURE_HPP
  33313. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/generic.hpp polybar-3.2.1/lib/xpp/include/xpp/generic.hpp
  33314. --- polybar-3.2.1.orig/lib/xpp/include/xpp/generic.hpp 1970-01-01 02:00:00.000000000 +0200
  33315. +++ polybar-3.2.1/lib/xpp/include/xpp/generic.hpp 2017-08-30 16:02:01.000000000 +0300
  33316. @@ -0,0 +1,15 @@
  33317. +#ifndef XPP_GENERIC_HPP
  33318. +#define XPP_GENERIC_HPP
  33319. +
  33320. +#include "generic/error.hpp"
  33321. +#include "generic/event.hpp"
  33322. +#include "generic/factory.hpp"
  33323. +#include "generic/request.hpp"
  33324. +#include "generic/resource.hpp"
  33325. +#include "generic/extension.hpp"
  33326. +#include "generic/signature.hpp"
  33327. +#include "generic/reply_iterator.hpp"
  33328. +#include "generic/iterator_traits.hpp"
  33329. +#include "generic/input_iterator_adapter.hpp"
  33330. +
  33331. +#endif // XPP_GENERIC_HPP
  33332. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/Makefile polybar-3.2.1/lib/xpp/include/xpp/Makefile
  33333. --- polybar-3.2.1.orig/lib/xpp/include/xpp/Makefile 1970-01-01 02:00:00.000000000 +0200
  33334. +++ polybar-3.2.1/lib/xpp/include/xpp/Makefile 2017-08-30 16:02:01.000000000 +0300
  33335. @@ -0,0 +1,25 @@
  33336. +CXXFLAGS=-std=c++11 -Wall -O3
  33337. +
  33338. +HPPSRCS=$(shell find . -maxdepth 1 -name '*.hpp')
  33339. +HPPOBJS=$(HPPSRCS:%.hpp=%.hpp.gch)
  33340. +
  33341. +all: ${DIRS} ${HPPOBJS}
  33342. +
  33343. +%.hpp.gch: %.hpp
  33344. + ${CXX} ${CXXFLAGS} -MMD -c $<
  33345. +
  33346. +-include $(HPPSRCS:%.hpp=%.d)
  33347. +include flags.makefile
  33348. +
  33349. +version: ${LIBS}
  33350. + @echo -e "\nGCC version:"
  33351. + @gcc -v 2>&1
  33352. +
  33353. +${LIBS}:
  33354. + @printf "%-20s" "$@:"
  33355. + @pkg-config --modversion $@
  33356. +
  33357. +clean:
  33358. + rm -f ${HPPOBJS}
  33359. +
  33360. +.PHONY: clean version
  33361. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/pixmap.hpp polybar-3.2.1/lib/xpp/include/xpp/pixmap.hpp
  33362. --- polybar-3.2.1.orig/lib/xpp/include/xpp/pixmap.hpp 1970-01-01 02:00:00.000000000 +0200
  33363. +++ polybar-3.2.1/lib/xpp/include/xpp/pixmap.hpp 2017-08-30 16:02:01.000000000 +0300
  33364. @@ -0,0 +1,78 @@
  33365. +#ifndef XPP_PIXMAP_HPP
  33366. +#define XPP_PIXMAP_HPP
  33367. +
  33368. +#include "proto/x.hpp"
  33369. +#include "generic/resource.hpp"
  33370. +
  33371. +namespace xpp {
  33372. +
  33373. +template<typename Connection, template<typename, typename> class ... Interfaces>
  33374. +class pixmap
  33375. + : public xpp::generic::resource<Connection, xcb_pixmap_t,
  33376. + xpp::x::pixmap, Interfaces ...>
  33377. +{
  33378. + protected:
  33379. + using base = xpp::generic::resource<Connection, xcb_pixmap_t,
  33380. + xpp::x::pixmap, Interfaces ...>;
  33381. +
  33382. + template<typename C, typename Create, typename Destroy>
  33383. + pixmap(C && c, Create && create, Destroy && destroy)
  33384. + : base(base::make(std::forward<C>(c),
  33385. + std::forward<Create>(create),
  33386. + std::forward<Destroy>(destroy)))
  33387. + {}
  33388. +
  33389. + public:
  33390. + using base::base;
  33391. + using base::operator=;
  33392. +
  33393. + template<typename C>
  33394. + static
  33395. + pixmap<Connection, Interfaces ...>
  33396. + create(C && c, uint8_t depth, xcb_drawable_t drawable,
  33397. + uint16_t width, uint16_t height)
  33398. + {
  33399. + return pixmap(
  33400. + std::forward<C>(c),
  33401. + [&](const Connection & c, const xcb_pixmap_t & pixmap)
  33402. + {
  33403. + xpp::x::create_pixmap(c, depth, pixmap, drawable, width, height);
  33404. + },
  33405. + [&](const Connection & c, const xcb_pixmap_t & pixmap)
  33406. + {
  33407. + xpp::x::free_pixmap(c, pixmap);
  33408. + });
  33409. + }
  33410. +
  33411. + template<typename C>
  33412. + static
  33413. + pixmap<Connection, Interfaces ...>
  33414. + create_checked(C && c, uint8_t depth, xcb_drawable_t drawable,
  33415. + uint16_t width, uint16_t height)
  33416. + {
  33417. + return pixmap(
  33418. + std::forward<C>(c),
  33419. + [&](const Connection & c, const xcb_pixmap_t & pixmap)
  33420. + {
  33421. + xpp::x::create_pixmap_checked(c, depth, pixmap, drawable, width, height);
  33422. + },
  33423. + [&](const Connection & c, const xcb_pixmap_t & pixmap)
  33424. + {
  33425. + xpp::x::free_pixmap_checked(c, pixmap);
  33426. + });
  33427. + }
  33428. +};
  33429. +
  33430. +namespace generic {
  33431. +
  33432. +template<typename Connection, template<typename, typename> class ... Interfaces>
  33433. +struct traits<xpp::pixmap<Connection, Interfaces ...>>
  33434. +{
  33435. + typedef xcb_pixmap_t type;
  33436. +};
  33437. +
  33438. +} // namespace generic
  33439. +
  33440. +} // namespace xpp
  33441. +
  33442. +#endif // XPP_PIXMAP_HPP
  33443. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/proto/.gitignore polybar-3.2.1/lib/xpp/include/xpp/proto/.gitignore
  33444. --- polybar-3.2.1.orig/lib/xpp/include/xpp/proto/.gitignore 1970-01-01 02:00:00.000000000 +0200
  33445. +++ polybar-3.2.1/lib/xpp/include/xpp/proto/.gitignore 2017-08-30 16:02:01.000000000 +0300
  33446. @@ -0,0 +1 @@
  33447. +*.hpp
  33448. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/valueparam.hpp polybar-3.2.1/lib/xpp/include/xpp/valueparam.hpp
  33449. --- polybar-3.2.1.orig/lib/xpp/include/xpp/valueparam.hpp 1970-01-01 02:00:00.000000000 +0200
  33450. +++ polybar-3.2.1/lib/xpp/include/xpp/valueparam.hpp 2017-08-30 16:02:01.000000000 +0300
  33451. @@ -0,0 +1,50 @@
  33452. +#ifndef X_VALUEPARAM_HPP
  33453. +#define X_VALUEPARAM_HPP
  33454. +
  33455. +#include <map>
  33456. +#include <vector>
  33457. +
  33458. +namespace xpp {
  33459. +
  33460. +class valueparam {
  33461. + public:
  33462. + valueparam &
  33463. + set(const uint32_t & bit, const uint32_t & value)
  33464. + {
  33465. + m_has_changed = true;
  33466. + m_values_map[bit] = value;
  33467. + return *this;
  33468. + }
  33469. +
  33470. + uint32_t
  33471. + mask(void)
  33472. + {
  33473. + return m_mask;
  33474. + }
  33475. +
  33476. + uint32_t * const
  33477. + values(void)
  33478. + {
  33479. + if (m_has_changed) {
  33480. + m_values.clear();
  33481. + }
  33482. +
  33483. + for (auto & item : m_values_map) {
  33484. + m_values.push_back(item.second);
  33485. + }
  33486. +
  33487. + m_has_changed = false;
  33488. +
  33489. + return m_values.data();
  33490. + }
  33491. +
  33492. + private:
  33493. + bool m_has_changed = true;
  33494. + uint32_t m_mask = 0;
  33495. + std::vector<uint32_t> m_values;
  33496. + std::map<uint32_t, uint32_t> m_values_map;
  33497. +};
  33498. +
  33499. +} // namespace xpp
  33500. +
  33501. +#endif // X_VALUEPARAM_HPP
  33502. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/window.hpp polybar-3.2.1/lib/xpp/include/xpp/window.hpp
  33503. --- polybar-3.2.1.orig/lib/xpp/include/xpp/window.hpp 1970-01-01 02:00:00.000000000 +0200
  33504. +++ polybar-3.2.1/lib/xpp/include/xpp/window.hpp 2017-08-30 16:02:01.000000000 +0300
  33505. @@ -0,0 +1,90 @@
  33506. +#ifndef XPP_WINDOW_HPP
  33507. +#define XPP_WINDOW_HPP
  33508. +
  33509. +#include "proto/x.hpp"
  33510. +#include "generic/resource.hpp"
  33511. +
  33512. +namespace xpp {
  33513. +
  33514. +template<typename Connection, template<typename, typename> class ... Interfaces>
  33515. +class window
  33516. + : public xpp::generic::resource<Connection, xcb_window_t,
  33517. + xpp::x::window, Interfaces ...>
  33518. +{
  33519. + protected:
  33520. + using base = xpp::generic::resource<Connection, xcb_window_t,
  33521. + xpp::x::window, Interfaces ...>;
  33522. +
  33523. + template<typename C, typename Create, typename Destroy>
  33524. + window(C && c, Create && create, Destroy && destroy)
  33525. + : base(base::make(std::forward<C>(c),
  33526. + std::forward<Create>(create),
  33527. + std::forward<Destroy>(destroy)))
  33528. + {}
  33529. +
  33530. + public:
  33531. + using base::base;
  33532. + using base::operator=;
  33533. +
  33534. + template<typename C>
  33535. + static
  33536. + window<Connection, Interfaces ...>
  33537. + create(C && c, uint8_t depth, xcb_window_t parent,
  33538. + int16_t x, int16_t y, uint16_t width, uint16_t height,
  33539. + uint16_t border_width,
  33540. + uint16_t _class, xcb_visualid_t visual,
  33541. + uint32_t value_mask, const uint32_t * value_list)
  33542. + {
  33543. + return window(
  33544. + std::forward<C>(c),
  33545. + [&](const Connection & c, const xcb_window_t & window)
  33546. + {
  33547. + xpp::x::create_window(c, depth, window, parent,
  33548. + x, y, width, height, border_width,
  33549. + _class, visual,
  33550. + value_mask, value_list);
  33551. + },
  33552. + [&](const Connection & c, const xcb_window_t & window)
  33553. + {
  33554. + xpp::x::destroy_window(c, window);
  33555. + });
  33556. + }
  33557. +
  33558. + template<typename C>
  33559. + static
  33560. + window<Connection, Interfaces ...>
  33561. + create_checked(C && c, uint8_t depth, xcb_window_t parent,
  33562. + int16_t x, int16_t y, uint16_t width, uint16_t height,
  33563. + uint16_t border_width,
  33564. + uint16_t _class, xcb_visualid_t visual,
  33565. + uint32_t value_mask, const uint32_t * value_list)
  33566. + {
  33567. + return window(
  33568. + std::forward<C>(c),
  33569. + [&](const Connection & c, const xcb_window_t & window)
  33570. + {
  33571. + xpp::x::create_window_checked(c, depth, window, parent,
  33572. + x, y, width, height, border_width,
  33573. + _class, visual,
  33574. + value_mask, value_list);
  33575. + },
  33576. + [&](const Connection & c, const xcb_window_t & window)
  33577. + {
  33578. + xpp::x::destroy_window_checked(c, window);
  33579. + });
  33580. + }
  33581. +};
  33582. +
  33583. +namespace generic {
  33584. +
  33585. +template<typename Connection, template<typename, typename> class ... Interfaces>
  33586. +struct traits<xpp::window<Connection, Interfaces ...>>
  33587. +{
  33588. + typedef xcb_window_t type;
  33589. +};
  33590. +
  33591. +} // namespace generic
  33592. +
  33593. +} // namespace xpp
  33594. +
  33595. +#endif // XPP_WINDOW_HPP
  33596. diff -Nuar polybar-3.2.1.orig/lib/xpp/include/xpp/xpp.hpp polybar-3.2.1/lib/xpp/include/xpp/xpp.hpp
  33597. --- polybar-3.2.1.orig/lib/xpp/include/xpp/xpp.hpp 1970-01-01 02:00:00.000000000 +0200
  33598. +++ polybar-3.2.1/lib/xpp/include/xpp/xpp.hpp 2017-08-30 16:02:01.000000000 +0300
  33599. @@ -0,0 +1,19 @@
  33600. +#ifndef XPP_HPP
  33601. +#define XPP_HPP
  33602. +
  33603. +#include "generic.hpp"
  33604. +
  33605. +#include "atom.hpp"
  33606. +#include "colormap.hpp"
  33607. +#include "cursor.hpp"
  33608. +#include "drawable.hpp"
  33609. +#include "font.hpp"
  33610. +#include "fontable.hpp"
  33611. +#include "gcontext.hpp"
  33612. +#include "pixmap.hpp"
  33613. +#include "window.hpp"
  33614. +
  33615. +#include "event.hpp"
  33616. +#include "connection.hpp"
  33617. +
  33618. +#endif // XPP_HPP
  33619. diff -Nuar polybar-3.2.1.orig/lib/xpp/README.md polybar-3.2.1/lib/xpp/README.md
  33620. --- polybar-3.2.1.orig/lib/xpp/README.md 1970-01-01 02:00:00.000000000 +0200
  33621. +++ polybar-3.2.1/lib/xpp/README.md 2017-08-30 16:02:01.000000000 +0300
  33622. @@ -0,0 +1,313 @@
  33623. +# xpp - A C++11 RAII wrapper for XCB
  33624. +
  33625. +## Synopsis
  33626. +
  33627. +XPP is a header only C++11
  33628. +[RAII](https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization)
  33629. +wrapper around [X protocol C-language Binding
  33630. +(XCB)](http://xcb.freedesktop.org). Pointers to dynamically allocated memory,
  33631. +such as events and errors are wrapped in std::shared_ptr.
  33632. +
  33633. +Furthermore, interfaces for connection and resource types are provided to
  33634. +facilitate the creation of custom classes. For convenience, a connection class
  33635. +and several basic resource type classes are readily available.
  33636. +
  33637. +XPP makes widespread use of the
  33638. +[Curiously Recurring Template Pattern (CRTP)](https://en.wikibooks.org/wiki/More_C++_Idioms/Curiously_Recurring_Template_Pattern)
  33639. +to avoid overhead through dynamic dispatch. Hence, most interfaces are
  33640. +implicitly defined.
  33641. +
  33642. +## Prerequisites
  33643. +
  33644. + * Python 2
  33645. + * GCC >= 4.8 (or Clang >= 3.3, untested)
  33646. + * libxcb
  33647. +
  33648. +## Quick Start
  33649. +
  33650. +```
  33651. + git clone https://github.com/jrk-/xpp
  33652. + cd xpp
  33653. + make
  33654. + make examples
  33655. + cd src/examples
  33656. + for demo in demo_*; do ./${demo}; done
  33657. +```
  33658. +
  33659. +## Documentation
  33660. +
  33661. +### General
  33662. +
  33663. +The bindings can be generated by calling `make` in the top level directory. If
  33664. +this fails, check the [`XCBGEN`](include/proto/Makefile#L38) and
  33665. +[`PROTODIR`](include/proto/Makefile#L39) variables in
  33666. +[include/proto/Makefile](include/proto/Makefile). These need to point to the `xcbgen`
  33667. +python package and the xml protocol description respectively.
  33668. +
  33669. +Once the bindings are generated they can be used by including
  33670. +[include/xpp.hpp](include/xpp.hpp). If an extensions is required, it needs to be
  33671. +included additionally. For example, the RandR extension is available through
  33672. +`proto/randr.hpp`, the Damage extension through `proto/damage.hpp`, etc.
  33673. +
  33674. +Recent (and working) examples can be found in [src/examples](src/examples).
  33675. +To compile them, call `make examples` in the `xpp` directory or just `make` in
  33676. +[src/examples](src/examples).
  33677. +
  33678. +### Requests
  33679. +
  33680. +Requests obey this naming scheme: `xpp:: ExtensionName :: RequestName`.
  33681. +
  33682. +##### Examples:
  33683. +
  33684. +Core X protocol:
  33685. +`MapWindow`: `xcb_map_window{,_checked}` -> `xpp::x::map_window{,_checked}`
  33686. +`InternAtom`: `xcb_intern_atom{,_checked}` -> `xpp::x::intern_atom{,_unchecked}`
  33687. +
  33688. +RandR protocol:
  33689. +`SelectInput`: `xcb_randr_select_input{,_checked}` -> `xpp::randr::select_input{,_checked}`
  33690. +`QueryVersion`: `xcb_randr_query_version{,_unchecked}` -> `xpp::randr::query_version{,_unchecked}`
  33691. +
  33692. +##### Default Parameter
  33693. +
  33694. +All `xcb_timestamp_t` parameters are alternatively available with a default
  33695. +value of `XCB_TIME_CURRENT_TIME`.
  33696. +
  33697. +##### Parameter Lists
  33698. +
  33699. +Requests which take a list of values as parameters can be used with any STL
  33700. +container by passing in Iterators. Example:
  33701. +
  33702. +```
  33703. +std::string string_example = "example string";
  33704. +// std::list<char> list_example = { 'a', 'b', 'c' };
  33705. +// std::map<int, char> map_example = { {0, 'a'}, {1, 'b'}, {2, 'c'} };
  33706. +xpp::x::change_property_checked(c, XCB_PROP_MODE_REPLACE, window,
  33707. + atom, XCB_ATOM_STRING, 8,
  33708. + string_example.begin(), string_example.end());
  33709. + // list_example.begin(), list_example.end());
  33710. + // for associative containers the value (std::pair<..>::second_type) will be used
  33711. + // map_example.begin(), map_example.end());
  33712. +```
  33713. +
  33714. +### Replies
  33715. +
  33716. +XCB returns replies only when they are explicitely queried. With XPP this is not
  33717. +necessary anymore, because the operators for accessing the reply are overloaded.
  33718. +
  33719. +For example, getting the reply for the `InternAtom` request is as simple as this:
  33720. +
  33721. +```
  33722. +auto reply = xpp::x::intern_atom(connection, true, "MY_ATOM_NAME");
  33723. +// do some other stuff ..
  33724. +// latency hiding is still effective, because the call to
  33725. +// xcb_intern_atom_reply happens but now in operator->()
  33726. +xcb_atom_t atom = reply->atom;
  33727. +```
  33728. +
  33729. +#### Member Accessors
  33730. +
  33731. +##### Simple Types
  33732. +
  33733. +Primitive types like `xcb_window_t`, `xcb_atom_t`, etc. can be accessed either
  33734. +directly through the overloaded `operator->()` or via a method which has the
  33735. +same name as the member. These methods are templated with a default template
  33736. +type of the native type. Any type which is default constructible from the native
  33737. +type or a connection and the native type can be specified as template argument.
  33738. +
  33739. +Examples:
  33740. +
  33741. +```
  33742. +xcb_window_t w1 = reply->member;
  33743. +xcb_window_t w2 = reply.member(); // default template parameter is xcb_window_t
  33744. +xpp::window w3 = reply.member<xpp::window>();
  33745. +```
  33746. +
  33747. +##### List Types
  33748. +
  33749. +Lists (e.g. the result for `QueryTree`) are accessible through iterators. The
  33750. +value type is templated, with the default being the native data type.
  33751. +
  33752. +Example:
  33753. +
  33754. +```
  33755. +auto tree = xpp::x::query_tree(c, window);
  33756. +
  33757. +// default template type: xcb_window_t
  33758. +for (auto && child : tree.children()) {
  33759. + // child has type xcb_window_t
  33760. +}
  33761. +
  33762. +// xpp::window is constructible with a connection and xcb_window_t
  33763. +// other types which are default-constructible with either the value type
  33764. +// (e.g. xcb_window_t) or a connection & the value type are possible, too
  33765. +for (auto && child : tree.children<xpp::window>()) {
  33766. + // child has type xpp::window
  33767. +}
  33768. +```
  33769. +
  33770. +Caveat: Some requests (in particular `GetProperty`) return an untyped array of
  33771. +bytes (`void *`). To access the desired data type, a template type must be
  33772. +specified. For constructible types a type trait must be implemented, like so:
  33773. +
  33774. +```
  33775. +struct my_type {
  33776. + my_type(const xcb_window_t &);
  33777. + // ..
  33778. +};
  33779. +
  33780. +namespace xpp { namespace generic {
  33781. +struct traits<my_type> {
  33782. + typedef xcb_atom_t type;
  33783. +};
  33784. +}; }; // namespace xpp::generic
  33785. +```
  33786. +
  33787. +### Errors
  33788. +
  33789. +XCB offers four different variants of request functions.
  33790. +
  33791. +##### Requests without a reply:
  33792. +
  33793. +* Error delivered through event queue: `xcb_void_cookie_t xcb_request(...)`
  33794. +
  33795. +* Error can be checked immediately with `xcb_request_check(xcb_connection_t *, xcb_void_cookie_t)`: `xcb_void_cookie_t xcb_request_checked(...)`
  33796. +
  33797. +##### Requests with reply:
  33798. +
  33799. +* Error can be checked when getting the reply:
  33800. +`xcb_request_reply_t * xcb_request_reply(xcb_connection_t *, xcb_request_cookie_t, xcb_generic_error_t **)`:
  33801. +`xcb_request_cookie_t xcb_request(...)`
  33802. +
  33803. +* Error delivered through event queue: `xcb_request_cookie_t xcb_request_unchecked(...)`
  33804. +
  33805. +For more information on this, refer to [xcb-requests (3)](http://www.x.org/releases/current/doc/man/man3/xcb-requests.3.xhtml).
  33806. +
  33807. +With xpp errors are either thrown as `std::shared_ptr<xcb_generic_error_t>` or
  33808. +typed as `xpp:: extension ::error:: error_type`, e.g. `xpp::x::error::value`.
  33809. +
  33810. +The latter are based upon `xpp::generic::error` (which inherits from
  33811. +`std::runtime_error`) and come with a textual error description which is
  33812. +accessible through the `what()` method.
  33813. +
  33814. +For typed errors it is necessary to use a connection class which implements the
  33815. +appropriate error dispatching. The supplied `xpp::connection` class already does
  33816. +this. If no error dispatcher are available (e.g. when used with
  33817. +`xcb_connection_t *`), then a simply `std::shared_ptr<xcb_generic_error_t>`
  33818. +will be thrown.
  33819. +
  33820. +### Events
  33821. +
  33822. +Events returned by the event producing methods (`wait_for_event`,
  33823. +`poll_for_event`, etc.) from `xpp::core` and `xpp::connection` are encapsulated
  33824. +as `std::shared_ptr<xcb_generic_event_t>`.
  33825. +
  33826. +For additional convenience typed events are available. An event type is based on
  33827. +`xpp::generic::event`. The general structure for a typed event is
  33828. +
  33829. +`xpp::` Extension `::event::` EventName
  33830. +
  33831. +Examples:
  33832. +
  33833. +```
  33834. +xpp::x::event::key_press
  33835. +xpp::randr::event::notify
  33836. +xpp::damage::event::notify
  33837. +```
  33838. +
  33839. +Events can be converted from `std::shared_ptr<xcb_generic_event_t>` to a typed
  33840. +event by either using an event dispatcher functor (e.g.
  33841. +`xpp::x::event::dispatcher`) or by using the event registry described below.
  33842. +
  33843. +##### Registry
  33844. +
  33845. +The event registry `xpp::event::registry<Connection, Extensions ...>` can be
  33846. +used to connect events and event handlers.
  33847. +
  33848. +First, a registry object for the desired `Connection` type and `Extensions` is
  33849. +necessary.
  33850. +
  33851. +Then, arbitrary objects, which implement the `xpp::event::sink<..>` interface
  33852. +need to be attached for event handling by calling the `attach()` method.
  33853. +It takes two parameters. The first one specifies the priority, in case there are
  33854. +more than one event handler for this event. Handlers with lower priorities are
  33855. +called first. The second one is a pointer to an object which implements the
  33856. +`xpp::event::sink<..>` interface.
  33857. +
  33858. +For a detailed example, take a look at this [demo](src/examples/demo_01.cpp).
  33859. +
  33860. +### Interfaces
  33861. +
  33862. +Interfaces for creating custom types are available.
  33863. +
  33864. +##### <a name="interface-connection"></a>Connection
  33865. +
  33866. +For every extension a "connection" interface, called
  33867. +`xpp:: ExtensionName ::interface<typename Derived, typename Connection>`
  33868. +is available.
  33869. +
  33870. +These encapsulate every request for a particular extension. The `Derived`
  33871. +template parameter specifies the class which wants to derive from the interface.
  33872. +The `Derived` class must provide a method `Connection connection();`.
  33873. +
  33874. +Examples:
  33875. +
  33876. +```
  33877. +xpp::x::interface<typename Derived, typename Connection>
  33878. +xpp::randr::interface<typename Derived, typename Connection>
  33879. +xpp::damage::interface<typename Derived, typename Connection>
  33880. +etc.
  33881. +```
  33882. +
  33883. +For a customizable default implementation, take a look at the `xpp::connection`
  33884. +class described [here](#default-type-connection).
  33885. +
  33886. +##### Resources
  33887. +
  33888. +In addition, interfaces for basic resource types like `xcb_window_t`,
  33889. +`xcb_atom_t`, `xcb_gcontext_t`, etc. are available.
  33890. +
  33891. +Again, the naming scheme follows the format
  33892. +`xpp:: ExtensionName :: XidType <typename Derived, typename Connection>`
  33893. +
  33894. +Despite the `connection()` method described [here](#interface-connection),
  33895. +`Derived` needs to implement a `resource()` method which returns a xid which
  33896. +will be passed as parameter to the encapsulated requests.
  33897. +
  33898. +Examples:
  33899. +
  33900. +```
  33901. +xpp::x::window<typename Derived, typename Connection>
  33902. +xpp::randr::output<typename Derived, typename Connection>
  33903. +xpp::render::glyphset<typename Derived, typename Connection>
  33904. +etc.
  33905. +```
  33906. +
  33907. +### Default Types
  33908. +
  33909. +##### <a name="default-type-connection"></a>Connection
  33910. +
  33911. +`xpp::connection<Extensions ...>` provides a default
  33912. +implementation of the [core connection methods](include/core.hpp), the core
  33913. +X protocol and error handling facilities. In addition, it is implicitly
  33914. +convertible to `xcb_connection_t *`, hence it can be used seamlessly with XCB
  33915. +functions. The connection can be augmented with additional extension methods, by
  33916. +specifying the desired extensions as template parameters.
  33917. +
  33918. +Example:
  33919. +
  33920. +`typedef xpp::connection<xpp::randr::extension, xpp::damage::extension> my_connection;`
  33921. +
  33922. +##### Resources
  33923. +
  33924. +For the basic resource types like `Drawable`, `Window`, `Pixmap`, `Atom`,
  33925. +`Colormap`, `Cursor`, `Font`, `Fontable` and `GContext` wrapper types exist.
  33926. +They are named `xpp::drawable`, `xpp::window`, etc.
  33927. +
  33928. +Each is based upon xpp::generic::resource and provides the core X protocol
  33929. +interface for the encapsulated resource type. If the resource can be acquired
  33930. +from the X server (e.g. with `CreateWindow`) then a named constructor is
  33931. +available (e.g. `create_window` for `xpp::window`).
  33932. +
  33933. +Resources acquired through the named constructors are reference counted. When
  33934. +their lifetime expires, the resource handle will automatically be freed on the
  33935. +server. No call to destroy or free functions is necessary.
  33936. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/examples/demo_01.cpp polybar-3.2.1/lib/xpp/src/examples/demo_01.cpp
  33937. --- polybar-3.2.1.orig/lib/xpp/src/examples/demo_01.cpp 1970-01-01 02:00:00.000000000 +0200
  33938. +++ polybar-3.2.1/lib/xpp/src/examples/demo_01.cpp 2017-08-30 16:02:01.000000000 +0300
  33939. @@ -0,0 +1,138 @@
  33940. +// This demo will allow the user to click on a window, grab the keyboard on it
  33941. +// and then print every key press and release event. Will exit when Escape is
  33942. +// pressed
  33943. +
  33944. +#include <iostream>
  33945. +
  33946. +#include <X11/Xlib.h> // XKeysymToString
  33947. +#include <X11/keysym.h> // XK_Escape
  33948. +#include <X11/cursorfont.h> // XC_cross
  33949. +
  33950. +#include "../xpp.hpp"
  33951. +
  33952. +// global variable to indicate whether the event loop should exit
  33953. +bool g_quit = false;
  33954. +
  33955. +// typedefs for convenience
  33956. +namespace x {
  33957. + typedef xpp::connection<> connection;
  33958. + typedef xpp::event::registry<connection &> registry;
  33959. +
  33960. + typedef xpp::font<connection &> font;
  33961. + typedef xpp::cursor<connection &> cursor;
  33962. + typedef xpp::window<connection &> window;
  33963. +
  33964. + typedef xpp::x::event::key_press<connection &> key_press;
  33965. + typedef xpp::x::event::key_release<connection &> key_release;
  33966. + typedef xpp::x::event::button_press<connection &> button_press;
  33967. +};
  33968. +
  33969. +// The event handler class
  33970. +// Implements the xpp::event::sink<..> interface with all events we are
  33971. +// interested in as template parameters
  33972. +template<typename Connection>
  33973. +class key_printer
  33974. + : public xpp::event::sink<x::key_press, x::key_release, x::button_press>
  33975. +{
  33976. + public:
  33977. + template<typename C>
  33978. + key_printer(C && c)
  33979. + : m_c(std::forward<C>(c))
  33980. + {}
  33981. +
  33982. + // xpp::event::sink<x::key_press>::handle(...) interface
  33983. + void handle(const x::key_press & e)
  33984. + {
  33985. + auto kbd_mapping = m_c.get_keyboard_mapping(e->detail, 1);
  33986. + // take the first value from the kbd_mapping list
  33987. + // This might throw, but for simplicity, no error handling here
  33988. + auto keysym = *kbd_mapping.keysyms().begin();
  33989. +
  33990. + if (keysym == XK_Escape) {
  33991. + std::cerr << "quitting" << std::endl;
  33992. + // parameter has a default value: XCB_TIME_CURRENT_TIME
  33993. + m_c.ungrab_keyboard();
  33994. + g_quit = true;
  33995. + } else {
  33996. + std::cerr << "key press: " << XKeysymToString(keysym) << std::endl;
  33997. + }
  33998. + }
  33999. +
  34000. + // xpp::event::sink<x::key_release>::handle(...) interface
  34001. + void handle(const x::key_release & e)
  34002. + {
  34003. + auto kbd_mapping = m_c.get_keyboard_mapping(e->detail, 1);
  34004. + auto keysym = *kbd_mapping.keysyms().begin();
  34005. + std::cerr << "key release: " << XKeysymToString(keysym) << std::endl;
  34006. + }
  34007. +
  34008. + // xpp::event::sink<x::button_press>::handle(...) interface
  34009. + void handle(const x::button_press & e)
  34010. + {
  34011. + m_c.ungrab_pointer(XCB_TIME_CURRENT_TIME);
  34012. +
  34013. + // event & reply accessors have a default template parameter, the c-type
  34014. + // Usable with any type which is constructible from the c-type or
  34015. + // connection + c-type
  34016. + // xcb_window_t grab_window = e.event();
  34017. + x::window grab_window = e.event<x::window>();
  34018. +
  34019. + if (e->event == e->root) {
  34020. + // xpp::window, etc. are assignable with the c-type
  34021. + grab_window = e.child();
  34022. + // xpp::window, etc. are implicitly convertible to c-type
  34023. + auto translate = grab_window.translate_coordinates(grab_window, 1, 1);
  34024. + grab_window = translate->child;
  34025. + }
  34026. +
  34027. + *m_c.grab_keyboard(true, grab_window,
  34028. + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
  34029. +
  34030. + std::cerr << "Grabbed " << grab_window
  34031. + << ". Press Escape to quit." << std::endl;
  34032. + }
  34033. +
  34034. + private:
  34035. + Connection m_c;
  34036. +};
  34037. +
  34038. +int main(int, char **)
  34039. +{
  34040. + try {
  34041. + // xpp::connection is implicitly convertible to xcb_connection_t *
  34042. + // Hence, it can be used with all xcb_* c functions.
  34043. + // However, this is not demonstrated here.
  34044. + x::connection connection;
  34045. + x::registry registry(connection);
  34046. +
  34047. + key_printer<x::connection &> key_printer(connection);
  34048. + registry.attach(0, &key_printer);
  34049. +
  34050. + x::font font = x::font::open_checked(connection, "cursor");
  34051. +
  34052. + // x::font, etc. is implicitly convertible to xcb_font_t
  34053. + x::cursor cursor = x::cursor::create_glyph_checked(connection, font, font,
  34054. + XC_cross, XC_cross + 1, 0, 0, 0, 0xffff, 0xffff, 0xffff);
  34055. +
  34056. + *connection.grab_pointer(false, connection.root(),
  34057. + XCB_EVENT_MASK_BUTTON_PRESS,
  34058. + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
  34059. + XCB_NONE, cursor);
  34060. + // default value for time = XCB_TIME_CURRENT_TIME);
  34061. +
  34062. + std::cerr << "Please click on a window" << std::endl;
  34063. +
  34064. + while (! g_quit) {
  34065. + connection.flush();
  34066. + registry.dispatch(connection.wait_for_event());
  34067. + }
  34068. +
  34069. + } catch (const std::exception & error) {
  34070. + std::cerr << "Exception (std::exception) in "
  34071. + << __FILE__ << " @ line " << __LINE__ << ", what(): "
  34072. + << error.what() << std::endl;
  34073. + std::exit(EXIT_FAILURE);
  34074. + }
  34075. +
  34076. + return EXIT_SUCCESS;
  34077. +}
  34078. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/examples/demo_02.cpp polybar-3.2.1/lib/xpp/src/examples/demo_02.cpp
  34079. --- polybar-3.2.1.orig/lib/xpp/src/examples/demo_02.cpp 1970-01-01 02:00:00.000000000 +0200
  34080. +++ polybar-3.2.1/lib/xpp/src/examples/demo_02.cpp 2017-08-30 16:02:01.000000000 +0300
  34081. @@ -0,0 +1,229 @@
  34082. +#include <iostream>
  34083. +
  34084. +#include "../xpp.hpp"
  34085. +#include "../proto/randr.hpp"
  34086. +#include "../proto/damage.hpp"
  34087. +#include "../proto/render.hpp"
  34088. +
  34089. +// typedefs for convenience
  34090. +namespace x {
  34091. + typedef xpp::connection<xpp::randr::extension,
  34092. + xpp::damage::extension,
  34093. + xpp::render::extension>
  34094. + connection;
  34095. +
  34096. + typedef xpp::event::registry<connection &,
  34097. + xpp::randr::extension,
  34098. + xpp::damage::extension,
  34099. + xpp::render::extension>
  34100. + registry;
  34101. +
  34102. + typedef xpp::font<connection &> font;
  34103. + typedef xpp::cursor<connection &> cursor;
  34104. + typedef xpp::window<connection &> window;
  34105. + typedef xpp::window<xcb_connection_t *> xcb_window;
  34106. +};
  34107. +
  34108. +int main(int, char **)
  34109. +{
  34110. + x::connection connection;
  34111. + x::registry registry(connection);
  34112. +
  34113. + // Print out all available font paths
  34114. + auto && paths = connection.get_font_path().path();
  34115. + std::cerr << "paths "
  34116. + << "(length: " << std::distance(paths.begin(), paths.end()) << "):"
  34117. + << std::endl;
  34118. + for (auto && path : paths) {
  34119. + std::cerr << "path [" << path.length() << "]: " << path << std::endl;
  34120. + }
  34121. + std::cerr << std::endl;
  34122. +
  34123. + // Print out all available fonts
  34124. + auto && fonts = connection.list_fonts(8, 1, "*").names();
  34125. + std::cerr << "fonts "
  34126. + << "(length: " << std::distance(fonts.begin(), fonts.end()) << "):"
  34127. + << std::endl;
  34128. + for (auto && name : fonts) {
  34129. + std::cerr << "font [" << name.length() << "]: " << name << std::endl;
  34130. + }
  34131. + std::cerr << std::endl;
  34132. +
  34133. + // Print all windows and their subwindows
  34134. + auto tree = connection.root<x::window>().query_tree();
  34135. + std::cerr << "children: " << std::endl;
  34136. + for (auto && child : tree.children<x::xcb_window>()) {
  34137. + std::cerr << child << " ";
  34138. + auto siblings = child.query_tree().children();
  34139. + auto siblings_length = std::distance(siblings.begin(), siblings.end());
  34140. + if (siblings_length > 0) {
  34141. + std::cerr << std::hex << "[" << siblings_length
  34142. + << " sibling" << (siblings_length > 1 ? "s" : "") << ": ";
  34143. + for (auto && sibling : siblings) {
  34144. + std::cerr << "0x" << sibling << (--siblings_length > 0 ? ", " : "");
  34145. + }
  34146. + std::cerr << std::dec << "]" << std::endl;
  34147. + } else {
  34148. + std::cerr << "[no siblings]" << std::endl;
  34149. + }
  34150. + }
  34151. + std::cerr << std::endl;
  34152. +
  34153. + // Creates an atom called "XPP_STRING_PROPERTY_DEMO" with a string property
  34154. + // "xpp is working" on the root window
  34155. + // check with `xprop -root XPP_STRING_PROPERTY_DEMO`
  34156. + try {
  34157. + auto my_string_atom =
  34158. + xpp::x::intern_atom(connection, false, "XPP_STRING_PROPERTY_DEMO");
  34159. +
  34160. + std::string my_string("xpp is working!");
  34161. +
  34162. + std::cerr << "atom for \"XPP_STRING_PROPERTY_DEMO\": "
  34163. + << my_string_atom.atom() << std::endl;
  34164. +
  34165. + auto atom_name = connection.get_atom_name(my_string_atom.atom());
  34166. + std::cerr << "atom name: " << atom_name.name() << std::endl;;
  34167. +
  34168. + connection.change_property_checked(
  34169. + XCB_PROP_MODE_REPLACE, connection.root(),
  34170. + my_string_atom.atom(), XCB_ATOM_STRING, 8,
  34171. + // using Iterator begin + end here
  34172. + my_string.begin(), my_string.end());
  34173. +
  34174. + // this will deliberately fail because window = 0
  34175. + // However, the previous call to change_property succeeded,
  34176. + // so everything is just fine
  34177. + connection.change_property_checked( XCB_PROP_MODE_REPLACE, 0,
  34178. + my_string_atom.atom(), XCB_ATOM_STRING, 8,
  34179. + // using length() & c_str()
  34180. + my_string.length(), my_string.c_str());
  34181. +
  34182. + } catch (const std::exception & e) {
  34183. + std::cerr << "change property failed: " << e.what() << std::endl;
  34184. + }
  34185. + std::cerr << std::endl;
  34186. +
  34187. + // Get the _NET_CLIENT_LIST_STACKING property
  34188. + // If an error occurs, it will be thrown only when trying to access the reply
  34189. + std::string _net_client_list_stacking = "_NET_CLIENT_LIST_STACKING";
  34190. + auto net_client_list_stacking_atom =
  34191. + connection.intern_atom(false, _net_client_list_stacking);
  34192. + auto net_client_list_stacking = connection.get_property(
  34193. + false, connection.root(), net_client_list_stacking_atom.atom(),
  34194. + XCB_ATOM_WINDOW, 0, UINT32_MAX);
  34195. +
  34196. + try {
  34197. + std::cerr << _net_client_list_stacking << " (xcb_window_t):" << std::hex;
  34198. + for (auto && w : net_client_list_stacking.value<xcb_window_t>()) {
  34199. + std::cerr << " 0x" << w;
  34200. + }
  34201. + std::cerr << std::dec << std::endl;
  34202. +
  34203. + std::cerr << _net_client_list_stacking << " (x::window):";
  34204. + for (auto && w : net_client_list_stacking.value<x::window>()) {
  34205. + std::cerr << " " << w;
  34206. + }
  34207. + std::cerr << std::endl;
  34208. +
  34209. + std::cerr << _net_client_list_stacking << " (x::xcb_window):";
  34210. + for (auto && w : net_client_list_stacking.value<x::xcb_window>()) {
  34211. + std::cerr << " " << w;
  34212. + }
  34213. + std::cerr << std::endl;
  34214. +
  34215. + } catch (const std::exception & e) {
  34216. + std::cerr << "Could not get " << _net_client_list_stacking << " property: "
  34217. + << e.what() << std::endl;
  34218. + }
  34219. + std::cerr << std::endl;
  34220. +
  34221. + // Randr needs query_version to work properly in subsequent calls
  34222. + // If methods are ambiguous (like query_version, then the extension interface
  34223. + // can be accessed through "extension_name()" (e.g. randr() or damage())
  34224. + connection.randr().query_version(XCB_RANDR_MAJOR_VERSION,
  34225. + XCB_RANDR_MINOR_VERSION);
  34226. +
  34227. + connection.select_input_checked(connection.root(), XCB_RANDR_NOTIFY);
  34228. +
  34229. + const auto & randr_ext = connection.extension<xpp::randr::extension>();
  34230. +
  34231. + std::cerr << "RandR Extension" << std::endl;
  34232. + std::cerr << "\tfirst_event: " << (int)randr_ext->first_event << std::endl;
  34233. + std::cerr << "\tfirst_error: " << (int)randr_ext->first_error << std::endl;
  34234. +
  34235. + const auto & damage_ext = connection.extension<xpp::damage::extension>();
  34236. +
  34237. + std::cerr << "Damage Extension" << std::endl;
  34238. + std::cerr << "\tfirst_event: " << (int)damage_ext->first_event << std::endl;
  34239. + std::cerr << "\tfirst_error: " << (int)damage_ext->first_error << std::endl;
  34240. +
  34241. + std::cerr << std::endl;
  34242. +
  34243. + try {
  34244. + // Produces XCB_RANDR_BAD_OUTPUT error
  34245. + auto output_info = connection.get_output_info(-1);
  34246. + output_info.get();
  34247. + } catch (const std::exception & e) {
  34248. + std::cerr << "get_output_info error: " << e.what() << std::endl;
  34249. + }
  34250. +
  34251. + try {
  34252. + // Produces XCB_RANDR_BAD_CRTC error
  34253. + auto crtc_info = connection.get_crtc_info(-1);
  34254. + crtc_info.get();
  34255. + } catch (const std::exception & e) {
  34256. + std::cerr << "get_crtc_info error: " << e.what() << std::endl;
  34257. + }
  34258. +
  34259. + // Produces XCB_RANDR_BAD_OUTPUT error in event queue
  34260. + auto output_info = connection.get_output_info_unchecked(-1);
  34261. + output_info.get();
  34262. +
  34263. + // Produces XCB_RANDR_BAD_CRTC error in event queue
  34264. + auto crtc_info = connection.get_crtc_info_unchecked(-1);
  34265. + crtc_info.get();
  34266. +
  34267. + try {
  34268. + // XCB_VALUE error
  34269. + connection.change_output_property_checked(-1, -1, -1, 0, 0, 0, nullptr);
  34270. + } catch (const std::exception & e) {
  34271. + std::cerr << "change_output_property error: " << e.what() << std::endl;
  34272. + }
  34273. +
  34274. + // XCB_VALUE error in event queue
  34275. + connection.change_output_property(-1, -1, -1, 0, 0, 0, nullptr);
  34276. +
  34277. + try {
  34278. + // XCB_RENDER_PICT_FORMAT error
  34279. + auto pict_index_values = connection.query_pict_index_values(-1);
  34280. + pict_index_values.get();
  34281. + } catch (const std::exception & e) {
  34282. + std::cerr << "query_pict_index_values error: " << e.what() << std::endl;
  34283. + }
  34284. +
  34285. + try {
  34286. + // XCB_RENDER_PICTURE error
  34287. + connection.change_picture_checked(-1, 0, nullptr);
  34288. + } catch (const std::exception & e) {
  34289. + std::cerr << "change_picture error: " << e.what() << std::endl;
  34290. + }
  34291. +
  34292. + // XCB_RENDER_PICT_FORMAT error in event queue
  34293. + auto pict_index_values = connection.query_pict_index_values_unchecked(-1);
  34294. + pict_index_values.get();
  34295. +
  34296. + // XCB_RENDER_PICTURE error in event queue
  34297. + connection.change_picture(-1, 0, nullptr);
  34298. +
  34299. + // Poll the event queue a couple of times to get the errors
  34300. + for (int i = 0; i < 5; ++i) {
  34301. + connection.flush();
  34302. + try {
  34303. + registry.dispatch(connection.wait_for_event());
  34304. + } catch (const std::exception & e) {
  34305. + std::cerr << "std::exception in event queue: " << e.what() << std::endl;
  34306. + }
  34307. + }
  34308. +
  34309. + return EXIT_SUCCESS;
  34310. +}
  34311. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/examples/Makefile polybar-3.2.1/lib/xpp/src/examples/Makefile
  34312. --- polybar-3.2.1.orig/lib/xpp/src/examples/Makefile 1970-01-01 02:00:00.000000000 +0200
  34313. +++ polybar-3.2.1/lib/xpp/src/examples/Makefile 2017-08-30 16:02:01.000000000 +0300
  34314. @@ -0,0 +1,14 @@
  34315. +include ../../include/flags.makefile
  34316. +
  34317. +CXXFLAGS+=-g
  34318. +CXXFLAGS+=-Wextra
  34319. +
  34320. +CPPSRCS=$(shell find . -name '*.cpp')
  34321. +EXAMPLES=${CPPSRCS:./%.cpp=%}
  34322. +
  34323. +all: ${EXAMPLES}
  34324. +
  34325. +clean:
  34326. + rm -f ${EXAMPLES}
  34327. +
  34328. +.PHONY: clean
  34329. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/callable.cpp polybar-3.2.1/lib/xpp/src/tests/callable.cpp
  34330. --- polybar-3.2.1.orig/lib/xpp/src/tests/callable.cpp 1970-01-01 02:00:00.000000000 +0200
  34331. +++ polybar-3.2.1/lib/xpp/src/tests/callable.cpp 2017-08-30 16:02:01.000000000 +0300
  34332. @@ -0,0 +1,83 @@
  34333. +// compile with `g++ -std=c++11 test.cpp`
  34334. +#include <iostream>
  34335. +
  34336. +#define CALLABLE(FUNCTION) callable<decltype(FUNCTION), FUNCTION>
  34337. +
  34338. +template<typename Signature, Signature & S>
  34339. +struct callable;
  34340. +
  34341. +template<typename Return,
  34342. + typename ... Args, Return (&Function)(Args ...)>
  34343. +struct callable<Return(Args ...), Function> {
  34344. + Return operator()(Args ... args)
  34345. + {
  34346. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  34347. + return Function(args ...);
  34348. + }
  34349. +};
  34350. +
  34351. +template<typename ... Arguments>
  34352. +class one_size_fits_them_all;
  34353. +
  34354. +// A generic template
  34355. +template<typename T, typename U, typename V,
  34356. + typename F1, typename F2, typename F3>
  34357. +class one_size_fits_them_all<T, U, V, F1, F2, F3>
  34358. +{
  34359. + public:
  34360. + one_size_fits_them_all(void)
  34361. + {
  34362. + std::cerr << "generic one_size_fits_them_all" << std::endl
  34363. + << __PRETTY_FUNCTION__ << std::endl << std::endl;
  34364. + F1()();
  34365. + F2()();
  34366. + F3()();
  34367. + std::cerr << std::endl;
  34368. + }
  34369. +};
  34370. +
  34371. +// A specialized template
  34372. +template<typename T, typename Callable>
  34373. +class one_size_fits_them_all<T, int, int, void, void, Callable>
  34374. +{
  34375. + public:
  34376. + one_size_fits_them_all(void)
  34377. + {
  34378. + std::cerr << "specialized one_size_fits_them_all" << std::endl
  34379. + << __PRETTY_FUNCTION__ << std::endl << std::endl;
  34380. + Callable()();
  34381. + std::cerr << std::endl;
  34382. + }
  34383. +};
  34384. +
  34385. +void f1(void)
  34386. +{
  34387. + std::cerr << __PRETTY_FUNCTION__ << std::endl << std::endl;
  34388. +}
  34389. +
  34390. +void f2(void)
  34391. +{
  34392. + std::cerr << __PRETTY_FUNCTION__ << std::endl << std::endl;
  34393. +}
  34394. +
  34395. +void f3(void)
  34396. +{
  34397. + std::cerr << __PRETTY_FUNCTION__ << std::endl << std::endl;
  34398. +}
  34399. +
  34400. +int main(int argc, char ** argv)
  34401. +{
  34402. + // generic template
  34403. + auto generic = one_size_fits_them_all<
  34404. + int, int, int, CALLABLE(f1), CALLABLE(f2), CALLABLE(f3)>();
  34405. +
  34406. + // specialized template
  34407. + auto specialized_int = one_size_fits_them_all<
  34408. + int, int, int, void, void, CALLABLE(f1)>();
  34409. +
  34410. + // specialized template
  34411. + auto specialized_double = one_size_fits_them_all<
  34412. + double, int, int, void, void, CALLABLE(f3)>();
  34413. +
  34414. + return 0;
  34415. +}
  34416. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/error_test.cpp polybar-3.2.1/lib/xpp/src/tests/error_test.cpp
  34417. --- polybar-3.2.1.orig/lib/xpp/src/tests/error_test.cpp 1970-01-01 02:00:00.000000000 +0200
  34418. +++ polybar-3.2.1/lib/xpp/src/tests/error_test.cpp 2017-08-30 16:02:01.000000000 +0300
  34419. @@ -0,0 +1,497 @@
  34420. +#include <iostream>
  34421. +#include <string>
  34422. +
  34423. +#include <xcb/xcb.h>
  34424. +
  34425. +#include "../event.hpp"
  34426. +#include "../core/value_iterator.hpp"
  34427. +#include "../core/connection.hpp"
  34428. +#include "../core/extension.hpp"
  34429. +#include "../core/error.hpp"
  34430. +
  34431. +#include "../request.hpp"
  34432. +#include "../request_ng.hpp"
  34433. +
  34434. +#define CHECKED_REQUEST(NAME) \
  34435. + decltype(NAME ## _reply), NAME ## _reply, \
  34436. + decltype(NAME), NAME
  34437. +
  34438. +#define UNCHECKED_REQUEST(NAME) \
  34439. + decltype(NAME ## _reply), NAME ## _reply, \
  34440. + decltype(NAME ## _unchecked), NAME ## _unchecked
  34441. +
  34442. +namespace xpp { namespace generic {
  34443. +
  34444. +// class get_screen_info_checked
  34445. +// : public checked_reply_request<xpp::connection<xpp::extension::randr>,
  34446. +// xpp::extension::randr,
  34447. +// CHECKED_REQUEST(xcb_randr_get_screen_info)>
  34448. +// {
  34449. +// public:
  34450. +// typedef checked_reply_request<xpp::connection<xpp::extension::randr>,
  34451. +// xpp::extension::randr,
  34452. +// CHECKED_REQUEST(xcb_randr_get_screen_info)>
  34453. +// base;
  34454. +// using base::base;
  34455. +// };
  34456. +
  34457. +// class get_screen_info_unchecked
  34458. +// : public unchecked_reply_request<UNCHECKED_REQUEST(xcb_randr_get_screen_info)>
  34459. +// {
  34460. +// public:
  34461. +// typedef unchecked_reply_request<UNCHECKED_REQUEST(xcb_randr_get_screen_info)>
  34462. +// base;
  34463. +// using base::base;
  34464. +// };
  34465. +
  34466. +// template<typename NoThrow = void>
  34467. +// class get_screen_info
  34468. +// : public std::conditional<std::is_same<NoThrow, std::nothrow_t>::value,
  34469. +// get_screen_info_unchecked,
  34470. +// get_screen_info_checked>::type
  34471. +// {
  34472. +// public:
  34473. +// typedef typename std::conditional<
  34474. +// std::is_same<NoThrow, std::nothrow_t>::value,
  34475. +// get_screen_info_unchecked,
  34476. +// get_screen_info_checked>::type
  34477. +// base;
  34478. +// using base::base;
  34479. +// };
  34480. +
  34481. +/*
  34482. +class query_tree_checked
  34483. + : public checked_reply_request<xpp::connection<>, void,
  34484. + CHECKED_REQUEST(xcb_query_tree)>
  34485. +{
  34486. + public:
  34487. + typedef checked_reply_request<xpp::connection<>, void,
  34488. + CHECKED_REQUEST(xcb_query_tree)>
  34489. + base;
  34490. + using base::base;
  34491. +};
  34492. +
  34493. +class query_tree_unchecked
  34494. + : public unchecked_reply_request<UNCHECKED_REQUEST(xcb_query_tree)>
  34495. +{
  34496. + public:
  34497. + typedef unchecked_reply_request<UNCHECKED_REQUEST(xcb_query_tree)>
  34498. + base;
  34499. + using base::base;
  34500. +};
  34501. +
  34502. +template<typename NoThrow = void>
  34503. +class query_tree
  34504. + : public std::conditional<std::is_same<NoThrow, std::nothrow_t>::value,
  34505. + query_tree_unchecked,
  34506. + query_tree_checked
  34507. + >::type
  34508. +{
  34509. + public:
  34510. + typedef typename std::conditional<
  34511. + std::is_same<NoThrow, std::nothrow_t>::value,
  34512. + query_tree_unchecked,
  34513. + query_tree_checked
  34514. + >::type
  34515. + base;
  34516. + using base::base;
  34517. +};
  34518. +*/
  34519. +
  34520. +// class query_tree_checked
  34521. +// : public xpp::generic::checked::request<xpp::extension::x,
  34522. +// CHECKED_REQUEST(xcb_query_tree)>
  34523. +// {
  34524. +// typedef xpp::generic::checked::request<xpp::extension::x,
  34525. +// CHECKED_REQUEST(xcb_query_tree)>
  34526. +// base;
  34527. +// using base::base;
  34528. +// };
  34529. +
  34530. +// class map_window_checked
  34531. +// : public ::test::generic::checked::request<xpp::extension::x,
  34532. +// CHECKED_REQUEST(xcb_map_window)>
  34533. +// {
  34534. +// typedef ::test::generic::checked::request<xpp::extension::x,
  34535. +// CHECKED_REQUEST(xcb_map_window)>
  34536. +// base;
  34537. +// using base::base;
  34538. +// };
  34539. +
  34540. +// class get_screen_info
  34541. +// // : public wrapper<xpp::connection<xpp::extension::randr>, xpp::extension::randr,
  34542. +// : public wrapper<xpp::connection<xpp::extension::randr>,
  34543. +// xpp::extension::randr, xpp::extension::x,
  34544. +// decltype(xcb_randr_get_screen_info_reply), xcb_randr_get_screen_info_reply,
  34545. +// decltype(xcb_randr_get_screen_info), xcb_randr_get_screen_info>
  34546. +// {
  34547. +// public:
  34548. +// // typedef wrapper<xpp::extension::randr,
  34549. +// typedef wrapper<xpp::connection<xpp::extension::randr>,
  34550. +// xpp::extension::randr, xpp::extension::x,
  34551. +// decltype(xcb_randr_get_screen_info_reply), xcb_randr_get_screen_info_reply,
  34552. +// decltype(xcb_randr_get_screen_info), xcb_randr_get_screen_info>
  34553. +// base;
  34554. +// using base::base;
  34555. +// };
  34556. +
  34557. +// class query_tree
  34558. +// // : public wrapper<xpp::extension::x,
  34559. +// : public wrapper<xpp::connection<>,
  34560. +// xpp::extension::x, xpp::extension::x,
  34561. +// decltype(xcb_query_tree_reply), xcb_query_tree_reply,
  34562. +// decltype(xcb_query_tree), xcb_query_tree>
  34563. +// {
  34564. +// public:
  34565. +// typedef wrapper<xpp::connection<>,
  34566. +// xpp::extension::x, xpp::extension::x,
  34567. +// decltype(xcb_query_tree_reply), xcb_query_tree_reply,
  34568. +// decltype(xcb_query_tree), xcb_query_tree>
  34569. +// base;
  34570. +// using base::base;
  34571. +// };
  34572. +
  34573. +// class dpms_capable
  34574. +// // : public wrapper<// xpp::connection<xpp::extension::dpms>, xpp::extension::dpms,
  34575. +// : public wrapper<xpp::extension::dpms,
  34576. +// decltype(xcb_dpms_capable_reply), xcb_dpms_capable_reply,
  34577. +// decltype(xcb_dpms_capable), xcb_dpms_capable>
  34578. +// {
  34579. +// public:
  34580. +// // typedef wrapper<// xpp::connection<xpp::extension::dpms>, xpp::extension::dpms,
  34581. +// typedef wrapper<xpp::extension::dpms,
  34582. +// decltype(xcb_dpms_capable_reply), xcb_dpms_capable_reply,
  34583. +// decltype(xcb_dpms_capable), xcb_dpms_capable>
  34584. +// base;
  34585. +// using base::base;
  34586. +// };
  34587. +
  34588. +// class render_query_pict_index_values
  34589. +// // : public wrapper<// xpp::connection<xpp::extension::render>, xpp::extension::render,
  34590. +// : public wrapper<xpp::extension::render,
  34591. +// decltype(xcb_render_query_pict_index_values_reply), xcb_render_query_pict_index_values_reply,
  34592. +// decltype(xcb_render_query_pict_index_values), xcb_render_query_pict_index_values>
  34593. +// {
  34594. +// public:
  34595. +// // typedef wrapper<// xpp::connection<xpp::extension::render>, xpp::extension::render,
  34596. +// typedef wrapper<xpp::extension::render,
  34597. +// decltype(xcb_render_query_pict_index_values_reply), xcb_render_query_pict_index_values_reply,
  34598. +// decltype(xcb_render_query_pict_index_values), xcb_render_query_pict_index_values>
  34599. +// base;
  34600. +// using base::base;
  34601. +// };
  34602. +
  34603. +// class render_query_filters
  34604. +// // : public wrapper<xpp::extension::render,
  34605. +// : public wrapper<xpp::connection<xpp::extension::render>,
  34606. +// xpp::extension::render, xpp::extension::x,
  34607. +// decltype(xcb_render_query_filters_reply), xcb_render_query_filters_reply,
  34608. +// decltype(xcb_render_query_filters), xcb_render_query_filters>
  34609. +// {
  34610. +// public:
  34611. +// // typedef wrapper<xpp::extension::render,
  34612. +// typedef wrapper<xpp::connection<xpp::extension::render>,
  34613. +// xpp::extension::render, xpp::extension::x,
  34614. +// decltype(xcb_render_query_filters_reply), xcb_render_query_filters_reply,
  34615. +// decltype(xcb_render_query_filters), xcb_render_query_filters>
  34616. +// base;
  34617. +// using base::base;
  34618. +// };
  34619. +
  34620. +// template<>
  34621. +// class query_tree<xcb_connection_t>
  34622. +// : public wrapper<xcb_connection_t, void,
  34623. +// decltype(xcb_query_tree_reply), xcb_query_tree_reply,
  34624. +// decltype(xcb_query_tree), xcb_query_tree>
  34625. +// {
  34626. +// public:
  34627. +// typedef wrapper<xcb_connection_t, void,
  34628. +// decltype(xcb_query_tree_reply), xcb_query_tree_reply,
  34629. +// decltype(xcb_query_tree), xcb_query_tree>
  34630. +// base;
  34631. +// using base::base;
  34632. +// };
  34633. +
  34634. +}; }; // namespace xpp::generic
  34635. +
  34636. +void error_dispatcher(xcb_generic_error_t * error)
  34637. +{
  34638. + switch (error->error_code) {
  34639. + case XCB_WINDOW:
  34640. + xcb_window_error_t * e = (xcb_window_error_t *)error;
  34641. + std::cerr << "XCB_WINDOW with bad_value: " << e->bad_value << std::endl;
  34642. + // throw xpp::error::generic<XCB_WINDOW, xcb_window_error_t>(error);
  34643. + throw xpp::generic::error<XCB_WINDOW, xcb_window_error_t>(error);
  34644. + // throw xpp::x::window_error(error);
  34645. + break;
  34646. + }
  34647. +}
  34648. +
  34649. +void check_error_direct(xcb_generic_error_t * error)
  34650. +{
  34651. + if (error) {
  34652. + std::cerr << "error code: " << (int)error->error_code << std::endl;
  34653. + try {
  34654. + error_dispatcher(error);
  34655. + } catch (const std::exception & exception) {
  34656. + std::cerr << "caught exception: " << exception.what() << std::endl;
  34657. + }
  34658. + } else {
  34659. + std::cerr << "no error occurred" << std::endl;
  34660. + }
  34661. +}
  34662. +
  34663. +void check_error_event(xcb_connection_t * c)
  34664. +{
  34665. + xcb_generic_event_t * event = xcb_poll_for_event(c);
  34666. + xcb_flush(c);
  34667. + if (event) {
  34668. + uint8_t response = event->response_type & ~0x80;
  34669. + std::cerr << "event response: " << (int)response << std::endl;
  34670. + check_error_direct((xcb_generic_error_t *)event);
  34671. + } else {
  34672. + std::cerr << "no event available" << std::endl;
  34673. + }
  34674. +}
  34675. +
  34676. +void
  34677. +map_window(xcb_connection_t * c, xcb_window_t window)
  34678. +{
  34679. + xcb_map_window(c, window);
  34680. +}
  34681. +
  34682. +template<typename Extension>
  34683. +void
  34684. +map_window(const Extension & e, xcb_connection_t * c, xcb_window_t window)
  34685. +{
  34686. + typedef typename Extension::error_dispatcher dispatcher;
  34687. + dispatcher(/* e->first_error */)(
  34688. + xcb_request_check(c, xcb_map_window_checked(c, window)));
  34689. +}
  34690. +
  34691. +template<typename ... Parameters>
  34692. +void
  34693. +map_window(const xpp::connection<Parameters ...> & c, xcb_window_t window)
  34694. +{
  34695. + map_window(static_cast<const xpp::extension::x &>(c), c, window);
  34696. +}
  34697. +
  34698. +int main(int argc, char ** argv)
  34699. +{
  34700. + xpp::connection<xpp::extension::randr,
  34701. + xpp::extension::render,
  34702. + xpp::extension::dpms> c("");
  34703. + // xpp::connection<> c("");
  34704. +
  34705. + // auto tree_1 = xpp::generic::query_tree<decltype(c), xpp::extension::x>(c, 0);
  34706. + // auto tree_1 = xpp::generic::query_tree<decltype(c)>(c, 0);
  34707. + // auto tree_1 = xpp::generic::query_tree<>(static_cast<xcb_connection_t *>(c), 0);
  34708. +
  34709. + auto & randr = static_cast<xpp::randr::protocol &>(c);
  34710. + auto & render = static_cast<xpp::render::protocol &>(c);
  34711. + auto & dpms = static_cast<xpp::dpms::protocol &>(c);
  34712. +
  34713. + auto & randr_ext = static_cast<xpp::extension::randr &>(c);
  34714. + auto & render_ext = static_cast<xpp::extension::render &>(c);
  34715. + auto & dpms_ext = static_cast<xpp::extension::dpms &>(c);
  34716. +
  34717. + *randr.query_version(XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
  34718. + *render.query_version(XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION);
  34719. + *dpms.get_version(XCB_DPMS_MAJOR_VERSION, XCB_DPMS_MINOR_VERSION);
  34720. +
  34721. + std::cerr << "randr first_error: " << (int)randr_ext->first_error << std::endl;
  34722. + std::cerr << "render first_error: " << (int)render_ext->first_error << std::endl;
  34723. + std::cerr << "dpms first_error: " << (int)dpms_ext->first_error << std::endl;
  34724. +
  34725. + // auto tree = xpp::generic::query_tree(c, 0);
  34726. + // std::cerr << "tree go" << std::endl;
  34727. + // try {
  34728. + // tree.get();
  34729. + // auto error = tree.error();
  34730. + // std::cerr << error.get() << std::endl;
  34731. + // } catch (const std::exception & exception) {
  34732. + // std::cerr << "Exception: " << exception.what() << std::endl;
  34733. + // }
  34734. + // std::cerr << "tree fin" << std::endl << std::endl;
  34735. +
  34736. + // auto screen_info = xpp::generic::get_screen_info(c, 0);
  34737. + // std::cerr << "screen_info go" << std::endl;
  34738. + // try {
  34739. + // screen_info.get();
  34740. + // auto error = screen_info.error();
  34741. + // std::cerr << error.get() << std::endl;
  34742. + // } catch (const std::exception & exception) {
  34743. + // std::cerr << "Exception: " << exception.what() << std::endl;
  34744. + // }
  34745. + // std::cerr << "screen_info fin" << std::endl << std::endl;
  34746. +
  34747. + // auto dpms_capable = xpp::generic::dpms_capable(c);
  34748. + // std::cerr << "dpms_capable go" << std::endl;
  34749. + // try {
  34750. + // dpms_capable.get();
  34751. + // } catch (const std::exception & exception) {
  34752. + // std::cerr << "Exception: " << exception.what() << std::endl;
  34753. + // }
  34754. + // std::cerr << "dpms_capable fin" << std::endl;
  34755. +
  34756. + // auto pict_index_values = xpp::generic::render_query_pict_index_values(c, -1);
  34757. + // std::cerr << "pict_index_values go" << std::endl;
  34758. + // try {
  34759. + // pict_index_values.get();
  34760. + // } catch (const std::exception & exception) {
  34761. + // std::cerr << "Exception: " << exception.what() << std::endl;
  34762. + // }
  34763. + // std::cerr << "pict_index_values fin" << std::endl;
  34764. +
  34765. + // auto filters = xpp::generic::render_query_filters(c, 0);
  34766. + // std::cerr << "filters go" << std::endl;
  34767. + // try {
  34768. + // filters.get();
  34769. + // auto error = filters.error();
  34770. + // std::cerr << error.get() << std::endl;
  34771. + // } catch (const std::exception & exception) {
  34772. + // std::cerr << "Exception: " << exception.what() << std::endl;
  34773. + // }
  34774. + // std::cerr << "filters fin" << std::endl << std::endl;
  34775. +
  34776. +
  34777. +
  34778. + // // auto tree_2 = xpp::generic::query_tree<xcb_connection_t>(c, 0);
  34779. + // auto tree_2 = xpp::generic::query_tree<>(c, 0);
  34780. + // std::cerr << "tree_2 go" << std::endl;
  34781. + // try {
  34782. + // tree_2.get();
  34783. + // } catch (const std::exception & exception) {
  34784. + // std::cerr << "Exception: " << exception.what() << std::endl;
  34785. + // }
  34786. + // std::cerr << "tree_2 fin" << std::endl;
  34787. +
  34788. + // auto reply = xpp::request::x::query_tree(c, 0);
  34789. + // reply.get();
  34790. + // reply.check((xpp::extension::x &)c);
  34791. +
  34792. + // auto reply = xpp::request::x::query_tree(c, 0);
  34793. + // reply.get();
  34794. + // try {
  34795. + // reply.check((xpp::extension::x &)c);
  34796. + // } catch (const std::exception & exception) {
  34797. + // std::cerr << "Exception: " << exception.what() << std::endl;
  34798. + // }
  34799. +
  34800. +
  34801. + // return 0;
  34802. +
  34803. + /*
  34804. + map_window(*c, 0);
  34805. +
  34806. + try {
  34807. + map_window(c, 0);
  34808. + } catch (...) {}
  34809. +
  34810. + try {
  34811. + map_window((xpp::extension::x &)c, c, 0);
  34812. + map_window((xpp::extension::x &)c, c, 0);
  34813. + // map_window((xpp::extension::randr &)c, c, 0);
  34814. + } catch (...) {}
  34815. + */
  34816. +
  34817. + // xcb_generic_error_t * generic_error = NULL;
  34818. + // xcb_query_tree_reply_t * query_tree_reply = NULL;
  34819. +
  34820. + // checked request with reply, error directly available
  34821. + {
  34822. + std::cerr << "checked request with reply, error directly available" << std::endl;
  34823. + // xcb_query_tree_cookie_t query_tree_cookie = xcb_query_tree(c, 5);
  34824. + // query_tree_reply = xcb_query_tree_reply(c, query_tree_cookie, &generic_error);
  34825. + try {
  34826. + auto screen_info = xpp::request::randr::get_screen_info(c, 0);
  34827. + // auto tree = xpp::generic::query_tree<>(c, 5);
  34828. + screen_info.get();
  34829. + } catch (const xpp::x::error::window & e) {
  34830. + std::cerr << "xpp::x::error::window: " << e.what() << std::endl;
  34831. + } catch (const std::exception & e) {
  34832. + std::cerr << "std::exception: " << e.what() << std::endl;
  34833. + }
  34834. + // auto reply = tree.get();
  34835. + c.flush();
  34836. + // std::cerr << "query_tree_reply: " << reply.get() << std::endl;
  34837. + // check_error_direct(tree.error());
  34838. + // std::cerr << "query_tree_reply: " << query_tree_reply << std::endl;
  34839. + // query_tree_reply = NULL;
  34840. + // check_error_direct(generic_error);
  34841. + // check_error_direct(generic_error);
  34842. + // generic_error = NULL;
  34843. + }
  34844. + std::cerr << std::endl;
  34845. +
  34846. + // checked request with reply, error directly available
  34847. + {
  34848. + std::cerr << "checked request with reply, error directly available" << std::endl;
  34849. + // xcb_query_tree_cookie_t query_tree_cookie = xcb_query_tree(c, 5);
  34850. + // query_tree_reply = xcb_query_tree_reply(c, query_tree_cookie, &generic_error);
  34851. + try {
  34852. + auto tree = xpp::request::x::query_tree(c, 5);
  34853. + // auto tree = xpp::generic::query_tree<>(c, 5);
  34854. + tree.get();
  34855. + } catch (const xpp::x::error::window & e) {
  34856. + std::cerr << "xpp::x::error::window: " << e.what() << std::endl;
  34857. + } catch (const std::exception & e) {
  34858. + std::cerr << "std::exception: " << e.what() << std::endl;
  34859. + }
  34860. + // auto reply = tree.get();
  34861. + c.flush();
  34862. + // std::cerr << "query_tree_reply: " << reply.get() << std::endl;
  34863. + // check_error_direct(tree.error());
  34864. + // std::cerr << "query_tree_reply: " << query_tree_reply << std::endl;
  34865. + // query_tree_reply = NULL;
  34866. + // check_error_direct(generic_error);
  34867. + // check_error_direct(generic_error);
  34868. + // generic_error = NULL;
  34869. + }
  34870. + std::cerr << std::endl;
  34871. +
  34872. + // // unchecked request with reply, error in event queue
  34873. + // {
  34874. + // std::cerr << "unchecked request with reply, error in event queue" << std::endl;
  34875. + // // xcb_query_tree_cookie_t query_tree_cookie = xcb_query_tree_unchecked(c, 17);
  34876. + // // query_tree_reply = xcb_query_tree_reply(c, query_tree_cookie, &generic_error);
  34877. + // auto tree = xpp::generic::query_tree<std::nothrow_t>(c, 5);
  34878. + // auto reply = tree.get();
  34879. + // c.flush();
  34880. + // std::cerr << "query_tree_reply: " << reply.get() << std::endl;
  34881. + // // std::cerr << "query_tree_reply: " << query_tree_reply << std::endl;
  34882. + // // std::cerr << "query_tree_reply error: " << generic_error << std::endl;
  34883. + // // query_tree_reply = NULL;
  34884. + // check_error_event(c);
  34885. + // }
  34886. + // std::cerr << std::endl;
  34887. +
  34888. + // // checked request without reply, error directly available
  34889. + // {
  34890. + // std::cerr << "checked request without reply, error directly available" << std::endl;
  34891. + // // xcb_void_cookie_t void_cookie = xcb_map_window_checked(c, 42);
  34892. + // try {
  34893. + // ::test::map_window(c, 0);
  34894. + // // xpp::request::x::map_window(c, 0);
  34895. + // } catch (const xpp::x::error::window & e) {
  34896. + // std::cerr << "xpp::x::error::window: " << e.what() << std::endl;
  34897. + // } catch (const std::exception & e) {
  34898. + // std::cerr << "std::exception: " << e.what() << std::endl;
  34899. + // }
  34900. + // c.flush();
  34901. + // // generic_error = xcb_request_check(c, void_cookie);
  34902. + // // check_error_direct(generic_error);
  34903. + // // generic_error = NULL;
  34904. + // }
  34905. + // std::cerr << std::endl;
  34906. +
  34907. + // unchecked request without reply, error in event queue
  34908. + {
  34909. + std::cerr << "unchecked request without reply, error in event queue" << std::endl;
  34910. + xcb_map_window(c, 0);
  34911. + c.flush();
  34912. + check_error_event(c);
  34913. + }
  34914. +
  34915. + return 0;
  34916. +}
  34917. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/event.cpp polybar-3.2.1/lib/xpp/src/tests/event.cpp
  34918. --- polybar-3.2.1.orig/lib/xpp/src/tests/event.cpp 1970-01-01 02:00:00.000000000 +0200
  34919. +++ polybar-3.2.1/lib/xpp/src/tests/event.cpp 2017-08-30 16:02:01.000000000 +0300
  34920. @@ -0,0 +1,125 @@
  34921. +#include <iostream>
  34922. +
  34923. +#include "../event.hpp"
  34924. +#include "../connection.hpp"
  34925. +
  34926. +using namespace xpp;
  34927. +using namespace event;
  34928. +
  34929. +xcb_window_t
  34930. +get_window(xcb_button_press_event_t * const e)
  34931. +{
  34932. + return e->event;
  34933. +}
  34934. +
  34935. +xcb_window_t
  34936. +get_window(xcb_motion_notify_event_t * const e)
  34937. +{
  34938. + return e->event;
  34939. +}
  34940. +
  34941. +namespace test {
  34942. +
  34943. +class handler : public dispatcher
  34944. + , public sink<button::press>
  34945. + , public sink<button::release>
  34946. + , public sink<motion::notify>
  34947. +{
  34948. + public:
  34949. + void handle(const button::press &)
  34950. + {
  34951. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  34952. + }
  34953. +
  34954. + void handle(const button::release & e)
  34955. + {
  34956. + if (XCB_BUTTON_PRESS == (e->response_type & ~0x80)) {
  34957. + std::cerr << __PRETTY_FUNCTION__ << " XCB_BUTTON_PRESS" << std::endl;
  34958. + } else {
  34959. + std::cerr << __PRETTY_FUNCTION__ << " XCB_BUTTON_RELEASE" << std::endl;
  34960. + }
  34961. + }
  34962. +
  34963. + void handle(const motion::notify &)
  34964. + {
  34965. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  34966. + }
  34967. +};
  34968. +
  34969. +class container : public direct::container {
  34970. + public:
  34971. + dispatcher * const
  34972. + at(const unsigned int & window) const
  34973. + {
  34974. + return m_dispatcher.at(window);
  34975. + }
  34976. +
  34977. + std::unordered_map<unsigned int, dispatcher *> m_dispatcher;
  34978. +};
  34979. +
  34980. +struct foo {
  34981. + void bar(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  34982. +};
  34983. +
  34984. +class foo_container : public any::container<foo> {
  34985. + public:
  34986. + foo * const at(const unsigned int & window)
  34987. + {
  34988. + return &m_foos.at(window);
  34989. + }
  34990. +
  34991. + std::unordered_map<unsigned int, foo> m_foos;
  34992. +};
  34993. +
  34994. +class foo_handler : public any::adapter<foo, button::press, 0, get_window> {
  34995. + public:
  34996. + using adapter::adapter;
  34997. +
  34998. + void handle(foo * const f, const button::press & e)
  34999. + {
  35000. + std::cerr << __PRETTY_FUNCTION__ << " response_type: " << (int)(e->response_type & ~0x80) << std::endl;
  35001. + f->bar();
  35002. + }
  35003. +};
  35004. +
  35005. +}; // namespace test
  35006. +
  35007. +int main(int argc, char ** argv)
  35008. +{
  35009. + connection c("");
  35010. + source source(c);
  35011. +
  35012. + auto tree = c.query_tree(c.root());
  35013. +
  35014. + test::handler handler;
  35015. + test::container container;
  35016. +
  35017. + test::foo_container foo_container;
  35018. + test::foo_handler foo_handler(source, foo_container);
  35019. +
  35020. + for (auto & window : tree.children()) {
  35021. + *(c.grab_pointer(false, window,
  35022. + XCB_EVENT_MASK_BUTTON_PRESS
  35023. + | XCB_EVENT_MASK_BUTTON_RELEASE
  35024. + | XCB_EVENT_MASK_POINTER_MOTION,
  35025. + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
  35026. + XCB_NONE, XCB_NONE, XCB_TIME_CURRENT_TIME));
  35027. +
  35028. + container.m_dispatcher[window] = &handler;
  35029. + foo_container.m_foos[window] = test::foo();
  35030. + }
  35031. +
  35032. + dispatcher * dispatcher[] =
  35033. + { new direct::adapter<button::press, 0, get_window>(source, container)
  35034. + , new direct::adapter<button::release, 0, get_window>(source, container)
  35035. + , new direct::adapter<motion::notify, 0, get_window>(source, container)
  35036. + };
  35037. +
  35038. + source.run();
  35039. +
  35040. + for (auto * d : dispatcher) {
  35041. + delete d;
  35042. + }
  35043. +
  35044. + return EXIT_SUCCESS;
  35045. +}
  35046. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/.gitignore polybar-3.2.1/lib/xpp/src/tests/.gitignore
  35047. --- polybar-3.2.1.orig/lib/xpp/src/tests/.gitignore 1970-01-01 02:00:00.000000000 +0200
  35048. +++ polybar-3.2.1/lib/xpp/src/tests/.gitignore 2017-08-30 16:02:01.000000000 +0300
  35049. @@ -0,0 +1,2 @@
  35050. +event
  35051. +iterator
  35052. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/iterator.cpp polybar-3.2.1/lib/xpp/src/tests/iterator.cpp
  35053. --- polybar-3.2.1.orig/lib/xpp/src/tests/iterator.cpp 1970-01-01 02:00:00.000000000 +0200
  35054. +++ polybar-3.2.1/lib/xpp/src/tests/iterator.cpp 2017-08-30 16:02:01.000000000 +0300
  35055. @@ -0,0 +1,155 @@
  35056. +#include <iostream>
  35057. +
  35058. +#include "../connection.hpp"
  35059. +
  35060. +class test {
  35061. + public:
  35062. +
  35063. + template<typename Data>
  35064. + class iterator {
  35065. + public:
  35066. + iterator(Data * const data, std::size_t index)
  35067. + : m_data(data), m_index(index)
  35068. + {}
  35069. +
  35070. + bool operator==(const iterator & other)
  35071. + {
  35072. + return m_index == other.m_index;
  35073. + }
  35074. +
  35075. + bool operator!=(const iterator & other)
  35076. + {
  35077. + return ! (*this == other);
  35078. + }
  35079. +
  35080. + const Data & operator*(void)
  35081. + {
  35082. + return m_data[m_index];
  35083. + }
  35084. +
  35085. + // prefix
  35086. + iterator & operator++(void)
  35087. + {
  35088. + ++m_index;
  35089. + return *this;
  35090. + }
  35091. +
  35092. + // postfix
  35093. + iterator operator++(int)
  35094. + {
  35095. + auto copy = *this;
  35096. + ++(*this);
  35097. + return copy;
  35098. + }
  35099. +
  35100. + // prefix
  35101. + iterator & operator--(void)
  35102. + {
  35103. + --m_index;
  35104. + return *this;
  35105. + }
  35106. +
  35107. + // postfix
  35108. + iterator operator--(int)
  35109. + {
  35110. + auto copy = *this;
  35111. + --(*this);
  35112. + return copy;
  35113. + }
  35114. +
  35115. + private:
  35116. + Data * const m_data;
  35117. + std::size_t m_index = 0;
  35118. + };
  35119. +
  35120. +
  35121. + template<typename T>
  35122. + iterator<T> begin(void)
  35123. + {
  35124. + throw "This must not happen!";
  35125. + }
  35126. +
  35127. + template<typename T>
  35128. + iterator<T> end(void)
  35129. + {
  35130. + throw "This must not happen!";
  35131. + }
  35132. +
  35133. + // private:
  35134. + std::vector<int> m_ints;
  35135. + std::vector<double> m_doubles;
  35136. +
  35137. +};
  35138. +
  35139. +template<>
  35140. +test::iterator<int> test::begin<int>(void)
  35141. +{
  35142. + return iterator<int>(m_ints.data(), 0);
  35143. +}
  35144. +
  35145. +template<>
  35146. +test::iterator<double> test::begin<double>(void)
  35147. +{
  35148. + return iterator<double>(m_doubles.data(), 0);
  35149. +}
  35150. +
  35151. +template<>
  35152. +test::iterator<int> test::end<int>(void)
  35153. +{
  35154. + return iterator<int>(m_ints.data(), m_ints.size());
  35155. +}
  35156. +
  35157. +template<>
  35158. +test::iterator<double> test::end<double>(void)
  35159. +{
  35160. + return iterator<double>(m_doubles.data(), m_ints.size());
  35161. +}
  35162. +
  35163. +int main(int argc, char ** argv)
  35164. +{
  35165. + xpp::connection c("");
  35166. +
  35167. + auto tree = c.query_tree(c.root());
  35168. +
  35169. + std::cerr << "#windows (children_len): " << tree->children_len << std::endl;
  35170. + std::cerr << "#windows (length): " << tree->length << std::endl;
  35171. +
  35172. + std::cerr << std::hex;
  35173. + for (auto & window : tree.children()) {
  35174. + std::cerr << "0x" << window << "; ";
  35175. + }
  35176. + std::cerr << std::dec << std::endl;;
  35177. +
  35178. + std::cerr << std::hex;
  35179. + for (auto it = tree.children().begin(); it != tree.children().end(); ++it) {
  35180. + std::cerr << "0x" << *it << "; ";
  35181. + }
  35182. + std::cerr << std::dec << std::endl;;
  35183. +
  35184. + std::cerr << std::hex;
  35185. + auto it = tree.children().begin();
  35186. + std::cerr << "it : " << *it << std::endl;
  35187. + std::cerr << "++it: " << *(++it) << std::endl;
  35188. + std::cerr << "it : " << *it << std::endl;
  35189. + std::cerr << "it++: " << *(it++) << std::endl;
  35190. + std::cerr << "it : " << *it << std::endl;
  35191. + std::cerr << "++it: " << *(++it) << std::endl;
  35192. + std::cerr << "it : " << *it << std::endl;
  35193. + std::cerr << "--it: " << *(--it) << std::endl;
  35194. + std::cerr << "it : " << *it << std::endl;
  35195. + std::cerr << "it--: " << *(it--) << std::endl;
  35196. + std::cerr << "it : " << *it << std::endl;
  35197. + std::cerr << std::dec << std::endl;;
  35198. +
  35199. + auto atom = c.intern_atom(false, "_NET_CLIENT_LIST_STACKING");
  35200. + auto properties = c.get_property<xcb_window_t>(
  35201. + false, c.root(), atom->atom, XCB_ATOM_WINDOW, 0, UINT32_MAX);
  35202. +
  35203. + std::cerr << std::hex;
  35204. + for (auto & window : properties) {
  35205. + std::cerr << "0x" << window << "; ";
  35206. + }
  35207. + std::cerr << std::dec << std::endl;;
  35208. +
  35209. + return EXIT_SUCCESS;
  35210. +}
  35211. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/Makefile polybar-3.2.1/lib/xpp/src/tests/Makefile
  35212. --- polybar-3.2.1.orig/lib/xpp/src/tests/Makefile 1970-01-01 02:00:00.000000000 +0200
  35213. +++ polybar-3.2.1/lib/xpp/src/tests/Makefile 2017-08-30 16:02:01.000000000 +0300
  35214. @@ -0,0 +1,25 @@
  35215. +include ../../include/flags.makefile
  35216. +
  35217. +# CXX=clang
  35218. +CXXFLAGS+=-g
  35219. +# CXXFLAGS+=-Wextra
  35220. +# CXXFLAGS+=-ftime-report
  35221. +
  35222. +CPPSRCS=event.cpp \
  35223. + requests.cpp \
  35224. + iterator.cpp
  35225. +
  35226. +all: ${CPPSRCS}
  35227. +
  35228. +${CPPSRCS}:
  35229. + ${CXX} ${LDFLAGS} ${CXXFLAGS} -o $(@:%.cpp=%) $@
  35230. +
  35231. +xlib-test: xlib-test.cpp
  35232. + ${CXX} $(shell pkg-config --libs --cflags x11 xrandr) -o $@ $<
  35233. +
  35234. +version:
  35235. +
  35236. +clean:
  35237. + rm -f ${CPPSRCS:%.cpp=%}
  35238. +
  35239. +.PHONY: ${CPPSRCS} clean
  35240. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/README.md polybar-3.2.1/lib/xpp/src/tests/README.md
  35241. --- polybar-3.2.1.orig/lib/xpp/src/tests/README.md 1970-01-01 02:00:00.000000000 +0200
  35242. +++ polybar-3.2.1/lib/xpp/src/tests/README.md 2017-08-30 16:02:01.000000000 +0300
  35243. @@ -0,0 +1,2 @@
  35244. +Just a couple of experiments to try out concepts, language features, ideas.
  35245. +Might or might not compile, run or crash, etc.
  35246. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/requests.cpp polybar-3.2.1/lib/xpp/src/tests/requests.cpp
  35247. --- polybar-3.2.1.orig/lib/xpp/src/tests/requests.cpp 1970-01-01 02:00:00.000000000 +0200
  35248. +++ polybar-3.2.1/lib/xpp/src/tests/requests.cpp 2017-08-30 16:02:01.000000000 +0300
  35249. @@ -0,0 +1,910 @@
  35250. +#include <iostream>
  35251. +
  35252. +// #include "../request.hpp"
  35253. +// #include "../core/connection.hpp"
  35254. +// #include "../core/window.hpp"
  35255. +// #include <xcb/xcb.h>
  35256. +// #include "../gen/sure_dude.hpp"
  35257. +// #include "../gen/xproto-stub.hpp"
  35258. +
  35259. +
  35260. +#include <X11/Xlib.h>
  35261. +#include <X11/keysym.h>
  35262. +#include <X11/cursorfont.h> // XC_cross
  35263. +
  35264. +#include "../xpp.hpp"
  35265. +#include "../proto/randr.hpp"
  35266. +#include "../proto/damage.hpp"
  35267. +#include "../proto/render.hpp"
  35268. +
  35269. +
  35270. +/*
  35271. +namespace xpp { namespace x { namespace error {
  35272. +
  35273. +void
  35274. +dispatcher::operator()(const std::shared_ptr<xcb_generic_error_t> &) const
  35275. +{
  35276. + throw std::runtime_error(
  35277. + std::string(__PRETTY_FUNCTION__)
  35278. + + "\n\thandling errors like a boss with first_error = "
  35279. + + std::to_string((uint32_t)m_first_error));
  35280. +}
  35281. +
  35282. +}; }; }; // namespace xpp::x::error
  35283. +*/
  35284. +
  35285. +// namespace my {
  35286. +//
  35287. +// struct dispatcher {
  35288. +// dispatcher(xcb_connection_t *) {}
  35289. +// void
  35290. +// operator()(const std::shared_ptr<xcb_generic_error_t> &) const
  35291. +// {
  35292. +// std::cerr << __PRETTY_FUNCTION__ << "\n\thandling errors like a boss" << std::endl;
  35293. +// }
  35294. +// };
  35295. +//
  35296. +// }; // namespace my
  35297. +
  35298. +/*
  35299. +namespace xpp {
  35300. +
  35301. +struct dummy_extension {
  35302. + uint8_t first_error = 42;
  35303. +};
  35304. +
  35305. +struct connection
  35306. + : public dummy_extension
  35307. + , public xpp::x::extension
  35308. + , public xpp::x::error::dispatcher
  35309. + // , public xpp::x::protocol<connection>
  35310. + // , virtual public xpp::generic::connection<xpp::connection>
  35311. + , public xpp::x::protocol<connection &>
  35312. + , virtual public xpp::generic::connection<xpp::connection &>
  35313. +{
  35314. + connection(xcb_connection_t * c)
  35315. + : xpp::x::error::dispatcher(
  35316. + static_cast<dummy_extension &>(*this).first_error)
  35317. + , m_c(c)
  35318. + , m_data(new int)
  35319. + {
  35320. + m_data = std::make_shared<int>();
  35321. + std::cerr << "connection c'tor: m_data.use_count(): "
  35322. + << m_data.use_count() << std::endl;
  35323. + }
  35324. +
  35325. + ~connection(void)
  35326. + {
  35327. + std::cerr << "~connection d'tor: m_data.use_count(): "
  35328. + << m_data.use_count() << std::endl;
  35329. + }
  35330. +
  35331. + connection(connection & other)
  35332. + : xpp::x::error::dispatcher(
  35333. + static_cast<const dummy_extension &>(other).first_error)
  35334. + , m_c(other.m_c)
  35335. + // , m_data(other.m_data)
  35336. + {
  35337. + std::cerr << "connection copy c'tor" << std::endl;
  35338. + }
  35339. +
  35340. + connection(connection && other) = default;
  35341. + // connection(const connection && other)
  35342. + // : xpp::x::error::dispatcher(
  35343. + // static_cast<const dummy_extension &&>(other).first_error)
  35344. + // , m_c(other.m_c)
  35345. + // {
  35346. + // std::cerr << "connection move c'tor" << std::endl;
  35347. + // }
  35348. +
  35349. + operator xcb_connection_t * const(void) const
  35350. + {
  35351. + return m_c;
  35352. + }
  35353. +
  35354. + xpp::connection &
  35355. + // xpp::connection
  35356. + get(void)
  35357. + {
  35358. + return *this;
  35359. + }
  35360. +
  35361. + xcb_connection_t * m_c;
  35362. + // std::vector<int> m_data;
  35363. + std::shared_ptr<int> m_data;
  35364. +};
  35365. +
  35366. +class window
  35367. + : public xpp::x::window<xpp::connection &>
  35368. + // , virtual public xpp::iterable<void>
  35369. + , virtual public xpp::iterable<xcb_window_t>
  35370. + // , virtual public xpp::xcb::type<const xcb_window_t &>
  35371. + // , virtual protected xpp::generic::connection<connection &>
  35372. +{
  35373. + public:
  35374. + window(xpp::connection & c, const xcb_window_t & window)
  35375. + : m_c(c)
  35376. + , m_window(window)
  35377. + {}
  35378. +
  35379. + // xpp::iterable<const xcb_window_t &>
  35380. + virtual
  35381. + void
  35382. + operator=(xcb_window_t window)
  35383. + {
  35384. + m_window = window;
  35385. + }
  35386. +
  35387. + virtual operator const xcb_window_t &(void) const
  35388. + {
  35389. + return m_window;
  35390. + }
  35391. +
  35392. + protected:
  35393. + xpp::connection & m_c;
  35394. + xcb_window_t m_window;
  35395. +
  35396. + xpp::connection &
  35397. + get(void)
  35398. + {
  35399. + return m_c;
  35400. + }
  35401. +};
  35402. +
  35403. +struct dummy_atom {
  35404. + dummy_atom(const xcb_atom_t & atom, xcb_connection_t * const) : m_atom(atom) {}
  35405. + xcb_atom_t m_atom;
  35406. +};
  35407. +
  35408. +}; // xpp
  35409. +*/
  35410. +
  35411. +// namespace xpp { namespace generic {
  35412. +//
  35413. +// template<REPLY_TEMPLATE>
  35414. +// struct reply_getter<xpp::connection, REPLY_SIGNATURE, checked_tag>
  35415. +// {
  35416. +// std::shared_ptr<Reply>
  35417. +// operator()(const xpp::connection & c, const Cookie & cookie)
  35418. +// {
  35419. +// std::cerr << "reply_getter special NO error" << std::endl;
  35420. +// return std::shared_ptr<Reply>(ReplyFunction(c, cookie, nullptr), std::free);
  35421. +// }
  35422. +// };
  35423. +//
  35424. +// }; };
  35425. +
  35426. +bool g_quit = false;
  35427. +
  35428. +namespace x {
  35429. + typedef xpp::connection<xpp::randr::extension,
  35430. + xpp::damage::extension,
  35431. + xpp::render::extension>
  35432. + connection;
  35433. +
  35434. + typedef xpp::event::registry<connection &,
  35435. + xpp::randr::extension,
  35436. + xpp::damage::extension,
  35437. + xpp::render::extension>
  35438. + registry;
  35439. +
  35440. + typedef xpp::font<connection &> font;
  35441. + typedef xpp::cursor<connection &> cursor;
  35442. + typedef xpp::window<connection &> window;
  35443. + typedef xpp::window<xcb_connection_t *> xcb_window;
  35444. +
  35445. + typedef xpp::x::event::key_press<connection &> key_press;
  35446. + typedef xpp::x::event::key_release<connection &> key_release;
  35447. + typedef xpp::x::event::button_press<connection &> button_press;
  35448. + typedef xpp::randr::event::notify<connection &> randr_notify;
  35449. + typedef xpp::randr::event::screen_change_notify<connection &> randr_screen_change_notify;
  35450. + typedef xpp::damage::event::notify<connection &> damage_notify;
  35451. +};
  35452. +
  35453. +class one_event
  35454. + : public xpp::event::sink<x::key_press>
  35455. +{
  35456. + public:
  35457. + void handle(const x::key_press &) {}
  35458. +};
  35459. +
  35460. +class two_event
  35461. + : public xpp::event::sink<x::key_press, x::key_release>
  35462. +{
  35463. + public:
  35464. + void handle(const x::key_press &) {}
  35465. + void handle(const x::key_release &) {}
  35466. +};
  35467. +
  35468. +class more_events
  35469. + : public xpp::event::sink<x::randr_notify, x::randr_screen_change_notify, x::damage_notify>
  35470. +{
  35471. + void handle(const x::randr_notify &)
  35472. + {
  35473. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  35474. + }
  35475. + void handle(const x::randr_screen_change_notify &)
  35476. + {
  35477. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  35478. + }
  35479. + void handle(const x::damage_notify &) {}
  35480. +};
  35481. +
  35482. +template<typename Connection>
  35483. +class key_printer
  35484. + : public xpp::event::sink<x::key_press,
  35485. + x::key_release,
  35486. + x::button_press>
  35487. + // xpp::randr::event::notify,
  35488. + // xpp::damage::event::notify,
  35489. + // xpp::xfixes::event::selection_notify,
  35490. + // xpp::screensaver::event::notify
  35491. + // >
  35492. +{
  35493. + public:
  35494. + template<typename C>
  35495. + key_printer(C && c)
  35496. + : m_c(std::forward<C>(c))
  35497. + {}
  35498. +
  35499. + void handle(const x::key_press & e)
  35500. + {
  35501. + auto kbd_mapping = m_c.get_keyboard_mapping(e->detail, 1);
  35502. + auto keysym = *kbd_mapping.keysyms().begin();
  35503. +
  35504. + if (keysym == XK_Escape) {
  35505. + std::cerr << "quitting" << std::endl;
  35506. + m_c.ungrab_keyboard(XCB_TIME_CURRENT_TIME);
  35507. + g_quit = true;
  35508. + } else {
  35509. + std::cerr << "key pressed: " << XKeysymToString(keysym) << std::endl;
  35510. + }
  35511. + }
  35512. +
  35513. + void handle(const x::key_release & e)
  35514. + {
  35515. + auto kbd_mapping = m_c.get_keyboard_mapping(e->detail, 1);
  35516. + auto keysym = *kbd_mapping.keysyms().begin();
  35517. + std::cerr << "key released: " << XKeysymToString(keysym) << std::endl;
  35518. + }
  35519. +
  35520. + void handle(const x::button_press & e)
  35521. + {
  35522. + m_c.ungrab_pointer(XCB_TIME_CURRENT_TIME);
  35523. +
  35524. + std::cerr << "root: 0x"
  35525. + << std::hex << e->root << std::dec
  35526. + << "; event: 0x"
  35527. + << std::hex << e->event << std::dec
  35528. + << "; child: 0x"
  35529. + << std::hex << e->child << std::dec
  35530. + << std::endl;
  35531. +
  35532. + // xcb_window_t w = e.event();
  35533. + x::window grab_window = e.event<x::window>();
  35534. + std::cerr << "grab_window: " << grab_window << std::endl;
  35535. +
  35536. + if (e->event == e->root) {
  35537. + grab_window = e.child();
  35538. + std::cerr << "new grab_window: " << grab_window << std::endl;
  35539. + auto translate = grab_window.translate_coordinates(grab_window, 1, 1);
  35540. + grab_window = translate->child;
  35541. + }
  35542. +
  35543. + std::cerr << "grabbing "
  35544. + << std::hex << grab_window << std::dec
  35545. + << std::endl;
  35546. +
  35547. + *m_c.grab_keyboard(true, grab_window,
  35548. + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
  35549. + // g_quit = true;
  35550. + }
  35551. +
  35552. + // void handle(const xpp::randr::event::notify & e)
  35553. + // {
  35554. + // std::cerr << __PRETTY_FUNCTION__ << std::endl;
  35555. + // }
  35556. +
  35557. + // void handle(const xpp::damage::event::notify & e)
  35558. + // {
  35559. + // std::cerr << __PRETTY_FUNCTION__ << std::endl;
  35560. + // }
  35561. +
  35562. + // void handle(const xpp::xfixes::event::selection_notify & e)
  35563. + // {
  35564. + // std::cerr << __PRETTY_FUNCTION__ << std::endl;
  35565. + // }
  35566. +
  35567. + // void handle(const xpp::screensaver::event::notify & e)
  35568. + // {
  35569. + // std::cerr << __PRETTY_FUNCTION__ << std::endl;
  35570. + // }
  35571. +
  35572. + // does not work
  35573. + // template<int OpCode, typename Event>
  35574. + // void handle(const xpp::generic::event<OpCode, Event> &)
  35575. + // {
  35576. + // std::cerr << __PRETTY_FUNCTION__ << std::endl;
  35577. + // }
  35578. +
  35579. + private:
  35580. + Connection m_c;
  35581. +};
  35582. +
  35583. +xcb_screen_t *
  35584. +screen_of_display(xcb_connection_t * c, int screen)
  35585. +{
  35586. + xcb_screen_iterator_t iter;
  35587. +
  35588. + iter = xcb_setup_roots_iterator(xcb_get_setup(c));
  35589. + for (; iter.rem; --screen, xcb_screen_next(&iter))
  35590. + if (screen == 0)
  35591. + return iter.data;
  35592. +
  35593. + return NULL;
  35594. +}
  35595. +
  35596. +int main(int argc, char ** argv)
  35597. +{
  35598. + // int default_screen;
  35599. + // xcb_connection_t * c = xcb_connect(nullptr, &default_screen);
  35600. + // xcb_screen_t * screen = screen_of_display(c, default_screen);
  35601. +
  35602. + // x::error_handler eh;
  35603. + x::connection connection;
  35604. + // xcb_connection_t * xcb_c = nullptr;
  35605. +
  35606. + try {
  35607. + x::window window(connection, argc > 1 ? std::strtol(argv[1], NULL, 10) : 0);
  35608. + auto tree = window.query_tree();
  35609. + std::cerr << "children of window (" << window << "): ";
  35610. + for (auto && child : tree.children<x::window>()) {
  35611. + std::cerr << child << ", ";
  35612. + }
  35613. + std::cerr << std::endl;
  35614. + } catch (const std::exception & exception) {
  35615. + std::cerr << std::endl;
  35616. + std::cerr << "window exception: " << exception.what() << std::endl;
  35617. + }
  35618. +
  35619. + auto net_client_list_stacking_atom = connection.intern_atom(
  35620. + false, "_NET_CLIENT_LIST_STACKING");
  35621. + auto net_client_list_stacking = connection.get_property(
  35622. + false, connection.root(), net_client_list_stacking_atom.atom(),
  35623. + XCB_ATOM_WINDOW, 0, UINT32_MAX);
  35624. +
  35625. + std::cerr << "_NET_CLIENT_LIST_STACKING (xcb_window_t):" << std::hex;
  35626. + for (auto && w : net_client_list_stacking.value<xcb_window_t>()) {
  35627. + std::cerr << " 0x" << w;
  35628. + }
  35629. + std::cerr << std::dec << std::endl;
  35630. +
  35631. + std::cerr << "_NET_CLIENT_LIST_STACKING (x::window):";
  35632. + for (auto && w : net_client_list_stacking.value<x::window>()) {
  35633. + std::cerr << " " << w;
  35634. + }
  35635. + std::cerr << std::endl;
  35636. +
  35637. + std::cerr << "_NET_CLIENT_LIST_STACKING (x::xcb_window):";
  35638. + for (auto && w : net_client_list_stacking.value<x::xcb_window>()) {
  35639. + std::cerr << " " << w;
  35640. + }
  35641. + std::cerr << std::endl;
  35642. +
  35643. +// #ifndef __clang__
  35644. + // static_cast<xpp::randr::protocol<const x::connection &> &>(connection)
  35645. + // .query_version(XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
  35646. +
  35647. + // connection.interface<xpp::randr::extension>()
  35648. + connection.randr().query_version(
  35649. + XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
  35650. +
  35651. + const xpp::randr::extension & randr = connection.extension<xpp::randr::extension>();
  35652. + // xpp::randr::extension & randr = static_cast<xpp::randr::extension &>(connection);
  35653. + std::cerr << "RandR Extension" << std::endl;
  35654. + std::cerr << "\tfirst_event: " << (int)randr->first_event << std::endl;
  35655. + std::cerr << "\tfirst_error: " << (int)randr->first_error << std::endl;
  35656. +
  35657. + connection.select_input_checked(connection.root(), XCB_RANDR_NOTIFY);
  35658. +
  35659. + const xpp::damage::extension & damage = connection.extension<xpp::damage::extension>();
  35660. + std::cerr << "Damage Extension" << std::endl;
  35661. + std::cerr << "\tfirst_event: " << (int)damage->first_event << std::endl;
  35662. + std::cerr << "\tfirst_error: " << (int)damage->first_error << std::endl;
  35663. +// #endif
  35664. +
  35665. + x::registry registry(connection);
  35666. +
  35667. + // key_printer<x::connection &> key_printer(connection);
  35668. + std::vector<key_printer<x::connection &>> key_printers(100, connection);
  35669. + // std::vector<key_printer<x::connection &> *> key_printers(100, new key_printer<x::connection &>(connection));
  35670. +
  35671. + const int n = 2;
  35672. + // registry.attach(0, &key_printer);
  35673. + for (int i = 0; i < n; ++i) {
  35674. + registry.attach(0, &key_printers[i]);
  35675. + // registry.attach(0, key_printers[i]);
  35676. + }
  35677. +
  35678. + for (int i = 0; i < n - 1; ++i) {
  35679. + registry.detach(0, &key_printers[i]);
  35680. + // registry.detach(0, key_printers[i]);
  35681. + }
  35682. +
  35683. + one_event oe;
  35684. + two_event te;
  35685. + more_events me;
  35686. +
  35687. + registry.attach(0, &oe);
  35688. + registry.attach(0, &te);
  35689. + registry.detach(0, &oe);
  35690. + registry.detach(0, &te);
  35691. +
  35692. + registry.attach(0, &me);
  35693. + // registry.detach(0, &me);
  35694. +
  35695. +
  35696. + // auto font = connection.generate_id();
  35697. + // connection.open_font(font, "cursor");
  35698. +
  35699. + // auto cursor = connection.generate_id();
  35700. + // connection.create_glyph_cursor(cursor, font, font,
  35701. + // XC_cross, XC_cross + 1, 0, 0, 0, 0xffff, 0xffff, 0xffff);
  35702. + // connection.close_font(font);
  35703. + // connection.close_cursor(cursor);
  35704. + // x::cursor cursor_xid = x::cursor(connection, 0);
  35705. +
  35706. +
  35707. + try {
  35708. + x::font font = x::font::open_checked(connection, "cursor");
  35709. +
  35710. + x::cursor cursor = x::cursor::create_glyph_checked(connection, font, font,
  35711. + XC_cross, XC_cross + 1, 0, 0, 0, 0xffff, 0xffff, 0xffff);
  35712. +
  35713. + *connection.grab_pointer(false, connection.root(),
  35714. + XCB_EVENT_MASK_BUTTON_PRESS,
  35715. + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
  35716. + XCB_NONE, cursor, XCB_TIME_CURRENT_TIME);
  35717. +
  35718. + std::cerr << "Please click on a window" << std::endl;
  35719. +
  35720. + } catch (const std::exception & error) {
  35721. + std::cerr << "Exception (std::exception) in "
  35722. + << __FILE__ << " @ line " << __LINE__ << ", what(): "
  35723. + << error.what() << std::endl;
  35724. + std::exit(EXIT_FAILURE);
  35725. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  35726. + std::cerr << "Exception (std::shared_ptr<xcb_generic_error_t>) in "
  35727. + << __FILE__ << " @ line " << __LINE__ << ", error_code: "
  35728. + << (int)error->error_code << std::endl;
  35729. + std::exit(EXIT_FAILURE);
  35730. + } catch (...) {
  35731. + std::cerr << "Exception (...) in "
  35732. + << __FILE__ << " @ line " << __LINE__
  35733. + << std::endl;
  35734. + std::exit(EXIT_FAILURE);
  35735. + }
  35736. +
  35737. +
  35738. + // xcb_randr_get_output_info_cookie_t goic = xcb_randr_get_output_info_unchecked(connection, -1, XCB_TIME_CURRENT_TIME);
  35739. + // xcb_randr_get_output_info_reply_t * goir = xcb_randr_get_output_info_reply(connection, goic, nullptr);
  35740. +
  35741. + // XCB_RANDR_BAD_OUTPUT
  35742. + auto output_info = connection.get_output_info_unchecked(-1);
  35743. + output_info.get();
  35744. +
  35745. + // XCB_RANDR_BAD_CRTC
  35746. + // auto crtc_info = connection.get_crtc_info_unchecked(-1);
  35747. + // crtc_info.get();
  35748. +
  35749. + // auto output_property = connection.query_output_property_unchecked(-1, -1);
  35750. + // output_property.get();
  35751. +
  35752. + connection.change_output_property(-1, -1, -1, 0, 0, 0, nullptr);
  35753. +
  35754. + // connection.map_window(-1);
  35755. +
  35756. + // auto & damage_proto = static_cast<xpp::damage::protocol<const x::connection &> &>(connection);
  35757. + // damage_proto.create(-1, -1, 0);
  35758. + // damage_proto.destroy(-1);
  35759. + // damage_proto.subtract(-1, 0, 0);
  35760. +
  35761. + connection.query_pict_index_values_unchecked(-1);
  35762. + connection.change_picture(-1, 0, nullptr);
  35763. +
  35764. +// clang_complete does not like this
  35765. +// causes vim to segfault
  35766. +// #if not defined __clang__
  35767. +
  35768. + while (! g_quit) {
  35769. + connection.flush();
  35770. + try {
  35771. + registry.dispatch(connection.wait_for_event());
  35772. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  35773. + std::cerr << "Caught std::shared_ptr<xcb_generic_error_t> in event loop "
  35774. + << "(code: " << (int)error->error_code << ")" << std::endl;
  35775. + } catch (const std::exception & error) {
  35776. + std::cerr << "Caught std::exception in event loop: " << error.what() << std::endl;
  35777. + } catch (...) {
  35778. + std::cerr << "Something really bad has happened" << std::endl;
  35779. + }
  35780. + }
  35781. +
  35782. +// #endif
  35783. +
  35784. + // xpp::x::event::key_press<x::connection &>
  35785. + // xek_1(connection, std::shared_ptr<xcb_generic_event_t>((xcb_generic_event_t *)new xcb_key_press_event_t));
  35786. + // xpp::x::event::key_press<xcb_connection_t *>
  35787. + // xek_2(connection, std::shared_ptr<xcb_generic_event_t>(((xcb_generic_event_t *)new xcb_key_press_event_t)));
  35788. + // xpp::x::event::key_press<xcb_connection_t *>
  35789. + // xek_3(xcb_c, std::shared_ptr<xcb_generic_event_t>(((xcb_generic_event_t *)new xcb_key_press_event_t)));
  35790. +
  35791. + // xpp::window<x::connection> w_1(connection);
  35792. + // xpp::window<xcb_connection_t *> w_2(xcb_c);
  35793. + // static_cast<xcb_window_t &>(w_1) = 12;
  35794. +
  35795. + // if (xcb_connection_has_error(c)) {
  35796. + // std::cerr << "Connection has error" << std::endl;
  35797. + // return EXIT_FAILURE;
  35798. + // }
  35799. +
  35800. + // xpp::x::error::dispatcher ed(connection);
  35801. +
  35802. + // xcb_void_cookie_t mwc = xcb_map_window_checked(c, -1);
  35803. + // xcb_flush(c);
  35804. + // xcb_generic_error_t * error = xcb_request_check(c, mwc);
  35805. + // xcb_flush(c);
  35806. + // if (error) {
  35807. + // std::free(error);
  35808. + // std::cerr << "mwc error" << std::endl;
  35809. + // }
  35810. +
  35811. + /*
  35812. + std::shared_ptr<xcb_query_tree_reply_t> qtr;
  35813. +
  35814. + typedef xpp::fixed::detail::simple<
  35815. + x::connection &, xcb_window_t,
  35816. + SIGNATURE(xcb_query_tree_children),
  35817. + SIGNATURE(xcb_query_tree_children_length)>
  35818. + simple_query_tree_iterator;
  35819. + simple_query_tree_iterator(connection, qtr, 0);
  35820. +
  35821. + typedef xpp::fixed::detail::object<
  35822. + x::connection &, x::window,
  35823. + SIGNATURE(xcb_query_tree_children),
  35824. + SIGNATURE(xcb_query_tree_children_length)>
  35825. + object_query_tree_iterator;
  35826. + object_query_tree_iterator(connection, qtr, 0);
  35827. + */
  35828. +
  35829. + // typedef xpp::iterator<
  35830. + // x::connection, x::window,
  35831. + // SIGNATURE(xcb_query_tree_children),
  35832. + // SIGNATURE(xcb_query_tree_children_length)>
  35833. + // query_tree_iter;
  35834. +
  35835. + // auto qt_iter = query_tree_iter(connection, qtr, 0);
  35836. +
  35837. + // typedef xpp::generic::list<x::connection,
  35838. + // xcb_query_tree_reply_t,
  35839. + // query_tree_iter>
  35840. + // query_tree_list;
  35841. +
  35842. + // auto qt_list = query_tree_list(connection, qtr);
  35843. + // auto qt_list_begin = qt_list.begin();
  35844. +
  35845. + // std::shared_ptr<xcb_query_tree_reply_t> qtr;
  35846. + // auto simple_iter = xpp::fixed::iterator::simple<
  35847. + // x::connection, xcb_window_t, xcb_window_t, xcb_query_tree_reply_t,
  35848. + // xcb_query_tree_children,
  35849. + // xcb_query_tree_children_length>(connection, qtr, 0);
  35850. +
  35851. + // auto object_iter = xpp::fixed::iterator::object<
  35852. + // x::connection, xcb_window_t, x::window, xcb_query_tree_reply_t,
  35853. + // xcb_query_tree_children,
  35854. + // xcb_query_tree_children_length>(connection, qtr, 0);
  35855. +
  35856. + // std::shared_ptr<xcb_get_font_path_reply_t> fpr;
  35857. + // typedef xpp::iterator<x::connection,
  35858. + // xcb_str_t,
  35859. + // xcb_str_t,
  35860. + // SIGNATURE(xcb_str_next),
  35861. + // SIGNATURE(xcb_str_sizeof),
  35862. + // SIGNATURE(xcb_get_font_path_path_iterator)>
  35863. + // font_path_iter;
  35864. +
  35865. + std::cerr << "fonts:" << std::endl;
  35866. + auto fonts = connection.list_fonts(8, 1, "*");
  35867. + for (auto && name : fonts.names()) {
  35868. + std::cerr << "font [" << name.length() << "]: " << name << std::endl;
  35869. + }
  35870. +
  35871. + std::cerr << "paths:" << std::endl;
  35872. + // auto font_paths = connection.get_font_path();
  35873. + for (auto && path : connection.get_font_path().path()) {
  35874. + std::cerr << "path [" << path.length() << "]: " << path << std::endl;
  35875. + }
  35876. +
  35877. + auto tree = connection.root<x::window>().query_tree();
  35878. + std::cerr << "children: ";
  35879. + for (auto && child : tree.children<x::xcb_window>()) {
  35880. + std::cerr << child << ", ";
  35881. + auto siblings = child.query_tree();
  35882. + std::cerr << "(siblings: ";
  35883. + for (auto && sibling : siblings.children()) {
  35884. + std::cerr << sibling << ", ";
  35885. + }
  35886. + std::cerr << "), " << std::endl;
  35887. + }
  35888. + std::cerr << std::endl;
  35889. +
  35890. + // auto tree_2 = connection.query_tree(screen->root);
  35891. + // std::cerr << "children: ";
  35892. + // for (auto & w : tree_2.children<x::window>()) {
  35893. + // std::cerr << w << ", ";
  35894. + // }
  35895. + // std::cerr << std::endl;
  35896. +
  35897. + // xcb_window_t window = 27263111;
  35898. + xcb_window_t window = 0;
  35899. +
  35900. + // test::map_window(c, window);
  35901. + // test::map_window(c, window, 0);
  35902. + xpp::x::map_window(connection, window);
  35903. + connection.map_window(window);
  35904. +
  35905. + try {
  35906. + // test::map_window_checked(c, window);
  35907. + // xpp::x::map_window_checked(c, window);
  35908. + connection.map_window_checked(window);
  35909. + } catch (const std::exception & e) {
  35910. + std::cerr << "CATCH: map_window exception:" << std::endl
  35911. + << "\twhat(): " << e.what() << std::endl;
  35912. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  35913. + std::cerr << "CATCH: map_window error: " << (int)error->error_code << std::endl;
  35914. + }
  35915. +
  35916. + // auto attrs_0 = test::get_window_attributes(c, window);
  35917. + // auto attrs_1 = test::get_window_attributes(connection, window);
  35918. + // auto attrs_2 = test::get_window_attributes_unchecked(connection, window);
  35919. +
  35920. + xpp::x::reply::checked::get_window_attributes<xcb_connection_t *>
  35921. + gwar(connection, window);
  35922. +
  35923. + auto attrs_0 = connection.get_window_attributes(window);
  35924. + // auto attrs_0 = xpp::x::get_window_attributes(c, window);
  35925. + auto attrs_1 = xpp::x::get_window_attributes(connection, window);
  35926. + auto attrs_2 = xpp::x::get_window_attributes_unchecked(connection, window);
  35927. +
  35928. + try {
  35929. + attrs_0.get();
  35930. + } catch (const std::exception & e) {
  35931. + std::cerr << "CATCH: attrs_0 exception:" << std::endl
  35932. + << "\twhat(): " << e.what() << std::endl;
  35933. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  35934. + std::cerr << "CATCH: attrs_0 std::shared_ptr<xcb_generic_error_t>::error_code: " << (int)error->error_code << std::endl;
  35935. + }
  35936. +
  35937. + if (! attrs_0) {
  35938. + std::cerr << "attrs_0 invalid" << std::endl;
  35939. + } else {
  35940. + std::cerr << "attrs_0 valid" << std::endl;
  35941. + }
  35942. +
  35943. + try {
  35944. + attrs_1.get();
  35945. + } catch (const std::exception & e) {
  35946. + std::cerr << "CATCH: attrs_1 exception:" << std::endl
  35947. + << "\twhat(): " << e.what() << std::endl;
  35948. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  35949. + std::cerr << "CATCH: attrs_1 std::shared_ptr<xcb_generic_error_t>::error_code: " << (int)error->error_code << std::endl;
  35950. + }
  35951. +
  35952. + if (! attrs_1) {
  35953. + std::cerr << "attrs_1 invalid" << std::endl;
  35954. + } else {
  35955. + std::cerr << "attrs_1 valid" << std::endl;
  35956. + }
  35957. +
  35958. + try {
  35959. + attrs_2.get();
  35960. + } catch (const std::exception & e) {
  35961. + std::cerr << "CATCH: attrs_2 exception:" << std::endl
  35962. + << "\twhat(): " << e.what() << std::endl;
  35963. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  35964. + std::cerr << "CATCH: attrs_2 std::shared_ptr<xcb_generic_error_t>::error_code: " << (int)error->error_code << std::endl;
  35965. + }
  35966. +
  35967. + if (! attrs_2) {
  35968. + std::cerr << "attrs_2 invalid" << std::endl;
  35969. + } else {
  35970. + std::cerr << "attrs_2 valid" << std::endl;
  35971. + }
  35972. +
  35973. + try {
  35974. + auto my_string_atom = xpp::x::intern_atom(connection, false, "MY_STRING");
  35975. + std::string my_string("SUPER COOL");
  35976. +
  35977. + std::cerr << "atom \"MY_STRING\": " << my_string_atom.atom() << std::endl;;
  35978. +
  35979. + auto atom_name = connection.get_atom_name(my_string_atom.atom());
  35980. + std::cerr << "atom name: " << atom_name.name() << std::endl;;
  35981. +
  35982. + // xpp::x::change_property_checked(c,
  35983. + connection.change_property_checked(
  35984. + XCB_PROP_MODE_REPLACE, connection.root(),
  35985. + my_string_atom.atom(), XCB_ATOM_STRING, 8,
  35986. + my_string.begin(), my_string.end());
  35987. +
  35988. + // xpp::x::change_property_checked(c,
  35989. + connection.change_property_checked(
  35990. + XCB_PROP_MODE_REPLACE, 0,
  35991. + my_string_atom.atom(), XCB_ATOM_STRING, 8,
  35992. + my_string.length(), my_string.c_str());
  35993. + } catch (const std::exception & e) {
  35994. + std::cerr << "change property failed: " << e.what() << std::endl;
  35995. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  35996. + std::cerr << "generic error: " << (int)error->error_code << std::endl;
  35997. + }
  35998. +
  35999. + connection.flush();
  36000. +
  36001. + // xcb_disconnect(c);
  36002. +
  36003. +
  36004. + /*
  36005. + std::cerr << std::endl << "intern_atom 1" << std::endl;
  36006. + auto atom_reply_1 =
  36007. + xpp::x::intern_atom_unchecked(c, false, 25, "_NET_CLIENT_LIST_STACKING");
  36008. + atom_reply_1.get();
  36009. + if (atom_reply_1) {
  36010. + std::cerr<<"atom_reply_1 success"<<std::endl;
  36011. + }
  36012. +
  36013. + std::cerr << std::endl << "intern_atom 2" << std::endl;
  36014. + auto atom_reply_2 = xpp::x::intern_atom(c, false, "_NET_CLIENT_LIST_STACKING");
  36015. + atom_reply_2.get();
  36016. + if (atom_reply_2) {
  36017. + std::cerr<<"atom_reply_2 success"<<std::endl;
  36018. + }
  36019. +
  36020. + std::cerr << std::endl << "intern_atom 3" << std::endl;
  36021. + auto atom_reply_3 = xpp::x::intern_atom(c, false, "_NET_CLIENT_LIST_STAC");
  36022. + try {
  36023. + atom_reply_3.get();
  36024. + std::cerr<<"atom_reply_3 success"<<std::endl;
  36025. + } catch (const std::shared_ptr<xcb_generic_error_t> & error) {
  36026. + std::cerr<<"CATCH: atom_reply_3 success, error_code: "
  36027. + << (int)error->error_code <<std::endl;
  36028. + }
  36029. +
  36030. + std::cerr << std::endl << "intern_atom 1 reply: ";
  36031. + xcb_atom_t atom = atom_reply_1->atom;
  36032. + std::cerr << (int)atom << std::endl;
  36033. +
  36034. + std::cerr << std::endl << "intern_atom 2 reply: ";
  36035. + auto dummy_atom = atom_reply_2.atom<xpp::dummy_atom>();
  36036. + std::cerr << (int)dummy_atom.m_atom << std::endl;
  36037. +
  36038. + auto my_string_atom = xpp::x::intern_atom(c, true, "MY_STRING");
  36039. + std::string my_string("LADIDA");
  36040. + xpp::x::change_property(
  36041. + c, XCB_PROP_MODE_REPLACE, 0, my_string_atom.atom(), XCB_ATOM_STRING, 8,
  36042. + my_string.begin(), my_string.end());
  36043. + */
  36044. +
  36045. + /*
  36046. + std::cerr << std::endl << "intern_atom 1" << std::endl;
  36047. + auto atom_reply_1 = intern_atom(c, false, 25, "_NET_CLIENT_LIST_STACKING");
  36048. +
  36049. + std::cerr << std::endl << "intern_atom 2" << std::endl;
  36050. + auto atom_reply_2 = intern_atom(c, false, std::string("_NET_CLIENT_LIST_STACKING"));
  36051. +
  36052. + std::cerr << std::endl << "intern_atom 3" << std::endl;
  36053. + auto atom_reply_3 = intern_atom<xpp::connection,
  36054. + my::dispatcher,
  36055. + xpp::x::error::dispatcher>
  36056. + (c, false, "FOO BAZ");
  36057. + atom_reply_3.get();
  36058. +
  36059. + std::cerr << std::endl << "intern_atom 1 reply: ";
  36060. + xcb_atom_t atom = atom_reply_1->atom;
  36061. + std::cerr << (int)atom << std::endl;
  36062. +
  36063. + std::cerr << std::endl << "intern_atom 2 reply: ";
  36064. + auto dummy_atom = atom_reply_2.atom<xpp::dummy_atom>();
  36065. + std::cerr << (int)dummy_atom.m_atom << std::endl;
  36066. +
  36067. + std::cerr << std::endl << "map_window 1" << std::endl;
  36068. + map_window(connection, 0);
  36069. + std::cerr << std::endl << "map_window 2" << std::endl;
  36070. + map_window<xpp::connection>(c, 0);
  36071. + std::cerr << std::endl << "map_window 3" << std::endl;
  36072. + map_window<xpp::connection, my::dispatcher, xpp::x::error::dispatcher>(connection, 0);
  36073. +
  36074. + auto my_string_atom =
  36075. + intern_atom<xpp::connection, my::dispatcher>(connection, true, "MY_STRING");
  36076. + std::string my_string("LADIDA");
  36077. + change_property<xpp::connection, my::dispatcher>(
  36078. + c, XCB_PROP_MODE_REPLACE, 0, my_string_atom.atom(), XCB_ATOM_STRING, 8,
  36079. + my_string.begin(), my_string.end());
  36080. + */
  36081. +
  36082. + /*
  36083. + std::cerr << std::endl << "auto wa_1" << std::endl;
  36084. + auto wa_1 = get_window_attributes(c, 0);
  36085. + std::cerr << std::endl << "auto wa_2" << std::endl;
  36086. + auto wa_2 = get_window_attributes<xpp::connection,
  36087. + my::dispatcher,
  36088. + xpp::x::error::dispatcher>
  36089. + (connection, 0);
  36090. + std::cerr << std::endl << "auto wa_3" << std::endl;
  36091. + auto wa_3 = get_window_attributes<xpp::connection,
  36092. + my::dispatcher,
  36093. + xpp::x::error::dispatcher>
  36094. + (connection, 0);
  36095. +
  36096. + std::cerr << std::endl << "wa_1" << std::endl;
  36097. + auto r1 = wa_1.get();
  36098. + std::cerr << std::endl << "wa_2" << std::endl;
  36099. + auto r2 = wa_2.get();
  36100. + std::cerr << std::endl << "wa_3" << std::endl;
  36101. + auto r3 = wa_3.get();
  36102. + */
  36103. +
  36104. + // try {
  36105. + // std::cerr << "YOLOLOLOL" << std::endl;
  36106. + // xcb_colormap_t cm = wa_3.colormap();
  36107. + // cm = wa_1->colormap;
  36108. + // cm = r1->colormap;
  36109. + // } catch (...) {}
  36110. +
  36111. + // map_window<xpp::connection>(c, 0);
  36112. + // map_window<xpp::connection, my::dispatcher, xpp::x::error::dispatcher>(c, 0);
  36113. +
  36114. + // auto wa_cookie = get_window_attributes_cookie(c, 0);
  36115. + // auto wa_reply_1 = get_window_attributes_reply<xpp::connection>(connection, wa_cookie);
  36116. + // auto wa_reply_2 = get_window_attributes_reply<
  36117. + // xpp::connection, my::dispatcher, xpp::x::error::dispatcher>(
  36118. + // connection, get_window_attributes_cookie()(c, 0));
  36119. +
  36120. + // wa_reply_1.get();
  36121. + // wa_reply_2.get();
  36122. +
  36123. + // auto wa = get_window_attributes(c, 0);
  36124. + // auto wa_error = get_window_attributes(ed, c, 0);
  36125. + // wa_error.get();
  36126. +
  36127. + // map_window_cookie<xpp::connection>()(connection, 0);
  36128. + // map_window_cookie<xpp::connection>()(ed, connection, 0);
  36129. + // map_window_cookie<xpp::connection>()(connection, connection, 0);
  36130. + // map_window_cookie<xpp::connection>()(xpp::x::error::dispatcher(), connection, 0);
  36131. +
  36132. + // get_window_attributes_cookie wac_1(c, 0);
  36133. + // get_window_attributes_cookie wac_2(c, 0);
  36134. +
  36135. + // get_window_attributes_reply<> war_1(connection, wac_1);
  36136. + // get_window_attributes_reply<> war_2(connection, wac_2);
  36137. +
  36138. + // get_window_attributes_reply<my::dispatcher, xpp::x::error::dispatcher>
  36139. + // war_3(connection, get_window_attributes_cookie()(c, 0), my::dispatcher(), xpp::x::error::dispatcher());
  36140. +
  36141. + // war_1.get();
  36142. + // war_2.get();
  36143. + // war_3.get();
  36144. +
  36145. +
  36146. + // map_window_cookie<xpp::connection> mwc_unchecked;
  36147. + // mwc_checked(, connection, 0);
  36148. + // mwc_checked(xpp::x::error::dispatcher(), connection, 0);
  36149. + // mwc_unchecked(connection, 0);
  36150. + // map_window_cookie<checked, xpp::connection> mwc_checked;
  36151. + // map_window_cookie<unchecked, xpp::connection> mwc_unchecked;
  36152. +
  36153. + // map_window(c, 0);
  36154. + // map_window<xpp::generic::checked>(c, 0);
  36155. + // auto reply = get_window_attributes(connection, 0);
  36156. + // reply.get();
  36157. +
  36158. + return EXIT_SUCCESS;
  36159. +}
  36160. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/resource.cpp polybar-3.2.1/lib/xpp/src/tests/resource.cpp
  36161. --- polybar-3.2.1.orig/lib/xpp/src/tests/resource.cpp 1970-01-01 02:00:00.000000000 +0200
  36162. +++ polybar-3.2.1/lib/xpp/src/tests/resource.cpp 2017-08-30 16:02:01.000000000 +0300
  36163. @@ -0,0 +1,49 @@
  36164. +#include <iostream>
  36165. +
  36166. +#include "../xpp.hpp"
  36167. +#include "../proto/randr.hpp"
  36168. +#include "../proto/damage.hpp"
  36169. +#include "../proto/render.hpp"
  36170. +
  36171. +#include <X11/Xlib.h>
  36172. +#include <X11/keysym.h>
  36173. +#include <X11/cursorfont.h> // XC_cross
  36174. +
  36175. +namespace x {
  36176. + typedef xpp::connection<
  36177. + // xpp::randr::extension,
  36178. + // xpp::damage::extension,
  36179. + // xpp::render::extension
  36180. + >
  36181. + connection;
  36182. +
  36183. + typedef xpp::event::registry<connection &
  36184. + // xpp::randr::extension,
  36185. + // xpp::damage::extension,
  36186. + // xpp::render::extension>
  36187. + >
  36188. + registry;
  36189. +
  36190. + typedef xpp::font<connection &> font;
  36191. + typedef xpp::cursor<connection &> cursor;
  36192. + typedef xpp::window<connection &> window;
  36193. + typedef xpp::window<xcb_connection_t *> xcb_window;
  36194. +
  36195. + typedef xpp::x::event::key_press<connection &> key_press;
  36196. + typedef xpp::x::event::key_release<connection &> key_release;
  36197. + typedef xpp::x::event::button_press<connection &> button_press;
  36198. + typedef xpp::randr::event::notify<connection &> randr_notify;
  36199. + typedef xpp::randr::event::screen_change_notify<connection &> randr_screen_change_notify;
  36200. + typedef xpp::damage::event::notify<connection &> damage_notify;
  36201. +};
  36202. +
  36203. +int main(int argc, char ** argv)
  36204. +{
  36205. + x::connection connection;
  36206. + xcb_font_t font = 0;
  36207. + auto cursor_1 = x::cursor(connection, 0);
  36208. + auto cursor_2 = x::cursor::create_glyph(connection, font, font,
  36209. + XC_cross, XC_cross + 1, 0, 0, 0, 0xffff, 0xffff, 0xffff);
  36210. +
  36211. + return 0;
  36212. +}
  36213. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/sizeof.cpp polybar-3.2.1/lib/xpp/src/tests/sizeof.cpp
  36214. --- polybar-3.2.1.orig/lib/xpp/src/tests/sizeof.cpp 1970-01-01 02:00:00.000000000 +0200
  36215. +++ polybar-3.2.1/lib/xpp/src/tests/sizeof.cpp 2017-08-30 16:02:01.000000000 +0300
  36216. @@ -0,0 +1,767 @@
  36217. +// compile with `g++ -std=c++11 test.cpp`
  36218. +#include <iostream>
  36219. +#include <map>
  36220. +#include <unordered_map>
  36221. +#include <vector>
  36222. +#include <algorithm>
  36223. +
  36224. +namespace test1 {
  36225. +
  36226. +template<typename T>
  36227. +struct interface {
  36228. + static std::size_t size_of(void)
  36229. + {
  36230. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36231. + return sizeof(T);
  36232. + }
  36233. +};
  36234. +
  36235. +template<>
  36236. +struct interface<void> {
  36237. + static std::size_t size_of(void)
  36238. + {
  36239. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36240. + return sizeof(char);
  36241. + }
  36242. +};
  36243. +
  36244. +template<typename T>
  36245. +struct A : public interface<T> {
  36246. + A(void)
  36247. + {
  36248. + std::cerr << __PRETTY_FUNCTION__ << " size_of(): "
  36249. + << this->size_of() << std::endl;
  36250. + }
  36251. +
  36252. + static std::size_t size_of(void)
  36253. + {
  36254. + std::cerr << "YOLOLOL" << std::endl;
  36255. + return 0;
  36256. + }
  36257. +};
  36258. +
  36259. +// template<typename T>
  36260. +struct B : public interface<int> {
  36261. + B(void)
  36262. + {
  36263. + std::cerr << __PRETTY_FUNCTION__ << " size_of(): "
  36264. + << this->size_of() << std::endl;
  36265. + }
  36266. +};
  36267. +
  36268. +// template<typename T>
  36269. +struct C : public interface<double> {
  36270. + C(void)
  36271. + {
  36272. + std::cerr << __PRETTY_FUNCTION__ << " size_of(): "
  36273. + << this->size_of() << std::endl;
  36274. + }
  36275. +};
  36276. +
  36277. +int main(int argc, char ** argv)
  36278. +{
  36279. + test1::A<int> t1_1;
  36280. + std::cerr << std::endl;
  36281. + test1::A<double> t1_2;
  36282. + std::cerr << std::endl;
  36283. + test1::A<char> t1_3;
  36284. + std::cerr << std::endl;
  36285. + test1::A<uint16_t> t1_4;
  36286. + std::cerr << std::endl;
  36287. + test1::A<void> t1_5;
  36288. + std::cerr << std::endl;
  36289. +
  36290. + test1::B t2_1;
  36291. + std::cerr << std::endl;
  36292. +
  36293. + test1::C t3_1;
  36294. + std::cerr << std::endl;
  36295. +
  36296. + return 0;
  36297. +}
  36298. +
  36299. +};
  36300. +
  36301. +namespace test2 {
  36302. +
  36303. +struct interface {
  36304. + static void test(void);
  36305. +};
  36306. +
  36307. +struct A : public interface {
  36308. + static void test(void)
  36309. + {
  36310. + std::cerr << __PRETTY_FUNCTION__ << " (A::test)" << std::endl;
  36311. + }
  36312. + A(void)
  36313. + {
  36314. + test();
  36315. + }
  36316. +};
  36317. +
  36318. +struct B : public interface {
  36319. + static void test(void)
  36320. + {
  36321. + std::cerr << __PRETTY_FUNCTION__ << " (B::test)" << std::endl;
  36322. + }
  36323. + B(void)
  36324. + {
  36325. + test();
  36326. + }
  36327. +};
  36328. +
  36329. +void test(const interface & i)
  36330. +{
  36331. + A::test();
  36332. + B::test();
  36333. + // decltype(i)::test();
  36334. +}
  36335. +
  36336. +int main(int argc, char ** argv)
  36337. +{
  36338. + test2::A a;
  36339. + test2::B b;
  36340. + test2::test(a);
  36341. + // test2::test();
  36342. +
  36343. + return 0;
  36344. +}
  36345. +
  36346. +};
  36347. +
  36348. +namespace test3 {
  36349. +
  36350. +template<typename T>
  36351. +struct Base {
  36352. + T t;
  36353. +};
  36354. +
  36355. +template<int N>
  36356. +struct select_type;
  36357. +
  36358. +template<>
  36359. +struct select_type<1> {
  36360. + Base<int> base;
  36361. +};
  36362. +
  36363. +template<>
  36364. +struct select_type<2> {
  36365. + Base<double> base;
  36366. +};
  36367. +
  36368. +int main(int argc, char ** argv)
  36369. +{
  36370. + constexpr int i = 0;
  36371. + test3::select_type<1> st_1;
  36372. + test3::select_type<2> st_2;
  36373. +
  36374. + return 0;
  36375. +}
  36376. +
  36377. +};
  36378. +
  36379. +namespace test4 {
  36380. +
  36381. +template<typename T>
  36382. +struct i {
  36383. + virtual bool f(T) = 0;
  36384. +};
  36385. +
  36386. +namespace a {
  36387. + struct a : public i<int> {
  36388. + bool f(int i)
  36389. + {
  36390. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36391. + return i == m_i;
  36392. + }
  36393. + int m_i = 0;
  36394. + };
  36395. +};
  36396. +
  36397. +namespace b {
  36398. + struct b : public i<int> {
  36399. + bool f(int i)
  36400. + {
  36401. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36402. + return i == m_i;
  36403. + }
  36404. + int m_i = 1;
  36405. + };
  36406. +};
  36407. +
  36408. +namespace c {
  36409. + struct c : public i<int> {
  36410. + bool f(int i)
  36411. + {
  36412. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36413. + return i == m_i;
  36414. + }
  36415. + int m_i = 2;
  36416. + };
  36417. +};
  36418. +
  36419. +template<typename ... IS>
  36420. +struct z : public IS ... {
  36421. +
  36422. + // template<typename ... VS>
  36423. + void
  36424. + run(int i)
  36425. + {
  36426. + std::cerr << __PRETTY_FUNCTION__ << " with i = " << i << std::endl;
  36427. + f(i, static_cast<IS *>(this) ...);
  36428. + }
  36429. +
  36430. + template<typename I, typename ... ISS>
  36431. + void
  36432. + f(int v, I * i, ISS ... is)
  36433. + {
  36434. + if (! i->f(v)) {
  36435. + f(v, is ...);
  36436. + } else {
  36437. + std::cerr << "We've got a winner!" << std::endl;
  36438. + }
  36439. + }
  36440. +
  36441. + template<typename I>
  36442. + void
  36443. + f(int v, I * i)
  36444. + {
  36445. + i->f(v);
  36446. + }
  36447. +
  36448. +};
  36449. +
  36450. +int main(int argc, char ** argv)
  36451. +{
  36452. + test4::z<test4::a::a, test4::b::b, test4::c::c> z;
  36453. + for (auto i : { 0, 1, 2, 3 }) {
  36454. + z.run(i);
  36455. + }
  36456. + return 0;
  36457. +}
  36458. +
  36459. +};
  36460. +
  36461. +namespace test5 {
  36462. +
  36463. +struct pod_generic {
  36464. + int id;
  36465. + int m_int;
  36466. +};
  36467. +
  36468. +struct pod_int {
  36469. + int id = 0;
  36470. + int m_int;
  36471. +};
  36472. +
  36473. +struct pod_double {
  36474. + int id = 1;
  36475. + double m_double;
  36476. +};
  36477. +
  36478. +struct pod_string {
  36479. + int id = 2;
  36480. + std::string m_string;
  36481. +};
  36482. +
  36483. +template<int OpCode>
  36484. +struct my_pod_wrapper {
  36485. + static const int opcode = OpCode;
  36486. +};
  36487. +
  36488. +struct my_pod_int_wrapper : public my_pod_wrapper<0> {
  36489. + my_pod_int_wrapper(pod_generic * pg)
  36490. + : m_pi((pod_int *)pg) {}
  36491. + pod_int * m_pi;
  36492. +};
  36493. +
  36494. +struct my_pod_double_wrapper : public my_pod_wrapper<1> {
  36495. + my_pod_double_wrapper(pod_generic * pg)
  36496. + : m_pd((pod_double *)pg) {}
  36497. + pod_double * m_pd;
  36498. +};
  36499. +
  36500. +struct my_pod_string_wrapper : public my_pod_wrapper<2> {
  36501. + my_pod_string_wrapper(pod_generic * pg)
  36502. + : m_ps((pod_string *)pg) {}
  36503. + pod_string * m_ps;
  36504. +};
  36505. +
  36506. +class dispatcher {
  36507. + public:
  36508. + virtual ~dispatcher(void) {}
  36509. + template<typename E> void dispatch(const E & e);
  36510. +};
  36511. +
  36512. +template<typename ... Events>
  36513. +class sink;
  36514. +
  36515. +template<typename E>
  36516. +class sink<E> : virtual public dispatcher {
  36517. + public:
  36518. + virtual void handle(const E & e) = 0;
  36519. +};
  36520. +
  36521. +template<typename Event, typename ... Events>
  36522. +class sink<Event, Events ...>
  36523. + : virtual public sink<Event>
  36524. + , virtual public sink<Events> ...
  36525. +{};
  36526. +
  36527. +template<typename E>
  36528. +void dispatcher::dispatch(const E & e)
  36529. +{
  36530. + dynamic_cast<sink<E> *>(this)->handle(e);
  36531. +}
  36532. +
  36533. +template<int ExtensionId>
  36534. +class pod_dispatcher {
  36535. + public:
  36536. + template<typename Dispatcher>
  36537. + bool
  36538. + operator()(pod_generic * pg, const Dispatcher & D) const
  36539. + {
  36540. + // std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36541. + std::cerr << "POD_DISPATCHER<" << ExtensionId << ">" << std::endl;
  36542. + switch (pg->id) {
  36543. + case 0:
  36544. + // std::cerr << "dispatch with my_pod_int_wrapper" << std::endl;
  36545. + D(my_pod_int_wrapper(pg));
  36546. + return true;
  36547. +
  36548. + case 1:
  36549. + // std::cerr << "dispatch with my_pod_double_wrapper" << std::endl;
  36550. + D(my_pod_double_wrapper(pg));
  36551. + return true;
  36552. +
  36553. + case 2:
  36554. + // std::cerr << "dispatch with my_pod_string_wrapper" << std::endl;
  36555. + D(my_pod_string_wrapper(pg));
  36556. + return true;
  36557. + };
  36558. +
  36559. + return false;
  36560. + }
  36561. +};
  36562. +
  36563. +template<>
  36564. +class pod_dispatcher<1> {
  36565. + public:
  36566. + template<typename Dispatcher>
  36567. + bool
  36568. + operator()(pod_generic * pg, const Dispatcher & D) const
  36569. + {
  36570. + std::cerr << "POD_DISPATCHER<1>" << std::endl;
  36571. + switch (pg->id) {
  36572. + case 0:
  36573. + // std::cerr << "dispatch with my_pod_int_wrapper" << std::endl;
  36574. + D(my_pod_int_wrapper(pg));
  36575. + return true;
  36576. +
  36577. + case 1:
  36578. + // std::cerr << "dispatch with my_pod_double_wrapper" << std::endl;
  36579. + D(my_pod_double_wrapper(pg));
  36580. + return true;
  36581. +
  36582. + case 2:
  36583. + // std::cerr << "dispatch with my_pod_string_wrapper" << std::endl;
  36584. + D(my_pod_string_wrapper(pg));
  36585. + return true;
  36586. + };
  36587. +
  36588. + return false;
  36589. + }
  36590. +};
  36591. +
  36592. +class a : public sink<my_pod_int_wrapper,
  36593. + my_pod_double_wrapper,
  36594. + my_pod_string_wrapper>
  36595. +{
  36596. + public:
  36597. + virtual void handle(const my_pod_int_wrapper &) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36598. + virtual void handle(const my_pod_double_wrapper &) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36599. + virtual void handle(const my_pod_string_wrapper &) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36600. +};
  36601. +
  36602. +class b : public sink<my_pod_string_wrapper,
  36603. + my_pod_double_wrapper>
  36604. +{
  36605. + public:
  36606. + virtual void handle(const my_pod_string_wrapper &) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36607. + virtual void handle(const my_pod_double_wrapper &) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36608. +};
  36609. +
  36610. +class c : public sink<my_pod_double_wrapper>
  36611. +{
  36612. + public:
  36613. + virtual void handle(const my_pod_double_wrapper &) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36614. +};
  36615. +
  36616. +template<typename ... POD_Dispatcher>
  36617. +struct handler_registry {
  36618. +
  36619. + template<typename D>
  36620. + bool
  36621. + dispatch(pod_generic * pg) const
  36622. + {
  36623. + std::cerr << "RecursiveDispatchEnd_EvenBetter" << std::endl;
  36624. + return D()(pg, *this);
  36625. + }
  36626. +
  36627. + template<typename D1, typename D2, typename ... Dispatcher>
  36628. + bool
  36629. + dispatch(pod_generic * pg) const
  36630. + {
  36631. + std::cerr << "BigFatDispatch_ManFeelsGood" << std::endl;
  36632. + D1()(pg, *this);
  36633. + return dispatch<D2, Dispatcher ...>(pg);
  36634. + }
  36635. +
  36636. + bool
  36637. + dispatch(pod_generic * pg) const
  36638. + {
  36639. + std::cerr << "InitialDispatch_JustAbitWeiry" << std::endl;
  36640. + return dispatch<POD_Dispatcher ...>(pg);
  36641. + }
  36642. +
  36643. + template<typename Event>
  36644. + void
  36645. + operator()(const Event & e) const
  36646. + {
  36647. + try {
  36648. + for (auto & item : m_dispatcher.at(Event::opcode)) {
  36649. + item.second->dispatch(e);
  36650. + }
  36651. + } catch (...) {}
  36652. + }
  36653. +
  36654. + template<typename Event1, typename Event2, typename ... Events>
  36655. + void
  36656. + attach(sink<Event1, Event2, Events ...> * s)
  36657. + {
  36658. + attach(Event1::opcode, s);
  36659. + attach((sink<Event2, Events ...> *)s);
  36660. + }
  36661. +
  36662. + template<typename Event>
  36663. + void
  36664. + attach(sink<Event> * s)
  36665. + {
  36666. + attach(Event::opcode, s);
  36667. + }
  36668. +
  36669. + void attach(unsigned int opcode, dispatcher * d)
  36670. + {
  36671. + m_dispatcher[opcode].emplace(0, d);
  36672. + }
  36673. +
  36674. + std::unordered_map<unsigned int,
  36675. + std::multimap<unsigned int, dispatcher *>> m_dispatcher;
  36676. +};
  36677. +
  36678. +template<typename I>
  36679. +void foo(int i, I j) {}
  36680. +
  36681. +int main(int argc, char ** argv)
  36682. +{
  36683. + int i = 42;
  36684. + std::string s = "42";
  36685. +
  36686. + pod_int pi;
  36687. + pod_double pd;
  36688. + pod_string ps;
  36689. +
  36690. + test5::a a;
  36691. + test5::b b;
  36692. + test5::c c;
  36693. +
  36694. + handler_registry<pod_dispatcher<0>,
  36695. + pod_dispatcher<1>,
  36696. + pod_dispatcher<2>> registry;
  36697. +
  36698. + registry.attach(&a);
  36699. + registry.attach(&b);
  36700. + registry.attach(&c);
  36701. +
  36702. + registry.dispatch((test5::pod_generic *)&pi);
  36703. + registry.dispatch((test5::pod_generic *)&ps);
  36704. + registry.dispatch((test5::pod_generic *)&pd);
  36705. +
  36706. + return 0;
  36707. +}
  36708. +
  36709. +};
  36710. +
  36711. +namespace test6 {
  36712. + template <typename... Types>
  36713. + struct foo {};
  36714. +
  36715. + template < typename... Types1, template <typename...> class T
  36716. + , typename... Types2, template <typename...> class V
  36717. + , typename U >
  36718. + void
  36719. + bar(const T<Types1...>&, const V<Types2...>&, const U& u)
  36720. + {
  36721. + std::cout << sizeof...(Types1) << std::endl;
  36722. + std::cout << sizeof...(Types2) << std::endl;
  36723. + std::cout << u << std::endl;
  36724. + }
  36725. +
  36726. + int main(int argc, char ** argv)
  36727. + {
  36728. + foo<char, int, float> f1;
  36729. + foo<char, int> f2;
  36730. + bar(f1, f2, 9);
  36731. + return 0;
  36732. + }
  36733. +};
  36734. +
  36735. +namespace test7 {
  36736. +
  36737. +static constexpr std::size_t * my_ext_1 = nullptr;
  36738. +static constexpr std::size_t * my_ext_2 = nullptr;
  36739. +static constexpr std::size_t * my_ext_3 = nullptr;
  36740. +static constexpr std::size_t * my_ext_4 = nullptr;
  36741. +
  36742. +// static const std::size_t id_4_0 = reinterpret_cast<std::size_t>(&my_ext_4 + 0);
  36743. +// static const std::size_t id_4_1 = reinterpret_cast<std::size_t>(&my_ext_4 + 1);
  36744. +// static const std::size_t id_4_2 = reinterpret_cast<std::size_t>(&my_ext_4 + 2);
  36745. +
  36746. +namespace p1 {
  36747. +template<std::size_t * Id>
  36748. +struct ext {};
  36749. +
  36750. +template<>
  36751. +struct ext<my_ext_1> {
  36752. + void call(void) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36753. +};
  36754. +};
  36755. +
  36756. +namespace p2 {
  36757. +template<std::size_t * Id>
  36758. +struct ext {};
  36759. +
  36760. +template<>
  36761. +struct ext<my_ext_2> {
  36762. + void call(void) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36763. +};
  36764. +};
  36765. +
  36766. +namespace p3 {
  36767. +template<std::size_t * Id>
  36768. +struct ext {};
  36769. +
  36770. +template<>
  36771. +struct ext<my_ext_3> {
  36772. + void call(void) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36773. +};
  36774. +};
  36775. +
  36776. +struct proto_1 {
  36777. + typedef p1::ext<my_ext_1> ext;
  36778. + template<typename Handler, typename Event>
  36779. + void dispatch(const Handler & h, const Event & e)
  36780. + {
  36781. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36782. + e.call(static_cast<const typename Event::ext &>(h));
  36783. + }
  36784. +};
  36785. +
  36786. +struct proto_2 {
  36787. + typedef p2::ext<my_ext_2> ext;
  36788. + template<typename Handler, typename Event>
  36789. + void dispatch(const Handler & h, const Event & e)
  36790. + {
  36791. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36792. + e.call(static_cast<const typename Event::ext &>(h));
  36793. + }
  36794. +};
  36795. +
  36796. +struct proto_3 {
  36797. + typedef p3::ext<my_ext_3> ext;
  36798. + template<typename Handler, typename Event>
  36799. + void dispatch(const Handler & h, const Event & e)
  36800. + {
  36801. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  36802. + e.call(static_cast<const typename Event::ext &>(h));
  36803. + }
  36804. +};
  36805. +
  36806. +struct event_1 {
  36807. + typedef p1::ext<my_ext_1> ext;
  36808. + typedef proto_1 proto;
  36809. + // void call(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36810. + void call(const ext & e) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; e.call(); }
  36811. +};
  36812. +
  36813. +struct event_2 {
  36814. + typedef p2::ext<my_ext_2> ext;
  36815. + typedef proto_2 proto;
  36816. + // void call(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36817. + void call(const ext & e) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; e.call(); }
  36818. +};
  36819. +
  36820. +struct event_3 {
  36821. + typedef p3::ext<my_ext_3> ext;
  36822. + typedef proto_3 proto;
  36823. + // void call(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36824. + void call(const ext & e) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; e.call(); }
  36825. +};
  36826. +
  36827. +struct pod_event_1 {
  36828. + const int id = 1;
  36829. +};
  36830. +
  36831. +struct pod_event_2 {
  36832. + const int id = 2;
  36833. +};
  36834. +
  36835. +struct pod_event_3 {
  36836. + const int id = 3;
  36837. +};
  36838. +
  36839. +template<typename ... Protos>
  36840. +struct proto
  36841. + : public Protos ...
  36842. + , public Protos::ext ...
  36843. +{
  36844. +
  36845. + template<typename Event>
  36846. + void run(const Event & event)
  36847. + {
  36848. + static_cast<typename Event::proto *>(this)->dispatch(*this, event);
  36849. + }
  36850. +
  36851. +};
  36852. +
  36853. +int main(int argc, char ** argv)
  36854. +{
  36855. + std::cerr << "my_ext_1: " << my_ext_1 << std::endl;
  36856. + std::cerr << "my_ext_2: " << my_ext_2 << std::endl;
  36857. + std::cerr << "my_ext_3: " << my_ext_3 << std::endl;
  36858. +
  36859. + proto<proto_1, proto_2, proto_3> p;
  36860. +
  36861. + event_1 e_1;
  36862. + event_2 e_2;
  36863. + event_3 e_3;
  36864. +
  36865. + p.run(e_1);
  36866. + p.run(e_2);
  36867. + p.run(e_3);
  36868. +
  36869. + return 0;
  36870. +}
  36871. +
  36872. +}; // namespace test7
  36873. +
  36874. +namespace test8 {
  36875. +
  36876. +struct a {
  36877. + void operator()(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36878. +};
  36879. +
  36880. +struct b {
  36881. + void operator()(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36882. +};
  36883. +
  36884. +struct c {
  36885. + void operator()(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36886. +};
  36887. +
  36888. +struct wrap_hull
  36889. +{
  36890. + virtual void do_cool_stuff(void) = 0;
  36891. +};
  36892. +
  36893. +template<typename ... Args>
  36894. +struct wrap
  36895. + : public wrap_hull
  36896. + , public Args ...
  36897. +{
  36898. + void do_cool_stuff(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  36899. +};
  36900. +
  36901. +template<typename ... Args>
  36902. +struct test : public Args ...
  36903. +{
  36904. + void trigger(void)
  36905. + {
  36906. + run<Args ...>();
  36907. + }
  36908. +
  36909. + template<typename Arg, typename Next, typename ... Rest>
  36910. + void run(void)
  36911. + {
  36912. + run<Arg>();
  36913. + run<Next, Rest ...>();
  36914. + }
  36915. +
  36916. + template<typename Arg>
  36917. + void run(void)
  36918. + {
  36919. + Arg()();
  36920. + }
  36921. +
  36922. + template<typename Arg, typename Next, typename ... Rest>
  36923. + void
  36924. + insert(wrap<Arg, Next, Rest ...> * w)
  36925. + {
  36926. + insert<Arg, Next, Rest ...>(
  36927. + reinterpret_cast<wrap<Arg> *>(w),
  36928. + reinterpret_cast<wrap<Next, Rest> *>(w) ...);
  36929. + }
  36930. +
  36931. + template<typename Arg, typename Next, typename ... Rest>
  36932. + void
  36933. + insert(wrap<Arg> * w, wrap<Next, Rest ...> * ws ...)
  36934. + {
  36935. + insert<Arg>(w);
  36936. + insert<Next, Rest ...>(
  36937. + reinterpret_cast<wrap<Next> *>(w),
  36938. + reinterpret_cast<wrap<Rest> *>(w) ...);
  36939. + }
  36940. +
  36941. + template<typename Arg>
  36942. + void
  36943. + insert(wrap_hull * wh)
  36944. + {
  36945. + m_wraps.push_back(wh);
  36946. + }
  36947. +
  36948. + void call_objects(void)
  36949. + {
  36950. + for (auto * wh : m_wraps) {
  36951. + wh->do_cool_stuff();
  36952. + }
  36953. + }
  36954. +
  36955. + std::vector<wrap_hull *> m_wraps;
  36956. +};
  36957. +
  36958. +int main(int argc, char ** argv)
  36959. +{
  36960. + struct test<a, b, c> t;
  36961. + t.trigger();
  36962. +
  36963. + struct wrap<a, b, c> w;
  36964. + t.insert(&w);
  36965. +
  36966. + t.call_objects();
  36967. +
  36968. + return 0;
  36969. +}
  36970. +
  36971. +}; // namespace test8
  36972. +
  36973. +int main(int argc, char ** argv)
  36974. +{
  36975. + // return test1::main(argc, argv);
  36976. + // return test2::main(argc, argv);
  36977. + // return test3::main(argc, argv);
  36978. + // return test4::main(argc, argv);
  36979. + // return test5::main(argc, argv);
  36980. + // return test6::main(argc, argv);
  36981. + // return test7::main(argc, argv);
  36982. + return test8::main(argc, argv);
  36983. +}
  36984. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/template.cpp polybar-3.2.1/lib/xpp/src/tests/template.cpp
  36985. --- polybar-3.2.1.orig/lib/xpp/src/tests/template.cpp 1970-01-01 02:00:00.000000000 +0200
  36986. +++ polybar-3.2.1/lib/xpp/src/tests/template.cpp 2017-08-30 16:02:01.000000000 +0300
  36987. @@ -0,0 +1,101 @@
  36988. +// compile with `g++ -std=c++11 test.cpp`
  36989. +#include <iostream>
  36990. +
  36991. +#define CALLABLE(FUNCTION) callable<decltype(FUNCTION), FUNCTION>
  36992. +
  36993. +template<typename Signature, Signature & S>
  36994. +struct callable;
  36995. +
  36996. +template<typename Return,
  36997. + typename ... Args, Return (&Function)(Args ...)>
  36998. +struct callable<Return(Args ...), Function> {
  36999. + Return operator()(Args ... args)
  37000. + {
  37001. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37002. + return Function(args ...);
  37003. + }
  37004. +};
  37005. +
  37006. +template<typename ... Arguments>
  37007. +class one_size_fits_them_all;
  37008. +
  37009. +// A generic template
  37010. +template<typename T, typename U, typename V,
  37011. + typename F1, typename F2, typename F3>
  37012. +class one_size_fits_them_all<T, U, V, F1, F2, F3>
  37013. +{
  37014. + public:
  37015. + one_size_fits_them_all(void)
  37016. + {
  37017. + std::cerr << "generic one_size_fits_them_all" << std::endl
  37018. + << __PRETTY_FUNCTION__ << std::endl << std::endl;
  37019. + F1()();
  37020. + F2()();
  37021. + F3()();
  37022. + std::cerr << std::endl;
  37023. + }
  37024. +};
  37025. +
  37026. +// A specialized template
  37027. +template<typename T, typename Callable>
  37028. +class one_size_fits_them_all<T, int, int, void, void, Callable>
  37029. +{
  37030. + public:
  37031. + one_size_fits_them_all(void)
  37032. + {
  37033. + std::cerr << "specialized one_size_fits_them_all" << std::endl
  37034. + << __PRETTY_FUNCTION__ << std::endl << std::endl;
  37035. + Callable()();
  37036. + std::cerr << std::endl;
  37037. + }
  37038. +};
  37039. +
  37040. +void f1(void)
  37041. +{
  37042. + std::cerr << __PRETTY_FUNCTION__ << std::endl << std::endl;
  37043. +}
  37044. +
  37045. +void f2(void)
  37046. +{
  37047. + std::cerr << __PRETTY_FUNCTION__ << std::endl << std::endl;
  37048. +}
  37049. +
  37050. +void f3(void)
  37051. +{
  37052. + std::cerr << __PRETTY_FUNCTION__ << std::endl << std::endl;
  37053. +}
  37054. +
  37055. +template<typename T>
  37056. +struct interface {
  37057. + static std::size_t size_of(void) { return sizeof(T); }
  37058. +};
  37059. +
  37060. +template<typename T>
  37061. +struct test : public interface<T> {
  37062. + test(void)
  37063. + {
  37064. + std::cerr << __PRETTY_FUNCTION__ << " size_of(): " << this->size_of() << std::endl;
  37065. + }
  37066. +};
  37067. +
  37068. +int main(int argc, char ** argv)
  37069. +{
  37070. + // generic template
  37071. + auto generic = one_size_fits_them_all<
  37072. + int, int, int, CALLABLE(f1), CALLABLE(f2), CALLABLE(f3)>();
  37073. +
  37074. + // specialized template
  37075. + auto specialized_int = one_size_fits_them_all<
  37076. + int, int, int, void, void, CALLABLE(f1)>();
  37077. +
  37078. + // specialized template
  37079. + auto specialized_double = one_size_fits_them_all<
  37080. + double, int, int, void, void, CALLABLE(f3)>();
  37081. +
  37082. + test<int> t1;
  37083. + test<double> t2;
  37084. + test<char> t3;
  37085. + test<uint16_t> t4;
  37086. +
  37087. + return 0;
  37088. +}
  37089. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/test.cpp polybar-3.2.1/lib/xpp/src/tests/test.cpp
  37090. --- polybar-3.2.1.orig/lib/xpp/src/tests/test.cpp 1970-01-01 02:00:00.000000000 +0200
  37091. +++ polybar-3.2.1/lib/xpp/src/tests/test.cpp 2017-08-30 16:02:01.000000000 +0300
  37092. @@ -0,0 +1,1255 @@
  37093. +#include <climits>
  37094. +#include <unistd.h>
  37095. +#include <iostream>
  37096. +#include <memory>
  37097. +#include <chrono>
  37098. +
  37099. +#include <list>
  37100. +
  37101. +template<typename T>
  37102. +struct is_callable {
  37103. +private:
  37104. + typedef char(&yes)[1];
  37105. + typedef char(&no)[2];
  37106. +
  37107. + struct Dummy {};
  37108. + struct Fallback { void operator()(); };
  37109. + // struct Derived : T, Fallback { };
  37110. + struct Derived : std::conditional<! std::is_fundamental<T>::value,
  37111. + T,
  37112. + Dummy>::type,
  37113. + Fallback { };
  37114. +
  37115. + template<typename U, U> struct Check;
  37116. +
  37117. + template<typename>
  37118. + static yes test(...);
  37119. +
  37120. + template<typename C>
  37121. + static no test(Check<void (Fallback::*)(), &C::operator()>*);
  37122. +
  37123. +public:
  37124. + static const bool value = sizeof(test<Derived>(0)) == sizeof(yes);
  37125. +};
  37126. +
  37127. +
  37128. +// #include <X11/Xlib.h>
  37129. +// #include <X11/keysymdef.h>
  37130. +// #include <X11/extensions/Xrandr.h>
  37131. +// #include <X11/cursorfont.h> // XC_cross
  37132. +
  37133. +// #include <xcb/xcbext.h>
  37134. +
  37135. +// #include "../event.hpp"
  37136. +// #include "../core/value_iterator.hpp"
  37137. +// #include "../core/connection.hpp"
  37138. +
  37139. +// template<typename Iterator>
  37140. +// void
  37141. +// test(Iterator begin, Iterator end)
  37142. +// {
  37143. +// std::cerr << "before initializer:";
  37144. +// for (auto it = begin; it != end; ++it) {
  37145. +// std::cerr << " " << *it;
  37146. +// }
  37147. +// std::cerr << std::endl;
  37148. +//
  37149. +// // auto vector = { begin, end };
  37150. +// // std::vector<typename value_trait<Iterator>::value_type> vector(begin, end);
  37151. +//
  37152. +// std::vector<typename value_type<Iterator,
  37153. +// ! std::is_pointer<Iterator>::value
  37154. +// >::type>
  37155. +// vector(begin, end);
  37156. +//
  37157. +// // std::initializer_list<Iterator> vector = { begin, end };
  37158. +//
  37159. +// std::cerr << "after initializer (size: " << vector.size() << "):";
  37160. +// for (auto & v : vector) {
  37161. +// std::cerr << " " << v;
  37162. +// }
  37163. +// std::cerr << std::endl;
  37164. +// }
  37165. +
  37166. +struct foo {
  37167. + static void create(int * c, unsigned int xid)
  37168. + {
  37169. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37170. + }
  37171. +
  37172. + static void destroy(int * c, unsigned int xid)
  37173. + {
  37174. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37175. + }
  37176. +};
  37177. +
  37178. +struct bar {
  37179. + static void create(int * c, unsigned int xid, double d)
  37180. + {
  37181. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37182. + }
  37183. + static void destroy(int * c, unsigned int xid)
  37184. + {
  37185. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37186. + }
  37187. +};
  37188. +
  37189. +template<typename Xid, typename ... Parameters>
  37190. +struct allocator {
  37191. +
  37192. + template<void (*Allocate)(int *, Xid, Parameters ...)>
  37193. + struct allocate
  37194. + {
  37195. + void
  37196. + operator()(int * c, Xid xid, Parameters ... parameters)
  37197. + {
  37198. + Allocate(c, xid, parameters ...);
  37199. + }
  37200. + };
  37201. +
  37202. + template<void (*Deallocate)(int *, Xid)>
  37203. + struct deallocate
  37204. + {
  37205. + void
  37206. + operator()(int * c, Xid xid)
  37207. + {
  37208. + Deallocate(c, xid);
  37209. + }
  37210. + };
  37211. +
  37212. +};
  37213. +
  37214. +template<typename Xid, typename Allocate = void, typename Deallocate = void>
  37215. +struct xid {
  37216. +
  37217. + template<typename ... Parameters>
  37218. + xid(Parameters ... parameters)
  37219. + {
  37220. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37221. + m_xid = std::shared_ptr<Xid>(new Xid(0), // xcb_generate_id(c)),
  37222. + [&](Xid * xid)
  37223. + {
  37224. + Deallocate()(NULL, *xid);
  37225. + delete xid;
  37226. + });
  37227. + Allocate()(NULL, 0, parameters ...);
  37228. + }
  37229. +
  37230. + std::shared_ptr<Xid> m_xid;
  37231. +};
  37232. +
  37233. +template<typename Xid>
  37234. +struct xid<Xid, void, void>
  37235. +{
  37236. + Xid xid;
  37237. +};
  37238. +
  37239. +template<typename Signature1, Signature1 & S1, typename Signature2, Signature2 & S2>
  37240. +struct wrapper;
  37241. +
  37242. +template<typename Return1,
  37243. + typename ... Args1,
  37244. + Return1(&F1)(Args1 ...),
  37245. + typename Return2,
  37246. + typename ... Args2,
  37247. + Return2(&F2)(Args2 ...)>
  37248. +struct wrapper<Return1(Args1 ...), F1, Return2(Args2 ...), F2> {
  37249. + static
  37250. + void
  37251. + allocate(Args1 ... args)
  37252. + {
  37253. + F1(args ...);
  37254. + }
  37255. + static
  37256. + void
  37257. + deallocate(Args2 ... args)
  37258. + {
  37259. + F2(args ...);
  37260. + }
  37261. +};
  37262. +
  37263. +struct caller {
  37264. + template<typename Callee>
  37265. + void operator()(const Callee & callee, int i)
  37266. + {
  37267. + switch (i) {
  37268. + case 0: callee(42);
  37269. + break;
  37270. + case 1: callee(2.73);
  37271. + break;
  37272. + case 2: callee(std::string("foo"));
  37273. + break;
  37274. + };
  37275. + }
  37276. +};
  37277. +
  37278. +struct callee {
  37279. + void operator()(int i) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37280. + template<typename Arg>
  37281. + void operator()(const Arg &) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37282. +};
  37283. +
  37284. +namespace mylib {
  37285. +
  37286. +namespace request {
  37287. + enum { checked, unchecked };
  37288. +};
  37289. +
  37290. +namespace extension {
  37291. +
  37292. +using mylib::request::checked;
  37293. +using mylib::request::unchecked;
  37294. +
  37295. +namespace request {
  37296. +template<int RequestType = unchecked>
  37297. +struct void_request {
  37298. + void operator()(void) const noexcept(RequestType == unchecked)
  37299. + {
  37300. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37301. + };
  37302. +};
  37303. +};
  37304. +
  37305. +// template<>
  37306. +// struct void_request<checked> {
  37307. +// void operator()(void) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; };
  37308. +// };
  37309. +
  37310. +namespace request {
  37311. +template<int RequestType = checked>
  37312. +struct reply_request {
  37313. + void operator()(void) const noexcept(RequestType == unchecked)
  37314. + {
  37315. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37316. + };
  37317. +};
  37318. +};
  37319. +
  37320. +// template<>
  37321. +// struct reply_request<unchecked> {
  37322. +// void operator()(void) const { std::cerr << __PRETTY_FUNCTION__ << std::endl; };
  37323. +// };
  37324. +
  37325. +struct interface {
  37326. + template<int RequestType = unchecked>
  37327. + void void_request(void) const { request::void_request<RequestType>()(); }
  37328. + template<int RequestType = checked>
  37329. + void reply_request(void) const { request::reply_request<RequestType>()(); }
  37330. +};
  37331. +
  37332. +}; // extension
  37333. +
  37334. +struct c : public extension::interface
  37335. +{};
  37336. +
  37337. +}; // mylib
  37338. +
  37339. +namespace test00 {
  37340. +
  37341. +enum { checked, unchecked };
  37342. +
  37343. +template<std::size_t check = unchecked>
  37344. +struct template_struct {
  37345. + template<typename Connection, typename ... Parameter>
  37346. + template_struct(Connection c, Parameter ... parameter) {}
  37347. +};
  37348. +
  37349. +template_struct<> ts(nullptr);
  37350. +
  37351. +template<std::size_t check = unchecked, typename Connection, typename ... Parameter>
  37352. +void
  37353. +template_function(Connection c, Parameter ... parameter)
  37354. +{
  37355. + if (check == checked) {
  37356. + std::cerr << "if (check) { // check == checked" << std::endl;
  37357. + } else {
  37358. + std::cerr << "} else { // check == unchecked" << std::endl;
  37359. + }
  37360. +}
  37361. +
  37362. +struct an_interface {
  37363. + template<typename std::size_t Check = unchecked, typename ... Parameter>
  37364. + void
  37365. + template_function(Parameter ... parameter)
  37366. + {
  37367. + test00::template_function<Check>(m_c, parameter ...);
  37368. + }
  37369. + double m_c;
  37370. +};
  37371. +
  37372. +void test(void)
  37373. +{
  37374. +// two t;
  37375. +// // t.do_it_void();
  37376. +// // t.do_it_void().unchecked();
  37377. +// auto reply_1 = t.do_it_reply();
  37378. +// auto reply_2 = t.do_it_reply().unchecked();
  37379. +// // reply.checked();
  37380. +// // auto reply = t.do_it_reply().checked();
  37381. +
  37382. + // template_function(t);
  37383. + // template_function(t, reply_1, reply_2);
  37384. + // template_function<checked>(reply_1, reply_2);
  37385. + // template_function<checked>(reply_2);
  37386. +
  37387. + an_interface i;
  37388. + i.template_function(0);
  37389. + i.template_function<checked>(0);
  37390. +}
  37391. +
  37392. +};
  37393. +
  37394. +namespace test01 {
  37395. +
  37396. +struct a {
  37397. + a(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37398. + a(const std::string & string) : m_string(string) {}
  37399. + a(const a & other) : m_string(other.m_string) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37400. + a(a && other) : m_string(std::move(other.m_string)) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37401. + ~a(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37402. + std::string m_string = "struct a";
  37403. +};
  37404. +
  37405. +struct b {
  37406. + // b(const a & a) : m_a(a) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37407. + // template<typename A>
  37408. + // b(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37409. + // b(a & a) : m_a(a) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37410. + // b(a && a) : m_a(std::move(a)) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37411. + b(a && a) : m_a(std::move(a)) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37412. + b(const a & a) : m_a(a) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37413. +
  37414. + // b(const b & other) : m_a(other.m_a) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37415. + b(b && other) : m_a(std::move(other.m_a)) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37416. +
  37417. + ~b(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37418. +
  37419. + // const a & m_a;
  37420. + a m_a;
  37421. +};
  37422. +
  37423. +b
  37424. +// foo(const a & a)
  37425. +foo(const a & a)
  37426. +{
  37427. + // return b(std::move(a));
  37428. + return b(a);
  37429. +}
  37430. +
  37431. +void test(void)
  37432. +{
  37433. + // b bb = foo(a());
  37434. + // b bb = foo(std::move(a()));
  37435. + a aa("a string on the stack");
  37436. + // b b1 = foo(aa);
  37437. + std::cerr << "(before move) aa.m_string: " << aa.m_string << std::endl;
  37438. + b b2 = foo(std::move(aa));
  37439. + std::cerr << "(after move) aa.m_string: " << aa.m_string << std::endl;
  37440. + // std::cerr << "b1.m_a.m_string: " << b1.m_a.m_string << std::endl;
  37441. + std::cerr << "b2.m_a.m_string: " << b2.m_a.m_string << std::endl;
  37442. +}
  37443. +
  37444. +};
  37445. +
  37446. +namespace test02 {
  37447. +
  37448. +struct a {
  37449. + static void foo(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37450. +};
  37451. +
  37452. +struct b : a {
  37453. + static void foo(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37454. +};
  37455. +
  37456. +struct c : b {
  37457. + static void foo(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37458. +};
  37459. +
  37460. +// struct d : a, b {
  37461. +// static void foo(void)
  37462. +// {
  37463. +// std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37464. +// a::foo();
  37465. +// b::foo();
  37466. +// }
  37467. +// };
  37468. +
  37469. +void test(void)
  37470. +{
  37471. + a::foo();
  37472. + b::foo();
  37473. + c::foo();
  37474. + // d::foo();
  37475. +}
  37476. +
  37477. +};
  37478. +
  37479. +namespace test03 {
  37480. +
  37481. +struct connection {};
  37482. +
  37483. +struct baz {
  37484. + int member;
  37485. +};
  37486. +
  37487. +struct fro {
  37488. + // fro(const int & i)
  37489. + // {
  37490. + // std::cerr << __PRETTY_FUNCTION__ << ": " << i << std::endl;
  37491. + // }
  37492. +
  37493. + fro(const int & i, connection *)
  37494. + {
  37495. + std::cerr << __PRETTY_FUNCTION__ << ": " << i << std::endl;
  37496. + }
  37497. +};
  37498. +
  37499. +struct foo {
  37500. + foo(const int & i, double d)
  37501. + {
  37502. + std::cerr << __PRETTY_FUNCTION__ << ": " << i << "; d: " << d << std::endl;
  37503. + }
  37504. +
  37505. + // foo(int i, connection *, double d)
  37506. + // {
  37507. + // std::cerr << __PRETTY_FUNCTION__ << ": " << i << "; d: " << d << std::endl;
  37508. + // }
  37509. +};
  37510. +
  37511. +namespace reply_member {
  37512. +
  37513. +template<typename ReturnType>
  37514. +class get_with_object {
  37515. + public:
  37516. + template<typename Arg, typename ... Parameter>
  37517. + ReturnType
  37518. + operator()(Arg & a, connection *, Parameter ... parameter)
  37519. + {
  37520. + return ReturnType { a, parameter ... };
  37521. + }
  37522. +};
  37523. +
  37524. +template<typename ReturnType>
  37525. +class get_with_object_and_connection {
  37526. + public:
  37527. + template<typename Arg, typename ... Parameter>
  37528. + ReturnType
  37529. + operator()(const Arg & a, connection * i, Parameter ... parameter)
  37530. + {
  37531. + return ReturnType { a, i, parameter ... };
  37532. + }
  37533. +};
  37534. +
  37535. +template<typename ReturnType>
  37536. +class get_fundamental {
  37537. + public:
  37538. + template<typename Arg>
  37539. + ReturnType
  37540. + operator()(const Arg & arg, connection *)
  37541. + {
  37542. + return ReturnType { arg };
  37543. + }
  37544. +};
  37545. +
  37546. +template<typename MemberType, typename ReturnType, typename ... Parameter>
  37547. +class get
  37548. + : public std::conditional<
  37549. + std::is_constructible<ReturnType, MemberType>::value,
  37550. + get_fundamental<ReturnType>,
  37551. + typename std::conditional<
  37552. + std::is_constructible<ReturnType,
  37553. + MemberType,
  37554. + connection *,
  37555. + Parameter ...>::value,
  37556. + get_with_object_and_connection<ReturnType>,
  37557. + get_with_object<ReturnType>
  37558. + >::type
  37559. + >::type
  37560. +{};
  37561. +
  37562. +};
  37563. +
  37564. +struct c {
  37565. + template<typename ReturnType = int, typename ... Parameter>
  37566. + ReturnType
  37567. + c_get(Parameter ... parameter)
  37568. + {
  37569. + using get = reply_member::get<decltype(b.member), ReturnType, Parameter ...>;
  37570. + return get()(b.member, i, parameter ...);
  37571. + }
  37572. +
  37573. + baz b;
  37574. + connection * i;
  37575. +};
  37576. +
  37577. +void
  37578. +test(void)
  37579. +{
  37580. + c cc;
  37581. + cc.b.member = 42;
  37582. +
  37583. + auto m_int = cc.c_get();
  37584. + std::cerr << "m: " << m_int << std::endl;
  37585. +
  37586. + // auto m_fro_i = cc.c_get<fro>();
  37587. + // auto m_foo_d = cc.c_get<foo>(3.14);
  37588. +}
  37589. +
  37590. +}; // test03
  37591. +
  37592. +namespace test04 {
  37593. +
  37594. +struct a {
  37595. + a(const std::string & s) : m_s(s) {}
  37596. + void operator()(const std::string & s) const
  37597. + {
  37598. + std::cerr << "a: " << s << "; m_s: " << m_s << std::endl;
  37599. + }
  37600. + std::string m_s;
  37601. +};
  37602. +
  37603. +struct b {
  37604. + void operator()(const std::string & s) const
  37605. + {
  37606. + std::cerr << "b: " << s << std::endl;
  37607. + }
  37608. +};
  37609. +
  37610. +struct c : a, b {
  37611. + c(void) : a("c : a") {}
  37612. + // void operator() (const std::string & s) { a::operator()(s); b::operator()(s); }
  37613. +};
  37614. +
  37615. +struct d {
  37616. + void
  37617. + operator()(const std::string & s) const
  37618. + {
  37619. + std::cerr << "d: " << s << std::endl;
  37620. + }
  37621. +};
  37622. +
  37623. +template<typename Base, typename Arg>
  37624. +void
  37625. +check(const Base & base, const Arg & arg)
  37626. +{
  37627. + base(arg);
  37628. +}
  37629. +
  37630. +template<typename Base, typename Arg, typename E>
  37631. +void
  37632. +check(const Base & base, const Arg & arg)
  37633. +{
  37634. + static_cast<const E &>(base)(arg);
  37635. +}
  37636. +
  37637. +template<typename Base, typename Arg, typename E, typename Next, typename ... Rest>
  37638. +void
  37639. +check(const Base & base, const Arg & arg)
  37640. +{
  37641. + check<Base, Arg, E>(base, arg);
  37642. + check<Base, Arg, Next, Rest ...>(base, arg);
  37643. +}
  37644. +
  37645. +template<typename E, typename ... ES>
  37646. +struct foo_base {
  37647. + foo_base(const E & e)
  37648. + : m_e(e)
  37649. + {}
  37650. +
  37651. + E m_e;
  37652. +
  37653. + void
  37654. + check_error(const std::string & s)
  37655. + {
  37656. + check<E, std::string, ES ...>(m_e, s);
  37657. + }
  37658. +};
  37659. +
  37660. +template<>
  37661. +struct foo_base<void> {
  37662. + foo_base(void)
  37663. + {}
  37664. +
  37665. + void
  37666. + check_error(const std::string & s)
  37667. + {
  37668. + std::cerr << "foo_base<void>" << std::endl;
  37669. + }
  37670. +};
  37671. +
  37672. +template<typename E = void, typename ... ES>
  37673. +struct foo
  37674. + : public foo_base<E, ES ...>
  37675. +{
  37676. + typedef foo_base<E, ES ...> base;
  37677. +
  37678. + using base::foo_base;
  37679. +
  37680. + template<typename ... P2>
  37681. + void
  37682. + operator()(const std::string & s, P2 ... p2)
  37683. + {
  37684. + base::check_error(s);
  37685. + }
  37686. +
  37687. +}; // struct foo;
  37688. +
  37689. +template<typename T>
  37690. +using decay = typename std::decay<T>::type;
  37691. +
  37692. +template<typename Condition, typename T = void>
  37693. +using enable_if =
  37694. + typename std::enable_if<Condition::value, T>::type;
  37695. +
  37696. +template<typename Condition, typename T = void>
  37697. +using disable_if =
  37698. + typename std::enable_if<! Condition::value, T>::type;
  37699. +
  37700. +// template<typename P, typename ... PS>
  37701. +// typename std::enable_if<is_callable<decay<P>>::value, void>::type
  37702. +// foo_function_dispatch(const std::string & s, P && p, PS ... ps)
  37703. +// {
  37704. +// std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37705. +// foo_function(p, s, ps ...);
  37706. +// }
  37707. +
  37708. +// template<typename P, typename ... PS>
  37709. +// typename std::enable_if<! is_callable<decay<P>>::value, void>::type
  37710. +// foo_function_dispatch(const std::string & s, P && p, PS ... ps)
  37711. +// {
  37712. +// std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37713. +// foo_function(s, p, ps ...);
  37714. +// }
  37715. +
  37716. +template<typename Parameter,
  37717. + typename ... Parameters,
  37718. + typename = disable_if<is_callable<decay<Parameter>>>>
  37719. +void
  37720. +foo_function(const std::string & s, Parameter && p, Parameters ... ps)
  37721. +{
  37722. + foo<>()(s, ps ...);
  37723. +}
  37724. +
  37725. +template<typename ... ErrorHandlers,
  37726. + typename ErrorHandler,
  37727. + typename ... Parameters,
  37728. + typename = enable_if<is_callable<decay<ErrorHandler>>>>
  37729. +void
  37730. +foo_function(const std::string & s, ErrorHandler && e, Parameters ... ps)
  37731. +{
  37732. + (foo<ErrorHandler, ErrorHandlers ...>(e))(s, ps ...);
  37733. +}
  37734. +
  37735. +struct foo_iface {
  37736. +
  37737. + foo_iface(void) {}
  37738. + foo_iface(const std::string & s) : m_s(s) {}
  37739. +
  37740. + template<typename ... ErrorHandlers, typename ... Parameters>
  37741. + void
  37742. + foo_method(Parameters ... ps)
  37743. + {
  37744. + foo_function<ErrorHandlers ...>(m_s, ps ...);
  37745. + }
  37746. +
  37747. + // template<typename P,
  37748. + // typename ... PS,
  37749. + // typename = disable_if<is_callable<decay<P>>>>
  37750. + // void
  37751. + // foo_method(P && p, PS ... ps)
  37752. + // {
  37753. + // foo_function(m_s, p, ps ...);
  37754. + // }
  37755. +
  37756. + // template<typename ... ErrorHandlers,
  37757. + // typename E,
  37758. + // typename ... PS,
  37759. + // typename = enable_if<is_callable<decay<E>>>>
  37760. + // void
  37761. + // foo_method(E && e, PS ... ps)
  37762. + // {
  37763. + // foo_function<ErrorHandlers ...>(m_s, e, ps ...);
  37764. + // }
  37765. +
  37766. + std::string m_s = "foo_iface";
  37767. +};
  37768. +
  37769. +// template<typename ... ES, typename E, typename ... PS, typename P>
  37770. +// void
  37771. +// foo_with_error(const std::string & s, PS ... ps, const E & e)
  37772. +// {
  37773. +// (foo<E, ES ...>(e))(s, ps ...);
  37774. +// // foo<std::function<void(const std::string &)>> f([](const std::string & s) { std::cerr << "lambda: " << s << std::endl; });
  37775. +// // f(s, ps ...);
  37776. +// }
  37777. +
  37778. +struct e {
  37779. + int i;
  37780. +};
  37781. +
  37782. +void
  37783. +test(void)
  37784. +{
  37785. + // d dd;
  37786. + // (foo<d>(dd))("aaa 42 aaa", 5,6,7);
  37787. + // ((foo<c, a, b>(c())))("ccc 42 ccc", 5,6,7);
  37788. +
  37789. + foo_function("hhh 42 hhh", a("abcde"), 5,6,7);
  37790. + foo_function("jjj 42 jjj", 5,6,7);
  37791. + foo_function("kkk 42 kkk", [](const std::string & s){ std::cerr << "lambda: " << s << std::endl; }, 5,6,7);
  37792. +
  37793. + foo_iface fi;
  37794. + fi.foo_method(5,6,7);
  37795. + fi.foo_method(b(), 5,6,7);
  37796. + c cc;
  37797. + fi.foo_method<a,b>(cc, 5,6,7);
  37798. +
  37799. + std::cerr << std::boolalpha << std::endl
  37800. + // << "has_member_operator(): " << has_member_operator<b>::value << std::endl
  37801. + << "is_callable: " << is_callable<b>::value << std::endl
  37802. + << "is_trivial: " << std::is_trivial<b>::value << std::endl
  37803. + << "is_pod: " << std::is_pod<b>::value << std::endl
  37804. + << "is_standard_layout: " << std::is_standard_layout<b>::value << std::endl
  37805. + << "is_fundamental: " << std::is_fundamental<b>::value << std::endl
  37806. + << "is_class: " << std::is_class<b>::value << std::endl
  37807. + << "is_object: " << std::is_object<b>::value << std::endl
  37808. + << std::endl;
  37809. +
  37810. + std::cerr << std::boolalpha << std::endl
  37811. + << "is_callable: " << is_callable<e>::value << std::endl
  37812. + << "is_trivial: " << std::is_trivial<e>::value << std::endl
  37813. + << "is_pod: " << std::is_pod<e>::value << std::endl
  37814. + << "is_standard_layout: " << std::is_standard_layout<e>::value << std::endl
  37815. + << "is_fundamental: " << std::is_fundamental<e>::value << std::endl
  37816. + << "is_class: " << std::is_class<e>::value << std::endl
  37817. + << "is_object: " << std::is_object<e>::value << std::endl
  37818. + << std::endl;
  37819. +
  37820. + std::cerr << std::boolalpha << std::endl
  37821. + << "is_callable: " << is_callable<int>::value << std::endl
  37822. + << std::endl;
  37823. +
  37824. + // foo<b>(b(1))("bbb 42 bbb", 5,6,7);
  37825. + // (foo<b>(b()))("bbb 42 bbb", 5,6,7);
  37826. + // foo<a, b>(c())("ccc 42 ccc", 5,6,7);
  37827. + // foo<>()("ddd 42 ddd", 5,6,7);
  37828. + // foo<a>()(a("a2"), "eee 42 eee", 5,6,7);
  37829. + // (foo<a>(a("a2")))("eee 42 eee", 5,6,7);
  37830. +}
  37831. +
  37832. +}; // test04
  37833. +
  37834. +namespace test05 {
  37835. +
  37836. +template<typename T>
  37837. +struct a {
  37838. + struct member {
  37839. + struct get {
  37840. + void operator()(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  37841. + };
  37842. + };
  37843. +};
  37844. +
  37845. +struct b : a<int> {
  37846. + void
  37847. + fun(void)
  37848. + {
  37849. + using get = member::get;
  37850. + get()();
  37851. + }
  37852. +};
  37853. +
  37854. +void
  37855. +test(void)
  37856. +{
  37857. + b bb;
  37858. + bb.fun();
  37859. +}
  37860. +
  37861. +}; // test05
  37862. +
  37863. +namespace test06 {
  37864. +
  37865. +void foo(int i)
  37866. +{
  37867. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  37868. +}
  37869. +
  37870. +auto &bar = foo;
  37871. +
  37872. +struct a {
  37873. + virtual void foo(void) = 0;
  37874. +};
  37875. +
  37876. +struct b : a {
  37877. + using a::foo;
  37878. + void bar(void) { foo(); }
  37879. + // decltype(a::foo) & bar = a::foo;
  37880. +};
  37881. +
  37882. +void test(void)
  37883. +{
  37884. + foo(1);
  37885. + bar(2);
  37886. +}
  37887. +
  37888. +}; // test05
  37889. +
  37890. +namespace test07 {
  37891. +
  37892. +class a {
  37893. + static const char * foo ;
  37894. + static const std::string bar ;
  37895. + static constexpr const char * baz = "baz";
  37896. +};
  37897. +const char * a::foo = "foo";
  37898. +const std::string a::bar = "bar";
  37899. +
  37900. +void
  37901. +test(void)
  37902. +{
  37903. + // a aa;
  37904. +}
  37905. +
  37906. +}; // test05
  37907. +
  37908. +namespace test08 {
  37909. +
  37910. +template<typename T>
  37911. +struct print {
  37912. + template<typename X>
  37913. + std::ostream &
  37914. + operator()(std::ostream & os, X && t)
  37915. + {
  37916. + return os << "forward: " << std::forward<T>(t);
  37917. + }
  37918. +};
  37919. +
  37920. +template<typename T>
  37921. +struct print<T *> {
  37922. + std::ostream &
  37923. + operator()(std::ostream & os, T * t)
  37924. + {
  37925. + return os << "pointer: " << *t;
  37926. + }
  37927. +};
  37928. +
  37929. +template<typename T>
  37930. +struct a {
  37931. + explicit a(T && t)
  37932. + : m_t(std::forward<T>(t))
  37933. + {
  37934. + std::ostream & os = std::cerr;
  37935. + os << __PRETTY_FUNCTION__ << " m_t: ";
  37936. + print<T>()(os, m_t);
  37937. + os << std::endl;
  37938. + }
  37939. +
  37940. + explicit a(const T & t)
  37941. + : m_t(t)
  37942. + {
  37943. + std::ostream & os = std::cerr;
  37944. + os << __PRETTY_FUNCTION__ << " m_t: ";
  37945. + print<T>()(os, m_t);
  37946. + os << std::endl;
  37947. + }
  37948. +
  37949. + ~a(void)
  37950. + {
  37951. + std::ostream & os = std::cerr;
  37952. + os << __PRETTY_FUNCTION__ << " m_t: ";
  37953. + print<T>()(os, m_t);
  37954. + os << std::endl;
  37955. + }
  37956. +
  37957. + T m_t;
  37958. +};
  37959. +
  37960. +void
  37961. +test(void)
  37962. +{
  37963. + int i = 0;
  37964. + double d = 0.0;
  37965. + a<int> ai(i);
  37966. + a<double> ad(d);
  37967. + a<int> aim(std::move(i));
  37968. + a<double> adm(std::move(d));
  37969. + a<int *> aip(&i);
  37970. + a<double *> adp(&d);
  37971. +}
  37972. +
  37973. +}; // test05
  37974. +
  37975. +namespace test09 {
  37976. +
  37977. +template<typename T, typename U>
  37978. +struct a {
  37979. + explicit a(const T & t, const U & u)
  37980. + : m_t(t)
  37981. + , m_u(u)
  37982. + {}
  37983. + explicit a(const T & t)
  37984. + : m_t(t)
  37985. + {}
  37986. + void operator=(const U & u) { m_u = u; }
  37987. + void set(const U & u) { m_u = u; }
  37988. + T m_t;
  37989. + U m_u;
  37990. +};
  37991. +
  37992. +int t = 0;
  37993. +
  37994. +a<int, int>
  37995. +get_by_value(const int & u)
  37996. +{
  37997. + return a<int, int>{ t, u };
  37998. +}
  37999. +
  38000. +a<int, int> reference_return_a(t);
  38001. +
  38002. +const a<int, int> &
  38003. +get_by_reference(const int & u)
  38004. +{
  38005. + reference_return_a = u;
  38006. + // reference_return_a.set(u);
  38007. + return reference_return_a;
  38008. +}
  38009. +
  38010. +a<int, int> &&
  38011. +get_by_move(const int & u)
  38012. +{
  38013. + return std::move(a<int, int>{t, u});
  38014. + // return a<int, int>{t, u};
  38015. +}
  38016. +
  38017. +void
  38018. +test(void)
  38019. +{
  38020. + int len = 1000000;
  38021. + std::chrono::time_point<std::chrono::high_resolution_clock> start;
  38022. + std::chrono::time_point<std::chrono::high_resolution_clock> stop;
  38023. +
  38024. + std::cerr << "get_by_value:" << std::endl;
  38025. + start = std::chrono::high_resolution_clock::now();
  38026. + for (int i = 0; i < len; ++i) {
  38027. + a<int, int> aa = get_by_value(i);
  38028. + std::cerr << "\r" << aa.m_u;
  38029. + }
  38030. + stop = std::chrono::high_resolution_clock::now();
  38031. + std::cerr << std::endl << "duration: " << (stop - start).count() << std::endl;
  38032. +
  38033. + std::cerr << "get_by_value_rvalue:" << std::endl;
  38034. + start = std::chrono::high_resolution_clock::now();
  38035. + for (int i = 0; i < len; ++i) {
  38036. + a<int, int> && aa = get_by_value(i);
  38037. + std::cerr << "\r" << aa.m_u;
  38038. + }
  38039. + stop = std::chrono::high_resolution_clock::now();
  38040. + std::cerr << std::endl << "duration: " << (stop - start).count() << std::endl;
  38041. +
  38042. + std::cerr << "get_by_reference:" << std::endl;
  38043. + start = std::chrono::high_resolution_clock::now();
  38044. + for (int i = 0; i < len; ++i) {
  38045. + const a<int, int> & aa = get_by_reference(i);
  38046. + std::cerr << "\r" << aa.m_u;
  38047. + }
  38048. + stop = std::chrono::high_resolution_clock::now();
  38049. + std::cerr << std::endl << "duration: " << (stop - start).count() << std::endl;
  38050. +
  38051. + // invalid examples
  38052. + /*
  38053. + std::cerr << "get_by_move_value:" << std::endl;
  38054. + start = std::chrono::high_resolution_clock::now();
  38055. + for (int i = 0; i < len; ++i) {
  38056. + a<int, int> aa = get_by_move(i);
  38057. + std::cerr << "\r" << aa.m_u;
  38058. + }
  38059. + stop = std::chrono::high_resolution_clock::now();
  38060. + std::cerr << std::endl << "duration: " << (stop - start).count() << std::endl;
  38061. +
  38062. + std::cerr << "get_by_move_rvalue:" << std::endl;
  38063. + start = std::chrono::high_resolution_clock::now();
  38064. + for (int i = 0; i < len; ++i) {
  38065. + a<int, int> && aa = get_by_move(i);
  38066. + std::cerr << "\r" << aa.m_u;
  38067. + }
  38068. + stop = std::chrono::high_resolution_clock::now();
  38069. + std::cerr << std::endl << "duration: " << (stop - start).count() << std::endl;
  38070. + */
  38071. +}
  38072. +
  38073. +}; // test05
  38074. +
  38075. +namespace test10 {
  38076. +
  38077. +class a {
  38078. + public:
  38079. + a(const unsigned int & i) : m_int(std::make_shared<unsigned int>(i)) {}
  38080. + operator unsigned int &(void)
  38081. + {
  38082. + return *m_int;
  38083. + }
  38084. + std::shared_ptr<unsigned int> m_int;
  38085. +};
  38086. +
  38087. +void
  38088. +test(void)
  38089. +{
  38090. + a aa { 0 };
  38091. + std::cerr << *aa.m_int << std::endl;
  38092. + static_cast<unsigned int &>(aa) = 42;
  38093. + std::cerr << *aa.m_int << std::endl;
  38094. +}
  38095. +
  38096. +}; // test05
  38097. +
  38098. +namespace test11 {
  38099. +
  38100. +template<typename T>
  38101. +class a {
  38102. + public:
  38103. + a(const T & i) {}
  38104. + a(const T & i, const unsigned int &) {}
  38105. +};
  38106. +
  38107. +void
  38108. +test(void)
  38109. +{
  38110. + std::cerr << std::boolalpha;
  38111. + // std::cerr << std::is_constructible<a, const unsigned int &>::value << std::endl;
  38112. + // std::cerr << std::is_constructible<a, unsigned int &>::value << std::endl;
  38113. + // std::cerr << std::is_constructible<a, unsigned int>::value << std::endl;
  38114. + std::cerr << std::is_constructible<a<unsigned int>, const unsigned int &>::value << std::endl;
  38115. + std::cerr << std::is_constructible<a<unsigned int>, unsigned int &>::value << std::endl;
  38116. + std::cerr << std::is_constructible<a<unsigned int>, unsigned int>::value << std::endl;
  38117. +}
  38118. +
  38119. +}; // test05
  38120. +
  38121. +namespace test12 {
  38122. +
  38123. +void
  38124. +test(void)
  38125. +{
  38126. + char a[2*sizeof(int)];
  38127. + uint * b = reinterpret_cast<uint *>(a);
  38128. + b[0] = (uint)'a' + ((uint)'b' << 8) + ((uint)'c' << 16) + ((uint)'d' << 24);
  38129. + b[1] = (uint)'e' + ((uint)'f' << 8) + ((uint)'g' << 16) + ((uint)'h' << 24);
  38130. + std::cerr << b[0] << ": " << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << std::endl;
  38131. + std::cerr << b[1] << ": " << a[4] << " " << a[5] << " " << a[6] << " " << a[7] << std::endl;
  38132. +}
  38133. +
  38134. +}; // test05
  38135. +
  38136. +namespace test13 {
  38137. +
  38138. +template<typename ... Args>
  38139. +struct a {
  38140. +};
  38141. +
  38142. +template<typename ... Types> struct b;
  38143. +
  38144. +// template<template<typename ...> class T, typename ... Args>
  38145. +// template<template<typename ... Args> class T> // , typename ... Args>
  38146. +// template<typename ... Args>
  38147. +// template<template<typename T<typename ... Args>>>
  38148. +
  38149. +template<typename ... Args, template<typename ...> class T>
  38150. +struct b<T<Args ...>> {
  38151. + b(const T<Args ...> & t)
  38152. + : m_t(t)
  38153. + {}
  38154. + T<Args ...> m_t;
  38155. +};
  38156. +
  38157. +template<typename ... Args, template<typename ...> class T>
  38158. +struct b<T<Args ...> &>
  38159. + : public b<T<Args ...>>
  38160. +{
  38161. + using base = b<T<Args ...>>;
  38162. + using base::base;
  38163. +};
  38164. +
  38165. +void
  38166. +test(void)
  38167. +{
  38168. + a<int> aa_1;
  38169. + b<a<int>> bb_1(aa_1);
  38170. + b<a<int> &> bb_2(aa_1);
  38171. +}
  38172. +
  38173. +}; // test05
  38174. +
  38175. +namespace test15 {
  38176. +
  38177. +struct i {
  38178. + virtual void fun(void) = 0;
  38179. +};
  38180. +
  38181. +struct a : i {
  38182. + void fun(void) { std::cerr << __PRETTY_FUNCTION__ << std::endl; }
  38183. +};
  38184. +
  38185. +struct b {
  38186. +};
  38187. +
  38188. +template<typename I>
  38189. +struct with_i : I
  38190. +{
  38191. + virtual
  38192. + void run(void)
  38193. + {
  38194. + std::cerr << "with_i" << std::endl;
  38195. + static_cast<i *>(this)->fun();
  38196. + }
  38197. +};
  38198. +
  38199. +struct without_i
  38200. +{
  38201. + virtual
  38202. + void run(void) { std::cerr << "without_i" << std::endl; }
  38203. +};
  38204. +
  38205. +template<typename T>
  38206. +struct i_test
  38207. + : std::conditional<std::is_base_of<i, T>::value, with_i<T>, without_i>::type
  38208. +{};
  38209. +
  38210. +void
  38211. +test(void)
  38212. +{
  38213. + i_test<a> a_test;
  38214. + a_test.run();
  38215. + i_test<b> b_test;
  38216. + b_test.run();
  38217. +}
  38218. +
  38219. +}; // test05
  38220. +
  38221. +int main(int argc, char ** argv)
  38222. +{
  38223. + // if (argc != 2) {
  38224. + // std::cerr << "Need one string argument" << std::endl;
  38225. + // return 1;
  38226. + // }
  38227. +
  38228. + // xid<xcb_window_t> xid_1;
  38229. +
  38230. + // xid<xcb_window_t,
  38231. + // allocator<xcb_window_t>::allocate<&foo::create>,
  38232. + // allocator<xcb_window_t>::deallocate<&foo::destroy>>
  38233. + // xid_2;
  38234. +
  38235. + // xid<xcb_window_t,
  38236. + // allocator<xcb_window_t, double>::allocate<&bar::create>,
  38237. + // allocator<xcb_window_t>::deallocate<&bar::destroy>>
  38238. + // xid_3(0.0);
  38239. +
  38240. + // wrapper<decltype(foo::create), foo::create,
  38241. + // decltype(foo::destroy), foo::destroy>::allocate(NULL, 0);
  38242. +
  38243. + // wrapper<decltype(foo::create), foo::create,
  38244. + // decltype(foo::destroy), foo::destroy>::deallocate(NULL, 0);
  38245. +
  38246. + // w_1.allocate(NULL, 0);
  38247. + // w_1.deallocate(NULL, 0);
  38248. +
  38249. + // // xpp::resource class!
  38250. + // // >>>>>>>>><<<<<<<<<<<
  38251. + // wrapper<decltype(bar::create), bar::create,
  38252. + // decltype(bar::destroy), bar::destroy>::allocate(NULL, 0, 0.0);
  38253. +
  38254. + // wrapper<decltype(bar::create), bar::create,
  38255. + // decltype(bar::destroy), bar::destroy>::deallocate(NULL, 0);
  38256. +
  38257. + // wrapper<decltype(bar::create), bar::create,
  38258. + // decltype(bar::destroy), bar::destroy> w_2;
  38259. + // w_2.allocate(NULL, 0, 0.0);
  38260. + // w_2.deallocate(NULL, 0);
  38261. +
  38262. + // wrapper<decltype(bar::create), bar::create> w_2;
  38263. +
  38264. + // xpp::connection<> connection("");
  38265. +
  38266. + // std::map<int, char> char_map;
  38267. + // char_map[0] = 'a';
  38268. + // char_map[1] = 'b';
  38269. + // char_map[2] = 'c';
  38270. +
  38271. + // value_iterator<std::map<int, char>::iterator> begin =
  38272. + // value_iterator<std::map<int, char>::iterator>(char_map.begin());
  38273. + // value_iterator<std::map<int, char>::iterator> end =
  38274. + // value_iterator<std::map<int, char>::iterator>(char_map.end());
  38275. +
  38276. + // std::vector<char> chars_1 = std::vector<char>(begin, end); std::vector<char> chars_2 = { begin, end };
  38277. + // const char * legacy_chars = "abc";
  38278. + // std::vector<char> chars_3 = { legacy_chars, legacy_chars + 3 };
  38279. +
  38280. + // // for (auto it = begin; it != end; ++it) {
  38281. + // for (auto & c : chars_1) {
  38282. + // std::cerr << "value: " << c << std::endl;
  38283. + // }
  38284. +
  38285. + // value_iterator<std::vector<char>::iterator> v_begin =
  38286. + // value_iterator<std::vector<char>::iterator>(chars_1.begin());
  38287. + // value_iterator<std::vector<char>::iterator> v_end =
  38288. + // value_iterator<std::vector<char>::iterator>(chars_1.end());
  38289. +
  38290. + // std::vector<char> vchar_1(v_begin, v_end);
  38291. + // std::vector<char> vchar_2 = { v_begin, v_end };
  38292. +
  38293. + // std::string my_string(argv[1]);
  38294. + // std::cerr << "test 1" << std::endl;
  38295. + // test(my_string.begin(), my_string.end());
  38296. + // std::cerr << "test 2" << std::endl;
  38297. + // test(my_string.c_str(), my_string.c_str() + my_string.length());
  38298. +
  38299. + // auto atom = connection.intern_atom(false, "MY_STRING");
  38300. +
  38301. + // xpp::request::x::change_property(connection, XCB_PROP_MODE_REPLACE,
  38302. + // connection.root(), atom->atom, XCB_ATOM_STRING, 8, my_string.length(),
  38303. + // my_string.c_str());
  38304. +
  38305. + // connection.change_property(XCB_PROP_MODE_REPLACE, connection.root(),
  38306. + // atom->atom, XCB_ATOM_STRING, 8,
  38307. + // begin, end);
  38308. +
  38309. + // connection.change_property(XCB_PROP_MODE_REPLACE, connection.root(),
  38310. + // atom->atom, XCB_ATOM_STRING, 8,
  38311. + // v_begin, v_end);
  38312. +
  38313. + // connection.flush();
  38314. +
  38315. + // caller()(callee(), 0);
  38316. + // caller()(callee(), 1);
  38317. + // caller()(callee(), 2);
  38318. +
  38319. + // using mylib::request::checked;
  38320. + // using mylib::request::unchecked;
  38321. +
  38322. + // mylib::extension::request::void_request<>()();
  38323. + // mylib::extension::request::void_request<checked>()();
  38324. +
  38325. + // mylib::c c;
  38326. + // c.void_request<>();
  38327. + // c.reply_request<>();
  38328. +
  38329. + // test00::test();
  38330. + // test01::test();
  38331. + // test02::test();
  38332. + // test03::test();
  38333. + // test04::test();
  38334. + // test05::test();
  38335. + // test06::test();
  38336. + // test07::test();
  38337. + // test08::test();
  38338. + // test09::test();
  38339. + // test10::test();
  38340. + // test11::test();
  38341. + // test12::test();
  38342. + // test13::test();
  38343. + // test14::test();
  38344. + test15::test();
  38345. +
  38346. + return 0;
  38347. +}
  38348. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/xlib.cpp polybar-3.2.1/lib/xpp/src/tests/xlib.cpp
  38349. --- polybar-3.2.1.orig/lib/xpp/src/tests/xlib.cpp 1970-01-01 02:00:00.000000000 +0200
  38350. +++ polybar-3.2.1/lib/xpp/src/tests/xlib.cpp 2017-08-30 16:02:01.000000000 +0300
  38351. @@ -0,0 +1,30 @@
  38352. +#include <climits>
  38353. +#include <unistd.h>
  38354. +#include <iostream>
  38355. +
  38356. +#include <X11/Xlib.h>
  38357. +#include <X11/extensions/Xrandr.h>
  38358. +
  38359. +int main(int argc, char ** argv)
  38360. +{
  38361. + Display * dpy = XOpenDisplay(NULL);
  38362. + Window root = DefaultRootWindow(dpy);
  38363. +
  38364. + XRRScreenConfiguration * screen_cfg = XRRGetScreenInfo(dpy, root);
  38365. + std::cerr << "rate: " << XRRConfigCurrentRate(screen_cfg) << std::endl;
  38366. +
  38367. + int nrates = 0;
  38368. + short * rates = XRRConfigRates(screen_cfg, 10, &nrates);
  38369. + std::cerr << "nrates: " << nrates << std::endl;
  38370. + for (int i = 0; i < nrates; ++i) {
  38371. + std::cerr << "rate: " << rates[i] << std::endl;
  38372. + }
  38373. +
  38374. + int nhosts = 0;
  38375. + XHostAddress * host_addresses = XListHosts(dpy, &nhosts, True);
  38376. + for (int i = 0; i < nhosts; ++i) {
  38377. + std::cerr << "address: " << host_addresses[i].address << std::endl;
  38378. + }
  38379. +
  38380. + return EXIT_SUCCESS;
  38381. +}
  38382. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/xlib-test.cpp polybar-3.2.1/lib/xpp/src/tests/xlib-test.cpp
  38383. --- polybar-3.2.1.orig/lib/xpp/src/tests/xlib-test.cpp 1970-01-01 02:00:00.000000000 +0200
  38384. +++ polybar-3.2.1/lib/xpp/src/tests/xlib-test.cpp 2017-08-30 16:02:01.000000000 +0300
  38385. @@ -0,0 +1,33 @@
  38386. +#include <climits>
  38387. +#include <unistd.h>
  38388. +#include <iostream>
  38389. +
  38390. +#include <X11/Xlib.h>
  38391. +#include <X11/extensions/Xrandr.h>
  38392. +
  38393. +int main(int argc, char ** argv)
  38394. +{
  38395. + Display * dpy = XOpenDisplay(NULL);
  38396. + Window root = DefaultRootWindow(dpy);
  38397. +
  38398. + XRRScreenConfiguration * screen_cfg = XRRGetScreenInfo(dpy, root);
  38399. + std::cerr << "rate: " << XRRConfigCurrentRate(screen_cfg) << std::endl;
  38400. +
  38401. + for (int nsizes = 0; nsizes < 16; ++nsizes) {
  38402. + int nrates = 0;
  38403. + short * rates = XRRConfigRates(screen_cfg, nsizes, &nrates);
  38404. + std::cerr << "nrates: " << nrates << std::endl;
  38405. + for (int i = 0; i < nrates; ++i) {
  38406. + std::cerr << "rate: " << rates[i] << std::endl;
  38407. + }
  38408. + }
  38409. +
  38410. + int nhosts = 0;
  38411. + int state = 0;
  38412. + XHostAddress * host_addresses = XListHosts(dpy, &nhosts, &state);
  38413. + for (int i = 0; i < nhosts; ++i) {
  38414. + std::cerr << "address: " << host_addresses[i].address << std::endl;
  38415. + }
  38416. +
  38417. + return 0;
  38418. +}
  38419. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/tests/xproto.cpp polybar-3.2.1/lib/xpp/src/tests/xproto.cpp
  38420. --- polybar-3.2.1.orig/lib/xpp/src/tests/xproto.cpp 1970-01-01 02:00:00.000000000 +0200
  38421. +++ polybar-3.2.1/lib/xpp/src/tests/xproto.cpp 2017-08-30 16:02:01.000000000 +0300
  38422. @@ -0,0 +1,870 @@
  38423. +#include <climits>
  38424. +#include <unistd.h>
  38425. +#include <iostream>
  38426. +
  38427. +#include <X11/Xlib.h>
  38428. +#include <X11/keysymdef.h>
  38429. +#include <X11/extensions/Xrandr.h>
  38430. +#include <X11/cursorfont.h> // XC_cross
  38431. +
  38432. +// #include <xcb/randr.h>
  38433. +// // #include "../gen/xproto_requests_with_accessors.hpp"
  38434. +// #include "../gen/randr_requests.hpp"
  38435. +// #include "../gen/xproto.hpp"
  38436. +// #include "../gen/randr.hpp"
  38437. +
  38438. +// #include "../xpp.hpp"
  38439. +
  38440. +#include "../event.hpp"
  38441. +#include "../core/connection.hpp"
  38442. +// #include "../gen/xproto.hpp"
  38443. +// #include "../gen/randr.hpp"
  38444. +
  38445. +bool g_quit = false;
  38446. +
  38447. +class key_printer
  38448. + : public xpp::event::sink<xpp::x::event::key_press,
  38449. + xpp::x::event::key_release,
  38450. + xpp::x::event::button_press,
  38451. + xpp::randr::event::notify,
  38452. + xpp::damage::event::notify,
  38453. + xpp::xfixes::event::selection_notify,
  38454. + xpp::screensaver::event::notify
  38455. + >
  38456. +{
  38457. + public:
  38458. + key_printer(const xpp::x::protocol & x)
  38459. + : m_x(x)
  38460. + {}
  38461. +
  38462. + void handle(const xpp::x::event::key_press & e)
  38463. + {
  38464. + auto kbd_mapping = m_x.get_keyboard_mapping(e->detail, 1);
  38465. + auto keysym = *kbd_mapping.keysyms().begin();
  38466. +
  38467. + if (keysym == XK_Escape) {
  38468. + std::cerr << "quitting" << std::endl;
  38469. + m_x.ungrab_keyboard();
  38470. + g_quit = true;
  38471. + } else {
  38472. + std::cerr << "key pressed: " << XKeysymToString(keysym) << std::endl;
  38473. + }
  38474. + }
  38475. +
  38476. + void handle(const xpp::x::event::key_release & e)
  38477. + {
  38478. + auto kbd_mapping = m_x.get_keyboard_mapping(e->detail, 1);
  38479. + auto keysym = *kbd_mapping.keysyms().begin();
  38480. + std::cerr << "key released: " << XKeysymToString(keysym) << std::endl;
  38481. + }
  38482. +
  38483. + void handle(const xpp::x::event::button_press & e)
  38484. + {
  38485. + m_x.ungrab_pointer();
  38486. +
  38487. + std::cerr << "root: 0x"
  38488. + << std::hex << e->root << std::dec
  38489. + << "; event: 0x"
  38490. + << std::hex << e->event << std::dec
  38491. + << "; child: 0x"
  38492. + << std::hex << e->child << std::dec
  38493. + << std::endl;
  38494. +
  38495. + xpp::window grab_window = e.event<xpp::window>();
  38496. + std::cerr << "grab_window: " << grab_window << std::endl;
  38497. +
  38498. + if (e->event == e->root) {
  38499. + grab_window = e.child();
  38500. + std::cerr << "new grab_window: " << grab_window << std::endl;
  38501. + auto translate = grab_window.translate_coordinates(grab_window, 1, 1);
  38502. + grab_window = translate->child;
  38503. + }
  38504. +
  38505. + std::cerr << "grabbing "
  38506. + << std::hex << grab_window << std::dec
  38507. + << std::endl;
  38508. +
  38509. + *m_x.grab_keyboard(true, grab_window,
  38510. + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
  38511. + }
  38512. +
  38513. + void handle(const xpp::randr::event::notify & e)
  38514. + {
  38515. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  38516. + }
  38517. +
  38518. + void handle(const xpp::damage::event::notify & e)
  38519. + {
  38520. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  38521. + }
  38522. +
  38523. + void handle(const xpp::xfixes::event::selection_notify & e)
  38524. + {
  38525. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  38526. + }
  38527. +
  38528. + void handle(const xpp::screensaver::event::notify & e)
  38529. + {
  38530. + std::cerr << __PRETTY_FUNCTION__ << std::endl;
  38531. + }
  38532. +
  38533. + // does not work
  38534. + // template<int OpCode, typename Event>
  38535. + // void handle(const xpp::generic::event<OpCode, Event> &)
  38536. + // {
  38537. + // std::cerr << __PRETTY_FUNCTION__ << std::endl;
  38538. + // }
  38539. +
  38540. + private:
  38541. + const xpp::x::protocol & m_x;
  38542. +};
  38543. +
  38544. +class xevent : public xpp::x::event::dispatcher {
  38545. + public:
  38546. +
  38547. + template<typename Event>
  38548. + void operator()(const Event &) const
  38549. + {
  38550. + }
  38551. +
  38552. + // template<int OpCode, typename Event>
  38553. + // void operator()(const xpp::generic::event<OpCode, Event> &) const
  38554. + // {
  38555. + // }
  38556. +
  38557. + void doit(xcb_generic_event_t * const e) const
  38558. + {
  38559. +#if not defined __clang__
  38560. + dispatcher::operator()(*this, e);
  38561. +#endif
  38562. + }
  38563. +
  38564. + protected:
  38565. + operator xcb_connection_t * const(void) { return nullptr; }
  38566. +};
  38567. +
  38568. +int main(int argc, char ** argv)
  38569. +{
  38570. + xpp::connection<xpp::extension::randr,
  38571. + xpp::extension::render,
  38572. + xpp::extension::xv,
  38573. + xpp::extension::damage,
  38574. + xpp::extension::xinerama,
  38575. + xpp::extension::xfixes,
  38576. + xpp::extension::input,
  38577. + xpp::extension::screensaver>
  38578. + connection("");
  38579. +
  38580. + // xpp::request::x::map_window(connection, 0);
  38581. + // xpp::request::x::query_tree(connection, 0);
  38582. +
  38583. + xpp::event::registry<xpp::extension::randr,
  38584. + xpp::extension::render,
  38585. + xpp::extension::xv,
  38586. + xpp::extension::damage,
  38587. + xpp::extension::xinerama,
  38588. + xpp::extension::xfixes,
  38589. + xpp::extension::input,
  38590. + xpp::extension::screensaver>
  38591. + registry(connection);
  38592. +
  38593. + std::vector<key_printer *> printers(100, new key_printer(connection));
  38594. +
  38595. + for (int i = 0; i < 100; ++i) {
  38596. + registry.attach(0, printers[i]);
  38597. + }
  38598. +
  38599. + for (int i = 0; i < 99; ++i) {
  38600. + registry.detach(0, printers[i]);
  38601. + }
  38602. +
  38603. + auto font_id = connection.generate_id();
  38604. + connection.open_font(font_id, "cursor");
  38605. + auto cursor_id = connection.generate_id();
  38606. + connection.create_glyph_cursor(cursor_id, font_id, font_id,
  38607. + XC_cross, XC_cross + 1, 0, 0, 0, 0xffff, 0xffff, 0xffff);
  38608. + connection.close_font(font_id);
  38609. +
  38610. + *connection.grab_pointer(false, connection.root(),
  38611. + XCB_EVENT_MASK_BUTTON_PRESS,
  38612. + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
  38613. + XCB_NONE, cursor_id);
  38614. +
  38615. + connection.free_cursor(cursor_id);
  38616. +
  38617. + std::cerr << "Please click on a window" << std::endl;
  38618. +
  38619. +// clang_complete does not like this
  38620. +// causes vim to segfault
  38621. +#if not defined __clang__
  38622. +
  38623. + while (! g_quit) {
  38624. + connection.flush();
  38625. + registry.dispatch(connection.wait_for_event());
  38626. + }
  38627. +
  38628. +#endif
  38629. +
  38630. +
  38631. + // WATCHOUT FOR THE RETURN
  38632. + // >>>>>>>>>>>>>>>>>>>>>>>
  38633. + return 0;
  38634. + // <<<<<<<<<<<<<<<<<<<<<<<
  38635. +
  38636. +
  38637. +
  38638. +
  38639. +
  38640. + *((xpp::randr::protocol &)connection).query_version(
  38641. + XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
  38642. +
  38643. + // auto & randr = (xpp::protocol::randr &)c;
  38644. + // auto version = randr.query_version(
  38645. + // XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
  38646. + // std::cerr << "randr_major: " << version->major_version
  38647. + // << "; randr_minor: " << version->minor_version << std::endl;
  38648. +
  38649. + // auto screens = connection.query_screens();
  38650. +
  38651. + // for (auto & info : screens.screen_info()) {
  38652. + // std::cerr << "screen @ "
  38653. + // << info.x_org << "x" << info.x_org
  38654. + // << "+"
  38655. + // << info.width << "+" << info.height
  38656. + // << std::endl;
  38657. + // }
  38658. +
  38659. + std::cerr << "connection.root().query_tree().children<xcb_window_t>():" << std::endl;
  38660. + for (auto & window : connection.root().query_tree().children()) {
  38661. + std::cerr << window << ", ";
  38662. + }
  38663. + std::cerr << std::endl;
  38664. +
  38665. + std::cerr << "connection.root().query_tree().children<xpp::window>():" << std::endl;
  38666. + for (auto & window : connection.root().query_tree().children<xpp::window>()) {
  38667. + std::cerr << window << ": ";
  38668. + for (auto & child : window.query_tree().children<xpp::window>()) {
  38669. + std::cerr << child << ", ";
  38670. + }
  38671. + std::cerr << std::endl;
  38672. + }
  38673. + std::cerr << std::endl;
  38674. +
  38675. + auto atom = xpp::request::x::intern_atom(
  38676. + connection, false, "_NET_CLIENT_LIST_STACKING");
  38677. + auto property = xpp::request::x::get_property(
  38678. + connection, false, connection.root(), atom->atom, XCB_ATOM_WINDOW, 0, UINT_MAX);
  38679. +
  38680. + std::cerr << "windows (xcb_window_t):" << std::hex << std::endl;
  38681. + for (auto & w : property.value<xcb_window_t>()) {
  38682. + std::cerr << "0x" << w << ", ";
  38683. + }
  38684. + std::cerr << std::dec << std::endl;
  38685. +
  38686. + std::cerr << "windows (xpp::window)" << std::hex << std::endl;
  38687. + for (auto & w : property.value<xpp::window>()) {
  38688. + std::cerr << w << ": ";
  38689. + for (auto & child : w.query_tree().children<xpp::window>()) {
  38690. + std::cerr << child << ", ";
  38691. + }
  38692. + std::cerr << std::endl;
  38693. + }
  38694. + std::cerr << std::dec << std::endl;
  38695. +
  38696. + std::cerr << "hosts:" << std::endl;
  38697. + auto hosts = xpp::request::x::list_hosts(connection);
  38698. + for (auto & host : hosts.hosts()) {
  38699. + std::cerr << "host: " << xcb_host_address(&host) << std::endl;
  38700. + }
  38701. +
  38702. + std::cerr << "fonts:" << std::endl;
  38703. + auto fonts = xpp::request::x::list_fonts(connection, 8, 1, "*");
  38704. + for (auto & name : fonts.names()) {
  38705. + std::cerr << "font (" << name.length() << "): " << name << std::endl;
  38706. + }
  38707. +
  38708. + auto font_paths = xpp::request::x::get_font_path(connection);
  38709. + for (auto & path : font_paths.path()) {
  38710. + std::cerr << "path (" << path.length() << "): " << path << std::endl;
  38711. + }
  38712. +
  38713. + auto screen_info = xpp::request::randr::get_screen_info(connection, connection.root());
  38714. + std::cerr << "nsizes: " << (int)screen_info->nSizes << std::endl;
  38715. + std::cerr << "SizeID: " << (int)screen_info->sizeID << std::endl;
  38716. + int i = 0;
  38717. + for (auto & rate : screen_info.rates()) {
  38718. + if (++i > screen_info->nSizes) break;
  38719. +
  38720. + uint16_t * rates = xcb_randr_refresh_rates_rates(&rate);
  38721. + std::cerr << "rates (length: "
  38722. + << xcb_randr_refresh_rates_rates_length(&rate)
  38723. + << "): ";
  38724. +
  38725. + for (int j = 0; j < xcb_randr_refresh_rates_rates_length(&rate); ++j) {
  38726. + std::cerr << rates[j];
  38727. + if (j < xcb_randr_refresh_rates_rates_length(&rate) - 1) {
  38728. + std::cerr << ", ";
  38729. + }
  38730. + }
  38731. + std::cerr << std::endl;
  38732. +
  38733. + }
  38734. +
  38735. +/*
  38736. + xcb_list_hosts_cookie_t hosts_cookie = xcb_list_hosts(c);
  38737. + xcb_list_hosts_reply_t * hosts_reply = xcb_list_hosts_reply(connection, hosts_cookie, NULL);
  38738. +
  38739. + std::cerr << "list hosts" << std::endl;
  38740. + xcb_host_iterator_t host_iter = xcb_list_hosts_hosts_iterator(hosts_reply);
  38741. + for ( ; host_iter.rem > 0; xcb_host_next(&host_iter) ) {
  38742. + xcb_host_t * host = (xcb_host_t *)host_iter.data;
  38743. + std::cerr << "host adress: " << xcb_host_address(host) << std::endl;
  38744. + std::cerr << "host family: " << (int)host->family << std::endl;
  38745. + std::cerr << "host address_len: " << (int)host->address_len << std::endl;
  38746. + }
  38747. +
  38748. + std::cerr << "Randr refresh rates: " << std::endl;
  38749. + xcb_randr_get_screen_info_cookie_t screen_info_cookie =
  38750. + xcb_randr_get_screen_info(connection, connection.root());
  38751. + xcb_randr_get_screen_info_reply_t * screen_info_reply =
  38752. + xcb_randr_get_screen_info_reply(connection, screen_info_cookie, NULL);
  38753. + std::cerr << "Randr refresh rates length: "
  38754. + << xcb_randr_get_screen_info_rates_length(screen_info_reply)
  38755. + << std::endl;
  38756. +
  38757. + xcb_randr_refresh_rates_iterator_t refresh_rates_iter =
  38758. + xcb_randr_get_screen_info_rates_iterator(screen_info_reply);
  38759. +
  38760. + for (int i = 0; i < screen_info->nSizes; ++i) {
  38761. + xcb_randr_refresh_rates_next(&refresh_rates_iter);
  38762. +
  38763. + xcb_randr_refresh_rates_t * rate =
  38764. + (xcb_randr_refresh_rates_t *)refresh_rates_iter.data;
  38765. + uint16_t * rates = xcb_randr_refresh_rates_rates(rate);
  38766. + std::cerr << "rates (length: "
  38767. + << xcb_randr_refresh_rates_rates_length(rate)
  38768. + << "): ";
  38769. + for (int j = 0; j < xcb_randr_refresh_rates_rates_length(rate); ++j) {
  38770. + std::cerr << rates[j];
  38771. + if (j < xcb_randr_refresh_rates_rates_length(rate) - 1) {
  38772. + std::cerr << ", ";
  38773. + }
  38774. + }
  38775. + std::cerr << std::endl;
  38776. + }
  38777. +
  38778. + auto pict_formats = xpp::request::render::query_pict_formats(c);
  38779. + for (auto & format : pict_formats.formats()) {
  38780. + std::cerr << "format.depth: " << (int)format.depth << std::endl;;
  38781. + }
  38782. + */
  38783. +
  38784. + /*
  38785. + {
  38786. + Display * dpy = XOpenDisplay(NULL);
  38787. + Window root = DefaultRootWindow(dpy);
  38788. + XRRScreenConfiguration * screen_cfg = XRRGetScreenInfo(dpy, root);
  38789. + std::cerr << "rate: " << XRRConfigCurrentRate(screen_cfg) << std::endl;
  38790. + int nrates = 0;
  38791. + short * rates = XRRConfigRates(screen_cfg, 10, &nrates);
  38792. + std::cerr << "nrates: " << nrates << std::endl;
  38793. + for (int i = 0; i < nrates; ++i) {
  38794. + std::cerr << "rate: " << rates[i] << std::endl;
  38795. + }
  38796. + }
  38797. + */
  38798. +
  38799. +// auto iter = xpp::iterator<xcb_str_t, xcb_str_t, xcb_list_fonts_reply_t,
  38800. +// xcb_str_iterator_t,
  38801. +// xpp::callable<decltype(xcb_str_next), xcb_str_next>,
  38802. +// xpp::callable<decltype(xcb_str_sizeof), xcb_str_sizeof>,
  38803. +// xpp::callable<decltype(xpp::callable_test), xpp::callable_test>>();
  38804. +
  38805. +// auto iter2 = xpp::iterator<int, int, int, int,
  38806. +// xpp::callable<decltype(xpp::next), xpp::next>,
  38807. +// xpp::callable<decltype(xpp::size_of), xpp::size_of>,
  38808. +// xpp::callable<decltype(xpp::get_iterator), xpp::get_iterator>>();
  38809. +
  38810. + // xcb_window_t root = 0;
  38811. + // auto x = connection.x();
  38812. + // auto windows = connection.x().query_tree(root);
  38813. + // auto primary_output = connection.randr().get_output_primary(root);
  38814. +
  38815. + // auto window = *windows.children().begin();
  38816. + // auto geometry = window.get_geometry();
  38817. +
  38818. +
  38819. +
  38820. + // primary_output->output;
  38821. +
  38822. + /*
  38823. + xpp::connection c("");
  38824. + // xpp::xproto::connection cc(*c);
  38825. + std::cerr << "c: " << *c << std::endl;
  38826. + std::cerr << "connection.root() " << connection.root() << std::endl;
  38827. +
  38828. + uint32_t mask = XCB_CW_BACK_PIXEL
  38829. + | XCB_CW_BORDER_PIXEL
  38830. + | XCB_CW_OVERRIDE_REDIRECT;
  38831. + uint32_t values[] = { 0xff123456, 0xff654321, true };
  38832. + // uint32_t values[] = { 0, 0, true };
  38833. +
  38834. + xpp::window window_1(
  38835. + connection, 24, *connection.root(), 25, 25, 50, 50, 2,
  38836. + XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_WINDOW_CLASS_COPY_FROM_PARENT,
  38837. + mask, values);
  38838. +
  38839. + std::cerr << window_1 << std::endl;
  38840. + */
  38841. +
  38842. + // {
  38843. + // auto window_2 = window_1;
  38844. + // std::cerr << window_2 << std::endl;
  38845. + // {
  38846. + // auto window_3 = window_2;
  38847. + // std::cerr << window_3 << std::endl;
  38848. + // window_3.map();
  38849. + // connection.flush();
  38850. + // }
  38851. + // sleep(3);
  38852. + // }
  38853. +
  38854. + // window_1.map();
  38855. + // connection.flush();
  38856. + // sleep(1);
  38857. +
  38858. + // connection.root().query_tree().children();
  38859. +
  38860. +
  38861. + // intern_atom
  38862. + /*
  38863. + auto atom =
  38864. + xpp::xproto::request::intern_atom(*connection, false, "_NET_CLIENT_LIST_STACKING");
  38865. + auto atom_name = xpp::xproto::request::get_atom_name(*connection, atom->atom);
  38866. + std::cerr << atom_name.name() << std::endl;
  38867. +
  38868. + auto property = xpp::xproto::request::get_property(
  38869. + *connection, false, *connection.root(), atom->atom, XCB_ATOM_WINDOW, 0, UINT_MAX);
  38870. +
  38871. + std::cerr << "windows" << std::hex << std::endl;
  38872. + for (auto & p : property.value<xcb_window_t>()) {
  38873. + std::cerr << "0x" << p << ", ";
  38874. + }
  38875. + std::cerr << std::dec << std::endl;
  38876. + */
  38877. +
  38878. + /*
  38879. + typedef xpp::generic::fixed_size::iterator<void,
  38880. + xcb_window_t,
  38881. + xcb_get_property_reply_t,
  38882. + xcb_get_property_value,
  38883. + xcb_get_property_value_length>
  38884. + window_iterator;
  38885. +
  38886. + window_iterator window_begin = property.value<xcb_window_t>().begin();
  38887. + window_iterator window_end = property.value<xcb_window_t>().end();
  38888. + */
  38889. +
  38890. + // list_fonts_with_info && list_fonts
  38891. + /*
  38892. + auto fonts_with_info =
  38893. + xpp::xproto::request::list_fonts_with_info(*connection, 8, "*");
  38894. +
  38895. + for (int i = 0; i < 8; ++i) {
  38896. + std::cerr << fonts_with_info.name() << std::endl;
  38897. + fonts_with_info.reset();
  38898. + }
  38899. +
  38900. + auto fonts = xpp::xproto::request::list_fonts(*connection, 8, "*");
  38901. + for (auto & font : fonts.names()) {
  38902. + std::cerr << "(" << font.length() << "): " << font << std::endl;
  38903. + }
  38904. + */
  38905. +
  38906. + // auto grab = xpp::xproto::request::grab_keyboard(
  38907. + // *connection, false, connection.root(), XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
  38908. +
  38909. + // query_tree iterator
  38910. + /*
  38911. + typedef xpp::generic::fixed_size::iterator<xcb_window_t,
  38912. + xcb_window_t,
  38913. + xcb_query_tree_reply_t,
  38914. + xcb_query_tree_children,
  38915. + xcb_query_tree_children_length>
  38916. + children_iterator;
  38917. +
  38918. + children_iterator children_begin, children_end;
  38919. + */
  38920. +
  38921. + // {
  38922. + // auto tree = xpp::xproto::request::query_tree(*connection, connection.root());
  38923. + // children_begin = tree.children().begin();
  38924. + // children_end = tree.children().end();
  38925. + // }
  38926. +
  38927. + // std::cerr << "windows" << std::endl;
  38928. + // for (auto it = children_begin; it != children_end; ++it) {
  38929. + // std::cerr << std::hex << "0x" << *it << ", ";
  38930. + // }
  38931. + // std::cerr << std::endl;
  38932. +
  38933. + // std::cerr << "crtcs" << std::endl;
  38934. + // auto primary = xpp::request::randr::get_output_primary(*connection, connection.root());
  38935. + // for (auto & crtc : xpp::request::randr::get_output_info(
  38936. + // *connection, primary->output, XCB_TIME_CURRENT_TIME).crtcs()) {
  38937. + // std::cerr << "crtc: " << crtc << std::endl;
  38938. + // }
  38939. +
  38940. + // list_hosts
  38941. + /*
  38942. + std::cerr << "hosts" << std::endl;
  38943. + for (auto & host : xpp::xproto::request::list_hosts(*c).hosts()) {
  38944. + std::cerr << std::string((char *)xcb_host_address(&host),
  38945. + xcb_host_address_length(&host))
  38946. + << std::endl;
  38947. + }
  38948. + */
  38949. +
  38950. + // std::cerr << "extensions" << std::endl;
  38951. + // for (auto & name : xpp::xproto::request::list_extensions(*c).names()) {
  38952. + // std::cerr << std::string((char *)xcb_str_name(&name), xcb_str_name_length(&name)) << std::endl;
  38953. + // }
  38954. +
  38955. + // get_font_path
  38956. + /*
  38957. + for (auto & path : xpp::xproto::request::get_font_path(*c).path()) {
  38958. + std::cerr << "(" << path.length() << ") path: " << path << std::endl;
  38959. + }
  38960. + */
  38961. +
  38962. + // list_fonts
  38963. + /*
  38964. + const size_t n_fonts = 16;
  38965. +
  38966. + std::cerr << "fonts (xpp 2)" << std::endl;
  38967. +
  38968. + typedef xpp::generic::variable_size::iterator<xcb_str_t,
  38969. + xcb_str_t,
  38970. + xcb_list_fonts_reply_t,
  38971. + xcb_str_iterator_t,
  38972. + xcb_str_next,
  38973. + xcb_str_sizeof,
  38974. + xcb_list_fonts_names_iterator>
  38975. + names_iterator;
  38976. +
  38977. + names_iterator names_begin, names_end;
  38978. +
  38979. + {
  38980. + auto names = xpp::xproto::request::list_fonts(*connection, n_fonts, 1, "*");
  38981. +
  38982. + names_begin = names_iterator::begin(names.get());
  38983. + names_end = names_iterator::end(names.get());
  38984. + }
  38985. +
  38986. + for (auto it = names_begin; it != names_end; ++it) {
  38987. + std::cerr << it->length() << ": " << *it << std::endl;
  38988. + }
  38989. + */
  38990. +
  38991. + return EXIT_SUCCESS;
  38992. +}
  38993. +
  38994. +
  38995. + // auto it = names_begin;
  38996. + // std::cerr << "it : " << xcb_str_name_length(&*it) << ": "
  38997. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  38998. + // << std::endl;
  38999. +
  39000. + // ++it;
  39001. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39002. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39003. + // << std::endl;
  39004. +
  39005. + // ++it;
  39006. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39007. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39008. + // << std::endl;
  39009. +
  39010. + // it++;
  39011. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39012. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39013. + // << std::endl;
  39014. +
  39015. + // it++;
  39016. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39017. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39018. + // << std::endl;
  39019. +
  39020. + // it++;
  39021. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39022. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39023. + // << std::endl;
  39024. +
  39025. + // it--;
  39026. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39027. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39028. + // << std::endl;
  39029. +
  39030. + // --it;
  39031. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39032. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39033. + // << std::endl;
  39034. +
  39035. + // it++;
  39036. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39037. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39038. + // << std::endl;
  39039. +
  39040. + // ++it;
  39041. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39042. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39043. + // << std::endl;
  39044. +
  39045. + // it++;
  39046. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39047. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39048. + // << std::endl;
  39049. +
  39050. + // ++it;
  39051. + // std::cerr << "it++: " << xcb_str_name_length(&*it) << ": "
  39052. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39053. + // << std::endl;
  39054. +
  39055. + // it--;
  39056. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39057. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39058. + // << std::endl;
  39059. +
  39060. + // --it;
  39061. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39062. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39063. + // << std::endl;
  39064. +
  39065. + // it--;
  39066. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39067. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39068. + // << std::endl;
  39069. +
  39070. + // --it;
  39071. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39072. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39073. + // << std::endl;
  39074. +
  39075. + // it--;
  39076. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39077. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39078. + // << std::endl;
  39079. +
  39080. + // --it;
  39081. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39082. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39083. + // << std::endl;
  39084. +
  39085. + // it--;
  39086. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39087. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39088. + // << std::endl;
  39089. +
  39090. + // --it;
  39091. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39092. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39093. + // << std::endl;
  39094. +
  39095. + // it--;
  39096. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39097. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39098. + // << std::endl;
  39099. +
  39100. + // --it;
  39101. + // std::cerr << "it--: " << xcb_str_name_length(&*it) << ": "
  39102. + // << std::string((char *)xcb_str_name(&*it), xcb_str_name_length(&*it))
  39103. + // << std::endl;
  39104. +
  39105. + // {
  39106. + // std::cerr << "fonts (native)" << std::endl;
  39107. + // xcb_list_fonts_cookie_t cookie = xcb_list_fonts(*connection, n_fonts, 1, "*");
  39108. + // xcb_list_fonts_reply_t * reply = xcb_list_fonts_reply(*connection, cookie, NULL);
  39109. + // xcb_str_iterator_t iter = xcb_list_fonts_names_iterator(reply);
  39110. + // xcb_str_t * name, * R, * prev;
  39111. + // int len1, len2, len3, len4;
  39112. +
  39113. + // // for ( ; iter.rem; xcb_str_next(&iter)) {
  39114. + // // xcb_str_t * name = iter.data;
  39115. + // // std::cerr << xcb_str_name_length(name) << ": " << std::string((char *)xcb_str_name(name), xcb_str_name_length(name)) << std::endl;
  39116. + // // }
  39117. +
  39118. + // name = iter.data;
  39119. + // std::cerr << std::endl;
  39120. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39121. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39122. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39123. + // std::cerr << xcb_str_name_length(name) << ": "
  39124. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39125. + // << std::endl;
  39126. +
  39127. + // xcb_str_next(&iter);
  39128. + // name = iter.data;
  39129. + // std::cerr << std::endl;
  39130. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39131. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39132. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39133. + // std::cerr << xcb_str_name_length(name) << ": "
  39134. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39135. + // << std::endl;
  39136. +
  39137. + // xcb_str_next(&iter);
  39138. + // name = iter.data;
  39139. + // std::cerr << std::endl;
  39140. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39141. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39142. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39143. + // std::cerr << xcb_str_name_length(name) << ": "
  39144. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39145. + // << std::endl;
  39146. +
  39147. + // len1 = xcb_str_sizeof(iter.data);
  39148. + // xcb_str_next(&iter);
  39149. + // name = iter.data;
  39150. + // std::cerr << std::endl;
  39151. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39152. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39153. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39154. + // std::cerr << xcb_str_name_length(name) << ": "
  39155. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39156. + // << std::endl;
  39157. +
  39158. + // len2 = xcb_str_sizeof(iter.data);
  39159. + // xcb_str_next(&iter);
  39160. + // name = iter.data;
  39161. + // std::cerr << std::endl;
  39162. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39163. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39164. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39165. + // std::cerr << xcb_str_name_length(name) << ": "
  39166. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39167. + // << std::endl;
  39168. +
  39169. + // len3 = xcb_str_sizeof(iter.data);
  39170. + // xcb_str_next(&iter);
  39171. + // name = iter.data;
  39172. + // std::cerr << std::endl;
  39173. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39174. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39175. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39176. + // std::cerr << xcb_str_name_length(name) << ": "
  39177. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39178. + // << std::endl;
  39179. +
  39180. + // len4 = xcb_str_sizeof(iter.data);
  39181. + // xcb_str_next(&iter);
  39182. + // name = iter.data;
  39183. + // std::cerr << std::endl;
  39184. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39185. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39186. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39187. + // std::cerr << xcb_str_name_length(name) << ": "
  39188. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39189. + // << std::endl;
  39190. +
  39191. +
  39192. +
  39193. +
  39194. + // ++iter.rem;
  39195. + // R = iter.data;
  39196. + // // xcb_str_t * prev = R - xcb_str_sizeof(R);
  39197. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_sizeof(R));
  39198. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_name_length(R)) - sizeof(xcb_str_t) - 1;
  39199. + // prev = (xcb_str_t *)((char *)R) - len4;
  39200. + // iter.index = (char *) iter.data - (char *) prev;
  39201. + // iter.data = prev;
  39202. + // name = iter.data;
  39203. + // std::cerr << std::endl;
  39204. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39205. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39206. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39207. + // std::cerr << xcb_str_name_length(name) << ": "
  39208. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39209. + // << std::endl;
  39210. +
  39211. + // ++iter.rem;
  39212. + // R = iter.data;
  39213. + // // xcb_str_t * prev = R - xcb_str_sizeof(R);
  39214. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_name_length(R));
  39215. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_name_length(R)) - sizeof(xcb_str_t) - 2;
  39216. + // prev = (xcb_str_t *)((char *)R) - len3;
  39217. + // iter.index = (char *) iter.data - (char *) prev;
  39218. + // iter.data = prev;
  39219. + // name = iter.data;
  39220. + // std::cerr << std::endl;
  39221. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39222. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39223. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39224. + // std::cerr << xcb_str_name_length(name) << ": "
  39225. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39226. + // << std::endl;
  39227. +
  39228. + // ++iter.rem;
  39229. + // R = iter.data;
  39230. + // // xcb_str_t * prev = R - xcb_str_sizeof(R);
  39231. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_name_length(R));
  39232. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_name_length(R)) - sizeof(xcb_str_t);
  39233. + // prev = (xcb_str_t *)((char *)R) - len2;
  39234. + // iter.index = (char *) iter.data - (char *) prev;
  39235. + // iter.data = prev;
  39236. + // name = iter.data;
  39237. + // std::cerr << std::endl;
  39238. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39239. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39240. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39241. + // std::cerr << xcb_str_name_length(name) << ": "
  39242. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39243. + // << std::endl;
  39244. +
  39245. + // ++iter.rem;
  39246. + // R = iter.data;
  39247. + // // xcb_str_t * prev = R - xcb_str_sizeof(R);
  39248. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_name_length(R));
  39249. + // // prev = (xcb_str_t *)(((char *)R) - xcb_str_name_length(R)) - sizeof(xcb_str_t);
  39250. + // prev = (xcb_str_t *)((char *)R) - len1;
  39251. + // iter.index = (char *) iter.data - (char *) prev;
  39252. + // iter.data = prev;
  39253. + // name = iter.data;
  39254. + // std::cerr << std::endl;
  39255. + // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39256. + // std::cerr << "index: 0x" << std::hex << iter.index << " (" << std::dec << iter.index << ")" << std::endl;
  39257. + // std::cerr << "rem: " << iter.rem << std::dec << std::endl;
  39258. + // std::cerr << xcb_str_name_length(name) << ": "
  39259. + // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39260. + // << std::endl;
  39261. +
  39262. + // // xcb_str_next(&iter);
  39263. + // // name = iter.data;
  39264. + // // std::cerr << "data: 0x" << std::hex << iter.data << " (" << std::dec << (unsigned long)iter.data << ")" << std::endl;
  39265. + // // std::cerr << "index: 0x" << std::hex << iter.index << std::dec << std::endl;
  39266. + // // std::cerr << xcb_str_name_length(name) << ": "
  39267. + // // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39268. + // // << std::endl;
  39269. +
  39270. + // // ++iter.rem;
  39271. + // // R = iter.data;
  39272. + // // prev = R - xcb_str_sizeof(R);
  39273. + // // iter.index = (char *) iter.data - (char *) prev;
  39274. + // // iter.data = prev;
  39275. + // // name = iter.data;
  39276. + // // std::cerr << "data: 0x" << std::hex << iter.data << "(" << std::dec << iter.data << ")" << std::endl;
  39277. + // // std::cerr << "index: 0x" << std::hex << iter.index << std::endl;
  39278. + // // std::cerr << xcb_str_name_length(name) << ": "
  39279. + // // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39280. + // // << std::endl;
  39281. +
  39282. + // // xcb_str_next(&iter);
  39283. + // // name = iter.data;
  39284. + // // std::cerr << "data: 0x" << std::hex << iter.data << "(" << std::dec << iter.data << ")" << std::endl;
  39285. + // // std::cerr << "index: 0x" << std::hex << iter.index << std::endl;
  39286. + // // std::cerr << xcb_str_name_length(name) << ": "
  39287. + // // << std::string((char *)xcb_str_name(name), xcb_str_name_length(name))
  39288. + // // << std::endl;
  39289. +
  39290. + // std::cerr << "length: " << xcb_list_fonts_names_length(reply) << std::endl;
  39291. + // }
  39292. +
  39293. diff -Nuar polybar-3.2.1.orig/lib/xpp/src/xpp.cpp polybar-3.2.1/lib/xpp/src/xpp.cpp
  39294. --- polybar-3.2.1.orig/lib/xpp/src/xpp.cpp 1970-01-01 02:00:00.000000000 +0200
  39295. +++ polybar-3.2.1/lib/xpp/src/xpp.cpp 2017-08-30 16:02:01.000000000 +0300
  39296. @@ -0,0 +1 @@
  39297. +#include "xpp.hpp"