Warning: 05-18 11:47:23 Path override failed for key base::DIR_APP_DICTIONARIES and path '/gnu/store/rfavr4qpam329q0qyp4zmjkavvlkzplj-goldendict-ng-24.05.05/bin/qtwebengine_dictionaries' Debug: 05-18 11:47:23 handle path: "/mnt/Reading/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 11:47:23 handle path: "/mnt/Data/Chinese caligraphy dictionaries" Debug: 05-18 11:47:23 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/dicts" Debug: 05-18 11:47:23 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 11:47:23 Epwing: found "EIDAI6" Warning: 05-18 11:47:23 "Epwing dictionary initializing failed: , error: EB library report error EB \"eb_set_subbook\" function error: EB_ERR_FAIL_OPEN_TEXT (failed to open a text file)\n" Debug: 05-18 11:47:23 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 11:47:23 Epwing: found "HYOGEN" Debug: 05-18 11:47:23 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 11:47:23 Epwing: found "RUIGIGO" Debug: 05-18 11:47:24 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 11:47:24 Epwing: found "RUIGIGO" Debug: 05-18 11:47:25 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 11:47:25 Epwing: found "ENCY" Debug: 05-18 11:47:25 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 11:47:25 Epwing: found "Snmkg99" Debug: 05-18 11:47:25 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 11:47:25 Epwing: found "BODY" Debug: 05-18 11:47:25 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 11:47:25 Epwing: found "MEIKYOJJ" Debug: 05-18 11:47:25 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/pronounciation" Debug: 05-18 11:47:25 handle path: "/mnt/Reading/Wikipedia Japa" Debug: 05-18 11:47:25 handle path: "/mnt/Data/Documents/dict - concise encyclopedia of mathematics" Debug: 05-18 11:47:25 handle path: "/home/hashirama/Downloads/Port" Debug: 05-18 11:47:25 handle path: "/mnt/Data/Documents/english_dictionary" Debug: 05-18 11:47:25 handle path: "/mnt/Sources/Epistularum's Tidy EPWing Collection [Version 1.0]" Debug: 05-18 11:47:25 handle path: "/mnt/Sources/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 11:47:25 Load done Debug: 05-18 11:47:25 Loading 198 abbrv Debug: 05-18 11:47:25 Loading 210 abbrv Debug: 05-18 11:47:25 Loading 183 abbrv Debug: 05-18 11:47:25 Loading 200 abbrv Debug: 05-18 11:47:25 starting create the fts with thread: 11 Debug: 05-18 11:47:25 waiting for all the fts creation to finish. Debug: 05-18 11:47:25 finished/cancel all the fts creation Debug: 05-18 11:47:25 Reloading all the tabs... Debug: 05-18 11:47:25 Reloading all the tabs... Debug: 05-18 11:47:25 reset inspector Debug: 05-18 11:47:25 getResource: "gdlookup://localhost/?word=Welcome!&group=4294967295" Debug: 05-18 11:47:25 scheme: "gdlookup" Debug: 05-18 11:47:25 host: "localhost" Debug: 05-18 11:47:25 In-place finish. Debug: 05-18 11:47:25 ====reading 2517 of (2517) bytes . Finished: 1 Debug: 05-18 11:47:25 article view loaded url: "data:text/html;charset=UTF-8,%3C%21DOCTYPE html%3E%0A%3Chtml%3E%3Chead%3E%0A%3Cmeta charset%3D%22utf-8%22%3E%0A%3Cscript src%3D%22qrc%3A%2F%2F%2Fscripts%2Fjquery-3.6.0.slim.min.js%22%3E%3C%2Fscript%3E" true Debug: 05-18 11:47:25 article view loaded url: "gdlookup://localhost/?word=Welcome!&group=4294967295" true Debug: 05-18 11:47:25 received: "220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <311858854.5575.1716047245@dict.dict.org>\r\n" Debug: 05-18 11:47:25 received: "110 166 databases present\r\n" Debug: 05-18 11:47:25 receive db: "gcide \"The Collaborative International Dictionary of English v.0.48\"" Debug: 05-18 11:47:25 receive db: "wn \"WordNet (r) 3.0 (2006)\"" Debug: 05-18 11:47:25 receive db: "moby-thesaurus \"Moby Thesaurus II by Grady Ward, 1.0\"" Debug: 05-18 11:47:25 receive db: "elements \"The Elements (07Nov00)\"" Debug: 05-18 11:47:25 receive db: "vera \"V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)\"" Debug: 05-18 11:47:25 receive db: "jargon \"The Jargon File (version 4.4.7, 29 Dec 2003)\"" Debug: 05-18 11:47:25 receive db: "foldoc \"The Free On-line Dictionary of Computing (30 December 2018)\"" Debug: 05-18 11:47:25 receive db: "easton \"Easton's 1897 Bible Dictionary\"" Debug: 05-18 11:47:25 receive db: "hitchcock \"Hitchcock's Bible Names Dictionary (late 1800's)\"" Debug: 05-18 11:47:25 receive db: "bouvier \"Bouvier's Law Dictionary, Revised 6th Ed (1856)\"" Debug: 05-18 11:47:25 receive db: "devil \"The Devil's Dictionary (1881-1906)\"" Debug: 05-18 11:47:25 receive db: "world02 \"CIA World Factbook 2002\"" Debug: 05-18 11:47:25 receive db: "gaz2k-counties \"U.S. Gazetteer Counties (2000)\"" Debug: 05-18 11:47:25 receive db: "gaz2k-places \"U.S. Gazetteer Places (2000)\"" Debug: 05-18 11:47:25 receive db: "gaz2k-zips \"U.S. Gazetteer Zip Code Tabulation Areas (2000)\"" Debug: 05-18 11:47:25 receive db: "fd-hrv-eng \"Croatian-English FreeDict Dictionary ver. 0.1.2\"" Debug: 05-18 11:47:25 receive db: "fd-fin-por \"suomi-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 11:47:25 receive db: "fd-fin-bul \"suomi-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 11:47:25 receive db: "fd-fra-bul \"fran\xC3\xA7""ais-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 11:47:25 receive db: "fd-deu-swe \"Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 11:47:25 receive db: "fd-fin-swe \"suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 11:47:25 receive db: "fd-jpn-rus \"Japanese-Russian FreeDict Dictionary ver. 0.1\"" Debug: 05-18 11:47:25 receive db: "fd-wol-fra \"Wolof - French FreeDict dictionary ver. 0.1\"" Debug: 05-18 11:47:25 receive db: "fd-fra-pol \"fran\xC3\xA7""ais-j\xC4\x99zyk" Debug: 05-18 11:47:25 received: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-deu \"English-German FreeDict Dictionary ver. 0.3.7\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-nld \"German-Dutch FreeDict Dictionary ver. 0.1.4\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-por-eng \"Portuguese-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-spa-deu \"Spanish-German FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ces-eng \"Czech-English FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-fin \"Svenska-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-pol \"English - Polish Piotrowski+Saloni/FreeDict dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-nor \"j\xC4\x99zyk polski-Norsk FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-rom \"English-Romanian FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-fra \"English-French FreeDict Dictionary ver. 0.1.6\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fin-ell \"suomi-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-lit \"English-Lithuanian FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ckb-kmr \"Sorani-Kurmanji Ferheng/FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-eng \"Italian-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-eng \"j\xC4\x99zyk polski-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-gle-eng \"Irish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-tur \"English-Turkish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-gle-pol \"Irish-Polish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-deu \"j\xC4\x99zyk polski-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-spa \"fran\xC3\xA7""ais-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-lit-eng \"Lithuanian-English FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-jpn \"English-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ara-eng \"Arabic-English FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-nld-ita \"Nederlands-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-lat \"English-Latin FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-hun \"English-Hungarian FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-jpn \"italiano-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-dan-eng \"Danish-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-hun-eng \"Hungarian-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-gle \"Polish-Irish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-fin \"fran\xC3\xA7""ais-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-nld-swe \"Nederlands-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-nld-eng \"Dutch-English Freedict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-kur \"German-Kurdish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-spa \"Deutsch-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-afr \"English-Afrikaans FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-swe \"English-Swedish FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-jpn-deu \"Japanese-German FreeDict Dictionary ver. 0.2.0\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-epo-eng \"Esperanto-English FreeDict dictionary ver. 1.0.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-nld \"j\xC4\x99zyk polski-Nederlands FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-lat-deu \"Lateinisch-Deutsch FreeDict-W\xC3\xB6rterbuch ver. 1.0.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-cym \"Eurfa Saesneg, English-Welsh Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-por-spa \"portugu\xC3\xAAs-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-spa \"English-Spanish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-tur \"Svenska-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-tur-eng \"Turkish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-tur-deu \"Turkish-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-fra \"j\xC4\x99zyk polski-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-por \"English-Portuguese FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-pol \"italiano-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-ces \"English-Czech dicts.info/FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-tur \"German-Turkish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-jpn \"fran\xC3\xA7""ais-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-cym-eng \"Eurfa Cymraeg, Welsh-English Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-bre-fra \"Breton-French FreeDict Dictionary (Geriadur Tomaz) ver. 0.8.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-jpn-fra \"Japanese-French FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-nld-deu \"Dutch-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-nld \"English-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-por \"German-Portuguese FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-hrv \"English-Croatian FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-mkd-bul \"Macedonian - Bulgarian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-eng \"Swedish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-spa \"j\xC4\x99zyk polski-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-jpn-eng \"Japanese-English FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-ell \"English - Modern Greek XDXF/FreeDict dictionary ver. 0.1.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-por \"italiano-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-swe \"j\xC4\x99zyk polski-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-fin \"j\xC4\x99zyk polski-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-kur-tur \"Kurdish-Turkish Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-swe \"italiano-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-swh \"English-Swahili xFried/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-kha-eng \"Khasi-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fin-eng \"suomi-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-hin \"English-Hindi FreeDict Dictionary ver. 1.6\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-spa-eng \"Spanish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-afr-eng \"Afrikaans-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-fin \"italiano-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-fin \"English-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-ita \"fran\xC3\xA7""ais-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-rus \"Deutsch-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-bul \"Deutsch-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-pol \"Deutsch-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-kur-deu \"Kurdish-German Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-spa-por \"Spanish-Portuguese FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-pol \"Svenska-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-rus \"Svenska-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-nld-spa \"Nederlands-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swh-pol \"Swahili-Polish SSSP/FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-oci-cat \"Lenga d'\xC3\xB2""c - Catal\xC3\xA0 FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-rus \"italiano-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-ell \"fran\xC3\xA7""ais-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-srp \"English-Serbian FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-tur \"fran\xC3\xA7""ais-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-eng \"French-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-ita-ell \"italiano-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-kur-eng \"Kurdish-English Ferheng/FreeDict Dictionary ver. 1.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-deu \"Svenska-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-fra \"Svenska-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-lat \"Svenska-latine FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-ell \"Svenska-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-rus \"English-Russian FreeDict Dictionary ver. 0.3.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-por \"j\xC4\x99zyk polski-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-gla-deu \"Scottish Gaelic-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-ita \"English-Italian FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-pol-ita \"j\xC4\x99zyk polski-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-swe \"fran\xC3\xA7""ais-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-isl-eng \"\xC3\xADslenska - English FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-spa \"Svenska-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-nno-nob \"Norwegian Nynorsk-Norwegian Bokm\xC3\xA5l FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swe-ita \"Svenska-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-deu \"fran\xC3\xA7""ais-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fin-ita \"suomi-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-nld-fra \"Nederlands-French FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-eng-ara \"English-Arabic FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-slk-eng \"Slovak-English FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fra-por \"fran\xC3\xA7""ais-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-spa-ast \"Spanish - Asturian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fin-jpn \"suomi-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-deu-ita \"German-Italian FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-swh-eng \"Swahili-English xFried/FreeDict Dictionary ver. 0.4.4\"\r\n" Debug: 05-18 11:47:25 receive db: "fd-fin-nor \"suomi-Norsk FreeDict+WikDict dictionary ver. 2018" Debug: 05-18 11:47:25 received: ".09.13\"\r\n" Debug: 05-18 11:47:25 receive db: ".09.13\"\r\n" Debug: 05-18 11:47:26 received: "fd-fra-nld \"French-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 11:47:35 getResource: "gdlookup://localhost/?word=取&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 11:47:35 scheme: "gdlookup" Debug: 05-18 11:47:35 host: "localhost" Debug: 05-18 11:47:35 clear current dictionaries: "取" Debug: 05-18 11:47:35 some body finished Debug: 05-18 11:47:35 one not finished. Debug: 05-18 11:47:35 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 11:47:35 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 11:47:35 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 11:47:35 some body finished Debug: 05-18 11:47:35 one finished. Debug: 05-18 11:47:35 erasing.. Debug: 05-18 11:47:35 erase done.. Debug: 05-18 11:47:35 send dicts(finished): "groupId:1,word:取,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 11:47:35 ====reading 1292 of (2698) bytes . Finished: 1 Debug: 05-18 11:47:35 receive dicts, current word: "取" "取" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 11:47:35 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 11:47:35 scheme: "gico" Debug: 05-18 11:47:35 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 11:47:35 article view loaded url: "gdlookup://localhost/?word=取&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a" true Debug: 05-18 11:57:25 socket error message: QAbstractSocket::RemoteHostClosedError Debug: 05-18 12:34:24 translating from clipboard or selection Debug: 05-18 12:34:24 clipboard data: "https://ajattix.loophole.site/hashirama/Hakurei.git" Debug: 05-18 12:34:24 Current state: true true false true Debug: 05-18 12:34:24 getResource: "gdlookup://localhost/?word=https://ajattix.loophole.site/hashirama/Hakurei.git&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:34:24 scheme: "gdlookup" Debug: 05-18 12:34:24 host: "localhost" Debug: 05-18 12:34:24 clear current dictionaries: "https://ajattix.loophole.site/hashirama/Hakurei.git" Debug: 05-18 12:34:24 some body finished Debug: 05-18 12:34:24 one not finished. Debug: 05-18 12:34:24 ====reading 1454 of (1454) bytes . Finished: 0 Debug: 05-18 12:34:24 ====reading 0 of (1454) bytes . Finished: 0 Debug: 05-18 12:34:24 ====reading 0 of (1454) bytes . Finished: 0 Debug: 05-18 12:34:24 some body finished Debug: 05-18 12:34:24 one finished. Debug: 05-18 12:34:24 erasing.. Debug: 05-18 12:34:24 erase done.. Debug: 05-18 12:34:24 send dicts(finished): "groupId:1,word:https://ajattix.loophole.site/hashirama/Hakurei.git,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:34:24 ====reading 1292 of (2746) bytes . Finished: 1 Debug: 05-18 12:34:24 receive dicts, current word: "https://ajattix.loophole.site/hashirama/Hakurei.git" "https://ajattix.loophole.site/hashirama/Hakurei.git" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 12:34:24 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 12:34:24 scheme: "gico" Debug: 05-18 12:34:24 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:34:24 article view loaded url: "gdlookup://localhost/?word=https://ajattix.loophole.site/hashirama/Hakurei.git&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-18 12:35:16 translating from clipboard or selection Debug: 05-18 12:35:16 clipboard data: "http://localhost:3000/hashirama/Hakurei.git" Debug: 05-18 12:35:16 Current state: true false false true Debug: 05-18 12:35:16 getResource: "gdlookup://localhost/?word=http://localhost:3000/hashirama/Hakurei.git&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:35:16 scheme: "gdlookup" Debug: 05-18 12:35:16 host: "localhost" Debug: 05-18 12:35:16 clear current dictionaries: "http://localhost:3000/hashirama/Hakurei.git" Debug: 05-18 12:35:16 some body finished Debug: 05-18 12:35:16 one not finished. Debug: 05-18 12:35:16 ====reading 1446 of (1446) bytes . Finished: 0 Debug: 05-18 12:35:16 ====reading 0 of (1446) bytes . Finished: 0 Debug: 05-18 12:35:16 ====reading 0 of (1446) bytes . Finished: 0 Debug: 05-18 12:35:16 some body finished Debug: 05-18 12:35:16 one finished. Debug: 05-18 12:35:16 erasing.. Debug: 05-18 12:35:16 erase done.. Debug: 05-18 12:35:16 send dicts(finished): "groupId:1,word:http://localhost:3000/hashirama/Hakurei.git,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:35:16 receive dicts, current word: "http://localhost:3000/hashirama/Hakurei.git" "http://localhost:3000/hashirama/Hakurei.git" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 12:35:16 ====reading 1292 of (2738) bytes . Finished: 1 Debug: 05-18 12:35:16 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 12:35:16 scheme: "gico" Debug: 05-18 12:35:16 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:35:16 article view loaded url: "gdlookup://localhost/?word=http://localhost:3000/hashirama/Hakurei.git&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f1" true Debug: 05-18 12:36:00 getResource: "gdlookup://localhost/?word=reproductible&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:36:00 scheme: "gdlookup" Debug: 05-18 12:36:00 host: "localhost" Debug: 05-18 12:36:00 clear current dictionaries: "reproductible" Debug: 05-18 12:36:00 some body finished Debug: 05-18 12:36:00 one not finished. Debug: 05-18 12:36:00 ====reading 1416 of (1416) bytes . Finished: 0 Debug: 05-18 12:36:00 ====reading 0 of (1416) bytes . Finished: 0 Debug: 05-18 12:36:00 ====reading 0 of (1416) bytes . Finished: 0 Debug: 05-18 12:36:01 getResource: "gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:36:01 scheme: "gdlookup" Debug: 05-18 12:36:01 host: "localhost" Debug: 05-18 12:36:01 clear current dictionaries: "誇る" Debug: 05-18 12:36:01 some body finished Debug: 05-18 12:36:01 one not finished. Debug: 05-18 12:36:01 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:36:01 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:36:01 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:36:01 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:36:02 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:36:02 scheme: "gdlookup" Debug: 05-18 12:36:02 host: "localhost" Debug: 05-18 12:36:02 clear current dictionaries: "悔しい" Debug: 05-18 12:36:02 some body finished Debug: 05-18 12:36:02 one not finished. Debug: 05-18 12:36:02 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:36:02 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:36:02 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 12:36:02 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:37:11 translating from clipboard or selection Debug: 05-18 12:37:11 clipboard data: "" Debug: 05-18 12:38:27 translating from clipboard or selection Debug: 05-18 12:38:27 clipboard data: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/OPSXBaluTvwUvbDYfpAwkHnf?allow_redirect=true" Debug: 05-18 12:38:27 Current state: true true false true Debug: 05-18 12:38:27 getResource: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/OPSXBaluTvwUvbDYfpAwkHnf?allow_redirect%3Dtrue&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:38:27 scheme: "gdlookup" Debug: 05-18 12:38:27 host: "localhost" Debug: 05-18 12:38:27 clear current dictionaries: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/OPSXBaluTvwUvbDYfpAwkHnf?allow_redirect=true" Debug: 05-18 12:38:27 some body finished Debug: 05-18 12:38:27 one not finished. Debug: 05-18 12:38:27 ====reading 1511 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:27 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:27 ====reading 0 of (1511) bytes . Finished: 0 Warning: 05-18 12:38:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:38:27 translating from clipboard or selection Debug: 05-18 12:38:27 clipboard data: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/OPSXBaluTvwUvbDYfpAwkHnf?allow_redirect=true" Debug: 05-18 12:38:27 Current state: true false false true Debug: 05-18 12:38:27 getResource: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/OPSXBaluTvwUvbDYfpAwkHnf?allow_redirect%3Dtrue&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:38:27 scheme: "gdlookup" Debug: 05-18 12:38:27 host: "localhost" Debug: 05-18 12:38:27 clear current dictionaries: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/OPSXBaluTvwUvbDYfpAwkHnf?allow_redirect=true" Debug: 05-18 12:38:27 some body finished Debug: 05-18 12:38:27 one not finished. Debug: 05-18 12:38:27 ====reading 1511 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:27 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:27 ====reading 0 of (1511) bytes . Finished: 0 Warning: 05-18 12:38:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:38:48 translating from clipboard or selection Debug: 05-18 12:38:48 clipboard data: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" Debug: 05-18 12:38:48 Current state: true false true true Debug: 05-18 12:38:48 getResource: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect%3Dtrue&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:38:48 scheme: "gdlookup" Debug: 05-18 12:38:48 host: "localhost" Debug: 05-18 12:38:48 clear current dictionaries: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" Debug: 05-18 12:38:48 some body finished Debug: 05-18 12:38:48 one not finished. Debug: 05-18 12:38:48 ====reading 1511 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:48 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:48 ====reading 0 of (1511) bytes . Finished: 0 Warning: 05-18 12:38:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:38:49 translating from clipboard or selection Debug: 05-18 12:38:49 clipboard data: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" Debug: 05-18 12:38:49 Current state: true false true true Debug: 05-18 12:38:49 getResource: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect%3Dtrue&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:38:49 scheme: "gdlookup" Debug: 05-18 12:38:49 host: "localhost" Debug: 05-18 12:38:49 clear current dictionaries: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" Debug: 05-18 12:38:49 some body finished Debug: 05-18 12:38:49 one not finished. Debug: 05-18 12:38:49 ====reading 1511 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:49 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 12:38:49 ====reading 0 of (1511) bytes . Finished: 0 Warning: 05-18 12:38:49 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:40:56 getResource: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect%3Dtrue&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:40:56 scheme: "gdlookup" Debug: 05-18 12:40:56 host: "localhost" Debug: 05-18 12:40:56 clear current dictionaries: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" Debug: 05-18 12:40:56 some body finished Debug: 05-18 12:40:56 send dicts(stemmed): "groupId:1,word:https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true,dictId:" Debug: 05-18 12:40:56 receive dicts, current word: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" : QList() Debug: 05-18 12:40:56 ====reading 1595 of (1595) bytes . Finished: 0 Debug: 05-18 12:40:56 ====reading 0 of (1595) bytes . Finished: 0 Debug: 05-18 12:40:56 ====reading 0 of (1595) bytes . Finished: 0 Debug: 05-18 12:40:56 ====reading 0 of (1595) bytes . Finished: 0 Warning: 05-18 12:40:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:40:56 ====reading 826 of (2421) bytes . Finished: 1 Debug: 05-18 12:40:56 article view loaded url: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect%3Dtrue&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d7" true Debug: 05-18 12:40:58 getResource: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect%3Dtrue&group=1&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:40:58 scheme: "gdlookup" Debug: 05-18 12:40:58 host: "localhost" Debug: 05-18 12:40:58 clear current dictionaries: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" Debug: 05-18 12:40:58 some body finished Debug: 05-18 12:40:58 one not finished. Debug: 05-18 12:40:58 ====reading 1511 of (1511) bytes . Finished: 0 Debug: 05-18 12:40:58 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 12:40:58 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 12:40:58 some body finished Debug: 05-18 12:40:58 one finished. Debug: 05-18 12:40:58 erasing.. Debug: 05-18 12:40:58 erase done.. Debug: 05-18 12:40:58 send dicts(finished): "groupId:1,word:https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:40:58 ====reading 6933 of (8444) bytes . Finished: 1 Debug: 05-18 12:40:58 receive dicts, current word: "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" "https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect=true" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:40:58 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:40:58 scheme: "gico" Debug: 05-18 12:40:58 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:40:58 article view loaded url: "gdlookup://localhost/?word=https://matrix.eientei.org/_matrix/media/v3/download/matrix.org/hIplYubEMEpQItBtIRJgjKUH?allow_redirect%3Dtrue&group=1&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99" true Debug: 05-18 12:40:59 getResource: "gdlookup://localhost/?word=誇る&group=1&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:40:59 scheme: "gdlookup" Debug: 05-18 12:40:59 host: "localhost" Debug: 05-18 12:40:59 clear current dictionaries: "誇る" Debug: 05-18 12:40:59 some body finished Debug: 05-18 12:40:59 one not finished. Debug: 05-18 12:40:59 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:40:59 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:40:59 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:40:59 some body finished Debug: 05-18 12:40:59 one finished. Debug: 05-18 12:40:59 erasing.. Debug: 05-18 12:40:59 erase done.. Debug: 05-18 12:40:59 send dicts(finished): "groupId:1,word:誇る,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:40:59 receive dicts, current word: "誇る" "誇る" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:40:59 ====reading 2571 of (3980) bytes . Finished: 1 Debug: 05-18 12:40:59 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:40:59 scheme: "gico" Debug: 05-18 12:40:59 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:40:59 article view loaded url: "gdlookup://localhost/?word=誇る&group=1&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c" true Debug: 05-18 12:40:59 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:40:59 scheme: "gdlookup" Debug: 05-18 12:40:59 host: "localhost" Debug: 05-18 12:40:59 clear current dictionaries: "悔しい" Debug: 05-18 12:40:59 some body finished Debug: 05-18 12:40:59 one not finished. Debug: 05-18 12:40:59 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:40:59 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:40:59 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:40:59 some body finished Debug: 05-18 12:40:59 one finished. Debug: 05-18 12:40:59 erasing.. Debug: 05-18 12:40:59 erase done.. Debug: 05-18 12:40:59 send dicts(finished): "groupId:1,word:悔しい,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:40:59 receive dicts, current word: "悔しい" "悔しい" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:40:59 ====reading 2922 of (4334) bytes . Finished: 1 Debug: 05-18 12:40:59 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:40:59 scheme: "gico" Debug: 05-18 12:40:59 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:40:59 article view loaded url: "gdlookup://localhost/?word=悔しい&group=1&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0" true Debug: 05-18 12:41:53 open link url: QUrl("bword:しいる") Debug: 05-18 12:41:53 getResource: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:41:53 scheme: "gdlookup" Debug: 05-18 12:41:53 host: "localhost" Debug: 05-18 12:41:53 clear current dictionaries: "しいる" Debug: 05-18 12:41:53 some body finished Debug: 05-18 12:41:53 one not finished. Debug: 05-18 12:41:53 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:53 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:53 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:53 some body finished Debug: 05-18 12:41:53 one finished. Debug: 05-18 12:41:53 erasing.. Debug: 05-18 12:41:53 erase done.. Debug: 05-18 12:41:53 send dicts(finished): "groupId:1,word:しいる,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:53 ====reading 2918 of (4330) bytes . Finished: 1 Debug: 05-18 12:41:53 receive dicts, current word: "しいる" "しいる" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:41:53 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:41:53 scheme: "gico" Debug: 05-18 12:41:53 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:53 article view loaded url: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50c" true Debug: 05-18 12:41:57 open link url: QUrl("bword:しう") Debug: 05-18 12:41:57 getResource: "gdlookup://localhost/?word=しう&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:41:57 scheme: "gdlookup" Debug: 05-18 12:41:57 host: "localhost" Debug: 05-18 12:41:57 clear current dictionaries: "しう" Debug: 05-18 12:41:57 some body finished Debug: 05-18 12:41:57 one not finished. Debug: 05-18 12:41:57 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:41:57 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:41:57 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:41:57 some body finished Debug: 05-18 12:41:57 one finished. Debug: 05-18 12:41:57 erasing.. Debug: 05-18 12:41:57 erase done.. Debug: 05-18 12:41:57 send dicts(finished): "groupId:1,word:しう,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:57 ====reading 2910 of (4319) bytes . Finished: 1 Debug: 05-18 12:41:57 receive dicts, current word: "しう" "しう" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:41:57 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:41:57 scheme: "gico" Debug: 05-18 12:41:57 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:57 article view loaded url: "gdlookup://localhost/?word=しう&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cd" true Debug: 05-18 12:41:58 open link url: QUrl("bword:しいる") Debug: 05-18 12:41:58 getResource: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:41:58 scheme: "gdlookup" Debug: 05-18 12:41:58 host: "localhost" Debug: 05-18 12:41:58 clear current dictionaries: "しいる" Debug: 05-18 12:41:58 some body finished Debug: 05-18 12:41:58 one not finished. Debug: 05-18 12:41:58 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:58 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:58 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:58 some body finished Debug: 05-18 12:41:58 one finished. Debug: 05-18 12:41:58 erasing.. Debug: 05-18 12:41:58 erase done.. Debug: 05-18 12:41:58 send dicts(finished): "groupId:1,word:しいる,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:58 ====reading 2918 of (4330) bytes . Finished: 1 Debug: 05-18 12:41:58 receive dicts, current word: "しいる" "しいる" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:41:58 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:41:58 scheme: "gico" Debug: 05-18 12:41:58 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:58 article view loaded url: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50c" true Debug: 05-18 12:41:59 open link url: QUrl("bword:悔しい") Debug: 05-18 12:41:59 getResource: "gdlookup://localhost/?word=悔しい&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:41:59 scheme: "gdlookup" Debug: 05-18 12:41:59 host: "localhost" Debug: 05-18 12:41:59 clear current dictionaries: "悔しい" Debug: 05-18 12:41:59 some body finished Debug: 05-18 12:41:59 one not finished. Debug: 05-18 12:41:59 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:59 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:59 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:41:59 some body finished Debug: 05-18 12:41:59 one finished. Debug: 05-18 12:41:59 erasing.. Debug: 05-18 12:41:59 erase done.. Debug: 05-18 12:41:59 send dicts(finished): "groupId:1,word:悔しい,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:59 ====reading 2922 of (4334) bytes . Finished: 1 Debug: 05-18 12:41:59 receive dicts, current word: "悔しい" "悔しい" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:41:59 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:41:59 scheme: "gico" Debug: 05-18 12:41:59 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:41:59 article view loaded url: "gdlookup://localhost/?word=悔しい&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50c" true Debug: 05-18 12:42:00 open link url: QUrl("bword:悔し") Debug: 05-18 12:42:00 getResource: "gdlookup://localhost/?word=悔し&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:42:00 scheme: "gdlookup" Debug: 05-18 12:42:00 host: "localhost" Debug: 05-18 12:42:00 clear current dictionaries: "悔し" Debug: 05-18 12:42:00 some body finished Debug: 05-18 12:42:00 one not finished. Debug: 05-18 12:42:00 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:42:00 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:42:00 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:42:00 some body finished Debug: 05-18 12:42:00 one finished. Debug: 05-18 12:42:00 erasing.. Debug: 05-18 12:42:00 erase done.. Debug: 05-18 12:42:00 send dicts(finished): "groupId:1,word:悔し,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:42:00 ====reading 2910 of (4319) bytes . Finished: 1 Debug: 05-18 12:42:00 receive dicts, current word: "悔し" "悔し" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:42:00 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:42:00 scheme: "gico" Debug: 05-18 12:42:00 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:42:00 article view loaded url: "gdlookup://localhost/?word=悔し&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cd" true Debug: 05-18 12:42:01 open link url: QUrl("bword:しいる") Debug: 05-18 12:42:01 getResource: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:42:01 scheme: "gdlookup" Debug: 05-18 12:42:01 host: "localhost" Debug: 05-18 12:42:01 clear current dictionaries: "しいる" Debug: 05-18 12:42:01 some body finished Debug: 05-18 12:42:01 one not finished. Debug: 05-18 12:42:01 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:42:01 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:42:01 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:42:01 some body finished Debug: 05-18 12:42:01 one finished. Debug: 05-18 12:42:01 erasing.. Debug: 05-18 12:42:01 erase done.. Debug: 05-18 12:42:01 send dicts(finished): "groupId:1,word:しいる,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-18 12:42:01 ====reading 2918 of (4330) bytes . Finished: 1 Debug: 05-18 12:42:01 receive dicts, current word: "しいる" "しいる" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-18 12:42:01 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-18 12:42:01 scheme: "gico" Debug: 05-18 12:42:01 host: "00824c93f503c5d1680483abdf367948" Debug: 05-18 12:42:01 article view loaded url: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50c" true Debug: 05-18 12:43:47 getResource: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74,9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 12:43:47 scheme: "gdlookup" Debug: 05-18 12:43:47 host: "localhost" Debug: 05-18 12:43:47 clear current dictionaries: "しいる" Debug: 05-18 12:43:47 some body finished Debug: 05-18 12:43:47 send dicts(stemmed): "groupId:1,word:しいる,dictId:" Debug: 05-18 12:43:47 receive dicts, current word: "しいる" "しいる" : QList() Debug: 05-18 12:43:47 ====reading 1527 of (1527) bytes . Finished: 0 Debug: 05-18 12:43:47 ====reading 0 of (1527) bytes . Finished: 0 Debug: 05-18 12:43:47 ====reading 14 of (1541) bytes . Finished: 1 Debug: 05-18 12:43:47 article view loaded url: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f42" true Debug: 05-18 12:43:49 getResource: "gdlookup://localhost/?word=しいる&group=1&scrollto=gdfrom-00824c93f503c5d1680483abdf367948&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:43:49 scheme: "gdlookup" Debug: 05-18 12:43:49 host: "localhost" Debug: 05-18 12:43:49 clear current dictionaries: "しいる" Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: "gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:44:01 scheme: "gdlookup" Debug: 05-18 12:44:01 host: "localhost" Debug: 05-18 12:44:01 clear current dictionaries: "誇る" Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: "Debug: 05-18 12:43:49 scheme: \"gdlookup\"\nDebug: 05-18 12:43:49 host: \"localhost\"\nDebug: 05-18 12:43:49 clear current dictionaries: \"しいる\"\nDebug: 05-18 12:43:49 some body finished\nDebug: 05-18 12:43:49 one not finished.\nDebug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\nDebug: 05-18 12:44:01 getResource: \"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\"\nDebug: 05-18 12:44:01 scheme: \"gdlookup\"\nDebug: 05-18 12:44:01 host: \"localhost\"\nDebug: 05-18 12:44:01 clear current dictionaries: \"誇る\"\nDebug: 05-18 12:44:01 some body finished\nDebug: 05-18 12:44:01 one not finished.\nDebug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\nWarning: 05-18 12:44:01 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\n" Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: "gdlookup://localhost/?word=Debug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:44:20 scheme: "gdlookup" Debug: 05-18 12:44:20 host: "localhost" Debug: 05-18 12:44:20 clear current dictionaries: "Debug: 05-18 12:43:49 scheme: \"gdlookup\" Debug: 05-18 12:43:49 host: \"localhost\" Debug: 05-18 12:43:49 clear current dictionaries: \"しいる\" Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: \"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\" Debug: 05-18 12:44:01 scheme: \"gdlookup\" Debug: 05-18 12:44:01 host: \"localhost\" Debug: 05-18 12:44:01 clear current dictionaries: \"誇る\" Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running." Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 ====reading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:44:43 translating from clipboard or selection Debug: 05-18 12:44:43 clipboard data: "Debug: 05-18 12:44:01 scheme: \"gdlookup\"\nDebug: 05-18 12:44:01 host: \"localhost\"\nDebug: 05-18 12:44:01 clear current dictionaries: \"誇る\"\nDebug: 05-18 12:44:01 some body finished\nDebug: 05-18 12:44:01 one not finished.\nDebug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\nWarning: 05-18 12:44:01 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\nDebug: 05-18 12:44:20 translating from clipboard or selection\nDebug: 05-18 12:44:20 clipboard data: \"Debug: 05-18 12:43:49 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:43:49 host: \\\"localhost\\\"\\nDebug: 05-18 12:43:49 clear current dictionaries: \\\"しいる\\\"\\nDebug: 05-18 12:43:49 some body finished\\nDebug: 05-18 12:43:49 one not finished.\\nDebug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0\\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\\nDebug: 05-18 12:44:01 getResource: \\\"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\"\\nDebug: 05-18 12:44:01 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:44:01 host: \\\"localhost\\\"\\nDebug: 05-18 12:44:01 clear current dictionaries: \\\"誇る\\\"\\nDebug: 05-18 12:44:01 some body finished\\nDebug: 05-18 12:44:01 one not finished.\\nDebug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\nWarning: 05-18 12:44:01 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\\n\"\nDebug: 05-18 12:44:20 Current state: true true false true\nDebug: 05-18 12:44:20 getResource: \"gdlookup://localhost/?word=Debug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\"\nDebug: 05-18 12:44:20 scheme: \"gdlookup\"\nDebug: 05-18 12:44:20 host: \"localhost\"\nDebug: 05-18 12:44:20 clear current dictionaries: \"Debug: 05-18 12:43:49 scheme: \\\"gdlookup\\\" Debug: 05-18 12:43:49 host: \\\"localhost\\\" Debug: 05-18 12:43:49 clear current dictionaries: \\\"しいる\\\" Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: \\\"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\" Debug: 05-18 12:44:01 scheme: \\\"gdlookup\\\" Debug: 05-18 12:44:01 host: \\\"localhost\\\" Debug: 05-18 12:44:01 clear current dictionaries: \\\"誇る\\\" Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\"\nDebug: 05-18 12:44:20 some body finished\nDebug: 05-18 12:44:20 one not finished.\nDebug: 05-18 12:44:20 ====reading 2853 of (2853) bytes . Finished: 0\nDebug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0\nDebug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0\nWarning: 05-18 12:44:20 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\n" Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: "gdlookup://localhost/?word=Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:44:43 scheme: "gdlookup" Debug: 05-18 12:44:43 host: "localhost" Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 ====reading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 ====reading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 ====reading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:44:50 translating from clipboard or selection Debug: 05-18 12:44:50 clipboard data: "Debug: 05-18 12:44:01 scheme: \"gdlookup\"\nDebug: 05-18 12:44:01 host: \"localhost\"\nDebug: 05-18 12:44:01 clear current dictionaries: \"誇る\"\nDebug: 05-18 12:44:01 some body finished\nDebug: 05-18 12:44:01 one not finished.\nDebug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\nWarning: 05-18 12:44:01 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\nDebug: 05-18 12:44:20 translating from clipboard or selection\nDebug: 05-18 12:44:20 clipboard data: \"Debug: 05-18 12:43:49 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:43:49 host: \\\"localhost\\\"\\nDebug: 05-18 12:43:49 clear current dictionaries: \\\"しいる\\\"\\nDebug: 05-18 12:43:49 some body finished\\nDebug: 05-18 12:43:49 one not finished.\\nDebug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0\\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\\nDebug: 05-18 12:44:01 getResource: \\\"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\"\\nDebug: 05-18 12:44:01 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:44:01 host: \\\"localhost\\\"\\nDebug: 05-18 12:44:01 clear current dictionaries: \\\"誇る\\\"\\nDebug: 05-18 12:44:01 some body finished\\nDebug: 05-18 12:44:01 one not finished.\\nDebug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\nWarning: 05-18 12:44:01 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\\n\"\nDebug: 05-18 12:44:20 Current state: true true false true\nDebug: 05-18 12:44:20 getResource: \"gdlookup://localhost/?word=Debug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\"\nDebug: 05-18 12:44:20 scheme: \"gdlookup\"\nDebug: 05-18 12:44:20 host: \"localhost\"\nDebug: 05-18 12:44:20 clear current dictionaries: \"Debug: 05-18 12:43:49 scheme: \\\"gdlookup\\\" Debug: 05-18 12:43:49 host: \\\"localhost\\\" Debug: 05-18 12:43:49 clear current dictionaries: \\\"しいる\\\" Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: \\\"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\" Debug: 05-18 12:44:01 scheme: \\\"gdlookup\\\" Debug: 05-18 12:44:01 host: \\\"localhost\\\" Debug: 05-18 12:44:01 clear current dictionaries: \\\"誇る\\\" Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\"\nDebug: 05-18 12:44:20 some body finished\nDebug: 05-18 12:44:20 one not finished.\nDebug: 05-18 12:44:20 ====reading 2853 of (2853) bytes . Finished: 0\nDebug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0\nDebug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0\nWarning: 05-18 12:44:20 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\nDebug: 05-18 12:44:43 translating from clipboard or selection\nDebug: 05-18 12:44:43 clipboard data: \"Debug: 05-18 12:44:01 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:44:01 host: \\\"localhost\\\"\\nDebug: 05-18 12:44:01 clear current dictionaries: \\\"誇る\\\"\\nDebug: 05-18 12:44:01 some body finished\\nDebug: 05-18 12:44:01 one not finished.\\nDebug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\nWarning: 05-18 12:44:01 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\\nDebug: 05-18 12:44:20 translating from clipboard or selection\\nDebug: 05-18 12:44:20 clipboard data: \\\"Debug: 05-18 12:43:49 scheme: \\\\\\\"gdlookup\\\\\\\"\\\\nDebug: 05-18 12:43:49 host: \\\\\\\"localhost\\\\\\\"\\\\nDebug: 05-18 12:43:49 clear current dictionaries: \\\\\\\"しいる\\\\\\\"\\\\nDebug: 05-18 12:43:49 some body finished\\\\nDebug: 05-18 12:43:49 one not finished.\\\\nDebug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0\\\\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\\\\nDebug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0\\\\nDebug: 05-18 12:44:01 getResource: \\\\\\\"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\\\\\"\\\\nDebug: 05-18 12:44:01 scheme: \\\\\\\"gdlookup\\\\\\\"\\\\nDebug: 05-18 12:44:01 host: \\\\\\\"localhost\\\\\\\"\\\\nDebug: 05-18 12:44:01 clear current dictionaries: \\\\\\\"誇る\\\\\\\"\\\\nDebug: 05-18 12:44:01 some body finished\\\\nDebug: 05-18 12:44:01 one not finished.\\\\nDebug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0\\\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\\\nDebug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0\\\\nWarning: 05-18 12:44:01 QProcess: Destroyed while process (\\\\\\\"/tmp/Hakurei/hakurei\\\\\\\") is still running.\\\\n\\\"\\nDebug: 05-18 12:44:20 Current state: true true false true\\nDebug: 05-18 12:44:20 getResource: \\\"gdlookup://localhost/?word=Debug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\"\\nDebug: 05-18 12:44:20 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:44:20 host: \\\"localhost\\\"\\nDebug: 05-18 12:44:20 clear current dictionaries: \\\"Debug: 05-18 12:43:49 scheme: \\\\\\\"gdlookup\\\\\\\" Debug: 05-18 12:43:49 host: \\\\\\\"localhost\\\\\\\" Debug: 05-18 12:43:49 clear current dictionaries: \\\\\\\"しいる\\\\\\\" Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: \\\\\\\"gdlookup://localhost/?word=誇る&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\\\\\" Debug: 05-18 12:44:01 scheme: \\\\\\\"gdlookup\\\\\\\" Debug: 05-18 12:44:01 host: \\\\\\\"localhost\\\\\\\" Debug: 05-18 12:44:01 clear current dictionaries: \\\\\\\"誇る\\\\\\\" Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (\\\\\\\"/tmp/Hakurei/hakurei\\\\\\\") is still running.\\\"\\nDebug: 05-18 12:44:20 some body finished\\nDebug: 05-18 12:44:20 one not finished.\\nDebug: 05-18 12:44:20 ====reading 2853 of (2853) bytes . Finished: 0\\nDebug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0\\nDebug: 05-18 12:44:20 ====reading 0 of (2853) bytes . Finished: 0\\nWarning: 05-18 12:44:20 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\\n\"\nDebug: 05-18 12:44:43 Current state: true true false true\nDebug: 05-18 12:44:43 getResource: \"gdlookup://localhost/?word=Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\"\nDebug: 05-18 12:44:43 scheme: \"gdlookup\"\nDebug: 05-18 12:44:43 host: \"localhost\"\nDebug: 05-18 12:44:43 some body finished\nDebug: 05-18 12:44:43 one not finished.\nDebug: 05-18 12:44:43 ====reading 7521 of (7521) bytes . Finished: 0\nDebug: 05-18 12:44:43 ====reading 0 of (7521) bytes . Finished: 0\nDebug: 05-18 12:44:43 ====reading 0 of (7521) bytes . Finished: 0\nWarning: 05-18 12:44:43 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\n" Debug: 05-18 12:44:50 Current state: true false false true Debug: 05-18 12:44:50 getResource: "gdlookup://localhost/?word=Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:43 translating from clipboard or selection Debug: 05-18 12:44:43 clipboard data: %22Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5CnDebug: 05-18 12:44:20 translating from clipboard or selection%5CnDebug: 05-18 12:44:20 clipboard data: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22%5C%5CnDebug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22%5C%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22%5C%5CnDebug: 05-18 12:43:49 some body finished%5C%5CnDebug: 05-18 12:43:49 one not finished.%5C%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5C%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5C%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5C%5CnDebug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22%5C%5CnDebug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22%5C%5CnDebug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22%5C%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22%5C%5CnDebug: 05-18 12:44:01 some body finished%5C%5CnDebug: 05-18 12:44:01 one not finished.%5C%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5C%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5C%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5C%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%5Cn%5C%22%5CnDebug: 05-18 12:44:20 Current state: true true false true%5CnDebug: 05-18 12:44:20 getResource: %5C%22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:44:50 scheme: "gdlookup" Debug: 05-18 12:44:50 host: "localhost" Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 ====reading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:44:56 translating from clipboard or selection Debug: 05-18 12:44:56 clipboard data: "f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\"\nDebug: 05-18 12:44:50 scheme: \"gdlookup\"\nDebug: 05-18 12:44:50 host: \"localhost\"\nDebug: 05-18 12:44:50 some body finished\nDebug: 05-18 12:44:50 one not finished.\nDebug: 05-18 12:44:50 ====reading 20974 of (20974) bytes . Finished: 0\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\nWarning: 05-18 12:44:50 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\n" Debug: 05-18 12:44:56 Current state: true false true true Debug: 05-18 12:44:56 getResource: "gdlookup://localhost/?word=f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:50 scheme: %22gdlookup%22 Debug: 05-18 12:44:50 host: %22localhost%22 Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:44:56 scheme: "gdlookup" Debug: 05-18 12:44:56 host: "localhost" Debug: 05-18 12:44:56 some body finished Debug: 05-18 12:44:56 one not finished. Debug: 05-18 12:44:56 ====reading 12650 of (12650) bytes . Finished: 0 Debug: 05-18 12:44:56 ====reading 0 of (12650) bytes . Finished: 0 Debug: 05-18 12:44:56 ====reading 0 of (12650) bytes . Finished: 0 Warning: 05-18 12:44:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:45:12 translating from clipboard or selection Debug: 05-18 12:45:12 clipboard data: "Debug: 05-18 12:44:50 scheme: \"gdlookup\"\nDebug: 05-18 12:44:50 host: \"localhost\"\nDebug: 05-18 12:44:50 some body finished\nDebug: 05-18 12:44:50 one not finished.\nDebug: 05-18 12:44:50 ====reading 20974 of (20974) bytes . Finished: 0\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\nWarning: 05-18 12:44:50 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\nDebug: 05-18 12:44:56 translating from clipboard or selection\nDebug: 05-18 12:44:56 clipboard data: \"f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\"\\nDebug: 05-18 12:44:50 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:44:50 host: \\\"localhost\\\"\\nDebug: 05-18 12:44:50 some body finished\\nDebug: 05-18 12:44:50 one not finished.\\nDebug: 05-18 12:44:50 ====reading 20974 of (20974) bytes . Finished: 0\\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\\nWarning: 05-18 12:44:50 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\\n\"\nDebug: 05-18 12:44:56 Current state: true false true true\nDebug: 05-18 12:44:56 getResource: \"gdlookup://localhost/?word=f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:50 scheme: %22gdlookup%22 Debug: 05-18 12:44:50 host: %22localhost%22 Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\"\nDebug: 05-18 12:44:56 scheme: \"gdlookup\"\nDebug: 05-18 12:44:56 host: \"localhost\"\nDebug: 05-18 12:44:56 some body finished\nDebug: 05-18 12:44:56 one not finished.\nDebug: 05-18 12:44:56 ====reading 12650 of (12650) bytes . Finished: 0\nDebug: 05-18 12:44:56 ====reading 0 of (12650) bytes . Finished: 0\nDebug: 05-18 12:44:56 ====reading 0 of (12650) bytes . Finished: 0" Debug: 05-18 12:45:12 Current state: true false true true Debug: 05-18 12:45:12 getResource: "gdlookup://localhost/?word=Debug: 05-18 12:44:50 scheme: %22gdlookup%22 Debug: 05-18 12:44:50 host: %22localhost%22 Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:56 translating from clipboard or selection Debug: 05-18 12:44:56 clipboard data: %22f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:50 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:50 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:50 some body finished%5CnDebug: 05-18 12:44:50 one not finished.%5CnDebug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0%5CnDebug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0%5CnDebug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0%5CnWarning: 05-18 12:44:50 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:56 Current state: true false true true Debug: 05-18 12:44:56 getResource: %22gdlookup://localhost/?word%3Df50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:50 scheme: %22gdlookup%22 Debug: 05-18 12:44:50 host: %22localhost%22 Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:56 scheme: %22gdlookup%22 Debug: 05-18 12:44:56 host: %22localhost%22 Debug: 05-18 12:44:56 some body finished Debug: 05-18 12:44:56 one not finished. Debug: 05-18 12:44:56 %3D%3D%3D%3Dreading 12650 of (12650) bytes . Finished: 0 Debug: 05-18 12:44:56 %3D%3D%3D%3Dreading 0 of (12650) bytes . Finished: 0 Debug: 05-18 12:44:56 %3D%3D%3D%3Dreading 0 of (12650) bytes . Finished: 0&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:45:12 scheme: "gdlookup" Debug: 05-18 12:45:12 host: "localhost" Debug: 05-18 12:45:12 some body finished Debug: 05-18 12:45:12 one not finished. Debug: 05-18 12:45:12 ====reading 25396 of (25396) bytes . Finished: 0 Debug: 05-18 12:45:12 ====reading 0 of (25396) bytes . Finished: 0 Debug: 05-18 12:45:12 ====reading 0 of (25396) bytes . Finished: 0 Warning: 05-18 12:45:12 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:45:13 translating from clipboard or selection Debug: 05-18 12:45:13 clipboard data: "Debug: 05-18 12:44:50 scheme: \"gdlookup\"\nDebug: 05-18 12:44:50 host: \"localhost\"\nDebug: 05-18 12:44:50 some body finished\nDebug: 05-18 12:44:50 one not finished.\nDebug: 05-18 12:44:50 ====reading 20974 of (20974) bytes . Finished: 0\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\nWarning: 05-18 12:44:50 QProcess: Destroyed while process (\"/tmp/Hakurei/hakurei\") is still running.\nDebug: 05-18 12:44:56 translating from clipboard or selection\nDebug: 05-18 12:44:56 clipboard data: \"f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\\\"\\nDebug: 05-18 12:44:50 scheme: \\\"gdlookup\\\"\\nDebug: 05-18 12:44:50 host: \\\"localhost\\\"\\nDebug: 05-18 12:44:50 some body finished\\nDebug: 05-18 12:44:50 one not finished.\\nDebug: 05-18 12:44:50 ====reading 20974 of (20974) bytes . Finished: 0\\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\\nDebug: 05-18 12:44:50 ====reading 0 of (20974) bytes . Finished: 0\\nWarning: 05-18 12:44:50 QProcess: Destroyed while process (\\\"/tmp/Hakurei/hakurei\\\") is still running.\\n\"\nDebug: 05-18 12:44:56 Current state: true false true true\nDebug: 05-18 12:44:56 getResource: \"gdlookup://localhost/?word=f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:50 scheme: %22gdlookup%22 Debug: 05-18 12:44:50 host: %22localhost%22 Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74\"\nDebug: 05-18 12:44:56 scheme: \"gdlookup\"\nDebug: 05-18 12:44:56 host: \"localhost\"\nDebug: 05-18 12:44:56 some body finished\nDebug: 05-18 12:44:56 one not finished.\nDebug: 05-18 12:44:56 ====reading 12650 of (12650) bytes . Finished: 0\nDebug: 05-18 12:44:56 ====reading 0 of (12650) bytes . Finished: 0\nDebug: 05-18 12:44:56 ====reading 0 of (12650) bytes . Finished: 0" Debug: 05-18 12:45:13 Current state: true false true true Debug: 05-18 12:45:13 getResource: "gdlookup://localhost/?word=Debug: 05-18 12:44:50 scheme: %22gdlookup%22 Debug: 05-18 12:44:50 host: %22localhost%22 Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:56 translating from clipboard or selection Debug: 05-18 12:44:56 clipboard data: %22f50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:50 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:50 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:50 some body finished%5CnDebug: 05-18 12:44:50 one not finished.%5CnDebug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0%5CnDebug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0%5CnDebug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0%5CnWarning: 05-18 12:44:50 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:56 Current state: true false true true Debug: 05-18 12:44:56 getResource: %22gdlookup://localhost/?word%3Df50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:20 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:20 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:20 clear current dictionaries: %5C%22Debug: 05-18 12:43:49 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:43:49 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%5C%5C%22しいる%5C%5C%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%5C%5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%5C%5C%22 Debug: 05-18 12:44:01 scheme: %5C%5C%5C%22gdlookup%5C%5C%5C%22 Debug: 05-18 12:44:01 host: %5C%5C%5C%22localhost%5C%5C%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%5C%5C%22誇る%5C%5C%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%5C%5C%22/tmp/Hakurei/hakurei%5C%5C%5C%22) is still running.%5C%22%5CnDebug: 05-18 12:44:20 some body finished%5CnDebug: 05-18 12:44:20 one not finished.%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnDebug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0%5CnWarning: 05-18 12:44:20 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:43 Current state: true true false true Debug: 05-18 12:44:43 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running. Debug: 05-18 12:44:20 translating from clipboard or selection Debug: 05-18 12:44:20 clipboard data: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:43:49 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22%5CnDebug: 05-18 12:43:49 some body finished%5CnDebug: 05-18 12:43:49 one not finished.%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22%5CnDebug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22%5CnDebug: 05-18 12:44:01 host: %5C%22localhost%5C%22%5CnDebug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22%5CnDebug: 05-18 12:44:01 some body finished%5CnDebug: 05-18 12:44:01 one not finished.%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnDebug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0%5CnWarning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%5Cn%22 Debug: 05-18 12:44:20 Current state: true true false true Debug: 05-18 12:44:20 getResource: %22gdlookup://localhost/?word%3DDebug: 05-18 12:43:49 scheme: %22gdlookup%22 Debug: 05-18 12:43:49 host: %22localhost%22 Debug: 05-18 12:43:49 clear current dictionaries: %22しいる%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:01 scheme: %22gdlookup%22 Debug: 05-18 12:44:01 host: %22localhost%22 Debug: 05-18 12:44:01 clear current dictionaries: %22誇る%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:20 scheme: %22gdlookup%22 Debug: 05-18 12:44:20 host: %22localhost%22 Debug: 05-18 12:44:20 clear current dictionaries: %22Debug: 05-18 12:43:49 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:43:49 host: %5C%22localhost%5C%22 Debug: 05-18 12:43:49 clear current dictionaries: %5C%22しいる%5C%22 Debug: 05-18 12:43:49 some body finished Debug: 05-18 12:43:49 one not finished. Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:43:49 %3D%3D%3D%3Dreading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:44:01 getResource: %5C%22gdlookup://localhost/?word%3D誇る%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%5C%22 Debug: 05-18 12:44:01 scheme: %5C%22gdlookup%5C%22 Debug: 05-18 12:44:01 host: %5C%22localhost%5C%22 Debug: 05-18 12:44:01 clear current dictionaries: %5C%22誇る%5C%22 Debug: 05-18 12:44:01 some body finished Debug: 05-18 12:44:01 one not finished. Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Debug: 05-18 12:44:01 %3D%3D%3D%3Dreading 0 of (1409) bytes . Finished: 0 Warning: 05-18 12:44:01 QProcess: Destroyed while process (%5C%22/tmp/Hakurei/hakurei%5C%22) is still running.%22 Debug: 05-18 12:44:20 some body finished Debug: 05-18 12:44:20 one not finished. Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 2853 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Debug: 05-18 12:44:20 %3D%3D%3D%3Dreading 0 of (2853) bytes . Finished: 0 Warning: 05-18 12:44:20 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:43 scheme: %22gdlookup%22 Debug: 05-18 12:44:43 host: %22localhost%22 Debug: 05-18 12:44:43 some body finished Debug: 05-18 12:44:43 one not finished. Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 7521 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Debug: 05-18 12:44:43 %3D%3D%3D%3Dreading 0 of (7521) bytes . Finished: 0 Warning: 05-18 12:44:43 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:50 scheme: %22gdlookup%22 Debug: 05-18 12:44:50 host: %22localhost%22 Debug: 05-18 12:44:50 some body finished Debug: 05-18 12:44:50 one not finished. Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 20974 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Debug: 05-18 12:44:50 %3D%3D%3D%3Dreading 0 of (20974) bytes . Finished: 0 Warning: 05-18 12:44:50 QProcess: Destroyed while process (%22/tmp/Hakurei/hakurei%22) is still running.%26group%3D1%26muted%3D00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74%22 Debug: 05-18 12:44:56 scheme: %22gdlookup%22 Debug: 05-18 12:44:56 host: %22localhost%22 Debug: 05-18 12:44:56 some body finished Debug: 05-18 12:44:56 one not finished. Debug: 05-18 12:44:56 %3D%3D%3D%3Dreading 12650 of (12650) bytes . Finished: 0 Debug: 05-18 12:44:56 %3D%3D%3D%3Dreading 0 of (12650) bytes . Finished: 0 Debug: 05-18 12:44:56 %3D%3D%3D%3Dreading 0 of (12650) bytes . Finished: 0&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:45:13 scheme: "gdlookup" Debug: 05-18 12:45:13 host: "localhost" Debug: 05-18 12:45:13 some body finished Debug: 05-18 12:45:13 one not finished. Debug: 05-18 12:45:13 ====reading 25396 of (25396) bytes . Finished: 0 Debug: 05-18 12:45:13 ====reading 0 of (25396) bytes . Finished: 0 Debug: 05-18 12:45:13 ====reading 0 of (25396) bytes . Finished: 0 Warning: 05-18 12:45:13 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:46:18 translating from clipboard or selection Debug: 05-18 12:46:18 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/gd-mandarin_cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=~/.local/gd-mandarin/user.dic\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t~/.local/gd-mandarin \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tmecab -d . -Ogdmandarin\t --dicdir=\"$(find_dicdir)\"\t--userdic=\"${USER_DICT}\"\n\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
'\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
'\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 12:46:18 Current state: true false true true Debug: 05-18 12:46:18 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/gd-mandarin_cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D~/.local/gd-mandarin/user.dic FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_dicdir() %7B dirname -- %22$( find %5C ~/.local/gd-mandarin %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi mecab -d . -Ogdmandarin --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E .gd-mandarin %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mandarin a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mandarin a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mandarin a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mandarin%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:46:18 scheme: "gdlookup" Debug: 05-18 12:46:18 host: "localhost" Debug: 05-18 12:46:18 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/gd-mandarin_cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=~/.local/gd-mandarin/user.dic FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_dicdir() { dirname -- \"$( find \\ ~/.local/gd-mandarin \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi mecab -d . -Ogdmandarin --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
' print_css } main \"$@\"" Debug: 05-18 12:46:18 some body finished Debug: 05-18 12:46:18 one not finished. Debug: 05-18 12:46:18 ====reading 5345 of (5345) bytes . Finished: 0 Debug: 05-18 12:46:18 ====reading 0 of (5345) bytes . Finished: 0 Debug: 05-18 12:46:18 ====reading 0 of (5345) bytes . Finished: 0 Warning: 05-18 12:46:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:46:18 translating from clipboard or selection Debug: 05-18 12:46:18 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/gd-mandarin_cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=~/.local/gd-mandarin/user.dic\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t~/.local/gd-mandarin \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tmecab -d . -Ogdmandarin\t --dicdir=\"$(find_dicdir)\"\t--userdic=\"${USER_DICT}\"\n\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
'\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
'\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 12:46:18 Current state: true false true true Debug: 05-18 12:46:18 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/gd-mandarin_cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D~/.local/gd-mandarin/user.dic FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_dicdir() %7B dirname -- %22$( find %5C ~/.local/gd-mandarin %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi mecab -d . -Ogdmandarin --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E .gd-mandarin %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mandarin a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mandarin a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mandarin a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mandarin%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:46:18 scheme: "gdlookup" Debug: 05-18 12:46:18 host: "localhost" Debug: 05-18 12:46:18 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/gd-mandarin_cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=~/.local/gd-mandarin/user.dic FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_dicdir() { dirname -- \"$( find \\ ~/.local/gd-mandarin \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi mecab -d . -Ogdmandarin --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
' print_css } main \"$@\"" Debug: 05-18 12:46:18 some body finished Debug: 05-18 12:46:18 one not finished. Debug: 05-18 12:46:18 ====reading 5345 of (5345) bytes . Finished: 0 Debug: 05-18 12:46:18 ====reading 0 of (5345) bytes . Finished: 0 Debug: 05-18 12:46:18 ====reading 0 of (5345) bytes . Finished: 0 Warning: 05-18 12:46:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:46:18 translating from clipboard or selection Debug: 05-18 12:46:18 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/gd-mandarin_cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=~/.local/gd-mandarin/user.dic\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t~/.local/gd-mandarin \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tmecab -d . -Ogdmandarin\t --dicdir=\"$(find_dicdir)\"\t--userdic=\"${USER_DICT}\"\n\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
'\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
'\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 12:46:18 Current state: true false true true Debug: 05-18 12:46:18 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/gd-mandarin_cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D~/.local/gd-mandarin/user.dic FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_dicdir() %7B dirname -- %22$( find %5C ~/.local/gd-mandarin %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi mecab -d . -Ogdmandarin --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E .gd-mandarin %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mandarin a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mandarin a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mandarin a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mandarin%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:46:18 scheme: "gdlookup" Debug: 05-18 12:46:18 host: "localhost" Debug: 05-18 12:46:18 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/gd-mandarin_cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=~/.local/gd-mandarin/user.dic FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_dicdir() { dirname -- \"$( find \\ ~/.local/gd-mandarin \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi mecab -d . -Ogdmandarin --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
' print_css } main \"$@\"" Debug: 05-18 12:46:18 some body finished Debug: 05-18 12:46:18 one not finished. Debug: 05-18 12:46:18 ====reading 5345 of (5345) bytes . Finished: 0 Debug: 05-18 12:46:18 ====reading 0 of (5345) bytes . Finished: 0 Debug: 05-18 12:46:18 ====reading 0 of (5345) bytes . Finished: 0 Warning: 05-18 12:46:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:48:48 translating from clipboard or selection Debug: 05-18 12:48:48 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 12:48:48 Current state: true false true true Debug: 05-18 12:48:48 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:48:48 scheme: "gdlookup" Debug: 05-18 12:48:48 host: "localhost" Debug: 05-18 12:48:48 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 12:48:48 some body finished Debug: 05-18 12:48:48 one not finished. Debug: 05-18 12:48:48 ====reading 10997 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:48 ====reading 0 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:48 ====reading 0 of (10997) bytes . Finished: 0 Warning: 05-18 12:48:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:48:48 translating from clipboard or selection Debug: 05-18 12:48:48 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 12:48:48 Current state: true false true true Debug: 05-18 12:48:48 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:48:48 scheme: "gdlookup" Debug: 05-18 12:48:48 host: "localhost" Debug: 05-18 12:48:48 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 12:48:48 some body finished Debug: 05-18 12:48:48 one not finished. Debug: 05-18 12:48:48 ====reading 10997 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:48 ====reading 0 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:48 ====reading 0 of (10997) bytes . Finished: 0 Warning: 05-18 12:48:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:48:48 translating from clipboard or selection Debug: 05-18 12:48:48 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 12:48:48 Current state: true false true true Debug: 05-18 12:48:48 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:48:48 scheme: "gdlookup" Debug: 05-18 12:48:48 host: "localhost" Debug: 05-18 12:48:48 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 12:48:48 some body finished Debug: 05-18 12:48:48 one not finished. Debug: 05-18 12:48:48 ====reading 10997 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:48 ====reading 0 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:48 ====reading 0 of (10997) bytes . Finished: 0 Warning: 05-18 12:48:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:48:49 translating from clipboard or selection Debug: 05-18 12:48:49 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 12:48:49 Current state: true false true true Debug: 05-18 12:48:49 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:48:49 scheme: "gdlookup" Debug: 05-18 12:48:49 host: "localhost" Debug: 05-18 12:48:49 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 12:48:49 some body finished Debug: 05-18 12:48:49 one not finished. Debug: 05-18 12:48:49 ====reading 10997 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:49 ====reading 0 of (10997) bytes . Finished: 0 Debug: 05-18 12:48:49 ====reading 0 of (10997) bytes . Finished: 0 Warning: 05-18 12:48:49 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:51:37 translating from clipboard or selection Debug: 05-18 12:51:37 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += R\"(\n\n\n\n\n\n\n
\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 12:51:37 Current state: true false true true Debug: 05-18 12:51:37 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D R%22( %3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:51:37 scheme: "gdlookup" Debug: 05-18 12:51:37 host: "localhost" Debug: 05-18 12:51:37 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += R\"(
)\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 12:51:37 some body finished Debug: 05-18 12:51:37 one not finished. Debug: 05-18 12:51:37 ====reading 10778 of (10778) bytes . Finished: 0 Debug: 05-18 12:51:37 ====reading 0 of (10778) bytes . Finished: 0 Debug: 05-18 12:51:37 ====reading 0 of (10778) bytes . Finished: 0 Warning: 05-18 12:51:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:51:54 translating from clipboard or selection Debug: 05-18 12:51:54 clipboard data: "" Debug: 05-18 12:51:55 translating from clipboard or selection Debug: 05-18 12:51:55 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 12:51:55 Current state: true false true true Debug: 05-18 12:51:55 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:51:55 scheme: "gdlookup" Debug: 05-18 12:51:55 host: "localhost" Debug: 05-18 12:51:55 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 12:51:55 some body finished Debug: 05-18 12:51:55 one not finished. Debug: 05-18 12:51:55 ====reading 10997 of (10997) bytes . Finished: 0 Debug: 05-18 12:51:55 ====reading 0 of (10997) bytes . Finished: 0 Debug: 05-18 12:51:55 ====reading 0 of (10997) bytes . Finished: 0 Warning: 05-18 12:51:55 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:52:41 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:52:41 scheme: "gdlookup" Debug: 05-18 12:52:41 host: "localhost" Debug: 05-18 12:52:41 clear current dictionaries: "悔しい" Debug: 05-18 12:52:41 some body finished Debug: 05-18 12:52:41 one not finished. Debug: 05-18 12:52:41 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:52:41 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:52:41 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 12:52:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:52:42 translating from clipboard or selection Debug: 05-18 12:52:42 clipboard data: "悔しい" Debug: 05-18 12:52:42 Current state: true false true true Debug: 05-18 12:52:42 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:52:42 scheme: "gdlookup" Debug: 05-18 12:52:42 host: "localhost" Debug: 05-18 12:52:42 clear current dictionaries: "悔しい" Debug: 05-18 12:52:42 some body finished Debug: 05-18 12:52:42 one not finished. Debug: 05-18 12:52:42 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 12:52:42 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 12:52:42 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 12:52:42 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:52:54 translating from clipboard or selection Debug: 05-18 12:52:54 clipboard data: " align-content: start;\n justify-content: space-around;\n text-align: left;\n padding: 5px 0px;\n}\n.hakurei .alternatives > ul {\n list-style-type: none;\n margin: 0;\n padding: calc( var(--size) / 4);\n background-color: hsl(0 0% 50% / 0.05);\n box-shadow: 0 0 4px hsl(0 0% 0% / 0.1);\n border-radius: 0.2rem;\n}\n.hakurei .alternatives > ul > li {\n margin-right: 1rem;\n}\n.container {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n}\n.segment {\n display: inline-block;\n}\n\n\n\n" Debug: 05-18 12:52:54 Current state: true true false true Debug: 05-18 12:52:54 getResource: "gdlookup://localhost/?word=align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E %3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:悔しい%22%3E悔しい%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cdiv class%3D%22segment%22%3Eい%3C/div%3E%3C/div%3E%3C/div%3E%3C/body%3E%3C/html%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:52:54 scheme: "gdlookup" Debug: 05-18 12:52:54 host: "localhost" Debug: 05-18 12:52:54 clear current dictionaries: "align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; } .hakurei .alternatives > ul { list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0% 50% / 0.05); box-shadow: 0 0 4px hsl(0 0% 0% / 0.1); border-radius: 0.2rem; } .hakurei .alternatives > ul > li { margin-right: 1rem; } .container { display: flex; flex-wrap: wrap; gap: 10px; } .segment { display: inline-block; } " Debug: 05-18 12:52:54 some body finished Debug: 05-18 12:52:54 one not finished. Debug: 05-18 12:52:54 ====reading 2449 of (2449) bytes . Finished: 0 Debug: 05-18 12:52:54 ====reading 0 of (2449) bytes . Finished: 0 Debug: 05-18 12:52:54 ====reading 0 of (2449) bytes . Finished: 0 Warning: 05-18 12:52:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:52:58 translating from clipboard or selection Debug: 05-18 12:52:58 clipboard data: "\n\n\n\n\n\n" Debug: 05-18 12:52:58 Current state: true false false true Debug: 05-18 12:52:58 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E %3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:悔しい%22%3E悔しい%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cdiv class%3D%22segment%22%3Eい%3C/div%3E%3C/div%3E%3C/div%3E%3C/body%3E%3C/html%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:52:58 scheme: "gdlookup" Debug: 05-18 12:52:58 host: "localhost" Debug: 05-18 12:52:58 clear current dictionaries: " " Debug: 05-18 12:52:58 some body finished Debug: 05-18 12:52:58 one not finished. Debug: 05-18 12:52:58 ====reading 3197 of (3197) bytes . Finished: 0 Debug: 05-18 12:52:58 ====reading 0 of (3197) bytes . Finished: 0 Debug: 05-18 12:52:58 ====reading 0 of (3197) bytes . Finished: 0 Warning: 05-18 12:52:58 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:52:59 translating from clipboard or selection Debug: 05-18 12:52:59 clipboard data: "\n\n\n\n\n\n" Debug: 05-18 12:52:59 Current state: true false true true Debug: 05-18 12:52:59 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E %3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:悔しい%22%3E悔しい%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cdiv class%3D%22segment%22%3Eい%3C/div%3E%3C/div%3E%3C/div%3E%3C/body%3E%3C/html%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:52:59 scheme: "gdlookup" Debug: 05-18 12:52:59 host: "localhost" Debug: 05-18 12:52:59 clear current dictionaries: " " Debug: 05-18 12:52:59 some body finished Debug: 05-18 12:52:59 one not finished. Debug: 05-18 12:52:59 ====reading 3197 of (3197) bytes . Finished: 0 Debug: 05-18 12:52:59 ====reading 0 of (3197) bytes . Finished: 0 Debug: 05-18 12:52:59 ====reading 0 of (3197) bytes . Finished: 0 Warning: 05-18 12:52:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:52:59 translating from clipboard or selection Debug: 05-18 12:52:59 clipboard data: "\n\n\n\n\n\n" Debug: 05-18 12:52:59 Current state: true false true true Debug: 05-18 12:52:59 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E %3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:悔し%22%3E悔し%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:悔しい%22%3E悔しい%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cdiv class%3D%22segment%22%3Eい%3C/div%3E%3C/div%3E%3C/div%3E%3C/body%3E%3C/html%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:52:59 scheme: "gdlookup" Debug: 05-18 12:52:59 host: "localhost" Debug: 05-18 12:52:59 clear current dictionaries: " " Debug: 05-18 12:52:59 some body finished Debug: 05-18 12:52:59 one not finished. Debug: 05-18 12:52:59 ====reading 3197 of (3197) bytes . Finished: 0 Debug: 05-18 12:52:59 ====reading 0 of (3197) bytes . Finished: 0 Debug: 05-18 12:52:59 ====reading 0 of (3197) bytes . Finished: 0 Warning: 05-18 12:52:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:54:38 translating from clipboard or selection Debug: 05-18 12:54:38 clipboard data: "I apologize for not addressing all your requirements. Here's a revised version that:\n\n Provides the CSS only at the end as a raw const string.\n Uses only div tags and a tags.\n Maintains the full functionality without removing features.\n\nHere's the updated code:\n\ncpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n.hakurei {\n font-size: 2rem;\n margin-bottom: 0.05em;\n margin-top: -0.2em;\n color: #1268c3;\n font-weight: normal;\n}\n.hakurei a {\n display: inline-block;\n font-weight: normal;\n color: royalblue;\n text-decoration: none;\n border-bottom: dashed max(1px, calc(1em / 16)) currentColor;\n}\n.hakurei a.hakurei-headword {\n background-color: #ddeeff;\n border-radius: 0.2rem;\n font-weight: 500;\n}\n.hakurei > ul {\n --size: 1rem;\n font-size: var(--size);\n padding-inline-start: var(--size);\n margin-block: 2px;\n}\n.hakurei .alternatives {\n --size: 1rem;\n display: grid;\n font-size: var(--size);\n gap: calc( var(--size) / 4);\n max-width: 100%;\n margin: 0 auto;\n grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));\n align-content: start;\n justify-content: space-around;\n text-align: left;\n padding: 5px 0px;\n}\n.hakurei .alternatives > ul {\n list-style-type: none;\n margin: 0;\n padding: calc( var(--size) / 4);\n background-color: hsl(0 0% 50% / 0.05);\n box-shadow: 0 0 4px hsl(0 0% 0% / 0.1);\n border-radius: 0.2rem;\n}\n.hakurei .alternatives > ul > li {\n margin-right: 1rem;\n}\n.container {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n}\n.segment {\n display: inline-block;\n}\n)\";\n\n output_html += \"
\";\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n\n // Output the CSS\n std::cout << \"\";\n // Output the HTML\n std::cout << output_html << std::endl;\n}" Debug: 05-18 12:54:38 Current state: true false true true Debug: 05-18 12:54:38 getResource: "gdlookup://localhost/?word=I apologize for not addressing all your requirements. Here%27s a revised version that: Provides the CSS only at the end as a raw const string. Uses only div tags and a tags. Maintains the full functionality without removing features. Here%27s the updated code: cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D )%22; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; // Output the CSS std::cout %3C%3C %22%3Cstyle%3E%22 %3C%3C css %3C%3C %22%3C/style%3E%22; // Output the HTML std::cout %3C%3C output_html %3C%3C std::endl; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:54:38 scheme: "gdlookup" Debug: 05-18 12:54:38 host: "localhost" Debug: 05-18 12:54:38 clear current dictionaries: "I apologize for not addressing all your requirements. Here's a revised version that: Provides the CSS only at the end as a raw const string. Uses only div tags and a tags. Maintains the full functionality without removing features. Here's the updated code: cpp #include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( .hakurei { font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: #1268c3; font-weight: normal; } .hakurei a { display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; } .hakurei a.hakurei-headword { background-color: #ddeeff; border-radius: 0.2rem; font-weight: 500; } .hakurei > ul { --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; } .hakurei .alternatives { --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; } .hakurei .alternatives > ul { list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0% 50% / 0.05); box-shadow: 0 0 4px hsl(0 0% 0% / 0.1); border-radius: 0.2rem; } .hakurei .alternatives > ul > li { margin-right: 1rem; } .container { display: flex; flex-wrap: wrap; gap: 10px; } .segment { display: inline-block; } )\"; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; // Output the CSS std::cout << \"\"; // Output the HTML std::cout << output_html << std::endl; }" Debug: 05-18 12:54:38 some body finished Debug: 05-18 12:54:38 one not finished. Debug: 05-18 12:54:38 ====reading 8210 of (8210) bytes . Finished: 0 Debug: 05-18 12:54:38 ====reading 0 of (8210) bytes . Finished: 0 Debug: 05-18 12:54:38 ====reading 0 of (8210) bytes . Finished: 0 Warning: 05-18 12:54:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:54:39 translating from clipboard or selection Debug: 05-18 12:54:39 clipboard data: " // Output the CSS\n std::cout << \"\";\n // Output the HTML\n std::cout << output_html << std::endl;\n}\n" Debug: 05-18 12:54:39 Current state: true false true true Debug: 05-18 12:54:39 getResource: "gdlookup://localhost/?word=// Output the CSS std::cout %3C%3C %22%3Cstyle%3E%22 %3C%3C css %3C%3C %22%3C/style%3E%22; // Output the HTML std::cout %3C%3C output_html %3C%3C std::endl; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:54:39 scheme: "gdlookup" Debug: 05-18 12:54:39 host: "localhost" Debug: 05-18 12:54:39 clear current dictionaries: "// Output the CSS std::cout << \"\"; // Output the HTML std::cout << output_html << std::endl; }" Debug: 05-18 12:54:39 some body finished Debug: 05-18 12:54:39 one not finished. Debug: 05-18 12:54:39 ====reading 1587 of (1587) bytes . Finished: 0 Debug: 05-18 12:54:39 ====reading 0 of (1587) bytes . Finished: 0 Debug: 05-18 12:54:39 ====reading 0 of (1587) bytes . Finished: 0 Warning: 05-18 12:54:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:54:39 translating from clipboard or selection Debug: 05-18 12:54:39 clipboard data: " // Output the CSS\n std::cout << \"\";\n // Output the HTML\n std::cout << output_html << std::endl;\n}\n" Debug: 05-18 12:54:39 Current state: true false true true Debug: 05-18 12:54:39 getResource: "gdlookup://localhost/?word=// Output the CSS std::cout %3C%3C %22%3Cstyle%3E%22 %3C%3C css %3C%3C %22%3C/style%3E%22; // Output the HTML std::cout %3C%3C output_html %3C%3C std::endl; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:54:39 scheme: "gdlookup" Debug: 05-18 12:54:39 host: "localhost" Debug: 05-18 12:54:39 clear current dictionaries: "// Output the CSS std::cout << \"\"; // Output the HTML std::cout << output_html << std::endl; }" Debug: 05-18 12:54:39 some body finished Debug: 05-18 12:54:39 one not finished. Debug: 05-18 12:54:39 ====reading 1587 of (1587) bytes . Finished: 0 Debug: 05-18 12:54:39 ====reading 0 of (1587) bytes . Finished: 0 Debug: 05-18 12:54:39 ====reading 0 of (1587) bytes . Finished: 0 Warning: 05-18 12:54:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 12:59:22 translating from clipboard or selection Debug: 05-18 12:59:22 clipboard data: "it's likely that we" Debug: 05-18 12:59:22 Current state: true false true true Debug: 05-18 12:59:22 getResource: "gdlookup://localhost/?word=it%27s likely that we&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 12:59:22 scheme: "gdlookup" Debug: 05-18 12:59:22 host: "localhost" Debug: 05-18 12:59:22 clear current dictionaries: "it's likely that we" Debug: 05-18 12:59:22 some body finished Debug: 05-18 12:59:22 one not finished. Debug: 05-18 12:59:22 ====reading 1422 of (1422) bytes . Finished: 0 Debug: 05-18 12:59:22 ====reading 0 of (1422) bytes . Finished: 0 Debug: 05-18 12:59:22 ====reading 0 of (1422) bytes . Finished: 0 Warning: 05-18 12:59:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:00:18 translating from clipboard or selection Debug: 05-18 13:00:18 clipboard data: "examine the bash script that i've sent earlier and debug to see each step of it and why it doens't enter in a loop" Debug: 05-18 13:00:18 Current state: true false true true Debug: 05-18 13:00:18 getResource: "gdlookup://localhost/?word=examine the bash script that i%27ve sent earlier and debug to see each step of it and why it doens%27t enter in a loop&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:00:18 scheme: "gdlookup" Debug: 05-18 13:00:18 host: "localhost" Debug: 05-18 13:00:18 clear current dictionaries: "examine the bash script that i've sent earlier and debug to see each step of it and why it doens't enter in a loop" Debug: 05-18 13:00:18 some body finished Debug: 05-18 13:00:18 one not finished. Debug: 05-18 13:00:18 ====reading 1517 of (1517) bytes . Finished: 0 Debug: 05-18 13:00:18 ====reading 0 of (1517) bytes . Finished: 0 Debug: 05-18 13:00:18 ====reading 0 of (1517) bytes . Finished: 0 Warning: 05-18 13:00:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:00:20 translating from clipboard or selection Debug: 05-18 13:00:20 clipboard data: "examine the bash script that i've sent earlier and debug to see each step of it and why it doens't enter in a loop" Debug: 05-18 13:00:20 Current state: true false true true Debug: 05-18 13:00:20 getResource: "gdlookup://localhost/?word=examine the bash script that i%27ve sent earlier and debug to see each step of it and why it doens%27t enter in a loop&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:00:20 scheme: "gdlookup" Debug: 05-18 13:00:20 host: "localhost" Debug: 05-18 13:00:20 clear current dictionaries: "examine the bash script that i've sent earlier and debug to see each step of it and why it doens't enter in a loop" Debug: 05-18 13:00:20 some body finished Debug: 05-18 13:00:20 one not finished. Debug: 05-18 13:00:20 ====reading 1517 of (1517) bytes . Finished: 0 Debug: 05-18 13:00:20 ====reading 0 of (1517) bytes . Finished: 0 Debug: 05-18 13:00:20 ====reading 0 of (1517) bytes . Finished: 0 Warning: 05-18 13:00:20 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:00:47 translating from clipboard or selection Debug: 05-18 13:00:47 clipboard data: " that i've sent earlier" Debug: 05-18 13:00:47 Current state: true false true true Debug: 05-18 13:00:47 getResource: "gdlookup://localhost/?word=that i%27ve sent earlier&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:00:47 scheme: "gdlookup" Debug: 05-18 13:00:47 host: "localhost" Debug: 05-18 13:00:47 clear current dictionaries: "that i've sent earlier" Debug: 05-18 13:00:47 some body finished Debug: 05-18 13:00:47 one not finished. Debug: 05-18 13:00:47 ====reading 1425 of (1425) bytes . Finished: 0 Debug: 05-18 13:00:47 ====reading 0 of (1425) bytes . Finished: 0 Debug: 05-18 13:00:47 ====reading 0 of (1425) bytes . Finished: 0 Warning: 05-18 13:00:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:00:49 translating from clipboard or selection Debug: 05-18 13:00:49 clipboard data: "examine the bash script and debug to see each step of it and why it doens't enter in a loop" Debug: 05-18 13:00:49 Current state: true false true true Debug: 05-18 13:00:49 getResource: "gdlookup://localhost/?word=examine the bash script and debug to see each step of it and why it doens%27t enter in a loop&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:00:49 scheme: "gdlookup" Debug: 05-18 13:00:49 host: "localhost" Debug: 05-18 13:00:49 clear current dictionaries: "examine the bash script and debug to see each step of it and why it doens't enter in a loop" Debug: 05-18 13:00:49 some body finished Debug: 05-18 13:00:49 one not finished. Debug: 05-18 13:00:49 ====reading 1494 of (1494) bytes . Finished: 0 Debug: 05-18 13:00:49 ====reading 0 of (1494) bytes . Finished: 0 Debug: 05-18 13:00:49 ====reading 0 of (1494) bytes . Finished: 0 Warning: 05-18 13:00:49 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:01:05 translating from clipboard or selection Debug: 05-18 13:01:05 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/mecab-cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=\"\"\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_user_dict() {\n\tfind \\\n\t\t\"$USER_DICT\" \\\n\t\t/usr/share/gd-tools/user_dic.dic \\\n\t\t~/.local/share/gd-tools/user_dic.dic \\\n\t\t-type f -print -quit 2>/dev/null\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t/usr/lib/mecab/dic/mecab-ipadic-neologd \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit 2>/dev/null\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tlocal -r user_dict=$(find_user_dict)\n\tlocal -a args=(\n\t\tmecab\n\t\t--node-format='%m'\n\t\t--unk-format='%m'\n\t\t--eos-format='
'\n\t\t--dicdir=\"$(find_dicdir)\"\n\t\t--userdic=\"${USER_DICT}\"\n\t)\n\tif [[ -n $user_dict ]]; then\n\t\targs+=(\"$user_dict\")\n\tfi\n\t\"${args[@]}\"\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
'\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
'\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 13:01:05 Current state: true false true true Debug: 05-18 13:01:05 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/mecab-cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D%22%22 FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_user_dict() %7B find %5C %22$USER_DICT%22 %5C /usr/share/gd-tools/user_dic.dic %5C ~/.local/share/gd-tools/user_dic.dic %5C -type f -print -quit 2%3E/dev/null %7D find_dicdir() %7B dirname -- %22$( find %5C /usr/lib/mecab/dic/mecab-ipadic-neologd %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit 2%3E/dev/null )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi local -r user_dict%3D$(find_user_dict) local -a args%3D( mecab --node-format%3D%27%3Ca href%3D%22bword:%25f[6]%22%3E%25m%3C/a%3E%27 --unk-format%3D%27%3Ca href%3D%22bword:%25m%22%3E%25m%3C/a%3E%27 --eos-format%3D%27%3Cbr%3E%27 --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 ) if [[ -n $user_dict ]]; then args+%3D(%22$user_dict%22) fi %22$%7Bargs[@]%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E * %7B margin: 0; padding: 0; %7D .gd-mecab %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mecab a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mecab a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mecab a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if [[ -n $USER_DICT ]] %26%26 ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mecab%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:01:05 scheme: "gdlookup" Debug: 05-18 13:01:05 host: "localhost" Debug: 05-18 13:01:05 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/mecab-cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=\"\" FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_user_dict() { find \\ \"$USER_DICT\" \\ /usr/share/gd-tools/user_dic.dic \\ ~/.local/share/gd-tools/user_dic.dic \\ -type f -print -quit 2>/dev/null } find_dicdir() { dirname -- \"$( find \\ /usr/lib/mecab/dic/mecab-ipadic-neologd \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit 2>/dev/null )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi local -r user_dict=$(find_user_dict) local -a args=( mecab --node-format='%m' --unk-format='%m' --eos-format='
' --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" ) if [[ -n $user_dict ]]; then args+=(\"$user_dict\") fi \"${args[@]}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
' print_css } main \"$@\"" Debug: 05-18 13:01:05 some body finished Debug: 05-18 13:01:05 one not finished. Debug: 05-18 13:01:05 ====reading 5843 of (5843) bytes . Finished: 0 Debug: 05-18 13:01:05 ====reading 0 of (5843) bytes . Finished: 0 Debug: 05-18 13:01:05 ====reading 0 of (5843) bytes . Finished: 0 Warning: 05-18 13:01:05 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:01:05 translating from clipboard or selection Debug: 05-18 13:01:05 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/mecab-cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=\"\"\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_user_dict() {\n\tfind \\\n\t\t\"$USER_DICT\" \\\n\t\t/usr/share/gd-tools/user_dic.dic \\\n\t\t~/.local/share/gd-tools/user_dic.dic \\\n\t\t-type f -print -quit 2>/dev/null\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t/usr/lib/mecab/dic/mecab-ipadic-neologd \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit 2>/dev/null\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tlocal -r user_dict=$(find_user_dict)\n\tlocal -a args=(\n\t\tmecab\n\t\t--node-format='%m'\n\t\t--unk-format='%m'\n\t\t--eos-format='
'\n\t\t--dicdir=\"$(find_dicdir)\"\n\t\t--userdic=\"${USER_DICT}\"\n\t)\n\tif [[ -n $user_dict ]]; then\n\t\targs+=(\"$user_dict\")\n\tfi\n\t\"${args[@]}\"\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
'\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
'\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 13:01:05 Current state: true false true true Debug: 05-18 13:01:05 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/mecab-cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D%22%22 FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_user_dict() %7B find %5C %22$USER_DICT%22 %5C /usr/share/gd-tools/user_dic.dic %5C ~/.local/share/gd-tools/user_dic.dic %5C -type f -print -quit 2%3E/dev/null %7D find_dicdir() %7B dirname -- %22$( find %5C /usr/lib/mecab/dic/mecab-ipadic-neologd %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit 2%3E/dev/null )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi local -r user_dict%3D$(find_user_dict) local -a args%3D( mecab --node-format%3D%27%3Ca href%3D%22bword:%25f[6]%22%3E%25m%3C/a%3E%27 --unk-format%3D%27%3Ca href%3D%22bword:%25m%22%3E%25m%3C/a%3E%27 --eos-format%3D%27%3Cbr%3E%27 --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 ) if [[ -n $user_dict ]]; then args+%3D(%22$user_dict%22) fi %22$%7Bargs[@]%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E * %7B margin: 0; padding: 0; %7D .gd-mecab %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mecab a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mecab a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mecab a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if [[ -n $USER_DICT ]] %26%26 ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mecab%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:01:05 scheme: "gdlookup" Debug: 05-18 13:01:05 host: "localhost" Debug: 05-18 13:01:05 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/mecab-cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=\"\" FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_user_dict() { find \\ \"$USER_DICT\" \\ /usr/share/gd-tools/user_dic.dic \\ ~/.local/share/gd-tools/user_dic.dic \\ -type f -print -quit 2>/dev/null } find_dicdir() { dirname -- \"$( find \\ /usr/lib/mecab/dic/mecab-ipadic-neologd \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit 2>/dev/null )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi local -r user_dict=$(find_user_dict) local -a args=( mecab --node-format='%m' --unk-format='%m' --eos-format='
' --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" ) if [[ -n $user_dict ]]; then args+=(\"$user_dict\") fi \"${args[@]}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
' print_css } main \"$@\"" Debug: 05-18 13:01:05 some body finished Debug: 05-18 13:01:05 one not finished. Debug: 05-18 13:01:05 ====reading 5843 of (5843) bytes . Finished: 0 Debug: 05-18 13:01:05 ====reading 0 of (5843) bytes . Finished: 0 Debug: 05-18 13:01:05 ====reading 0 of (5843) bytes . Finished: 0 Warning: 05-18 13:01:05 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:01:05 translating from clipboard or selection Debug: 05-18 13:01:05 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/mecab-cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=\"\"\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_user_dict() {\n\tfind \\\n\t\t\"$USER_DICT\" \\\n\t\t/usr/share/gd-tools/user_dic.dic \\\n\t\t~/.local/share/gd-tools/user_dic.dic \\\n\t\t-type f -print -quit 2>/dev/null\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t/usr/lib/mecab/dic/mecab-ipadic-neologd \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit 2>/dev/null\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tlocal -r user_dict=$(find_user_dict)\n\tlocal -a args=(\n\t\tmecab\n\t\t--node-format='%m'\n\t\t--unk-format='%m'\n\t\t--eos-format='
'\n\t\t--dicdir=\"$(find_dicdir)\"\n\t\t--userdic=\"${USER_DICT}\"\n\t)\n\tif [[ -n $user_dict ]]; then\n\t\targs+=(\"$user_dict\")\n\tfi\n\t\"${args[@]}\"\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
'\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
'\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 13:01:05 Current state: true false true true Debug: 05-18 13:01:05 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/mecab-cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D%22%22 FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_user_dict() %7B find %5C %22$USER_DICT%22 %5C /usr/share/gd-tools/user_dic.dic %5C ~/.local/share/gd-tools/user_dic.dic %5C -type f -print -quit 2%3E/dev/null %7D find_dicdir() %7B dirname -- %22$( find %5C /usr/lib/mecab/dic/mecab-ipadic-neologd %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit 2%3E/dev/null )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi local -r user_dict%3D$(find_user_dict) local -a args%3D( mecab --node-format%3D%27%3Ca href%3D%22bword:%25f[6]%22%3E%25m%3C/a%3E%27 --unk-format%3D%27%3Ca href%3D%22bword:%25m%22%3E%25m%3C/a%3E%27 --eos-format%3D%27%3Cbr%3E%27 --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 ) if [[ -n $user_dict ]]; then args+%3D(%22$user_dict%22) fi %22$%7Bargs[@]%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E * %7B margin: 0; padding: 0; %7D .gd-mecab %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mecab a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mecab a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mecab a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if [[ -n $USER_DICT ]] %26%26 ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mecab%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:01:05 scheme: "gdlookup" Debug: 05-18 13:01:05 host: "localhost" Debug: 05-18 13:01:05 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/mecab-cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=\"\" FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_user_dict() { find \\ \"$USER_DICT\" \\ /usr/share/gd-tools/user_dic.dic \\ ~/.local/share/gd-tools/user_dic.dic \\ -type f -print -quit 2>/dev/null } find_dicdir() { dirname -- \"$( find \\ /usr/lib/mecab/dic/mecab-ipadic-neologd \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit 2>/dev/null )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi local -r user_dict=$(find_user_dict) local -a args=( mecab --node-format='%m' --unk-format='%m' --eos-format='
' --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" ) if [[ -n $user_dict ]]; then args+=(\"$user_dict\") fi \"${args[@]}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
' print_css } main \"$@\"" Debug: 05-18 13:01:05 some body finished Debug: 05-18 13:01:05 one not finished. Debug: 05-18 13:01:05 ====reading 5843 of (5843) bytes . Finished: 0 Debug: 05-18 13:01:05 ====reading 0 of (5843) bytes . Finished: 0 Debug: 05-18 13:01:05 ====reading 0 of (5843) bytes . Finished: 0 Warning: 05-18 13:01:05 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:01:59 translating from clipboard or selection Debug: 05-18 13:01:59 clipboard data: "highlight_word(): Highlights the target word in the HTML output." Debug: 05-18 13:01:59 Current state: true false true true Debug: 05-18 13:01:59 getResource: "gdlookup://localhost/?word=highlight_word(): Highlights the target word in the HTML output.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:01:59 scheme: "gdlookup" Debug: 05-18 13:01:59 host: "localhost" Debug: 05-18 13:01:59 clear current dictionaries: "highlight_word(): Highlights the target word in the HTML output." Debug: 05-18 13:01:59 some body finished Debug: 05-18 13:01:59 one not finished. Debug: 05-18 13:01:59 ====reading 1467 of (1467) bytes . Finished: 0 Debug: 05-18 13:01:59 ====reading 0 of (1467) bytes . Finished: 0 Debug: 05-18 13:01:59 ====reading 0 of (1467) bytes . Finished: 0 Warning: 05-18 13:01:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:02:00 translating from clipboard or selection Debug: 05-18 13:02:00 clipboard data: "highlight_word(): Highlights the target word in the HTML output." Debug: 05-18 13:02:00 Current state: true false true true Debug: 05-18 13:02:00 getResource: "gdlookup://localhost/?word=highlight_word(): Highlights the target word in the HTML output.&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:02:00 scheme: "gdlookup" Debug: 05-18 13:02:00 host: "localhost" Debug: 05-18 13:02:00 clear current dictionaries: "highlight_word(): Highlights the target word in the HTML output." Debug: 05-18 13:02:00 some body finished Debug: 05-18 13:02:00 one not finished. Debug: 05-18 13:02:00 ====reading 1467 of (1467) bytes . Finished: 0 Debug: 05-18 13:02:00 ====reading 0 of (1467) bytes . Finished: 0 Debug: 05-18 13:02:00 ====reading 0 of (1467) bytes . Finished: 0 Warning: 05-18 13:02:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:33:07 translating from clipboard or selection Debug: 05-18 13:33:07 clipboard data: "se for " Debug: 05-18 13:33:07 Current state: true false true true Debug: 05-18 13:33:07 getResource: "gdlookup://localhost/?word=se for&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:33:07 scheme: "gdlookup" Debug: 05-18 13:33:07 host: "localhost" Debug: 05-18 13:33:07 clear current dictionaries: "se for" Debug: 05-18 13:33:07 some body finished Debug: 05-18 13:33:07 one not finished. Debug: 05-18 13:33:07 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 13:33:07 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 13:33:07 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 13:33:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 13:35:06 translating from clipboard or selection Debug: 05-18 13:35:06 clipboard data: "ehh sim" Debug: 05-18 13:35:06 Current state: true false true true Debug: 05-18 13:35:06 getResource: "gdlookup://localhost/?word=ehh sim&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 13:35:06 scheme: "gdlookup" Debug: 05-18 13:35:06 host: "localhost" Debug: 05-18 13:35:06 clear current dictionaries: "ehh sim" Debug: 05-18 13:35:06 some body finished Debug: 05-18 13:35:06 one not finished. Debug: 05-18 13:35:06 ====reading 1410 of (1410) bytes . Finished: 0 Debug: 05-18 13:35:06 ====reading 0 of (1410) bytes . Finished: 0 Debug: 05-18 13:35:06 ====reading 0 of (1410) bytes . Finished: 0 Warning: 05-18 13:35:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:21:04 translating from clipboard or selection Debug: 05-18 14:21:04 clipboard data: "hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:04 Current state: true false true true Debug: 05-18 14:21:04 getResource: "gdlookup://localhost/?word=hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:21:04 scheme: "gdlookup" Debug: 05-18 14:21:04 host: "localhost" Debug: 05-18 14:21:04 clear current dictionaries: "hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:04 some body finished Debug: 05-18 14:21:04 one not finished. Debug: 05-18 14:21:04 ====reading 1453 of (1453) bytes . Finished: 0 Debug: 05-18 14:21:04 ====reading 0 of (1453) bytes . Finished: 0 Debug: 05-18 14:21:04 ====reading 0 of (1453) bytes . Finished: 0 Warning: 05-18 14:21:04 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:21:04 translating from clipboard or selection Debug: 05-18 14:21:04 clipboard data: "hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:04 Current state: true false true true Debug: 05-18 14:21:04 getResource: "gdlookup://localhost/?word=hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:21:04 scheme: "gdlookup" Debug: 05-18 14:21:04 host: "localhost" Debug: 05-18 14:21:04 clear current dictionaries: "hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:04 some body finished Debug: 05-18 14:21:04 one not finished. Debug: 05-18 14:21:04 ====reading 1453 of (1453) bytes . Finished: 0 Debug: 05-18 14:21:04 ====reading 0 of (1453) bytes . Finished: 0 Debug: 05-18 14:21:04 ====reading 0 of (1453) bytes . Finished: 0 Warning: 05-18 14:21:04 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:21:04 translating from clipboard or selection Debug: 05-18 14:21:04 clipboard data: "hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:04 Current state: true false true true Debug: 05-18 14:21:04 getResource: "gdlookup://localhost/?word=hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:21:04 scheme: "gdlookup" Debug: 05-18 14:21:04 host: "localhost" Debug: 05-18 14:21:04 clear current dictionaries: "hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:04 some body finished Debug: 05-18 14:21:04 one not finished. Debug: 05-18 14:21:04 ====reading 1453 of (1453) bytes . Finished: 0 Debug: 05-18 14:21:04 ====reading 0 of (1453) bytes . Finished: 0 Debug: 05-18 14:21:04 ====reading 0 of (1453) bytes . Finished: 0 Warning: 05-18 14:21:05 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:21:06 translating from clipboard or selection Debug: 05-18 14:21:06 clipboard data: "ajattix.loophole.site/hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:06 Current state: true false true true Debug: 05-18 14:21:06 getResource: "gdlookup://localhost/?word=ajattix.loophole.site/hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:21:06 scheme: "gdlookup" Debug: 05-18 14:21:06 host: "localhost" Debug: 05-18 14:21:06 clear current dictionaries: "ajattix.loophole.site/hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:06 some body finished Debug: 05-18 14:21:06 one not finished. Debug: 05-18 14:21:06 ====reading 1475 of (1475) bytes . Finished: 0 Debug: 05-18 14:21:06 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-18 14:21:06 ====reading 0 of (1475) bytes . Finished: 0 Warning: 05-18 14:21:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:21:07 translating from clipboard or selection Debug: 05-18 14:21:07 clipboard data: "ajattix.loophole.site/hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:07 Current state: true false true true Debug: 05-18 14:21:07 getResource: "gdlookup://localhost/?word=ajattix.loophole.site/hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:21:07 scheme: "gdlookup" Debug: 05-18 14:21:07 host: "localhost" Debug: 05-18 14:21:07 clear current dictionaries: "ajattix.loophole.site/hashirama/gd-tools/raw/branch/main/src/gd-mecab.sh" Debug: 05-18 14:21:07 some body finished Debug: 05-18 14:21:07 one not finished. Debug: 05-18 14:21:07 ====reading 1475 of (1475) bytes . Finished: 0 Debug: 05-18 14:21:07 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-18 14:21:07 ====reading 0 of (1475) bytes . Finished: 0 Warning: 05-18 14:21:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:21:24 translating from clipboard or selection Debug: 05-18 14:21:24 clipboard data: "nice" Debug: 05-18 14:21:24 Current state: true false true true Debug: 05-18 14:21:24 getResource: "gdlookup://localhost/?word=nice&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:21:24 scheme: "gdlookup" Debug: 05-18 14:21:24 host: "localhost" Debug: 05-18 14:21:24 clear current dictionaries: "nice" Debug: 05-18 14:21:24 some body finished Debug: 05-18 14:21:24 one not finished. Debug: 05-18 14:21:24 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 14:21:24 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 14:21:24 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 14:21:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:53:36 translating from clipboard or selection Debug: 05-18 14:53:36 clipboard data: "debug " Debug: 05-18 14:53:36 Current state: true true false true Debug: 05-18 14:53:36 getResource: "gdlookup://localhost/?word=debug&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:53:36 scheme: "gdlookup" Debug: 05-18 14:53:36 host: "localhost" Debug: 05-18 14:53:36 clear current dictionaries: "debug" Debug: 05-18 14:53:36 some body finished Debug: 05-18 14:53:36 one not finished. Debug: 05-18 14:53:36 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 14:53:36 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 14:53:36 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 14:53:36 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:54:13 translating from clipboard or selection Debug: 05-18 14:54:13 clipboard data: "debug " Debug: 05-18 14:54:13 Current state: true false false true Debug: 05-18 14:54:13 getResource: "gdlookup://localhost/?word=debug&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:54:13 scheme: "gdlookup" Debug: 05-18 14:54:13 host: "localhost" Debug: 05-18 14:54:13 clear current dictionaries: "debug" Debug: 05-18 14:54:13 some body finished Debug: 05-18 14:54:13 one not finished. Debug: 05-18 14:54:13 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 14:54:13 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 14:54:13 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 14:54:13 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:54:18 translating from clipboard or selection Debug: 05-18 14:54:18 clipboard data: "debug " Debug: 05-18 14:54:18 Current state: true false true true Debug: 05-18 14:54:18 getResource: "gdlookup://localhost/?word=debug&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:54:18 scheme: "gdlookup" Debug: 05-18 14:54:18 host: "localhost" Debug: 05-18 14:54:18 clear current dictionaries: "debug" Debug: 05-18 14:54:18 some body finished Debug: 05-18 14:54:18 one not finished. Debug: 05-18 14:54:18 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 14:54:18 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 14:54:18 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 14:54:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:54:19 translating from clipboard or selection Debug: 05-18 14:54:19 clipboard data: "debug " Debug: 05-18 14:54:19 Current state: true false true true Debug: 05-18 14:54:19 getResource: "gdlookup://localhost/?word=debug&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:54:19 scheme: "gdlookup" Debug: 05-18 14:54:19 host: "localhost" Debug: 05-18 14:54:19 clear current dictionaries: "debug" Debug: 05-18 14:54:19 some body finished Debug: 05-18 14:54:19 one not finished. Debug: 05-18 14:54:19 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 14:54:19 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 14:54:19 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 14:54:19 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:55:20 translating from clipboard or selection Debug: 05-18 14:55:20 clipboard data: "" Debug: 05-18 14:55:49 translating from clipboard or selection Debug: 05-18 14:55:49 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += R\"(\n\n\n\n\n\n\n
\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 14:55:49 Current state: true false true true Debug: 05-18 14:55:49 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D R%22( %3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:55:49 scheme: "gdlookup" Debug: 05-18 14:55:49 host: "localhost" Debug: 05-18 14:55:49 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += R\"(
)\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 14:55:49 some body finished Debug: 05-18 14:55:49 one not finished. Debug: 05-18 14:55:49 ====reading 10778 of (10778) bytes . Finished: 0 Debug: 05-18 14:55:49 ====reading 0 of (10778) bytes . Finished: 0 Debug: 05-18 14:55:49 ====reading 0 of (10778) bytes . Finished: 0 Warning: 05-18 14:55:49 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:55:50 translating from clipboard or selection Debug: 05-18 14:55:50 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += R\"(\n\n\n\n\n\n\n
\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 14:55:50 Current state: true false true true Debug: 05-18 14:55:50 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D R%22( %3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:55:50 scheme: "gdlookup" Debug: 05-18 14:55:50 host: "localhost" Debug: 05-18 14:55:50 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += R\"(
)\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 14:55:50 some body finished Debug: 05-18 14:55:50 one not finished. Debug: 05-18 14:55:50 ====reading 10778 of (10778) bytes . Finished: 0 Debug: 05-18 14:55:50 ====reading 0 of (10778) bytes . Finished: 0 Debug: 05-18 14:55:50 ====reading 0 of (10778) bytes . Finished: 0 Warning: 05-18 14:55:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:55:50 translating from clipboard or selection Debug: 05-18 14:55:50 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += R\"(\n\n\n\n\n\n\n
\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 14:55:50 Current state: true false true true Debug: 05-18 14:55:50 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D R%22( %3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E %3C/head%3E %3Cbody%3E %3Cdiv class%3D%22hakurei%22%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:55:50 scheme: "gdlookup" Debug: 05-18 14:55:50 host: "localhost" Debug: 05-18 14:55:50 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += R\"(
)\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 14:55:50 some body finished Debug: 05-18 14:55:50 one not finished. Debug: 05-18 14:55:50 ====reading 10778 of (10778) bytes . Finished: 0 Debug: 05-18 14:55:50 ====reading 0 of (10778) bytes . Finished: 0 Debug: 05-18 14:55:50 ====reading 0 of (10778) bytes . Finished: 0 Warning: 05-18 14:55:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:56:08 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:56:08 scheme: "gdlookup" Debug: 05-18 14:56:08 host: "localhost" Debug: 05-18 14:56:08 clear current dictionaries: "悔しい" Debug: 05-18 14:56:08 some body finished Debug: 05-18 14:56:08 one not finished. Debug: 05-18 14:56:08 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 14:56:08 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 14:56:08 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 14:56:08 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:56:09 translating from clipboard or selection Debug: 05-18 14:56:09 clipboard data: "悔しい" Debug: 05-18 14:56:09 Current state: true false true true Debug: 05-18 14:56:09 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:56:09 scheme: "gdlookup" Debug: 05-18 14:56:09 host: "localhost" Debug: 05-18 14:56:09 clear current dictionaries: "悔しい" Debug: 05-18 14:56:09 some body finished Debug: 05-18 14:56:09 one not finished. Debug: 05-18 14:56:09 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 14:56:09 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 14:56:09 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 14:56:09 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:56:10 translating from clipboard or selection Debug: 05-18 14:56:10 clipboard data: "悔しい" Debug: 05-18 14:56:10 Current state: true false true true Debug: 05-18 14:56:10 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:56:10 scheme: "gdlookup" Debug: 05-18 14:56:10 host: "localhost" Debug: 05-18 14:56:10 clear current dictionaries: "悔しい" Debug: 05-18 14:56:10 some body finished Debug: 05-18 14:56:10 one not finished. Debug: 05-18 14:56:10 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 14:56:10 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 14:56:10 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 14:56:10 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:56:45 translating from clipboard or selection Debug: 05-18 14:56:45 clipboard data: "Compilation failed due to following error(s)." Debug: 05-18 14:56:45 Current state: true true false true Debug: 05-18 14:56:45 getResource: "gdlookup://localhost/?word=Compilation failed due to following error(s).&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:56:45 scheme: "gdlookup" Debug: 05-18 14:56:45 host: "localhost" Debug: 05-18 14:56:45 clear current dictionaries: "Compilation failed due to following error(s)." Debug: 05-18 14:56:45 some body finished Debug: 05-18 14:56:45 one not finished. Debug: 05-18 14:56:45 ====reading 1448 of (1448) bytes . Finished: 0 Debug: 05-18 14:56:45 ====reading 0 of (1448) bytes . Finished: 0 Debug: 05-18 14:56:45 ====reading 0 of (1448) bytes . Finished: 0 Warning: 05-18 14:56:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:57:16 translating from clipboard or selection Debug: 05-18 14:57:16 clipboard data: " output_html += R\"(\n\n\n" Debug: 05-18 14:57:16 Current state: true false false true Debug: 05-18 14:57:16 getResource: "gdlookup://localhost/?word=output_html +%3D R%22( %3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:57:16 scheme: "gdlookup" Debug: 05-18 14:57:16 host: "localhost" Debug: 05-18 14:57:16 clear current dictionaries: "output_html += R\"( " Debug: 05-18 14:57:16 some body finished Debug: 05-18 14:57:16 one not finished. Debug: 05-18 14:57:16 ====reading 1474 of (1474) bytes . Finished: 0 Debug: 05-18 14:57:16 ====reading 0 of (1474) bytes . Finished: 0 Debug: 05-18 14:57:16 ====reading 0 of (1474) bytes . Finished: 0 Warning: 05-18 14:57:16 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:57:17 translating from clipboard or selection Debug: 05-18 14:57:17 clipboard data: "\n\n" Debug: 05-18 14:57:17 Current state: true false true true Debug: 05-18 14:57:17 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:57:17 scheme: "gdlookup" Debug: 05-18 14:57:17 host: "localhost" Debug: 05-18 14:57:17 clear current dictionaries: " " Debug: 05-18 14:57:17 some body finished Debug: 05-18 14:57:17 one not finished. Debug: 05-18 14:57:17 ====reading 1450 of (1450) bytes . Finished: 0 Debug: 05-18 14:57:17 ====reading 0 of (1450) bytes . Finished: 0 Debug: 05-18 14:57:17 ====reading 0 of (1450) bytes . Finished: 0 Warning: 05-18 14:57:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:57:27 translating from clipboard or selection Debug: 05-18 14:57:27 clipboard data: "\n\n" Debug: 05-18 14:57:27 Current state: true false true true Debug: 05-18 14:57:27 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E %3Chtml%3E %3Chead%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:57:27 scheme: "gdlookup" Debug: 05-18 14:57:27 host: "localhost" Debug: 05-18 14:57:27 clear current dictionaries: " " Debug: 05-18 14:57:27 some body finished Debug: 05-18 14:57:27 one not finished. Debug: 05-18 14:57:27 ====reading 1450 of (1450) bytes . Finished: 0 Debug: 05-18 14:57:27 ====reading 0 of (1450) bytes . Finished: 0 Debug: 05-18 14:57:27 ====reading 0 of (1450) bytes . Finished: 0 Warning: 05-18 14:57:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:57:42 translating from clipboard or selection Debug: 05-18 14:57:42 clipboard data: "" Debug: 05-18 14:57:42 Current state: true false true true Debug: 05-18 14:57:42 getResource: "gdlookup://localhost/?word=%3Cbody%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:57:42 scheme: "gdlookup" Debug: 05-18 14:57:42 host: "localhost" Debug: 05-18 14:57:42 clear current dictionaries: "" Debug: 05-18 14:57:42 some body finished Debug: 05-18 14:57:42 one not finished. Debug: 05-18 14:57:42 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 14:57:42 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 14:57:42 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 14:57:42 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:57:43 translating from clipboard or selection Debug: 05-18 14:57:43 clipboard data: "\n" Debug: 05-18 14:57:43 Current state: true false true true Debug: 05-18 14:57:43 getResource: "gdlookup://localhost/?word=%3C/head%3E %3Cbody%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:57:43 scheme: "gdlookup" Debug: 05-18 14:57:43 host: "localhost" Debug: 05-18 14:57:43 clear current dictionaries: " " Debug: 05-18 14:57:43 some body finished Debug: 05-18 14:57:43 one not finished. Debug: 05-18 14:57:43 ====reading 1429 of (1429) bytes . Finished: 0 Debug: 05-18 14:57:43 ====reading 0 of (1429) bytes . Finished: 0 Debug: 05-18 14:57:43 ====reading 0 of (1429) bytes . Finished: 0 Warning: 05-18 14:57:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:57:44 translating from clipboard or selection Debug: 05-18 14:57:44 clipboard data: "\n" Debug: 05-18 14:57:44 Current state: true false true true Debug: 05-18 14:57:44 getResource: "gdlookup://localhost/?word=%3C/head%3E %3Cbody%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:57:44 scheme: "gdlookup" Debug: 05-18 14:57:44 host: "localhost" Debug: 05-18 14:57:44 clear current dictionaries: " " Debug: 05-18 14:57:44 some body finished Debug: 05-18 14:57:44 one not finished. Debug: 05-18 14:57:44 ====reading 1429 of (1429) bytes . Finished: 0 Debug: 05-18 14:57:44 ====reading 0 of (1429) bytes . Finished: 0 Debug: 05-18 14:57:44 ====reading 0 of (1429) bytes . Finished: 0 Warning: 05-18 14:57:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:57:45 translating from clipboard or selection Debug: 05-18 14:57:45 clipboard data: "\n" Debug: 05-18 14:57:45 Current state: true false true true Debug: 05-18 14:57:45 getResource: "gdlookup://localhost/?word=%3C/head%3E %3Cbody%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:57:45 scheme: "gdlookup" Debug: 05-18 14:57:45 host: "localhost" Debug: 05-18 14:57:45 clear current dictionaries: " " Debug: 05-18 14:57:45 some body finished Debug: 05-18 14:57:45 one not finished. Debug: 05-18 14:57:45 ====reading 1429 of (1429) bytes . Finished: 0 Debug: 05-18 14:57:45 ====reading 0 of (1429) bytes . Finished: 0 Debug: 05-18 14:57:45 ====reading 0 of (1429) bytes . Finished: 0 Warning: 05-18 14:57:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:58:16 translating from clipboard or selection Debug: 05-18 14:58:16 clipboard data: "" Debug: 05-18 14:58:18 Current state: true false true true Debug: 05-18 14:58:18 getResource: "gdlookup://localhost/?word=%3C/body%3E%3C/html%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:58:18 scheme: "gdlookup" Debug: 05-18 14:58:18 host: "localhost" Debug: 05-18 14:58:18 clear current dictionaries: "" Debug: 05-18 14:58:18 some body finished Debug: 05-18 14:58:18 one not finished. Debug: 05-18 14:58:18 ====reading 1429 of (1429) bytes . Finished: 0 Debug: 05-18 14:58:18 ====reading 0 of (1429) bytes . Finished: 0 Debug: 05-18 14:58:18 ====reading 0 of (1429) bytes . Finished: 0 Warning: 05-18 14:58:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 14:58:19 translating from clipboard or selection Debug: 05-18 14:58:19 clipboard data: "" Debug: 05-18 14:58:19 Current state: true false true true Debug: 05-18 14:58:19 getResource: "gdlookup://localhost/?word=%3C/body%3E%3C/html%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 14:58:19 scheme: "gdlookup" Debug: 05-18 14:58:19 host: "localhost" Debug: 05-18 14:58:19 clear current dictionaries: "" Debug: 05-18 14:58:19 some body finished Debug: 05-18 14:58:19 one not finished. Debug: 05-18 14:58:19 ====reading 1429 of (1429) bytes . Finished: 0 Debug: 05-18 14:58:19 ====reading 0 of (1429) bytes . Finished: 0 Debug: 05-18 14:58:19 ====reading 0 of (1429) bytes . Finished: 0 Warning: 05-18 14:58:19 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:01:49 translating from clipboard or selection Debug: 05-18 15:01:49 clipboard data: "+=" Debug: 05-18 15:01:49 Current state: true false true true Debug: 05-18 15:01:49 getResource: "gdlookup://localhost/?word=+%3D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:01:49 scheme: "gdlookup" Debug: 05-18 15:01:49 host: "localhost" Debug: 05-18 15:01:49 clear current dictionaries: "+=" Debug: 05-18 15:01:49 some body finished Debug: 05-18 15:01:49 one not finished. Debug: 05-18 15:01:49 ====reading 1405 of (1405) bytes . Finished: 0 Debug: 05-18 15:01:49 ====reading 0 of (1405) bytes . Finished: 0 Debug: 05-18 15:01:49 ====reading 0 of (1405) bytes . Finished: 0 Warning: 05-18 15:01:49 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:01:50 translating from clipboard or selection Debug: 05-18 15:01:50 clipboard data: "+=" Debug: 05-18 15:01:50 Current state: true false true true Debug: 05-18 15:01:50 getResource: "gdlookup://localhost/?word=+%3D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:01:50 scheme: "gdlookup" Debug: 05-18 15:01:50 host: "localhost" Debug: 05-18 15:01:50 clear current dictionaries: "+=" Debug: 05-18 15:01:50 some body finished Debug: 05-18 15:01:50 one not finished. Debug: 05-18 15:01:50 ====reading 1405 of (1405) bytes . Finished: 0 Debug: 05-18 15:01:50 ====reading 0 of (1405) bytes . Finished: 0 Debug: 05-18 15:01:50 ====reading 0 of (1405) bytes . Finished: 0 Warning: 05-18 15:01:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:01:52 translating from clipboard or selection Debug: 05-18 15:01:52 clipboard data: "+=" Debug: 05-18 15:01:52 Current state: true false true true Debug: 05-18 15:01:52 getResource: "gdlookup://localhost/?word=+%3D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:01:52 scheme: "gdlookup" Debug: 05-18 15:01:52 host: "localhost" Debug: 05-18 15:01:52 clear current dictionaries: "+=" Debug: 05-18 15:01:52 some body finished Debug: 05-18 15:01:52 one not finished. Debug: 05-18 15:01:52 ====reading 1405 of (1405) bytes . Finished: 0 Debug: 05-18 15:01:52 ====reading 0 of (1405) bytes . Finished: 0 Debug: 05-18 15:01:52 ====reading 0 of (1405) bytes . Finished: 0 Warning: 05-18 15:01:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:03:22 getResource: "gdlookup://localhost/?word=悔しい&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:03:22 scheme: "gdlookup" Debug: 05-18 15:03:22 host: "localhost" Debug: 05-18 15:03:22 clear current dictionaries: "悔しい" Debug: 05-18 15:03:22 some body finished Debug: 05-18 15:03:22 one not finished. Debug: 05-18 15:03:22 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 15:03:22 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 15:03:22 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 15:03:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:04:57 translating from clipboard or selection Debug: 05-18 15:04:57 clipboard data: "・レボリ" Debug: 05-18 15:04:57 Current state: true true false true Debug: 05-18 15:04:57 getResource: "gdlookup://localhost/?word=・レボリ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:04:57 scheme: "gdlookup" Debug: 05-18 15:04:57 host: "localhost" Debug: 05-18 15:04:57 clear current dictionaries: "・レボリ" Debug: 05-18 15:04:57 some body finished Debug: 05-18 15:04:57 one not finished. Debug: 05-18 15:04:57 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 15:04:57 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 15:04:57 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 15:04:57 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:04:58 translating from clipboard or selection Debug: 05-18 15:04:58 clipboard data: "・レボリ" Debug: 05-18 15:04:58 Current state: true false false true Debug: 05-18 15:04:58 getResource: "gdlookup://localhost/?word=・レボリ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:04:58 scheme: "gdlookup" Debug: 05-18 15:04:58 host: "localhost" Debug: 05-18 15:04:58 clear current dictionaries: "・レボリ" Debug: 05-18 15:04:58 some body finished Debug: 05-18 15:04:58 one not finished. Debug: 05-18 15:04:58 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 15:04:58 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 15:04:58 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 15:04:58 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:08:00 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:08:00 scheme: "gdlookup" Debug: 05-18 15:08:00 host: "localhost" Debug: 05-18 15:08:00 clear current dictionaries: "転生したら剣でした" Debug: 05-18 15:08:00 some body finished Debug: 05-18 15:08:00 one not finished. Debug: 05-18 15:08:00 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 15:08:00 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 15:08:00 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 15:08:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:08:02 translating from clipboard or selection Debug: 05-18 15:08:02 clipboard data: "転生したら剣でした" Debug: 05-18 15:08:02 Current state: true false true true Debug: 05-18 15:08:02 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:08:02 scheme: "gdlookup" Debug: 05-18 15:08:02 host: "localhost" Debug: 05-18 15:08:02 clear current dictionaries: "転生したら剣でした" Debug: 05-18 15:08:02 some body finished Debug: 05-18 15:08:02 one not finished. Debug: 05-18 15:08:02 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 15:08:02 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 15:08:02 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 15:08:02 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 15:08:11 translating from clipboard or selection Debug: 05-18 15:08:11 clipboard data: "転生\">転生
" Debug: 05-18 15:08:11 Current state: true true false true Debug: 05-18 15:08:11 getResource: "gdlookup://localhost/?word=転生%22%3E転生%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:した%22%3Eした%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca class%3D href%3D%22bword:した%22%3Eした%3C/a%3E%3C/li%3E%3Cli%3E%3Ca class%3D href%3D%22bword:したら%22%3Eしたら%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cdiv class%3D%22segment%22%3Eら%3C/div%3E%3Cdiv class%3D%22segment%22%3E剣%3C/div%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:でし%22%3Eでし%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca class%3D href%3D%22bword:でし%22%3Eでし%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cdiv class%3D%22segment%22%3Eた%3C/div%3E%3C/div%3E%3C/div%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 15:08:11 scheme: "gdlookup" Debug: 05-18 15:08:11 host: "localhost" Debug: 05-18 15:08:11 clear current dictionaries: "転生\">転生
" Debug: 05-18 15:08:11 some body finished Debug: 05-18 15:08:11 one not finished. Debug: 05-18 15:08:11 ====reading 2344 of (2344) bytes . Finished: 0 Debug: 05-18 15:08:11 ====reading 0 of (2344) bytes . Finished: 0 Debug: 05-18 15:08:11 ====reading 0 of (2344) bytes . Finished: 0 Warning: 05-18 15:08:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:39:08 translating from clipboard or selection Debug: 05-18 16:39:08 clipboard data: "柱間" Debug: 05-18 16:39:08 Current state: true false false true Debug: 05-18 16:39:08 getResource: "gdlookup://localhost/?word=柱間&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:39:08 scheme: "gdlookup" Debug: 05-18 16:39:08 host: "localhost" Debug: 05-18 16:39:08 clear current dictionaries: "柱間" Debug: 05-18 16:39:08 some body finished Debug: 05-18 16:39:08 one not finished. Debug: 05-18 16:39:08 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 16:39:08 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 16:39:08 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 16:39:08 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:40:09 translating from clipboard or selection Debug: 05-18 16:40:09 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:40:09 Current state: true false true true Debug: 05-18 16:40:09 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:40:09 scheme: "gdlookup" Debug: 05-18 16:40:09 host: "localhost" Debug: 05-18 16:40:09 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:40:09 some body finished Debug: 05-18 16:40:09 one not finished. Debug: 05-18 16:40:09 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:09 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:09 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:40:09 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:40:12 translating from clipboard or selection Debug: 05-18 16:40:12 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:40:12 Current state: true false true true Debug: 05-18 16:40:12 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:40:12 scheme: "gdlookup" Debug: 05-18 16:40:12 host: "localhost" Debug: 05-18 16:40:12 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:40:12 some body finished Debug: 05-18 16:40:12 one not finished. Debug: 05-18 16:40:12 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:12 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:12 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:40:12 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:40:12 translating from clipboard or selection Debug: 05-18 16:40:12 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:40:12 Current state: true false true true Debug: 05-18 16:40:12 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:40:12 scheme: "gdlookup" Debug: 05-18 16:40:12 host: "localhost" Debug: 05-18 16:40:12 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:40:12 some body finished Debug: 05-18 16:40:12 one not finished. Debug: 05-18 16:40:12 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:12 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:12 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:40:12 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:40:13 translating from clipboard or selection Debug: 05-18 16:40:13 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:40:13 Current state: true false true true Debug: 05-18 16:40:13 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:40:13 scheme: "gdlookup" Debug: 05-18 16:40:13 host: "localhost" Debug: 05-18 16:40:13 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:40:13 some body finished Debug: 05-18 16:40:13 one not finished. Debug: 05-18 16:40:13 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:13 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:40:13 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:40:13 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:18 translating from clipboard or selection Debug: 05-18 16:43:18 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6 && i + 1 < len) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe && i + 2 < len) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e && i + 3 < len) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n } else {\n throw std::runtime_error(\"Invalid UTF-8 encoding detected.\");\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(substring);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file;\n\n try {\n dict_file = find_dic_file().string(); // Default dictionary file path\n } catch (const std::exception& e) {\n std::cerr << \"Error finding dictionary file: \" << e.what() << std::endl;\n return 1;\n }\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n goldendict_mode = true;\n sentence = argv[i + 1];\n i++;\n } else {\n word = argv[i];\n }\n }\n\n if (sentence.empty()) {\n if (word.empty()) {\n std::cerr << \"Error: no word or sentence provided.\" << std::endl;\n return 1;\n }\n sentence = word;\n }\n\n try {\n const auto dict_data = xcdat::Dictionary(dict_file);\n std::vector entries;\n for (const auto& entry : dict_data.get_index().get_entries()) {\n entries.emplace_back(entry.get_word(), entry.get_id());\n }\n std::sort(entries.begin(), entries.end(), [](const Entry& a, const Entry& b) {\n return a.decoded_view.size() > b.decoded_view.size();\n });\n\n std::map> alternatives_map;\n std::vector substrings;\n\n for (const auto& entry : entries) {\n std::string decoded_word = std::string(entry.decoded_view);\n if (sentence.find(decoded_word) != std::string::npos) {\n substrings.push_back(decoded_word);\n auto it = alternatives_map.find(decoded_word);\n if (it == alternatives_map.end()) {\n alternatives_map[decoded_word] = {decoded_word};\n } else {\n it->second.insert(decoded_word);\n }\n }\n }\n\n if (debug_mode) {\n std::string raw_output;\n for (const auto& entry : entries) {\n raw_output += std::string(entry.decoded_view) + \"\\n\";\n }\n print_debug_info(substrings, raw_output);\n }\n\n wrap_html_output(substrings, alternatives_map, sentence);\n\n } catch (const std::exception& e) {\n std::cerr << \"Error: \" << e.what() << std::endl;\n return 1;\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:18 Current state: true false true true Debug: 05-18 16:43:18 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6 %26%26 i + 1 %3C len) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe %26%26 i + 2 %3C len) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e %26%26 i + 3 %3C len) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D else %7B throw std::runtime_error(%22Invalid UTF-8 encoding detected.%22); %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(substring); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file; try %7B dict_file %3D find_dic_file().string(); // Default dictionary file path %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C %22Error finding dictionary file: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B goldendict_mode %3D true; sentence %3D argv[i + 1]; i++; %7D else %7B word %3D argv[i]; %7D %7D if (sentence.empty()) %7B if (word.empty()) %7B std::cerr %3C%3C %22Error: no word or sentence provided.%22 %3C%3C std::endl; return 1; %7D sentence %3D word; %7D try %7B const auto dict_data %3D xcdat::Dictionary(dict_file); std::vector%3CEntry%3E entries; for (const auto%26 entry : dict_data.get_index().get_entries()) %7B entries.emplace_back(entry.get_word(), entry.get_id()); %7D std::sort(entries.begin(), entries.end(), [](const Entry%26 a, const Entry%26 b) %7B return a.decoded_view.size() %3E b.decoded_view.size(); %7D); std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; std::vector%3Cstd::string%3E substrings; for (const auto%26 entry : entries) %7B std::string decoded_word %3D std::string(entry.decoded_view); if (sentence.find(decoded_word) !%3D std::string::npos) %7B substrings.push_back(decoded_word); auto it %3D alternatives_map.find(decoded_word); if (it %3D%3D alternatives_map.end()) %7B alternatives_map[decoded_word] %3D %7Bdecoded_word%7D; %7D else %7B it-%3Esecond.insert(decoded_word); %7D %7D %7D if (debug_mode) %7B std::string raw_output; for (const auto%26 entry : entries) %7B raw_output +%3D std::string(entry.decoded_view) + %22%5Cn%22; %7D print_debug_info(substrings, raw_output); %7D wrap_html_output(substrings, alternatives_map, sentence); %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:18 scheme: "gdlookup" Debug: 05-18 16:43:18 host: "localhost" Debug: 05-18 16:43:18 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6 && i + 1 < len) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe && i + 2 < len) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e && i + 3 < len) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } else { throw std::runtime_error(\"Invalid UTF-8 encoding detected.\"); } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(substring); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file; try { dict_file = find_dic_file().string(); // Default dictionary file path } catch (const std::exception& e) { std::cerr << \"Error finding dictionary file: \" << e.what() << std::endl; return 1; } // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { goldendict_mode = true; sentence = argv[i + 1]; i++; } else { word = argv[i]; } } if (sentence.empty()) { if (word.empty()) { std::cerr << \"Error: no word or sentence provided.\" << std::endl; return 1; } sentence = word; } try { const auto dict_data = xcdat::Dictionary(dict_file); std::vector entries; for (const auto& entry : dict_data.get_index().get_entries()) { entries.emplace_back(entry.get_word(), entry.get_id()); } std::sort(entries.begin(), entries.end(), [](const Entry& a, const Entry& b) { return a.decoded_view.size() > b.decoded_view.size(); }); std::map> alternatives_map; std::vector substrings; for (const auto& entry : entries) { std::string decoded_word = std::string(entry.decoded_view); if (sentence.find(decoded_word) != std::string::npos) { substrings.push_back(decoded_word); auto it = alternatives_map.find(decoded_word); if (it == alternatives_map.end()) { alternatives_map[decoded_word] = {decoded_word}; } else { it->second.insert(decoded_word); } } } if (debug_mode) { std::string raw_output; for (const auto& entry : entries) { raw_output += std::string(entry.decoded_view) + \"\\n\"; } print_debug_info(substrings, raw_output); } wrap_html_output(substrings, alternatives_map, sentence); } catch (const std::exception& e) { std::cerr << \"Error: \" << e.what() << std::endl; return 1; } return 0; }" Debug: 05-18 16:43:18 some body finished Debug: 05-18 16:43:18 one not finished. Debug: 05-18 16:43:18 ====reading 10159 of (10159) bytes . Finished: 0 Debug: 05-18 16:43:18 ====reading 0 of (10159) bytes . Finished: 0 Debug: 05-18 16:43:18 ====reading 0 of (10159) bytes . Finished: 0 Warning: 05-18 16:43:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:43 translating from clipboard or selection Debug: 05-18 16:43:43 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:43 Current state: true false true true Debug: 05-18 16:43:43 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:43 scheme: "gdlookup" Debug: 05-18 16:43:43 host: "localhost" Debug: 05-18 16:43:43 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:43:43 some body finished Debug: 05-18 16:43:43 one not finished. Debug: 05-18 16:43:43 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:43 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:43 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:43:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:50 translating from clipboard or selection Debug: 05-18 16:43:50 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:50 Current state: true false true true Debug: 05-18 16:43:50 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:50 scheme: "gdlookup" Debug: 05-18 16:43:50 host: "localhost" Debug: 05-18 16:43:50 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:43:50 some body finished Debug: 05-18 16:43:50 one not finished. Debug: 05-18 16:43:50 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:50 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:50 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:43:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:52 translating from clipboard or selection Debug: 05-18 16:43:52 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:52 Current state: true false true true Debug: 05-18 16:43:52 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:52 scheme: "gdlookup" Debug: 05-18 16:43:52 host: "localhost" Debug: 05-18 16:43:52 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:43:52 some body finished Debug: 05-18 16:43:52 one not finished. Debug: 05-18 16:43:52 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:52 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:52 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:43:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:52 translating from clipboard or selection Debug: 05-18 16:43:52 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:52 Current state: true false true true Debug: 05-18 16:43:52 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:52 scheme: "gdlookup" Debug: 05-18 16:43:52 host: "localhost" Debug: 05-18 16:43:52 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:43:52 some body finished Debug: 05-18 16:43:52 one not finished. Debug: 05-18 16:43:52 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:52 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:52 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:43:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:53 translating from clipboard or selection Debug: 05-18 16:43:53 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:53 Current state: true false true true Debug: 05-18 16:43:53 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:53 scheme: "gdlookup" Debug: 05-18 16:43:53 host: "localhost" Debug: 05-18 16:43:53 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:43:53 some body finished Debug: 05-18 16:43:53 one not finished. Debug: 05-18 16:43:53 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:53 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:53 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:43:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:54 translating from clipboard or selection Debug: 05-18 16:43:54 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:54 Current state: true false true true Debug: 05-18 16:43:54 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:54 scheme: "gdlookup" Debug: 05-18 16:43:54 host: "localhost" Debug: 05-18 16:43:54 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:43:54 some body finished Debug: 05-18 16:43:54 one not finished. Debug: 05-18 16:43:54 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:54 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:54 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:43:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:43:56 translating from clipboard or selection Debug: 05-18 16:43:56 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"\";\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n // Process the search string once\n auto process_search_string = [&]() {\n auto itr = trie.make_prefix_iterator(search_string);\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After processing: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n results.clear();\n };\n\n // Initial processing\n process_search_string();\n\n // Further process the search string by removing characters one by one\n while (!search_string.empty()) {\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n search_string = new_search_string;\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n // Process again\n process_search_string();\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:43:56 Current state: true false true true Debug: 05-18 16:43:56 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca class%3D%22%22 href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; // Process the search string once auto process_search_string %3D [%26]() %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After processing: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); %7D; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) %7B const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); // Process again process_search_string(); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:43:56 scheme: "gdlookup" Debug: 05-18 16:43:56 host: "localhost" Debug: 05-18 16:43:56 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"\"; output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; // Process the search string once auto process_search_string = [&]() { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Print debug information if in debug mode if (debug_mode) { std::cout << \"After processing: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); }; // Initial processing process_search_string(); // Further process the search string by removing characters one by one while (!search_string.empty()) { const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); // Process again process_search_string(); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:43:56 some body finished Debug: 05-18 16:43:56 one not finished. Debug: 05-18 16:43:56 ====reading 10681 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:56 ====reading 0 of (10681) bytes . Finished: 0 Debug: 05-18 16:43:56 ====reading 0 of (10681) bytes . Finished: 0 Warning: 05-18 16:43:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:21 translating from clipboard or selection Debug: 05-18 16:44:21 clipboard data: " | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:21 Current state: true true false true Debug: 05-18 16:44:21 getResource: "gdlookup://localhost/?word=%7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:21 scheme: "gdlookup" Debug: 05-18 16:44:21 host: "localhost" Debug: 05-18 16:44:21 clear current dictionaries: "| ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:21 some body finished Debug: 05-18 16:44:21 one not finished. Debug: 05-18 16:44:21 ====reading 12252 of (12252) bytes . Finished: 0 Debug: 05-18 16:44:21 ====reading 0 of (12252) bytes . Finished: 0 Debug: 05-18 16:44:21 ====reading 0 of (12252) bytes . Finished: 0 Warning: 05-18 16:44:21 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:23 translating from clipboard or selection Debug: 05-18 16:44:23 clipboard data: " = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:23 Current state: true false false true Debug: 05-18 16:44:23 getResource: "gdlookup://localhost/?word=%3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:23 scheme: "gdlookup" Debug: 05-18 16:44:23 host: "localhost" Debug: 05-18 16:44:23 clear current dictionaries: "= __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:23 some body finished Debug: 05-18 16:44:23 one not finished. Debug: 05-18 16:44:23 ====reading 14655 of (14655) bytes . Finished: 0 Debug: 05-18 16:44:23 ====reading 0 of (14655) bytes . Finished: 0 Debug: 05-18 16:44:23 ====reading 0 of (14655) bytes . Finished: 0 Warning: 05-18 16:44:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:29 translating from clipboard or selection Debug: 05-18 16:44:29 clipboard data: " from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:29 Current state: true false true true Debug: 05-18 16:44:29 getResource: "gdlookup://localhost/?word=from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:29 scheme: "gdlookup" Debug: 05-18 16:44:29 host: "localhost" Debug: 05-18 16:44:29 clear current dictionaries: "from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:29 some body finished Debug: 05-18 16:44:29 one not finished. Debug: 05-18 16:44:29 ====reading 19544 of (19544) bytes . Finished: 0 Debug: 05-18 16:44:29 ====reading 0 of (19544) bytes . Finished: 0 Debug: 05-18 16:44:29 ====reading 0 of (19544) bytes . Finished: 0 Warning: 05-18 16:44:29 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:31 translating from clipboard or selection Debug: 05-18 16:44:31 clipboard data: " from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:31 Current state: true false true true Debug: 05-18 16:44:31 getResource: "gdlookup://localhost/?word=from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry%26, Entry%26)’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:31 scheme: "gdlookup" Debug: 05-18 16:44:31 host: "localhost" Debug: 05-18 16:44:31 clear current dictionaries: "from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:31 some body finished Debug: 05-18 16:44:31 one not finished. Debug: 05-18 16:44:31 ====reading 22393 of (22393) bytes . Finished: 0 Debug: 05-18 16:44:31 ====reading 0 of (22393) bytes . Finished: 0 Debug: 05-18 16:44:31 ====reading 0 of (22393) bytes . Finished: 0 Warning: 05-18 16:44:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:32 translating from clipboard or selection Debug: 05-18 16:44:32 clipboard data: "/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 262 | *__result = _GLIBCXX_MOVE(*__first);\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:32 Current state: true false true true Debug: 05-18 16:44:32 getResource: "gdlookup://localhost/?word=/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 262 %7C *__result %3D _GLIBCXX_MOVE(*__first); %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry%26, Entry%26)’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:32 scheme: "gdlookup" Debug: 05-18 16:44:32 host: "localhost" Debug: 05-18 16:44:32 clear current dictionaries: "/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 262 | *__result = _GLIBCXX_MOVE(*__first); | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:32 some body finished Debug: 05-18 16:44:32 one not finished. Debug: 05-18 16:44:32 ====reading 23390 of (23390) bytes . Finished: 0 Debug: 05-18 16:44:32 ====reading 0 of (23390) bytes . Finished: 0 Debug: 05-18 16:44:32 ====reading 0 of (23390) bytes . Finished: 0 Warning: 05-18 16:44:32 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:35 translating from clipboard or selection Debug: 05-18 16:44:35 clipboard data: "andomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 1831 | *__first = _GLIBCXX_MOVE(__val);\n | ^\nsrc/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed:\n 15 | struct Entry {\n | ^~~~~\nsrc/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive]\nIn file included from /run/current-system/profile/include/c++/bits/basic_string.h:48,\n from /run/current-system/profile/include/c++/string:55,\n from /run/current-system/profile/include/c++/bits/locale_classes.h:40,\n from /run/current-system/profile/include/c++/bits/ios_base.h:41,\n from /run/current-system/profile/include/c++/ios:42,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’\n 172 | operator=(const basic_string_view&) noexcept = default;\n | ^~~~~~~~\nsrc/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator\n 15 | struct Entry {\n | ^~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 262 | *__result = _GLIBCXX_MOVE(*__first);\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:35 Current state: true false true true Debug: 05-18 16:44:35 getResource: "gdlookup://localhost/?word=andomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 1831 %7C *__first %3D _GLIBCXX_MOVE(__val); %7C %5E src/main.cc:15:8: note: ‘Entry%26 Entry::operator%3D(Entry%26%26)’ is implicitly deleted because the default definition would be ill-formed: 15 %7C struct Entry %7B %7C %5E~~~~ src/main.cc:15:8: error: passing ‘const string_view’ %7Baka ‘const std::basic_string_view%3Cchar%3E’%7D as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view%3C_CharT, _Traits%3E%26 std::basic_string_view%3C_CharT, _Traits%3E::operator%3D(const std::basic_string_view%3C_CharT, _Traits%3E%26) [with _CharT %3D char; _Traits %3D std::char_traits%3Cchar%3E]’ 172 %7C operator%3D(const basic_string_view%26) noexcept %3D default; %7C %5E~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 %7C struct Entry %7B %7C %5E~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 262 %7C *__result %3D _GLIBCXX_MOVE(*__first); %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry%26, Entry%26)’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:35 scheme: "gdlookup" Debug: 05-18 16:44:35 host: "localhost" Debug: 05-18 16:44:35 clear current dictionaries: "andomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 1831 | *__first = _GLIBCXX_MOVE(__val); | ^ src/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed: 15 | struct Entry { | ^~~~~ src/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’ 172 | operator=(const basic_string_view&) noexcept = default; | ^~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 | struct Entry { | ^~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 262 | *__result = _GLIBCXX_MOVE(*__first); | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:35 some body finished Debug: 05-18 16:44:35 one not finished. Debug: 05-18 16:44:35 ====reading 27312 of (27312) bytes . Finished: 0 Debug: 05-18 16:44:35 ====reading 0 of (27312) bytes . Finished: 0 Debug: 05-18 16:44:35 ====reading 0 of (27312) bytes . Finished: 0 Warning: 05-18 16:44:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:38 translating from clipboard or selection Debug: 05-18 16:44:38 clipboard data: "src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’\n 255 | const auto dict_data = xcdat::Dictionary(dict_file);\n | ^~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 1831 | *__first = _GLIBCXX_MOVE(__val);\n | ^\nsrc/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed:\n 15 | struct Entry {\n | ^~~~~\nsrc/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive]\nIn file included from /run/current-system/profile/include/c++/bits/basic_string.h:48,\n from /run/current-system/profile/include/c++/string:55,\n from /run/current-system/profile/include/c++/bits/locale_classes.h:40,\n from /run/current-system/profile/include/c++/bits/ios_base.h:41,\n from /run/current-system/profile/include/c++/ios:42,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’\n 172 | operator=(const basic_string_view&) noexcept = default;\n | ^~~~~~~~\nsrc/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator\n 15 | struct Entry {\n | ^~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 262 | *__result = _GLIBCXX_MOVE(*__first);\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:38 Current state: true false true true Debug: 05-18 16:44:39 getResource: "gdlookup://localhost/?word=src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 %7C const auto dict_data %3D xcdat::Dictionary(dict_file); %7C %5E~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 1831 %7C *__first %3D _GLIBCXX_MOVE(__val); %7C %5E src/main.cc:15:8: note: ‘Entry%26 Entry::operator%3D(Entry%26%26)’ is implicitly deleted because the default definition would be ill-formed: 15 %7C struct Entry %7B %7C %5E~~~~ src/main.cc:15:8: error: passing ‘const string_view’ %7Baka ‘const std::basic_string_view%3Cchar%3E’%7D as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view%3C_CharT, _Traits%3E%26 std::basic_string_view%3C_CharT, _Traits%3E::operator%3D(const std::basic_string_view%3C_CharT, _Traits%3E%26) [with _CharT %3D char; _Traits %3D std::char_traits%3Cchar%3E]’ 172 %7C operator%3D(const basic_string_view%26) noexcept %3D default; %7C %5E~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 %7C struct Entry %7B %7C %5E~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 262 %7C *__result %3D _GLIBCXX_MOVE(*__first); %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry%26, Entry%26)’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:39 scheme: "gdlookup" Debug: 05-18 16:44:39 host: "localhost" Debug: 05-18 16:44:39 clear current dictionaries: "src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 | const auto dict_data = xcdat::Dictionary(dict_file); | ^~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 1831 | *__first = _GLIBCXX_MOVE(__val); | ^ src/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed: 15 | struct Entry { | ^~~~~ src/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’ 172 | operator=(const basic_string_view&) noexcept = default; | ^~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 | struct Entry { | ^~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 262 | *__result = _GLIBCXX_MOVE(*__first); | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:39 some body finished Debug: 05-18 16:44:39 one not finished. Debug: 05-18 16:44:39 ====reading 28509 of (28509) bytes . Finished: 0 Debug: 05-18 16:44:39 ====reading 0 of (28509) bytes . Finished: 0 Debug: 05-18 16:44:39 ====reading 0 of (28509) bytes . Finished: 0 Warning: 05-18 16:44:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:41 translating from clipboard or selection Debug: 05-18 16:44:41 clipboard data: "/tmp/Hakurei $ g++ src/main.cc -o hakurei\nsrc/main.cc: In function ‘int main(int, char**)’:\nsrc/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’\n 255 | const auto dict_data = xcdat::Dictionary(dict_file);\n | ^~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 1831 | *__first = _GLIBCXX_MOVE(__val);\n | ^\nsrc/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed:\n 15 | struct Entry {\n | ^~~~~\nsrc/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive]\nIn file included from /run/current-system/profile/include/c++/bits/basic_string.h:48,\n from /run/current-system/profile/include/c++/string:55,\n from /run/current-system/profile/include/c++/bits/locale_classes.h:40,\n from /run/current-system/profile/include/c++/bits/ios_base.h:41,\n from /run/current-system/profile/include/c++/ios:42,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’\n 172 | operator=(const basic_string_view&) noexcept = default;\n | ^~~~~~~~\nsrc/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator\n 15 | struct Entry {\n | ^~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 262 | *__result = _GLIBCXX_MOVE(*__first);\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:41 Current state: true false true true Debug: 05-18 16:44:41 getResource: "gdlookup://localhost/?word=/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘int main(int, char**)’: src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 %7C const auto dict_data %3D xcdat::Dictionary(dict_file); %7C %5E~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 1831 %7C *__first %3D _GLIBCXX_MOVE(__val); %7C %5E src/main.cc:15:8: note: ‘Entry%26 Entry::operator%3D(Entry%26%26)’ is implicitly deleted because the default definition would be ill-formed: 15 %7C struct Entry %7B %7C %5E~~~~ src/main.cc:15:8: error: passing ‘const string_view’ %7Baka ‘const std::basic_string_view%3Cchar%3E’%7D as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view%3C_CharT, _Traits%3E%26 std::basic_string_view%3C_CharT, _Traits%3E::operator%3D(const std::basic_string_view%3C_CharT, _Traits%3E%26) [with _CharT %3D char; _Traits %3D std::char_traits%3Cchar%3E]’ 172 %7C operator%3D(const basic_string_view%26) noexcept %3D default; %7C %5E~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 %7C struct Entry %7B %7C %5E~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 262 %7C *__result %3D _GLIBCXX_MOVE(*__first); %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry%26, Entry%26)’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:41 scheme: "gdlookup" Debug: 05-18 16:44:41 host: "localhost" Debug: 05-18 16:44:41 clear current dictionaries: "/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘int main(int, char**)’: src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 | const auto dict_data = xcdat::Dictionary(dict_file); | ^~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 1831 | *__first = _GLIBCXX_MOVE(__val); | ^ src/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed: 15 | struct Entry { | ^~~~~ src/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’ 172 | operator=(const basic_string_view&) noexcept = default; | ^~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 | struct Entry { | ^~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 262 | *__result = _GLIBCXX_MOVE(*__first); | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:41 some body finished Debug: 05-18 16:44:41 one not finished. Debug: 05-18 16:44:41 ====reading 28605 of (28605) bytes . Finished: 0 Debug: 05-18 16:44:41 ====reading 0 of (28605) bytes . Finished: 0 Debug: 05-18 16:44:41 ====reading 0 of (28605) bytes . Finished: 0 Warning: 05-18 16:44:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:42 translating from clipboard or selection Debug: 05-18 16:44:42 clipboard data: "/tmp/Hakurei $ g++ src/main.cc -o hakurei\nsrc/main.cc: In function ‘int main(int, char**)’:\nsrc/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’\n 255 | const auto dict_data = xcdat::Dictionary(dict_file);\n | ^~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 1831 | *__first = _GLIBCXX_MOVE(__val);\n | ^\nsrc/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed:\n 15 | struct Entry {\n | ^~~~~\nsrc/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive]\nIn file included from /run/current-system/profile/include/c++/bits/basic_string.h:48,\n from /run/current-system/profile/include/c++/string:55,\n from /run/current-system/profile/include/c++/bits/locale_classes.h:40,\n from /run/current-system/profile/include/c++/bits/ios_base.h:41,\n from /run/current-system/profile/include/c++/ios:42,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’\n 172 | operator=(const basic_string_view&) noexcept = default;\n | ^~~~~~~~\nsrc/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator\n 15 | struct Entry {\n | ^~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 262 | *__result = _GLIBCXX_MOVE(*__first);\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:42 Current state: true false true true Debug: 05-18 16:44:42 getResource: "gdlookup://localhost/?word=/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘int main(int, char**)’: src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 %7C const auto dict_data %3D xcdat::Dictionary(dict_file); %7C %5E~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 1831 %7C *__first %3D _GLIBCXX_MOVE(__val); %7C %5E src/main.cc:15:8: note: ‘Entry%26 Entry::operator%3D(Entry%26%26)’ is implicitly deleted because the default definition would be ill-formed: 15 %7C struct Entry %7B %7C %5E~~~~ src/main.cc:15:8: error: passing ‘const string_view’ %7Baka ‘const std::basic_string_view%3Cchar%3E’%7D as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view%3C_CharT, _Traits%3E%26 std::basic_string_view%3C_CharT, _Traits%3E::operator%3D(const std::basic_string_view%3C_CharT, _Traits%3E%26) [with _CharT %3D char; _Traits %3D std::char_traits%3Cchar%3E]’ 172 %7C operator%3D(const basic_string_view%26) noexcept %3D default; %7C %5E~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 %7C struct Entry %7B %7C %5E~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 262 %7C *__result %3D _GLIBCXX_MOVE(*__first); %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry%26, Entry%26)’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:42 scheme: "gdlookup" Debug: 05-18 16:44:42 host: "localhost" Debug: 05-18 16:44:42 clear current dictionaries: "/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘int main(int, char**)’: src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 | const auto dict_data = xcdat::Dictionary(dict_file); | ^~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 1831 | *__first = _GLIBCXX_MOVE(__val); | ^ src/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed: 15 | struct Entry { | ^~~~~ src/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’ 172 | operator=(const basic_string_view&) noexcept = default; | ^~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 | struct Entry { | ^~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 262 | *__result = _GLIBCXX_MOVE(*__first); | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:42 some body finished Debug: 05-18 16:44:42 one not finished. Debug: 05-18 16:44:42 ====reading 28605 of (28605) bytes . Finished: 0 Debug: 05-18 16:44:42 ====reading 0 of (28605) bytes . Finished: 0 Debug: 05-18 16:44:42 ====reading 0 of (28605) bytes . Finished: 0 Warning: 05-18 16:44:42 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:44:42 translating from clipboard or selection Debug: 05-18 16:44:42 clipboard data: "/tmp/Hakurei $ g++ src/main.cc -o hakurei\nsrc/main.cc: In function ‘int main(int, char**)’:\nsrc/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’\n 255 | const auto dict_data = xcdat::Dictionary(dict_file);\n | ^~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 1831 | *__first = _GLIBCXX_MOVE(__val);\n | ^\nsrc/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed:\n 15 | struct Entry {\n | ^~~~~\nsrc/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive]\nIn file included from /run/current-system/profile/include/c++/bits/basic_string.h:48,\n from /run/current-system/profile/include/c++/string:55,\n from /run/current-system/profile/include/c++/bits/locale_classes.h:40,\n from /run/current-system/profile/include/c++/bits/ios_base.h:41,\n from /run/current-system/profile/include/c++/ios:42,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’\n 172 | operator=(const basic_string_view&) noexcept = default;\n | ^~~~~~~~\nsrc/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator\n 15 | struct Entry {\n | ^~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 262 | *__result = _GLIBCXX_MOVE(*__first);\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’\n 196 | swap(_Tp& __a, _Tp& __b)\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/move.h:57,\n from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’:\n/run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’\n/run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’\n 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type;\n | ^~~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43,\n from /run/current-system/profile/include/c++/exception:153,\n from /run/current-system/profile/include/c++/ios:39,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’:\n/run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’\n 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])\n | ^~~~\n/run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’\n 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted)\n 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete;\n | ^~~~\n/run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed:\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’\n 182 | swap(*__a, *__b);\n | ~~~~^~~~~~~~~~~~\nIn file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61,\n from /run/current-system/profile/include/c++/algorithm:62,\n from src/main.cc:3:\n/run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’:\n/run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild));\n | ^\n/run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’\n 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first\n | ^\nIn file included from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’:\n/run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’\n/run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’\nsrc/main.cc:260:18: required from here\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable\n 738 | static_assert( __assignable::type::value, \"type is not assignable\" );\n | ^~~~~\n/run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false\nIn file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71,\n from /run/current-system/profile/include/c++/bits/char_traits.h:39,\n from /run/current-system/profile/include/c++/ios:40,\n from /run/current-system/profile/include/c++/ostream:38,\n from /run/current-system/profile/include/c++/iostream:39,\n from src/main.cc:1:\n/run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope:\n/run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined\n 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp)\n | ^~~~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 16:44:42 Current state: true false true true Debug: 05-18 16:44:42 getResource: "gdlookup://localhost/?word=/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘int main(int, char**)’: src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 %7C const auto dict_data %3D xcdat::Dictionary(dict_file); %7C %5E~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 1831 %7C *__first %3D _GLIBCXX_MOVE(__val); %7C %5E src/main.cc:15:8: note: ‘Entry%26 Entry::operator%3D(Entry%26%26)’ is implicitly deleted because the default definition would be ill-formed: 15 %7C struct Entry %7B %7C %5E~~~~ src/main.cc:15:8: error: passing ‘const string_view’ %7Baka ‘const std::basic_string_view%3Cchar%3E’%7D as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view%3C_CharT, _Traits%3E%26 std::basic_string_view%3C_CharT, _Traits%3E::operator%3D(const std::basic_string_view%3C_CharT, _Traits%3E%26) [with _CharT %3D char; _Traits %3D std::char_traits%3Cchar%3E]’ 172 %7C operator%3D(const basic_string_view%26) noexcept %3D default; %7C %5E~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 %7C struct Entry %7B %7C %5E~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 262 %7C *__result %3D _GLIBCXX_MOVE(*__first); %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry%26, Entry%26)’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26)’ 196 %7C swap(_Tp%26 __a, _Tp%26 __b) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template%3Cbool _Cond, class _Tp%3E using __enable_if_t %3D typename std::enable_if::type [with bool _Cond %3D false; _Tp %3D void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template%3Cclass ... _Cond%3E using _Require %3D std::__enable_if_t%3Cstd::__and_%3C %3Ctemplate-parameter-1-1%3E %3E::value%3E [with _Cond %3D %7Bstd::__not_%3Cstd::__is_tuple_like%3CEntry%3E %3E, std::is_move_constructible%3CEntry%3E, std::is_move_assignable%3CEntry%3E%7D]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template%3Cclass _Tp%3E std::_Require%3Cstd::__not_%3Cstd::__is_tuple_like%3C_Tp%3E %3E, std::is_move_constructible%3C_Tp%3E, std::is_move_assignable%3C_Tp%3E %3E std::swap(_Tp%26, _Tp%26) [with _Tp %3D Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if%3Cfalse, void%3E’ 2211 %7C using __enable_if_t %3D typename enable_if%3C_Cond, _Tp%3E::type; %7C %5E~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _ForwardIterator2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template%3Cclass _Tp, long unsigned int _Nm%3E std::__enable_if_t%3Cstd::__is_swappable%3C_Tp%3E::value%3E std::swap(_Tp (%26)[_Nm], _Tp (%26)[_Nm])’ 220 %7C swap(_Tp (%26__a)[_Nm], _Tp (%26__b)[_Nm]) %7C %5E~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3Cstd::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ 533 %7C swap(pair%3C_T1, _T2%3E%26 __x, pair%3C_T1, _T2%3E%26 __y) %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template%3Cclass _T1, class _T2%3E typename std::enable_if%3C(! std::__and_%3Cstd::__is_swappable%3C_T1%3E, std::__is_swappable%3C_T2%3E %3E::value)%3E::type std::swap(std::pair%3C_T1, _T2%3E%26, std::pair%3C_T1, _T2%3E%26)’ (deleted) 541 %7C swap(pair%3C_T1, _T2%3E%26, pair%3C_T1, _T2%3E%26) %3D delete; %7C %5E~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair%3C_T1, _T2%3E’ 182 %7C swap(*__a, *__b); %7C ~~~~%5E~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Distance %3D long int; _Tp %3D Entry; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare%26) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Size %3D long int; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 234 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first + __secondChild)); %7C %5E /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry%26 Entry::operator%3D(Entry%26%26)’ 240 %7C *(__first + __holeIndex) %3D _GLIBCXX_MOVE(*(__first %7C %5E In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward%3C_IsMove, true, std::random_access_iterator_tag%3E::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp %3D Entry; bool _IsMove %3D true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove %3D true; _BI1 %3D Entry*; _BI2 %3D Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove %3D true; _II %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _OI %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _BI2 %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D __gnu_cxx::__ops::_Iter_comp_iter%3Cmain(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E %3E]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter %3D __gnu_cxx::__normal_iterator%3CEntry*, std::vector%3CEntry%3E %3E; _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 %7C static_assert( __assignable::type::value, %22type is not assignable%22 ); %7C %5E~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant%3Cbool, false%3E::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val%3C_Compare%3E::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter%3C_Compare%3E%26%26) [with _Compare %3D main(int, char**)::%3Clambda(const Entry%26, const Entry%26)%3E]’ used but never defined 187 %7C _Iter_comp_val(_Iter_comp_iter%3C_Compare%3E%26%26 __comp) %7C %5E~~~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:44:42 scheme: "gdlookup" Debug: 05-18 16:44:42 host: "localhost" Debug: 05-18 16:44:42 clear current dictionaries: "/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘int main(int, char**)’: src/main.cc:255:39: error: ‘Dictionary’ is not a member of ‘xcdat’ 255 | const auto dict_data = xcdat::Dictionary(dict_file); | ^~~~~~~~~~ In file included from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_algo.h: In instantiation of ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algo.h:1831:24: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 1831 | *__first = _GLIBCXX_MOVE(__val); | ^ src/main.cc:15:8: note: ‘Entry& Entry::operator=(Entry&&)’ is implicitly deleted because the default definition would be ill-formed: 15 | struct Entry { | ^~~~~ src/main.cc:15:8: error: passing ‘const string_view’ {aka ‘const std::basic_string_view’} as ‘this’ argument discards qualifiers [-fpermissive] In file included from /run/current-system/profile/include/c++/bits/basic_string.h:48, from /run/current-system/profile/include/c++/string:55, from /run/current-system/profile/include/c++/bits/locale_classes.h:40, from /run/current-system/profile/include/c++/bits/ios_base.h:41, from /run/current-system/profile/include/c++/ios:42, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/string_view:172:7: note: in call to ‘constexpr std::basic_string_view<_CharT, _Traits>& std::basic_string_view<_CharT, _Traits>::operator=(const std::basic_string_view<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits]’ 172 | operator=(const basic_string_view&) noexcept = default; | ^~~~~~~~ src/main.cc:15:8: error: non-static const member ‘const uint64_t Entry::id’, cannot use default assignment operator 15 | struct Entry { | ^~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:1649:19: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:262:17: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 262 | *__result = _GLIBCXX_MOVE(*__first); | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: error: no matching function for call to ‘swap(Entry&, Entry&)’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/move.h:196:5: note: candidate: ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&)’ 196 | swap(_Tp& __a, _Tp& __b) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:196:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/move.h:57, from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/type_traits: In substitution of ‘template using __enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = void]’: /run/current-system/profile/include/c++/type_traits:2215:11: required by substitution of ‘template using _Require = std::__enable_if_t >::value> [with _Cond = {std::__not_ >, std::is_move_constructible, std::is_move_assignable}]’ /run/current-system/profile/include/c++/bits/move.h:196:5: required by substitution of ‘template std::_Require >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = Entry]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: required from ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/type_traits:2211:11: error: no type named ‘type’ in ‘struct std::enable_if’ 2211 | using __enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/exception_ptr.h:43, from /run/current-system/profile/include/c++/exception:153, from /run/current-system/profile/include/c++/ios:39, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘void std::iter_swap(_ForwardIterator1, _ForwardIterator2) [with _ForwardIterator1 = __gnu_cxx::__normal_iterator >; _ForwardIterator2 = __gnu_cxx::__normal_iterator >]’: /run/current-system/profile/include/c++/bits/stl_algo.h:85:20: required from ‘void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1904:34: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1938:38: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/move.h:220:5: note: candidate: ‘template std::__enable_if_t::value> std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm])’ 220 | swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) | ^~~~ /run/current-system/profile/include/c++/bits/move.h:220:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: mismatched types ‘_Tp [_Nm]’ and ‘Entry’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: candidate: ‘template typename std::enable_if, std::__is_swappable<_T2> >::value>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ 533 | swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:533:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:64, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: candidate: ‘template typename std::enable_if<(! std::__and_, std::__is_swappable<_T2> >::value)>::type std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&)’ (deleted) 541 | swap(pair<_T1, _T2>&, pair<_T1, _T2>&) = delete; | ^~~~ /run/current-system/profile/include/c++/bits/stl_pair.h:541:5: note: template argument deduction/substitution failed: In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h:182:11: note: ‘Entry’ is not derived from ‘std::pair<_T1, _T2>’ 182 | swap(*__a, *__b); | ~~~~^~~~~~~~~~~~ In file included from /run/current-system/profile/include/c++/bits/stl_algo.h:61, from /run/current-system/profile/include/c++/algorithm:62, from src/main.cc:3: /run/current-system/profile/include/c++/bits/stl_heap.h: In instantiation of ‘void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Distance = long int; _Tp = Entry; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’: /run/current-system/profile/include/c++/bits/stl_heap.h:355:22: required from ‘void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1646:23: required from ‘void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1917:25: required from ‘void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1933:27: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1954:25: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_heap.h:234:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 234 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first + __secondChild)); | ^ /run/current-system/profile/include/c++/bits/stl_heap.h:240:36: error: use of deleted function ‘Entry& Entry::operator=(Entry&&)’ 240 | *(__first + __holeIndex) = _GLIBCXX_MOVE(*(__first | ^ In file included from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/stl_algobase.h: In instantiation of ‘static _Tp* std::__copy_move_backward<_IsMove, true, std::random_access_iterator_tag>::__copy_move_b(const _Tp*, const _Tp*, _Tp*) [with _Tp = Entry; bool _IsMove = true]’: /run/current-system/profile/include/c++/bits/stl_algobase.h:760:37: required from ‘_BI2 std::__copy_move_backward_a2(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:769:51: required from ‘_BI2 std::__copy_move_backward_a1(_BI1, _BI1, _BI2) [with bool _IsMove = true; _BI1 = Entry*; _BI2 = Entry*]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:800:5: required from ‘_OI std::__copy_move_backward_a(_II, _II, _OI) [with bool _IsMove = true; _II = __gnu_cxx::__normal_iterator >; _OI = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algobase.h:894:47: required from ‘_BI2 std::move_backward(_BI1, _BI1, _BI2) [with _BI1 = __gnu_cxx::__normal_iterator >; _BI2 = __gnu_cxx::__normal_iterator >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1830:8: required from ‘void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1866:25: required from ‘void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:1957:31: required from ‘void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator >; _Compare = __gnu_cxx::__ops::_Iter_comp_iter >]’ /run/current-system/profile/include/c++/bits/stl_algo.h:4875:18: required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator >; _Compare = main(int, char**)::]’ src/main.cc:260:18: required from here /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: error: static assertion failed: type is not assignable 738 | static_assert( __assignable::type::value, \"type is not assignable\" ); | ^~~~~ /run/current-system/profile/include/c++/bits/stl_algobase.h:738:46: note: ‘std::integral_constant::value’ evaluates to false In file included from /run/current-system/profile/include/c++/bits/stl_algobase.h:71, from /run/current-system/profile/include/c++/bits/char_traits.h:39, from /run/current-system/profile/include/c++/ios:40, from /run/current-system/profile/include/c++/ostream:38, from /run/current-system/profile/include/c++/iostream:39, from src/main.cc:1: /run/current-system/profile/include/c++/bits/predefined_ops.h: At global scope: /run/current-system/profile/include/c++/bits/predefined_ops.h:187:7: warning: ‘__gnu_cxx::__ops::_Iter_comp_val<_Compare>::_Iter_comp_val(__gnu_cxx::__ops::_Iter_comp_iter<_Compare>&&) [with _Compare = main(int, char**)::]’ used but never defined 187 | _Iter_comp_val(_Iter_comp_iter<_Compare>&& __comp) | ^~~~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 16:44:42 some body finished Debug: 05-18 16:44:42 one not finished. Debug: 05-18 16:44:42 ====reading 28605 of (28605) bytes . Finished: 0 Debug: 05-18 16:44:42 ====reading 0 of (28605) bytes . Finished: 0 Debug: 05-18 16:44:42 ====reading 0 of (28605) bytes . Finished: 0 Warning: 05-18 16:44:42 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:46:07 translating from clipboard or selection Debug: 05-18 16:46:07 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:46:07 Current state: true false true true Debug: 05-18 16:46:07 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:46:07 scheme: "gdlookup" Debug: 05-18 16:46:07 host: "localhost" Debug: 05-18 16:46:07 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:46:07 some body finished Debug: 05-18 16:46:07 one not finished. Debug: 05-18 16:46:07 ====reading 10997 of (10997) bytes . Finished: 0 Debug: 05-18 16:46:07 ====reading 0 of (10997) bytes . Finished: 0 Debug: 05-18 16:46:07 ====reading 0 of (10997) bytes . Finished: 0 Warning: 05-18 16:46:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:46:07 translating from clipboard or selection Debug: 05-18 16:46:07 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:46:07 Current state: true false true true Debug: 05-18 16:46:08 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:46:08 scheme: "gdlookup" Debug: 05-18 16:46:08 host: "localhost" Debug: 05-18 16:46:08 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:46:08 some body finished Debug: 05-18 16:46:08 one not finished. Debug: 05-18 16:46:08 ====reading 10997 of (10997) bytes . Finished: 0 Debug: 05-18 16:46:08 ====reading 0 of (10997) bytes . Finished: 0 Debug: 05-18 16:46:08 ====reading 0 of (10997) bytes . Finished: 0 Warning: 05-18 16:46:08 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:46:11 translating from clipboard or selection Debug: 05-18 16:46:11 clipboard data: "handling" Debug: 05-18 16:46:11 Current state: true false true true Debug: 05-18 16:46:11 getResource: "gdlookup://localhost/?word=handling&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:46:11 scheme: "gdlookup" Debug: 05-18 16:46:11 host: "localhost" Debug: 05-18 16:46:11 clear current dictionaries: "handling" Debug: 05-18 16:46:11 some body finished Debug: 05-18 16:46:11 one not finished. Debug: 05-18 16:46:11 ====reading 1411 of (1411) bytes . Finished: 0 Debug: 05-18 16:46:11 ====reading 0 of (1411) bytes . Finished: 0 Debug: 05-18 16:46:11 ====reading 0 of (1411) bytes . Finished: 0 Warning: 05-18 16:46:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:57:33 translating from clipboard or selection Debug: 05-18 16:57:33 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:57:33 Current state: true false true true Debug: 05-18 16:57:33 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%3C/head%3E%3Cbody%3E%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:57:33 scheme: "gdlookup" Debug: 05-18 16:57:33 host: "localhost" Debug: 05-18 16:57:33 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:57:33 some body finished Debug: 05-18 16:57:33 one not finished. Debug: 05-18 16:57:33 ====reading 11374 of (11374) bytes . Finished: 0 Debug: 05-18 16:57:33 ====reading 0 of (11374) bytes . Finished: 0 Debug: 05-18 16:57:33 ====reading 0 of (11374) bytes . Finished: 0 Warning: 05-18 16:57:34 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:57:37 translating from clipboard or selection Debug: 05-18 16:57:37 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6 && i + 1 < len) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe && i + 2 < len) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e && i + 3 < len) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n } else {\n throw std::runtime_error(\"Invalid UTF-8 encoding detected.\");\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(substring);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file;\n\n try {\n dict_file = find_dic_file().string(); // Default dictionary file path\n } catch (const std::exception& e) {\n std::cerr << \"Error finding dictionary file: \" << e.what() << std::endl;\n return 1;\n }\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n goldendict_mode = true;\n sentence = argv[i + 1];\n i++;\n } else {\n word = argv[i];\n }\n }\n\n if (sentence.empty()) {\n if (word.empty()) {\n std::cerr << \"Error: no word or sentence provided.\" << std::endl;\n return 1;\n }\n sentence = word;\n }\n\n try {\n const auto dict_data = xcdat::Dictionary(dict_file);\n std::vector entries;\n for (const auto& entry : dict_data.get_index().get_entries()) {\n entries.emplace_back(entry.get_word(), entry.get_id());\n }\n std::sort(entries.begin(), entries.end(), [](const Entry& a, const Entry& b) {\n return a.decoded_view.size() > b.decoded_view.size();\n });\n\n std::map> alternatives_map;\n std::vector substrings;\n\n for (const auto& entry : entries) {\n std::string decoded_word = std::string(entry.decoded_view);\n if (sentence.find(decoded_word) != std::string::npos) {\n substrings.push_back(decoded_word);\n auto it = alternatives_map.find(decoded_word);\n if (it == alternatives_map.end()) {\n alternatives_map[decoded_word] = {decoded_word};\n } else {\n it->second.insert(decoded_word);\n }\n }\n }\n\n if (debug_mode) {\n std::string raw_output;\n for (const auto& entry : entries) {\n raw_output += std::string(entry.decoded_view) + \"\\n\";\n }\n print_debug_info(substrings, raw_output);\n }\n\n wrap_html_output(substrings, alternatives_map, sentence);\n\n } catch (const std::exception& e) {\n std::cerr << \"Error: \" << e.what() << std::endl;\n return 1;\n }\n\n return 0;\n}\n" Debug: 05-18 16:57:37 Current state: true false true true Debug: 05-18 16:57:38 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6 %26%26 i + 1 %3C len) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe %26%26 i + 2 %3C len) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e %26%26 i + 3 %3C len) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D else %7B throw std::runtime_error(%22Invalid UTF-8 encoding detected.%22); %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(substring); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file; try %7B dict_file %3D find_dic_file().string(); // Default dictionary file path %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C %22Error finding dictionary file: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B goldendict_mode %3D true; sentence %3D argv[i + 1]; i++; %7D else %7B word %3D argv[i]; %7D %7D if (sentence.empty()) %7B if (word.empty()) %7B std::cerr %3C%3C %22Error: no word or sentence provided.%22 %3C%3C std::endl; return 1; %7D sentence %3D word; %7D try %7B const auto dict_data %3D xcdat::Dictionary(dict_file); std::vector%3CEntry%3E entries; for (const auto%26 entry : dict_data.get_index().get_entries()) %7B entries.emplace_back(entry.get_word(), entry.get_id()); %7D std::sort(entries.begin(), entries.end(), [](const Entry%26 a, const Entry%26 b) %7B return a.decoded_view.size() %3E b.decoded_view.size(); %7D); std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; std::vector%3Cstd::string%3E substrings; for (const auto%26 entry : entries) %7B std::string decoded_word %3D std::string(entry.decoded_view); if (sentence.find(decoded_word) !%3D std::string::npos) %7B substrings.push_back(decoded_word); auto it %3D alternatives_map.find(decoded_word); if (it %3D%3D alternatives_map.end()) %7B alternatives_map[decoded_word] %3D %7Bdecoded_word%7D; %7D else %7B it-%3Esecond.insert(decoded_word); %7D %7D %7D if (debug_mode) %7B std::string raw_output; for (const auto%26 entry : entries) %7B raw_output +%3D std::string(entry.decoded_view) + %22%5Cn%22; %7D print_debug_info(substrings, raw_output); %7D wrap_html_output(substrings, alternatives_map, sentence); %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:57:38 scheme: "gdlookup" Debug: 05-18 16:57:38 host: "localhost" Debug: 05-18 16:57:38 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6 && i + 1 < len) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe && i + 2 < len) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e && i + 3 < len) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } else { throw std::runtime_error(\"Invalid UTF-8 encoding detected.\"); } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(substring); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file; try { dict_file = find_dic_file().string(); // Default dictionary file path } catch (const std::exception& e) { std::cerr << \"Error finding dictionary file: \" << e.what() << std::endl; return 1; } // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { goldendict_mode = true; sentence = argv[i + 1]; i++; } else { word = argv[i]; } } if (sentence.empty()) { if (word.empty()) { std::cerr << \"Error: no word or sentence provided.\" << std::endl; return 1; } sentence = word; } try { const auto dict_data = xcdat::Dictionary(dict_file); std::vector entries; for (const auto& entry : dict_data.get_index().get_entries()) { entries.emplace_back(entry.get_word(), entry.get_id()); } std::sort(entries.begin(), entries.end(), [](const Entry& a, const Entry& b) { return a.decoded_view.size() > b.decoded_view.size(); }); std::map> alternatives_map; std::vector substrings; for (const auto& entry : entries) { std::string decoded_word = std::string(entry.decoded_view); if (sentence.find(decoded_word) != std::string::npos) { substrings.push_back(decoded_word); auto it = alternatives_map.find(decoded_word); if (it == alternatives_map.end()) { alternatives_map[decoded_word] = {decoded_word}; } else { it->second.insert(decoded_word); } } } if (debug_mode) { std::string raw_output; for (const auto& entry : entries) { raw_output += std::string(entry.decoded_view) + \"\\n\"; } print_debug_info(substrings, raw_output); } wrap_html_output(substrings, alternatives_map, sentence); } catch (const std::exception& e) { std::cerr << \"Error: \" << e.what() << std::endl; return 1; } return 0; }" Debug: 05-18 16:57:38 some body finished Debug: 05-18 16:57:38 one not finished. Debug: 05-18 16:57:38 ====reading 10159 of (10159) bytes . Finished: 0 Debug: 05-18 16:57:38 ====reading 0 of (10159) bytes . Finished: 0 Debug: 05-18 16:57:38 ====reading 0 of (10159) bytes . Finished: 0 Warning: 05-18 16:57:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:57:38 translating from clipboard or selection Debug: 05-18 16:57:38 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6 && i + 1 < len) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe && i + 2 < len) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e && i + 3 < len) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n } else {\n throw std::runtime_error(\"Invalid UTF-8 encoding detected.\");\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n std::string css = R\"(\n\n)\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(substring);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += css;\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file;\n\n try {\n dict_file = find_dic_file().string(); // Default dictionary file path\n } catch (const std::exception& e) {\n std::cerr << \"Error finding dictionary file: \" << e.what() << std::endl;\n return 1;\n }\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n goldendict_mode = true;\n sentence = argv[i + 1];\n i++;\n } else {\n word = argv[i];\n }\n }\n\n if (sentence.empty()) {\n if (word.empty()) {\n std::cerr << \"Error: no word or sentence provided.\" << std::endl;\n return 1;\n }\n sentence = word;\n }\n\n try {\n const auto dict_data = xcdat::Dictionary(dict_file);\n std::vector entries;\n for (const auto& entry : dict_data.get_index().get_entries()) {\n entries.emplace_back(entry.get_word(), entry.get_id());\n }\n std::sort(entries.begin(), entries.end(), [](const Entry& a, const Entry& b) {\n return a.decoded_view.size() > b.decoded_view.size();\n });\n\n std::map> alternatives_map;\n std::vector substrings;\n\n for (const auto& entry : entries) {\n std::string decoded_word = std::string(entry.decoded_view);\n if (sentence.find(decoded_word) != std::string::npos) {\n substrings.push_back(decoded_word);\n auto it = alternatives_map.find(decoded_word);\n if (it == alternatives_map.end()) {\n alternatives_map[decoded_word] = {decoded_word};\n } else {\n it->second.insert(decoded_word);\n }\n }\n }\n\n if (debug_mode) {\n std::string raw_output;\n for (const auto& entry : entries) {\n raw_output += std::string(entry.decoded_view) + \"\\n\";\n }\n print_debug_info(substrings, raw_output);\n }\n\n wrap_html_output(substrings, alternatives_map, sentence);\n\n } catch (const std::exception& e) {\n std::cerr << \"Error: \" << e.what() << std::endl;\n return 1;\n }\n\n return 0;\n}\n" Debug: 05-18 16:57:38 Current state: true false true true Debug: 05-18 16:57:38 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6 %26%26 i + 1 %3C len) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe %26%26 i + 2 %3C len) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e %26%26 i + 3 %3C len) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D else %7B throw std::runtime_error(%22Invalid UTF-8 encoding detected.%22); %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; std::string css %3D R%22( %3Cstyle%3E .hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D .hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D .hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D .hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D .hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D .hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D .hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D .container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D .segment %7B display: inline-block; %7D %3C/style%3E )%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(substring); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D css; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file; try %7B dict_file %3D find_dic_file().string(); // Default dictionary file path %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C %22Error finding dictionary file: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B goldendict_mode %3D true; sentence %3D argv[i + 1]; i++; %7D else %7B word %3D argv[i]; %7D %7D if (sentence.empty()) %7B if (word.empty()) %7B std::cerr %3C%3C %22Error: no word or sentence provided.%22 %3C%3C std::endl; return 1; %7D sentence %3D word; %7D try %7B const auto dict_data %3D xcdat::Dictionary(dict_file); std::vector%3CEntry%3E entries; for (const auto%26 entry : dict_data.get_index().get_entries()) %7B entries.emplace_back(entry.get_word(), entry.get_id()); %7D std::sort(entries.begin(), entries.end(), [](const Entry%26 a, const Entry%26 b) %7B return a.decoded_view.size() %3E b.decoded_view.size(); %7D); std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; std::vector%3Cstd::string%3E substrings; for (const auto%26 entry : entries) %7B std::string decoded_word %3D std::string(entry.decoded_view); if (sentence.find(decoded_word) !%3D std::string::npos) %7B substrings.push_back(decoded_word); auto it %3D alternatives_map.find(decoded_word); if (it %3D%3D alternatives_map.end()) %7B alternatives_map[decoded_word] %3D %7Bdecoded_word%7D; %7D else %7B it-%3Esecond.insert(decoded_word); %7D %7D %7D if (debug_mode) %7B std::string raw_output; for (const auto%26 entry : entries) %7B raw_output +%3D std::string(entry.decoded_view) + %22%5Cn%22; %7D print_debug_info(substrings, raw_output); %7D wrap_html_output(substrings, alternatives_map, sentence); %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:57:38 scheme: "gdlookup" Debug: 05-18 16:57:38 host: "localhost" Debug: 05-18 16:57:38 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6 && i + 1 < len) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe && i + 2 < len) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e && i + 3 < len) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } else { throw std::runtime_error(\"Invalid UTF-8 encoding detected.\"); } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; std::string css = R\"( )\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(substring); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += css; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file; try { dict_file = find_dic_file().string(); // Default dictionary file path } catch (const std::exception& e) { std::cerr << \"Error finding dictionary file: \" << e.what() << std::endl; return 1; } // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { goldendict_mode = true; sentence = argv[i + 1]; i++; } else { word = argv[i]; } } if (sentence.empty()) { if (word.empty()) { std::cerr << \"Error: no word or sentence provided.\" << std::endl; return 1; } sentence = word; } try { const auto dict_data = xcdat::Dictionary(dict_file); std::vector entries; for (const auto& entry : dict_data.get_index().get_entries()) { entries.emplace_back(entry.get_word(), entry.get_id()); } std::sort(entries.begin(), entries.end(), [](const Entry& a, const Entry& b) { return a.decoded_view.size() > b.decoded_view.size(); }); std::map> alternatives_map; std::vector substrings; for (const auto& entry : entries) { std::string decoded_word = std::string(entry.decoded_view); if (sentence.find(decoded_word) != std::string::npos) { substrings.push_back(decoded_word); auto it = alternatives_map.find(decoded_word); if (it == alternatives_map.end()) { alternatives_map[decoded_word] = {decoded_word}; } else { it->second.insert(decoded_word); } } } if (debug_mode) { std::string raw_output; for (const auto& entry : entries) { raw_output += std::string(entry.decoded_view) + \"\\n\"; } print_debug_info(substrings, raw_output); } wrap_html_output(substrings, alternatives_map, sentence); } catch (const std::exception& e) { std::cerr << \"Error: \" << e.what() << std::endl; return 1; } return 0; }" Debug: 05-18 16:57:38 some body finished Debug: 05-18 16:57:38 one not finished. Debug: 05-18 16:57:38 ====reading 10159 of (10159) bytes . Finished: 0 Debug: 05-18 16:57:38 ====reading 0 of (10159) bytes . Finished: 0 Debug: 05-18 16:57:38 ====reading 0 of (10159) bytes . Finished: 0 Warning: 05-18 16:57:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:57:48 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:57:48 scheme: "gdlookup" Debug: 05-18 16:57:48 host: "localhost" Debug: 05-18 16:57:48 clear current dictionaries: "違和感" Debug: 05-18 16:57:48 some body finished Debug: 05-18 16:57:48 one not finished. Debug: 05-18 16:57:48 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 16:57:48 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 16:57:48 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 16:57:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:57:58 translating from clipboard or selection Debug: 05-18 16:57:58 clipboard data: "違和感" Debug: 05-18 16:57:58 Current state: true false true true Debug: 05-18 16:57:58 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:57:58 scheme: "gdlookup" Debug: 05-18 16:57:58 host: "localhost" Debug: 05-18 16:57:58 clear current dictionaries: "違和感" Debug: 05-18 16:57:58 some body finished Debug: 05-18 16:57:58 one not finished. Debug: 05-18 16:57:58 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 16:57:58 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 16:57:58 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 16:57:58 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:58:31 translating from clipboard or selection Debug: 05-18 16:58:31 clipboard data: "" Debug: 05-18 16:58:31 Current state: true true false true Debug: 05-18 16:58:31 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:58:31 scheme: "gdlookup" Debug: 05-18 16:58:31 host: "localhost" Debug: 05-18 16:58:31 clear current dictionaries: "" Debug: 05-18 16:58:31 some body finished Debug: 05-18 16:58:31 one not finished. Debug: 05-18 16:58:31 ====reading 1448 of (1448) bytes . Finished: 0 Debug: 05-18 16:58:31 ====reading 0 of (1448) bytes . Finished: 0 Debug: 05-18 16:58:31 ====reading 0 of (1448) bytes . Finished: 0 Warning: 05-18 16:58:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:58:32 translating from clipboard or selection Debug: 05-18 16:58:32 clipboard data: "" Debug: 05-18 16:58:32 Current state: true false false true Debug: 05-18 16:58:32 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:58:32 scheme: "gdlookup" Debug: 05-18 16:58:32 host: "localhost" Debug: 05-18 16:58:32 clear current dictionaries: "" Debug: 05-18 16:58:32 some body finished Debug: 05-18 16:58:32 one not finished. Debug: 05-18 16:58:32 ====reading 1448 of (1448) bytes . Finished: 0 Debug: 05-18 16:58:32 ====reading 0 of (1448) bytes . Finished: 0 Debug: 05-18 16:58:32 ====reading 0 of (1448) bytes . Finished: 0 Warning: 05-18 16:58:32 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:58:33 translating from clipboard or selection Debug: 05-18 16:58:33 clipboard data: "" Debug: 05-18 16:58:33 Current state: true false true true Debug: 05-18 16:58:33 getResource: "gdlookup://localhost/?word=%3C!DOCTYPE html%3E%3Chtml%3E%3Chead%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:58:33 scheme: "gdlookup" Debug: 05-18 16:58:33 host: "localhost" Debug: 05-18 16:58:33 clear current dictionaries: "" Debug: 05-18 16:58:33 some body finished Debug: 05-18 16:58:33 one not finished. Debug: 05-18 16:58:33 ====reading 1448 of (1448) bytes . Finished: 0 Debug: 05-18 16:58:33 ====reading 0 of (1448) bytes . Finished: 0 Debug: 05-18 16:58:33 ====reading 0 of (1448) bytes . Finished: 0 Warning: 05-18 16:58:33 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:58:46 translating from clipboard or selection Debug: 05-18 16:58:46 clipboard data: "" Debug: 05-18 16:58:46 Current state: true false true true Debug: 05-18 16:58:46 getResource: "gdlookup://localhost/?word=%3C/head%3E%3Cbody%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:58:46 scheme: "gdlookup" Debug: 05-18 16:58:46 host: "localhost" Debug: 05-18 16:58:46 clear current dictionaries: "" Debug: 05-18 16:58:46 some body finished Debug: 05-18 16:58:46 one not finished. Debug: 05-18 16:58:46 ====reading 1428 of (1428) bytes . Finished: 0 Debug: 05-18 16:58:46 ====reading 0 of (1428) bytes . Finished: 0 Debug: 05-18 16:58:46 ====reading 0 of (1428) bytes . Finished: 0 Warning: 05-18 16:58:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:58:47 translating from clipboard or selection Debug: 05-18 16:58:47 clipboard data: "" Debug: 05-18 16:58:47 Current state: true false true true Debug: 05-18 16:58:47 getResource: "gdlookup://localhost/?word=%3C/head%3E%3Cbody%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:58:47 scheme: "gdlookup" Debug: 05-18 16:58:47 host: "localhost" Debug: 05-18 16:58:47 clear current dictionaries: "" Debug: 05-18 16:58:47 some body finished Debug: 05-18 16:58:47 one not finished. Debug: 05-18 16:58:47 ====reading 1428 of (1428) bytes . Finished: 0 Debug: 05-18 16:58:47 ====reading 0 of (1428) bytes . Finished: 0 Debug: 05-18 16:58:47 ====reading 0 of (1428) bytes . Finished: 0 Warning: 05-18 16:58:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:58:48 translating from clipboard or selection Debug: 05-18 16:58:48 clipboard data: "" Debug: 05-18 16:58:48 Current state: true false true true Debug: 05-18 16:58:48 getResource: "gdlookup://localhost/?word=%3C/head%3E%3Cbody%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:58:48 scheme: "gdlookup" Debug: 05-18 16:58:48 host: "localhost" Debug: 05-18 16:58:48 clear current dictionaries: "" Debug: 05-18 16:58:48 some body finished Debug: 05-18 16:58:48 one not finished. Debug: 05-18 16:58:48 ====reading 1428 of (1428) bytes . Finished: 0 Debug: 05-18 16:58:48 ====reading 0 of (1428) bytes . Finished: 0 Debug: 05-18 16:58:48 ====reading 0 of (1428) bytes . Finished: 0 Warning: 05-18 16:58:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:59:09 translating from clipboard or selection Debug: 05-18 16:59:09 clipboard data: " const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:59:09 Current state: true false true true Debug: 05-18 16:59:09 getResource: "gdlookup://localhost/?word=const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:59:09 scheme: "gdlookup" Debug: 05-18 16:59:09 host: "localhost" Debug: 05-18 16:59:09 clear current dictionaries: "const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \" output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:59:09 some body finished Debug: 05-18 16:59:09 one not finished. Debug: 05-18 16:59:09 ====reading 10965 of (10965) bytes . Finished: 0 Debug: 05-18 16:59:09 ====reading 0 of (10965) bytes . Finished: 0 Debug: 05-18 16:59:09 ====reading 0 of (10965) bytes . Finished: 0 Warning: 05-18 16:59:09 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:59:19 translating from clipboard or selection Debug: 05-18 16:59:19 clipboard data: " output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:59:19 Current state: true false true true Debug: 05-18 16:59:19 getResource: "gdlookup://localhost/?word=output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:59:19 scheme: "gdlookup" Debug: 05-18 16:59:19 host: "localhost" Debug: 05-18 16:59:19 clear current dictionaries: "output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:59:19 some body finished Debug: 05-18 16:59:19 one not finished. Debug: 05-18 16:59:19 ====reading 6166 of (6166) bytes . Finished: 0 Debug: 05-18 16:59:19 ====reading 0 of (6166) bytes . Finished: 0 Debug: 05-18 16:59:19 ====reading 0 of (6166) bytes . Finished: 0 Warning: 05-18 16:59:19 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:59:23 translating from clipboard or selection Debug: 05-18 16:59:23 clipboard data: "" Debug: 05-18 16:59:25 translating from clipboard or selection Debug: 05-18 16:59:25 clipboard data: " output_html += \";\n" Debug: 05-18 16:59:25 Current state: true false true true Debug: 05-18 16:59:25 getResource: "gdlookup://localhost/?word=output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:59:25 scheme: "gdlookup" Debug: 05-18 16:59:25 host: "localhost" Debug: 05-18 16:59:25 clear current dictionaries: "output_html += \";" Debug: 05-18 16:59:25 some body finished Debug: 05-18 16:59:25 one not finished. Debug: 05-18 16:59:25 ====reading 2926 of (2926) bytes . Finished: 0 Debug: 05-18 16:59:25 ====reading 0 of (2926) bytes . Finished: 0 Debug: 05-18 16:59:25 ====reading 0 of (2926) bytes . Finished: 0 Warning: 05-18 16:59:25 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:59:34 translating from clipboard or selection Debug: 05-18 16:59:34 clipboard data: " output_html += \";\n" Debug: 05-18 16:59:34 Current state: true false true true Debug: 05-18 16:59:34 getResource: "gdlookup://localhost/?word=output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:59:34 scheme: "gdlookup" Debug: 05-18 16:59:34 host: "localhost" Debug: 05-18 16:59:34 clear current dictionaries: "output_html += \";" Debug: 05-18 16:59:34 some body finished Debug: 05-18 16:59:34 one not finished. Debug: 05-18 16:59:34 ====reading 2926 of (2926) bytes . Finished: 0 Debug: 05-18 16:59:34 ====reading 0 of (2926) bytes . Finished: 0 Debug: 05-18 16:59:34 ====reading 0 of (2926) bytes . Finished: 0 Warning: 05-18 16:59:34 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:59:34 translating from clipboard or selection Debug: 05-18 16:59:35 clipboard data: " output_html += \";\n" Debug: 05-18 16:59:35 Current state: true false true true Debug: 05-18 16:59:35 getResource: "gdlookup://localhost/?word=output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:59:35 scheme: "gdlookup" Debug: 05-18 16:59:35 host: "localhost" Debug: 05-18 16:59:35 clear current dictionaries: "output_html += \";" Debug: 05-18 16:59:35 some body finished Debug: 05-18 16:59:35 one not finished. Debug: 05-18 16:59:35 ====reading 2926 of (2926) bytes . Finished: 0 Debug: 05-18 16:59:35 ====reading 0 of (2926) bytes . Finished: 0 Debug: 05-18 16:59:35 ====reading 0 of (2926) bytes . Finished: 0 Warning: 05-18 16:59:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 16:59:45 translating from clipboard or selection Debug: 05-18 16:59:45 clipboard data: "\t output_html += \";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"\"; // Close container div\n output_html += \"\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 16:59:45 Current state: true false true true Debug: 05-18 16:59:45 getResource: "gdlookup://localhost/?word=output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%3C/body%3E%3C/html%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 16:59:45 scheme: "gdlookup" Debug: 05-18 16:59:45 host: "localhost" Debug: 05-18 16:59:45 clear current dictionaries: "output_html += \"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"\"; // Close container div output_html += \"\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 16:59:45 some body finished Debug: 05-18 16:59:45 one not finished. Debug: 05-18 16:59:45 ====reading 6573 of (6573) bytes . Finished: 0 Debug: 05-18 16:59:45 ====reading 0 of (6573) bytes . Finished: 0 Debug: 05-18 16:59:45 ====reading 0 of (6573) bytes . Finished: 0 Warning: 05-18 16:59:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:00:11 translating from clipboard or selection Debug: 05-18 17:00:11 clipboard data: "class=\"hakurei\">
" Debug: 05-18 17:00:43 Current state: true false true true Debug: 05-18 17:00:43 getResource: "gdlookup://localhost/?word=%3C/div%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:00:43 scheme: "gdlookup" Debug: 05-18 17:00:43 host: "localhost" Debug: 05-18 17:00:43 clear current dictionaries: "
" Debug: 05-18 17:00:43 some body finished Debug: 05-18 17:00:43 one not finished. Debug: 05-18 17:00:43 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 17:00:43 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 17:00:43 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 17:00:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:00:43 translating from clipboard or selection Debug: 05-18 17:00:43 clipboard data: "
" Debug: 05-18 17:00:43 Current state: true false true true Debug: 05-18 17:00:43 getResource: "gdlookup://localhost/?word=%3C/div%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:00:43 scheme: "gdlookup" Debug: 05-18 17:00:43 host: "localhost" Debug: 05-18 17:00:43 clear current dictionaries: "
" Debug: 05-18 17:00:43 some body finished Debug: 05-18 17:00:43 one not finished. Debug: 05-18 17:00:43 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 17:00:43 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 17:00:43 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 17:00:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:00:46 translating from clipboard or selection Debug: 05-18 17:00:46 clipboard data: "
" Debug: 05-18 17:00:46 Current state: true false true true Debug: 05-18 17:00:46 getResource: "gdlookup://localhost/?word=%3Cdiv class%3D%22hakurei%22%3E%3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:違和%22%3E違和%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:違和%22%3E違和%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:違和感%22%3E違和感%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cstyle%3E.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D.segment %7B display: inline-block; %7D%3C/style%3E%3Cdiv class%3D%22segment%22%3E感%3C/div%3E%3C/div%3E%3C/div%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:00:46 scheme: "gdlookup" Debug: 05-18 17:00:46 host: "localhost" Debug: 05-18 17:00:46 clear current dictionaries: "
" Debug: 05-18 17:00:46 some body finished Debug: 05-18 17:00:46 one not finished. Debug: 05-18 17:00:46 ====reading 3084 of (3084) bytes . Finished: 0 Debug: 05-18 17:00:46 ====reading 0 of (3084) bytes . Finished: 0 Debug: 05-18 17:00:46 ====reading 0 of (3084) bytes . Finished: 0 Warning: 05-18 17:00:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:00:46 translating from clipboard or selection Debug: 05-18 17:00:46 clipboard data: "
" Debug: 05-18 17:00:46 Current state: true false true true Debug: 05-18 17:00:46 getResource: "gdlookup://localhost/?word=%3Cdiv class%3D%22hakurei%22%3E%3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:違和%22%3E違和%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:違和%22%3E違和%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:違和感%22%3E違和感%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cstyle%3E.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D.segment %7B display: inline-block; %7D%3C/style%3E%3Cdiv class%3D%22segment%22%3E感%3C/div%3E%3C/div%3E%3C/div%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:00:46 scheme: "gdlookup" Debug: 05-18 17:00:46 host: "localhost" Debug: 05-18 17:00:46 clear current dictionaries: "
" Debug: 05-18 17:00:46 some body finished Debug: 05-18 17:00:46 one not finished. Debug: 05-18 17:00:46 ====reading 3084 of (3084) bytes . Finished: 0 Debug: 05-18 17:00:46 ====reading 0 of (3084) bytes . Finished: 0 Debug: 05-18 17:00:46 ====reading 0 of (3084) bytes . Finished: 0 Warning: 05-18 17:00:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:00:47 translating from clipboard or selection Debug: 05-18 17:00:47 clipboard data: "
" Debug: 05-18 17:00:47 Current state: true false true true Debug: 05-18 17:00:47 getResource: "gdlookup://localhost/?word=%3Cdiv class%3D%22hakurei%22%3E%3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:違和%22%3E違和%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:違和%22%3E違和%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:違和感%22%3E違和感%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cstyle%3E.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D.segment %7B display: inline-block; %7D%3C/style%3E%3Cdiv class%3D%22segment%22%3E感%3C/div%3E%3C/div%3E%3C/div%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:00:47 scheme: "gdlookup" Debug: 05-18 17:00:47 host: "localhost" Debug: 05-18 17:00:47 clear current dictionaries: "
" Debug: 05-18 17:00:47 some body finished Debug: 05-18 17:00:47 one not finished. Debug: 05-18 17:00:47 ====reading 3084 of (3084) bytes . Finished: 0 Debug: 05-18 17:00:47 ====reading 0 of (3084) bytes . Finished: 0 Debug: 05-18 17:00:47 ====reading 0 of (3084) bytes . Finished: 0 Warning: 05-18 17:00:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:01:00 translating from clipboard or selection Debug: 05-18 17:01:00 clipboard data: "#" Debug: 05-18 17:01:00 Current state: true false true true Debug: 05-18 17:01:00 getResource: "gdlookup://localhost/?word=%23&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:01:00 scheme: "gdlookup" Debug: 05-18 17:01:00 host: "localhost" Debug: 05-18 17:01:00 clear current dictionaries: "#" Debug: 05-18 17:01:00 some body finished Debug: 05-18 17:01:00 one not finished. Debug: 05-18 17:01:00 ====reading 1404 of (1404) bytes . Finished: 0 Debug: 05-18 17:01:00 ====reading 0 of (1404) bytes . Finished: 0 Debug: 05-18 17:01:00 ====reading 0 of (1404) bytes . Finished: 0 Warning: 05-18 17:01:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:01:02 translating from clipboard or selection Debug: 05-18 17:01:02 clipboard data: "#" Debug: 05-18 17:01:02 Current state: true false true true Debug: 05-18 17:01:02 getResource: "gdlookup://localhost/?word=%23&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:01:02 scheme: "gdlookup" Debug: 05-18 17:01:02 host: "localhost" Debug: 05-18 17:01:02 clear current dictionaries: "#" Debug: 05-18 17:01:02 some body finished Debug: 05-18 17:01:02 one not finished. Debug: 05-18 17:01:02 ====reading 1404 of (1404) bytes . Finished: 0 Debug: 05-18 17:01:02 ====reading 0 of (1404) bytes . Finished: 0 Debug: 05-18 17:01:02 ====reading 0 of (1404) bytes . Finished: 0 Warning: 05-18 17:01:02 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:01:21 translating from clipboard or selection Debug: 05-18 17:01:21 clipboard data: "" Debug: 05-18 17:01:27 translating from clipboard or selection Debug: 05-18 17:01:27 clipboard data: "
" Debug: 05-18 17:01:27 Current state: true false true true Debug: 05-18 17:01:27 getResource: "gdlookup://localhost/?word=%3Cdiv class%3D%22hakurei%22%3E%3Cdiv class%3D%22container%22%3E%3Cdiv class%3D%22segment%22%3E%3Ca class%3D%22hakurei-headword%22 href%3D%22bword:違和%22%3E違和%3C/a%3E%3Cdiv class%3D%22alternatives%22%3E%3Cul%3E%3Cli%3E%3Ca href%3D%22bword:違和%22%3E違和%3C/a%3E%3C/li%3E%3Cli%3E%3Ca href%3D%22bword:違和感%22%3E違和感%3C/a%3E%3C/li%3E%3C/ul%3E%3C/div%3E%3C/div%3E%3Cstyle%3E.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D.segment %7B display: inline-block; %7D%3C/style%3E%3Cdiv class%3D%22segment%22%3E感%3C/div%3E%3C/div%3E%3C/div%3E&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:01:27 scheme: "gdlookup" Debug: 05-18 17:01:27 host: "localhost" Debug: 05-18 17:01:27 clear current dictionaries: "
" Debug: 05-18 17:01:27 some body finished Debug: 05-18 17:01:27 one not finished. Debug: 05-18 17:01:27 ====reading 3084 of (3084) bytes . Finished: 0 Debug: 05-18 17:01:27 ====reading 0 of (3084) bytes . Finished: 0 Debug: 05-18 17:01:27 ====reading 0 of (3084) bytes . Finished: 0 Warning: 05-18 17:01:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:01:31 translating from clipboard or selection Debug: 05-18 17:01:31 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 17:01:31 Current state: true false true true Debug: 05-18 17:01:31 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:01:31 scheme: "gdlookup" Debug: 05-18 17:01:31 host: "localhost" Debug: 05-18 17:01:31 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 17:01:31 some body finished Debug: 05-18 17:01:31 one not finished. Debug: 05-18 17:01:31 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 17:01:31 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 17:01:31 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 17:01:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:01:31 translating from clipboard or selection Debug: 05-18 17:01:31 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 17:01:31 Current state: true false true true Debug: 05-18 17:01:31 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:01:31 scheme: "gdlookup" Debug: 05-18 17:01:31 host: "localhost" Debug: 05-18 17:01:31 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 17:01:31 some body finished Debug: 05-18 17:01:31 one not finished. Debug: 05-18 17:01:31 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 17:01:31 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 17:01:31 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 17:01:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:01:32 translating from clipboard or selection Debug: 05-18 17:01:32 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 17:01:32 Current state: true false true true Debug: 05-18 17:01:32 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:01:32 scheme: "gdlookup" Debug: 05-18 17:01:32 host: "localhost" Debug: 05-18 17:01:32 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 17:01:32 some body finished Debug: 05-18 17:01:32 one not finished. Debug: 05-18 17:01:32 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 17:01:32 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 17:01:32 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 17:01:32 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:02:23 translating from clipboard or selection Debug: 05-18 17:02:23 clipboard data: " // Adding CSS Styles once to avoid repetition\n output_html += \"\";" Debug: 05-18 17:02:23 Current state: true false true true Debug: 05-18 17:02:23 getResource: "gdlookup://localhost/?word=// Adding CSS Styles once to avoid repetition output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:02:23 scheme: "gdlookup" Debug: 05-18 17:02:23 host: "localhost" Debug: 05-18 17:02:23 clear current dictionaries: "// Adding CSS Styles once to avoid repetition output_html += \"\";" Debug: 05-18 17:02:23 some body finished Debug: 05-18 17:02:23 one not finished. Debug: 05-18 17:02:23 ====reading 2978 of (2978) bytes . Finished: 0 Debug: 05-18 17:02:23 ====reading 0 of (2978) bytes . Finished: 0 Debug: 05-18 17:02:23 ====reading 0 of (2978) bytes . Finished: 0 Warning: 05-18 17:02:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:02:24 translating from clipboard or selection Debug: 05-18 17:02:24 clipboard data: " // Adding CSS Styles once to avoid repetition\n output_html += \"\";" Debug: 05-18 17:02:24 Current state: true false true true Debug: 05-18 17:02:24 getResource: "gdlookup://localhost/?word=// Adding CSS Styles once to avoid repetition output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:02:24 scheme: "gdlookup" Debug: 05-18 17:02:24 host: "localhost" Debug: 05-18 17:02:24 clear current dictionaries: "// Adding CSS Styles once to avoid repetition output_html += \"\";" Debug: 05-18 17:02:24 some body finished Debug: 05-18 17:02:24 one not finished. Debug: 05-18 17:02:24 ====reading 2978 of (2978) bytes . Finished: 0 Debug: 05-18 17:02:24 ====reading 0 of (2978) bytes . Finished: 0 Debug: 05-18 17:02:24 ====reading 0 of (2978) bytes . Finished: 0 Warning: 05-18 17:02:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:03:46 translating from clipboard or selection Debug: 05-18 17:03:46 clipboard data: " // Load dictionary\n xcdat::Xcdat dict;\n dict.load(dict_file);" Debug: 05-18 17:03:46 Current state: true false true true Debug: 05-18 17:03:46 getResource: "gdlookup://localhost/?word=// Load dictionary xcdat::Xcdat dict; dict.load(dict_file);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:03:46 scheme: "gdlookup" Debug: 05-18 17:03:46 host: "localhost" Debug: 05-18 17:03:46 clear current dictionaries: "// Load dictionary xcdat::Xcdat dict; dict.load(dict_file);" Debug: 05-18 17:03:46 some body finished Debug: 05-18 17:03:46 one not finished. Debug: 05-18 17:03:46 ====reading 1462 of (1462) bytes . Finished: 0 Debug: 05-18 17:03:46 ====reading 0 of (1462) bytes . Finished: 0 Debug: 05-18 17:03:46 ====reading 0 of (1462) bytes . Finished: 0 Warning: 05-18 17:03:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:04:44 translating from clipboard or selection Debug: 05-18 17:04:44 clipboard data: "https://youtu.be/nLG5e-6O8ww" Debug: 05-18 17:04:44 Current state: true false true true Debug: 05-18 17:04:44 getResource: "gdlookup://localhost/?word=https://youtu.be/nLG5e-6O8ww&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:04:44 scheme: "gdlookup" Debug: 05-18 17:04:44 host: "localhost" Debug: 05-18 17:04:44 clear current dictionaries: "https://youtu.be/nLG5e-6O8ww" Debug: 05-18 17:04:44 some body finished Debug: 05-18 17:04:44 one not finished. Debug: 05-18 17:04:44 ====reading 1431 of (1431) bytes . Finished: 0 Debug: 05-18 17:04:44 ====reading 0 of (1431) bytes . Finished: 0 Debug: 05-18 17:04:44 ====reading 0 of (1431) bytes . Finished: 0 Warning: 05-18 17:04:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:04:45 translating from clipboard or selection Debug: 05-18 17:04:45 clipboard data: "https://youtu.be/nLG5e-6O8ww" Debug: 05-18 17:04:45 Current state: true false true true Debug: 05-18 17:04:45 getResource: "gdlookup://localhost/?word=https://youtu.be/nLG5e-6O8ww&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:04:45 scheme: "gdlookup" Debug: 05-18 17:04:45 host: "localhost" Debug: 05-18 17:04:45 clear current dictionaries: "https://youtu.be/nLG5e-6O8ww" Debug: 05-18 17:04:45 some body finished Debug: 05-18 17:04:45 one not finished. Debug: 05-18 17:04:45 ====reading 1431 of (1431) bytes . Finished: 0 Debug: 05-18 17:04:45 ====reading 0 of (1431) bytes . Finished: 0 Debug: 05-18 17:04:45 ====reading 0 of (1431) bytes . Finished: 0 Warning: 05-18 17:04:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 17:17:32 translating from clipboard or selection Debug: 05-18 17:17:32 clipboard data: "@" Debug: 05-18 17:17:32 Current state: true false true true Debug: 05-18 17:17:32 getResource: "gdlookup://localhost/?word=@&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 17:17:32 scheme: "gdlookup" Debug: 05-18 17:17:32 host: "localhost" Debug: 05-18 17:17:32 clear current dictionaries: "@" Debug: 05-18 17:17:32 some body finished Debug: 05-18 17:17:32 one not finished. Debug: 05-18 17:17:32 ====reading 1404 of (1404) bytes . Finished: 0 Debug: 05-18 17:17:32 ====reading 0 of (1404) bytes . Finished: 0 Debug: 05-18 17:17:32 ====reading 0 of (1404) bytes . Finished: 0 Warning: 05-18 17:17:32 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:31:20 translating from clipboard or selection Debug: 05-18 18:31:20 clipboard data: "compre" Debug: 05-18 18:31:20 Current state: true false true true Debug: 05-18 18:31:20 getResource: "gdlookup://localhost/?word=compre&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:31:20 scheme: "gdlookup" Debug: 05-18 18:31:20 host: "localhost" Debug: 05-18 18:31:20 clear current dictionaries: "compre" Debug: 05-18 18:31:20 some body finished Debug: 05-18 18:31:20 one not finished. Debug: 05-18 18:31:20 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 18:31:20 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 18:31:20 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 18:31:20 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:35:06 translating from clipboard or selection Debug: 05-18 18:35:06 clipboard data: "350x5= " Debug: 05-18 18:35:06 Current state: true false true true Debug: 05-18 18:35:06 getResource: "gdlookup://localhost/?word=350x5%3D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:35:06 scheme: "gdlookup" Debug: 05-18 18:35:06 host: "localhost" Debug: 05-18 18:35:06 clear current dictionaries: "350x5=" Debug: 05-18 18:35:06 some body finished Debug: 05-18 18:35:06 one not finished. Debug: 05-18 18:35:06 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 18:35:06 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 18:35:06 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 18:35:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:35:12 translating from clipboard or selection Debug: 05-18 18:35:12 clipboard data: "isso eh td imposto, o ps5 " Debug: 05-18 18:35:12 Current state: true false true true Debug: 05-18 18:35:12 getResource: "gdlookup://localhost/?word=isso eh td imposto, o ps5&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:35:12 scheme: "gdlookup" Debug: 05-18 18:35:12 host: "localhost" Debug: 05-18 18:35:12 clear current dictionaries: "isso eh td imposto, o ps5" Debug: 05-18 18:35:12 some body finished Debug: 05-18 18:35:12 one not finished. Debug: 05-18 18:35:12 ====reading 1428 of (1428) bytes . Finished: 0 Debug: 05-18 18:35:12 ====reading 0 of (1428) bytes . Finished: 0 Debug: 05-18 18:35:12 ====reading 0 of (1428) bytes . Finished: 0 Warning: 05-18 18:35:12 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:35:54 translating from clipboard or selection Debug: 05-18 18:35:54 clipboard data: "essa placa de vie" Debug: 05-18 18:35:54 Current state: true false true true Debug: 05-18 18:35:54 getResource: "gdlookup://localhost/?word=essa placa de vie&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:35:54 scheme: "gdlookup" Debug: 05-18 18:35:54 host: "localhost" Debug: 05-18 18:35:54 clear current dictionaries: "essa placa de vie" Debug: 05-18 18:35:54 some body finished Debug: 05-18 18:35:54 one not finished. Debug: 05-18 18:35:54 ====reading 1420 of (1420) bytes . Finished: 0 Debug: 05-18 18:35:54 ====reading 0 of (1420) bytes . Finished: 0 Debug: 05-18 18:35:54 ====reading 0 of (1420) bytes . Finished: 0 Warning: 05-18 18:35:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:36:45 translating from clipboard or selection Debug: 05-18 18:36:45 clipboard data: "pior que eu n " Debug: 05-18 18:36:45 Current state: true false true true Debug: 05-18 18:36:45 getResource: "gdlookup://localhost/?word=pior que eu n&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:36:45 scheme: "gdlookup" Debug: 05-18 18:36:45 host: "localhost" Debug: 05-18 18:36:45 clear current dictionaries: "pior que eu n" Debug: 05-18 18:36:45 some body finished Debug: 05-18 18:36:45 one not finished. Debug: 05-18 18:36:45 ====reading 1416 of (1416) bytes . Finished: 0 Debug: 05-18 18:36:45 ====reading 0 of (1416) bytes . Finished: 0 Debug: 05-18 18:36:45 ====reading 0 of (1416) bytes . Finished: 0 Warning: 05-18 18:36:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:37:30 translating from clipboard or selection Debug: 05-18 18:37:30 clipboard data: "isso " Debug: 05-18 18:37:30 Current state: true false true true Debug: 05-18 18:37:30 getResource: "gdlookup://localhost/?word=isso&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:37:30 scheme: "gdlookup" Debug: 05-18 18:37:30 host: "localhost" Debug: 05-18 18:37:31 clear current dictionaries: "isso" Debug: 05-18 18:37:31 some body finished Debug: 05-18 18:37:31 one not finished. Debug: 05-18 18:37:31 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 18:37:31 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 18:37:31 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 18:37:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:38:47 translating from clipboard or selection Debug: 05-18 18:38:47 clipboard data: "eu nao t" Debug: 05-18 18:38:47 Current state: true false true true Debug: 05-18 18:38:47 getResource: "gdlookup://localhost/?word=eu nao t&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:38:47 scheme: "gdlookup" Debug: 05-18 18:38:47 host: "localhost" Debug: 05-18 18:38:47 clear current dictionaries: "eu nao t" Debug: 05-18 18:38:47 some body finished Debug: 05-18 18:38:47 one not finished. Debug: 05-18 18:38:47 ====reading 1411 of (1411) bytes . Finished: 0 Debug: 05-18 18:38:47 ====reading 0 of (1411) bytes . Finished: 0 Debug: 05-18 18:38:47 ====reading 0 of (1411) bytes . Finished: 0 Warning: 05-18 18:38:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 18:38:50 translating from clipboard or selection Debug: 05-18 18:38:50 clipboard data: "usei" Debug: 05-18 18:38:50 Current state: true false true true Debug: 05-18 18:38:50 getResource: "gdlookup://localhost/?word=usei&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 18:38:50 scheme: "gdlookup" Debug: 05-18 18:38:50 host: "localhost" Debug: 05-18 18:38:50 clear current dictionaries: "usei" Debug: 05-18 18:38:50 some body finished Debug: 05-18 18:38:50 one not finished. Debug: 05-18 18:38:50 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 18:38:50 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 18:38:50 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 18:38:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:31 translating from clipboard or selection Debug: 05-18 19:09:31 clipboard data: "e ta errado? kk\n" Debug: 05-18 19:09:31 Current state: true false true true Debug: 05-18 19:09:31 getResource: "gdlookup://localhost/?word=e ta errado? kk&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:31 scheme: "gdlookup" Debug: 05-18 19:09:31 host: "localhost" Debug: 05-18 19:09:31 clear current dictionaries: "e ta errado? kk" Debug: 05-18 19:09:31 some body finished Debug: 05-18 19:09:31 one not finished. Debug: 05-18 19:09:31 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 19:09:31 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 19:09:31 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 19:09:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:33 translating from clipboard or selection Debug: 05-18 19:09:33 clipboard data: "qualidade" Debug: 05-18 19:09:33 Current state: true false true true Debug: 05-18 19:09:33 getResource: "gdlookup://localhost/?word=qualidade&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:33 scheme: "gdlookup" Debug: 05-18 19:09:33 host: "localhost" Debug: 05-18 19:09:33 clear current dictionaries: "qualidade" Debug: 05-18 19:09:33 some body finished Debug: 05-18 19:09:33 one not finished. Debug: 05-18 19:09:33 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 19:09:33 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 19:09:33 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 19:09:33 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:33 translating from clipboard or selection Debug: 05-18 19:09:33 clipboard data: "saude e qualidade de comida tambem, eh foda la\n\n" Debug: 05-18 19:09:33 Current state: true false true true Debug: 05-18 19:09:33 getResource: "gdlookup://localhost/?word=saude e qualidade de comida tambem, eh foda la &group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:33 scheme: "gdlookup" Debug: 05-18 19:09:33 host: "localhost" Debug: 05-18 19:09:33 clear current dictionaries: "saude e qualidade de comida tambem, eh foda la " Debug: 05-18 19:09:33 some body finished Debug: 05-18 19:09:33 one not finished. Debug: 05-18 19:09:33 ====reading 1453 of (1453) bytes . Finished: 0 Debug: 05-18 19:09:33 ====reading 0 of (1453) bytes . Finished: 0 Debug: 05-18 19:09:33 ====reading 0 of (1453) bytes . Finished: 0 Warning: 05-18 19:09:33 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:35 translating from clipboard or selection Debug: 05-18 19:09:35 clipboard data: "o tanto de grana que ela ganha slc\n" Debug: 05-18 19:09:35 Current state: true false true true Debug: 05-18 19:09:35 getResource: "gdlookup://localhost/?word=o tanto de grana que ela ganha slc&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:35 scheme: "gdlookup" Debug: 05-18 19:09:35 host: "localhost" Debug: 05-18 19:09:35 clear current dictionaries: "o tanto de grana que ela ganha slc" Debug: 05-18 19:09:35 some body finished Debug: 05-18 19:09:35 one not finished. Debug: 05-18 19:09:35 ====reading 1437 of (1437) bytes . Finished: 0 Debug: 05-18 19:09:35 ====reading 0 of (1437) bytes . Finished: 0 Debug: 05-18 19:09:35 ====reading 0 of (1437) bytes . Finished: 0 Warning: 05-18 19:09:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:36 translating from clipboard or selection Debug: 05-18 19:09:36 clipboard data: "conheco uma veia que vai la pra ficar de baba e fazer unha delas (ela cobra uma nota)\n" Debug: 05-18 19:09:36 Current state: true false true true Debug: 05-18 19:09:36 getResource: "gdlookup://localhost/?word=conheco uma veia que vai la pra ficar de baba e fazer unha delas (ela cobra uma nota)&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:36 scheme: "gdlookup" Debug: 05-18 19:09:36 host: "localhost" Debug: 05-18 19:09:36 clear current dictionaries: "conheco uma veia que vai la pra ficar de baba e fazer unha delas (ela cobra uma nota)" Debug: 05-18 19:09:36 some body finished Debug: 05-18 19:09:36 one not finished. Debug: 05-18 19:09:36 ====reading 1488 of (1488) bytes . Finished: 0 Debug: 05-18 19:09:36 ====reading 0 of (1488) bytes . Finished: 0 Debug: 05-18 19:09:36 ====reading 0 of (1488) bytes . Finished: 0 Warning: 05-18 19:09:36 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:37 translating from clipboard or selection Debug: 05-18 19:09:37 clipboard data: "lavar privada la ja da grana kkk\n" Debug: 05-18 19:09:37 Current state: true false true true Debug: 05-18 19:09:37 getResource: "gdlookup://localhost/?word=lavar privada la ja da grana kkk&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:37 scheme: "gdlookup" Debug: 05-18 19:09:37 host: "localhost" Debug: 05-18 19:09:37 clear current dictionaries: "lavar privada la ja da grana kkk" Debug: 05-18 19:09:37 some body finished Debug: 05-18 19:09:37 one not finished. Debug: 05-18 19:09:37 ====reading 1435 of (1435) bytes . Finished: 0 Debug: 05-18 19:09:37 ====reading 0 of (1435) bytes . Finished: 0 Debug: 05-18 19:09:37 ====reading 0 of (1435) bytes . Finished: 0 Warning: 05-18 19:09:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:39 translating from clipboard or selection Debug: 05-18 19:09:39 clipboard data: "pais" Debug: 05-18 19:09:39 Current state: true false true true Debug: 05-18 19:09:39 getResource: "gdlookup://localhost/?word=pais&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:39 scheme: "gdlookup" Debug: 05-18 19:09:39 host: "localhost" Debug: 05-18 19:09:39 clear current dictionaries: "pais" Debug: 05-18 19:09:39 some body finished Debug: 05-18 19:09:39 one not finished. Debug: 05-18 19:09:39 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 19:09:39 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 19:09:39 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 19:09:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:40 translating from clipboard or selection Debug: 05-18 19:09:40 clipboard data: "a real eh que esse pais ja era, a tendencia eh a gente virar uma brazuela da vida\n\n" Debug: 05-18 19:09:40 Current state: true false true true Debug: 05-18 19:09:40 getResource: "gdlookup://localhost/?word=a real eh que esse pais ja era, a tendencia eh a gente virar uma brazuela da vida &group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:40 scheme: "gdlookup" Debug: 05-18 19:09:40 host: "localhost" Debug: 05-18 19:09:40 clear current dictionaries: "a real eh que esse pais ja era, a tendencia eh a gente virar uma brazuela da vida " Debug: 05-18 19:09:40 some body finished Debug: 05-18 19:09:40 one not finished. Debug: 05-18 19:09:40 ====reading 1488 of (1488) bytes . Finished: 0 Debug: 05-18 19:09:40 ====reading 0 of (1488) bytes . Finished: 0 Debug: 05-18 19:09:40 ====reading 0 of (1488) bytes . Finished: 0 Warning: 05-18 19:09:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:41 translating from clipboard or selection Debug: 05-18 19:09:41 clipboard data: "sem contar kabum e etc\n" Debug: 05-18 19:09:41 Current state: true false true true Debug: 05-18 19:09:41 getResource: "gdlookup://localhost/?word=sem contar kabum e etc&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:41 scheme: "gdlookup" Debug: 05-18 19:09:41 host: "localhost" Debug: 05-18 19:09:41 clear current dictionaries: "sem contar kabum e etc" Debug: 05-18 19:09:41 some body finished Debug: 05-18 19:09:41 one not finished. Debug: 05-18 19:09:41 ====reading 1425 of (1425) bytes . Finished: 0 Debug: 05-18 19:09:41 ====reading 0 of (1425) bytes . Finished: 0 Debug: 05-18 19:09:41 ====reading 0 of (1425) bytes . Finished: 0 Warning: 05-18 19:09:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:42 translating from clipboard or selection Debug: 05-18 19:09:42 clipboard data: "ai tu vai ver o mercado brasileiro: positivo, rise mode e multilaser, cobrando caro por produto merda\n" Debug: 05-18 19:09:42 Current state: true false true true Debug: 05-18 19:09:42 getResource: "gdlookup://localhost/?word=ai tu vai ver o mercado brasileiro: positivo, rise mode e multilaser, cobrando caro por produto merda&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:42 scheme: "gdlookup" Debug: 05-18 19:09:42 host: "localhost" Debug: 05-18 19:09:42 clear current dictionaries: "ai tu vai ver o mercado brasileiro: positivo, rise mode e multilaser, cobrando caro por produto merda" Debug: 05-18 19:09:42 some body finished Debug: 05-18 19:09:42 one not finished. Debug: 05-18 19:09:42 ====reading 1504 of (1504) bytes . Finished: 0 Debug: 05-18 19:09:42 ====reading 0 of (1504) bytes . Finished: 0 Debug: 05-18 19:09:42 ====reading 0 of (1504) bytes . Finished: 0 Warning: 05-18 19:09:42 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:43 translating from clipboard or selection Debug: 05-18 19:09:43 clipboard data: "nacionalismo num pais que as empresas brasileiras fazem lobby pra aumentar imposto de importacao pra \"\"\"valorizarem\"\"\" mercado brasileiro\n" Debug: 05-18 19:09:43 Current state: true false true true Debug: 05-18 19:09:43 getResource: "gdlookup://localhost/?word=nacionalismo num pais que as empresas brasileiras fazem lobby pra aumentar imposto de importacao pra %22%22%22valorizarem%22%22%22 mercado brasileiro&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:43 scheme: "gdlookup" Debug: 05-18 19:09:43 host: "localhost" Debug: 05-18 19:09:43 clear current dictionaries: "nacionalismo num pais que as empresas brasileiras fazem lobby pra aumentar imposto de importacao pra \"\"\"valorizarem\"\"\" mercado brasileiro" Debug: 05-18 19:09:43 some body finished Debug: 05-18 19:09:43 one not finished. Debug: 05-18 19:09:43 ====reading 1570 of (1570) bytes . Finished: 0 Debug: 05-18 19:09:43 ====reading 0 of (1570) bytes . Finished: 0 Debug: 05-18 19:09:43 ====reading 0 of (1570) bytes . Finished: 0 Warning: 05-18 19:09:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:46 translating from clipboard or selection Debug: 05-18 19:09:46 clipboard data: "eu tenho um lado nacionalista, mas sinceramente tem q se esforçar muito pra gostar de alguma coisa aqui\n\n" Debug: 05-18 19:09:46 Current state: true false true true Debug: 05-18 19:09:46 getResource: "gdlookup://localhost/?word=eu tenho um lado nacionalista, mas sinceramente tem q se esforçar muito pra gostar de alguma coisa aqui &group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:46 scheme: "gdlookup" Debug: 05-18 19:09:46 host: "localhost" Debug: 05-18 19:09:46 clear current dictionaries: "eu tenho um lado nacionalista, mas sinceramente tem q se esforçar muito pra gostar de alguma coisa aqui " Debug: 05-18 19:09:46 some body finished Debug: 05-18 19:09:46 one not finished. Debug: 05-18 19:09:46 ====reading 1511 of (1511) bytes . Finished: 0 Debug: 05-18 19:09:46 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 19:09:46 ====reading 0 of (1511) bytes . Finished: 0 Warning: 05-18 19:09:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:09:47 translating from clipboard or selection Debug: 05-18 19:09:47 clipboard data: "situação é cada vez mais apocaliptica\n" Debug: 05-18 19:09:47 Current state: true false true true Debug: 05-18 19:09:47 getResource: "gdlookup://localhost/?word=situação é cada vez mais apocaliptica&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:09:47 scheme: "gdlookup" Debug: 05-18 19:09:47 host: "localhost" Debug: 05-18 19:09:47 clear current dictionaries: "situação é cada vez mais apocaliptica" Debug: 05-18 19:09:47 some body finished Debug: 05-18 19:09:47 one not finished. Debug: 05-18 19:09:47 ====reading 1443 of (1443) bytes . Finished: 0 Debug: 05-18 19:09:47 ====reading 0 of (1443) bytes . Finished: 0 Debug: 05-18 19:09:47 ====reading 0 of (1443) bytes . Finished: 0 Warning: 05-18 19:09:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:11:33 translating from clipboard or selection Debug: 05-18 19:11:33 clipboard data: "situação é cada vez mais apocaliptica\n" Debug: 05-18 19:11:33 Current state: true false true true Debug: 05-18 19:11:33 getResource: "gdlookup://localhost/?word=situação é cada vez mais apocaliptica&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:11:33 scheme: "gdlookup" Debug: 05-18 19:11:33 host: "localhost" Debug: 05-18 19:11:33 clear current dictionaries: "situação é cada vez mais apocaliptica" Debug: 05-18 19:11:33 some body finished Debug: 05-18 19:11:33 one not finished. Debug: 05-18 19:11:33 ====reading 1443 of (1443) bytes . Finished: 0 Debug: 05-18 19:11:33 ====reading 0 of (1443) bytes . Finished: 0 Debug: 05-18 19:11:33 ====reading 0 of (1443) bytes . Finished: 0 Warning: 05-18 19:11:33 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:11:34 translating from clipboard or selection Debug: 05-18 19:11:34 clipboard data: "eu tenho um lado nacionalista, mas sinceramente tem q se esforçar muito pra gostar de alguma coisa aqui\n\n" Debug: 05-18 19:11:34 Current state: true false true true Debug: 05-18 19:11:34 getResource: "gdlookup://localhost/?word=eu tenho um lado nacionalista, mas sinceramente tem q se esforçar muito pra gostar de alguma coisa aqui &group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:11:34 scheme: "gdlookup" Debug: 05-18 19:11:34 host: "localhost" Debug: 05-18 19:11:34 clear current dictionaries: "eu tenho um lado nacionalista, mas sinceramente tem q se esforçar muito pra gostar de alguma coisa aqui " Debug: 05-18 19:11:34 some body finished Debug: 05-18 19:11:34 one not finished. Debug: 05-18 19:11:34 ====reading 1511 of (1511) bytes . Finished: 0 Debug: 05-18 19:11:34 ====reading 0 of (1511) bytes . Finished: 0 Debug: 05-18 19:11:34 ====reading 0 of (1511) bytes . Finished: 0 Warning: 05-18 19:11:34 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:13:39 translating from clipboard or selection Debug: 05-18 19:13:39 clipboard data: "usuario de guix" Debug: 05-18 19:13:39 Current state: true false true true Debug: 05-18 19:13:39 getResource: "gdlookup://localhost/?word=usuario de guix&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:13:39 scheme: "gdlookup" Debug: 05-18 19:13:39 host: "localhost" Debug: 05-18 19:13:39 clear current dictionaries: "usuario de guix" Debug: 05-18 19:13:39 some body finished Debug: 05-18 19:13:39 one not finished. Debug: 05-18 19:13:39 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 19:13:39 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 19:13:39 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 19:13:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:13:39 translating from clipboard or selection Debug: 05-18 19:13:39 clipboard data: "usuario de guix" Debug: 05-18 19:13:39 Current state: true false true true Debug: 05-18 19:13:39 getResource: "gdlookup://localhost/?word=usuario de guix&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:13:39 scheme: "gdlookup" Debug: 05-18 19:13:39 host: "localhost" Debug: 05-18 19:13:39 clear current dictionaries: "usuario de guix" Debug: 05-18 19:13:39 some body finished Debug: 05-18 19:13:39 one not finished. Debug: 05-18 19:13:39 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 19:13:39 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 19:13:39 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 19:13:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:13:43 translating from clipboard or selection Debug: 05-18 19:13:43 clipboard data: "usuario de guix medio" Debug: 05-18 19:13:43 Current state: true false true true Debug: 05-18 19:13:43 getResource: "gdlookup://localhost/?word=usuario de guix medio&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:13:43 scheme: "gdlookup" Debug: 05-18 19:13:43 host: "localhost" Debug: 05-18 19:13:43 clear current dictionaries: "usuario de guix medio" Debug: 05-18 19:13:43 some body finished Debug: 05-18 19:13:43 one not finished. Debug: 05-18 19:13:43 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 19:13:43 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 19:13:43 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 19:13:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:14:18 translating from clipboard or selection Debug: 05-18 19:14:18 clipboard data: "pra mim sentou na privada e encostou o pe no chao ja pode nmorar\nK\nK\n" Debug: 05-18 19:14:18 Current state: true false true true Debug: 05-18 19:14:18 getResource: "gdlookup://localhost/?word=pra mim sentou na privada e encostou o pe no chao ja pode nmorar K K&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:14:18 scheme: "gdlookup" Debug: 05-18 19:14:18 host: "localhost" Debug: 05-18 19:14:18 clear current dictionaries: "pra mim sentou na privada e encostou o pe no chao ja pode nmorar K K" Debug: 05-18 19:14:18 some body finished Debug: 05-18 19:14:18 one not finished. Debug: 05-18 19:14:18 ====reading 1477 of (1477) bytes . Finished: 0 Debug: 05-18 19:14:18 ====reading 0 of (1477) bytes . Finished: 0 Debug: 05-18 19:14:18 ====reading 0 of (1477) bytes . Finished: 0 Warning: 05-18 19:14:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:15:12 translating from clipboard or selection Debug: 05-18 19:15:12 clipboard data: "naquele video eu tava mt difere" Debug: 05-18 19:15:12 Current state: true false true true Debug: 05-18 19:15:12 getResource: "gdlookup://localhost/?word=naquele video eu tava mt difere&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:15:12 scheme: "gdlookup" Debug: 05-18 19:15:12 host: "localhost" Debug: 05-18 19:15:12 clear current dictionaries: "naquele video eu tava mt difere" Debug: 05-18 19:15:12 some body finished Debug: 05-18 19:15:12 one not finished. Debug: 05-18 19:15:12 ====reading 1434 of (1434) bytes . Finished: 0 Debug: 05-18 19:15:12 ====reading 0 of (1434) bytes . Finished: 0 Debug: 05-18 19:15:12 ====reading 0 of (1434) bytes . Finished: 0 Warning: 05-18 19:15:12 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:15:16 translating from clipboard or selection Debug: 05-18 19:15:16 clipboard data: "nera eu nao" Debug: 05-18 19:15:16 Current state: true false true true Debug: 05-18 19:15:16 getResource: "gdlookup://localhost/?word=nera eu nao&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:15:16 scheme: "gdlookup" Debug: 05-18 19:15:16 host: "localhost" Debug: 05-18 19:15:16 clear current dictionaries: "nera eu nao" Debug: 05-18 19:15:16 some body finished Debug: 05-18 19:15:16 one not finished. Debug: 05-18 19:15:16 ====reading 1414 of (1414) bytes . Finished: 0 Debug: 05-18 19:15:16 ====reading 0 of (1414) bytes . Finished: 0 Debug: 05-18 19:15:16 ====reading 0 of (1414) bytes . Finished: 0 Warning: 05-18 19:15:16 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:15:17 translating from clipboard or selection Debug: 05-18 19:15:17 clipboard data: "nera eu nao" Debug: 05-18 19:15:17 Current state: true false true true Debug: 05-18 19:15:17 getResource: "gdlookup://localhost/?word=nera eu nao&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:15:17 scheme: "gdlookup" Debug: 05-18 19:15:17 host: "localhost" Debug: 05-18 19:15:17 clear current dictionaries: "nera eu nao" Debug: 05-18 19:15:17 some body finished Debug: 05-18 19:15:17 one not finished. Debug: 05-18 19:15:17 ====reading 1414 of (1414) bytes . Finished: 0 Debug: 05-18 19:15:17 ====reading 0 of (1414) bytes . Finished: 0 Debug: 05-18 19:15:17 ====reading 0 of (1414) bytes . Finished: 0 Warning: 05-18 19:15:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:15:53 translating from clipboard or selection Debug: 05-18 19:15:53 clipboard data: "sex" Debug: 05-18 19:15:53 Current state: true false true true Debug: 05-18 19:15:53 getResource: "gdlookup://localhost/?word=sex&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:15:53 scheme: "gdlookup" Debug: 05-18 19:15:53 host: "localhost" Debug: 05-18 19:15:53 clear current dictionaries: "sex" Debug: 05-18 19:15:53 some body finished Debug: 05-18 19:15:53 one not finished. Debug: 05-18 19:15:53 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 19:15:53 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 19:15:53 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 19:15:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:17:47 translating from clipboard or selection Debug: 05-18 19:17:47 clipboard data: "eu pareco umta" Debug: 05-18 19:17:47 Current state: true false true true Debug: 05-18 19:17:47 getResource: "gdlookup://localhost/?word=eu pareco umta&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:17:47 scheme: "gdlookup" Debug: 05-18 19:17:47 host: "localhost" Debug: 05-18 19:17:47 clear current dictionaries: "eu pareco umta" Debug: 05-18 19:17:47 some body finished Debug: 05-18 19:17:47 one not finished. Debug: 05-18 19:17:47 ====reading 1417 of (1417) bytes . Finished: 0 Debug: 05-18 19:17:47 ====reading 0 of (1417) bytes . Finished: 0 Debug: 05-18 19:17:47 ====reading 0 of (1417) bytes . Finished: 0 Warning: 05-18 19:17:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:20:36 translating from clipboard or selection Debug: 05-18 19:20:36 clipboard data: "https://www.youtube.com/watch?v=zOB5QhWu1VY" Debug: 05-18 19:20:36 Current state: true false true true Debug: 05-18 19:20:36 getResource: "gdlookup://localhost/?word=https://www.youtube.com/watch?v%3DzOB5QhWu1VY&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:20:36 scheme: "gdlookup" Debug: 05-18 19:20:36 host: "localhost" Debug: 05-18 19:20:36 clear current dictionaries: "https://www.youtube.com/watch?v=zOB5QhWu1VY" Debug: 05-18 19:20:36 some body finished Debug: 05-18 19:20:36 one not finished. Debug: 05-18 19:20:36 ====reading 1446 of (1446) bytes . Finished: 0 Debug: 05-18 19:20:36 ====reading 0 of (1446) bytes . Finished: 0 Debug: 05-18 19:20:36 ====reading 0 of (1446) bytes . Finished: 0 Warning: 05-18 19:20:36 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:20:36 translating from clipboard or selection Debug: 05-18 19:20:36 clipboard data: "https://www.youtube.com/watch?v=zOB5QhWu1VY" Debug: 05-18 19:20:36 Current state: true false true true Debug: 05-18 19:20:36 getResource: "gdlookup://localhost/?word=https://www.youtube.com/watch?v%3DzOB5QhWu1VY&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:20:36 scheme: "gdlookup" Debug: 05-18 19:20:36 host: "localhost" Debug: 05-18 19:20:36 clear current dictionaries: "https://www.youtube.com/watch?v=zOB5QhWu1VY" Debug: 05-18 19:20:36 some body finished Debug: 05-18 19:20:36 one not finished. Debug: 05-18 19:20:36 ====reading 1446 of (1446) bytes . Finished: 0 Debug: 05-18 19:20:36 ====reading 0 of (1446) bytes . Finished: 0 Debug: 05-18 19:20:36 ====reading 0 of (1446) bytes . Finished: 0 Warning: 05-18 19:20:36 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:22:11 translating from clipboard or selection Debug: 05-18 19:22:11 clipboard data: "uma vez e" Debug: 05-18 19:22:11 Current state: true false true true Debug: 05-18 19:22:11 getResource: "gdlookup://localhost/?word=uma vez e&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:22:11 scheme: "gdlookup" Debug: 05-18 19:22:11 host: "localhost" Debug: 05-18 19:22:11 clear current dictionaries: "uma vez e" Debug: 05-18 19:22:11 some body finished Debug: 05-18 19:22:11 one not finished. Debug: 05-18 19:22:11 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 19:22:11 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 19:22:11 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 19:22:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:22:44 translating from clipboard or selection Debug: 05-18 19:22:44 clipboard data: "amanha vou p igreja com ela " Debug: 05-18 19:22:44 Current state: true false true true Debug: 05-18 19:22:44 getResource: "gdlookup://localhost/?word=amanha vou p igreja com ela&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:22:44 scheme: "gdlookup" Debug: 05-18 19:22:44 host: "localhost" Debug: 05-18 19:22:44 clear current dictionaries: "amanha vou p igreja com ela" Debug: 05-18 19:22:44 some body finished Debug: 05-18 19:22:44 one not finished. Debug: 05-18 19:22:44 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 19:22:44 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 19:22:44 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 19:22:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:23:06 translating from clipboard or selection Debug: 05-18 19:23:06 clipboard data: "se quiserem eh so falar q faco " Debug: 05-18 19:23:06 Current state: true false true true Debug: 05-18 19:23:06 getResource: "gdlookup://localhost/?word=se quiserem eh so falar q faco&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:23:06 scheme: "gdlookup" Debug: 05-18 19:23:06 host: "localhost" Debug: 05-18 19:23:06 clear current dictionaries: "se quiserem eh so falar q faco" Debug: 05-18 19:23:06 some body finished Debug: 05-18 19:23:06 one not finished. Debug: 05-18 19:23:06 ====reading 1433 of (1433) bytes . Finished: 0 Debug: 05-18 19:23:06 ====reading 0 of (1433) bytes . Finished: 0 Debug: 05-18 19:23:06 ====reading 0 of (1433) bytes . Finished: 0 Warning: 05-18 19:23:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:23:35 translating from clipboard or selection Debug: 05-18 19:23:35 clipboard data: "os cara e" Debug: 05-18 19:23:35 Current state: true false true true Debug: 05-18 19:23:35 getResource: "gdlookup://localhost/?word=os cara e&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:23:35 scheme: "gdlookup" Debug: 05-18 19:23:35 host: "localhost" Debug: 05-18 19:23:35 clear current dictionaries: "os cara e" Debug: 05-18 19:23:35 some body finished Debug: 05-18 19:23:35 one not finished. Debug: 05-18 19:23:35 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 19:23:35 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 19:23:35 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 19:23:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:24:44 translating from clipboard or selection Debug: 05-18 19:24:44 clipboard data: "pra mim qiamt" Debug: 05-18 19:24:44 Current state: true false true true Debug: 05-18 19:24:44 getResource: "gdlookup://localhost/?word=pra mim qiamt&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:24:44 scheme: "gdlookup" Debug: 05-18 19:24:44 host: "localhost" Debug: 05-18 19:24:44 clear current dictionaries: "pra mim qiamt" Debug: 05-18 19:24:44 some body finished Debug: 05-18 19:24:44 one not finished. Debug: 05-18 19:24:44 ====reading 1416 of (1416) bytes . Finished: 0 Debug: 05-18 19:24:44 ====reading 0 of (1416) bytes . Finished: 0 Debug: 05-18 19:24:44 ====reading 0 of (1416) bytes . Finished: 0 Warning: 05-18 19:24:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:24:45 translating from clipboard or selection Debug: 05-18 19:24:45 clipboard data: "so ouco " Debug: 05-18 19:24:45 Current state: true false true true Debug: 05-18 19:24:45 getResource: "gdlookup://localhost/?word=so ouco&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:24:45 scheme: "gdlookup" Debug: 05-18 19:24:45 host: "localhost" Debug: 05-18 19:24:45 clear current dictionaries: "so ouco" Debug: 05-18 19:24:45 some body finished Debug: 05-18 19:24:45 one not finished. Debug: 05-18 19:24:45 ====reading 1410 of (1410) bytes . Finished: 0 Debug: 05-18 19:24:45 ====reading 0 of (1410) bytes . Finished: 0 Debug: 05-18 19:24:45 ====reading 0 of (1410) bytes . Finished: 0 Warning: 05-18 19:24:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:25:35 translating from clipboard or selection Debug: 05-18 19:25:35 clipboard data: "o plot eh" Debug: 05-18 19:25:35 Current state: true false true true Debug: 05-18 19:25:35 getResource: "gdlookup://localhost/?word=o plot eh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:25:35 scheme: "gdlookup" Debug: 05-18 19:25:35 host: "localhost" Debug: 05-18 19:25:35 clear current dictionaries: "o plot eh" Debug: 05-18 19:25:35 some body finished Debug: 05-18 19:25:35 one not finished. Debug: 05-18 19:25:35 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 19:25:35 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 19:25:35 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 19:25:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:25:37 translating from clipboard or selection Debug: 05-18 19:25:37 clipboard data: "nao " Debug: 05-18 19:25:37 Current state: true false true true Debug: 05-18 19:25:37 getResource: "gdlookup://localhost/?word=nao&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:25:37 scheme: "gdlookup" Debug: 05-18 19:25:37 host: "localhost" Debug: 05-18 19:25:37 clear current dictionaries: "nao" Debug: 05-18 19:25:37 some body finished Debug: 05-18 19:25:37 one not finished. Debug: 05-18 19:25:37 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 19:25:37 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 19:25:37 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 19:25:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:25:39 translating from clipboard or selection Debug: 05-18 19:25:39 clipboard data: "eh " Debug: 05-18 19:25:39 Current state: true false true true Debug: 05-18 19:25:39 getResource: "gdlookup://localhost/?word=eh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:25:39 scheme: "gdlookup" Debug: 05-18 19:25:39 host: "localhost" Debug: 05-18 19:25:39 clear current dictionaries: "eh" Debug: 05-18 19:25:39 some body finished Debug: 05-18 19:25:39 one not finished. Debug: 05-18 19:25:39 ====reading 1405 of (1405) bytes . Finished: 0 Debug: 05-18 19:25:39 ====reading 0 of (1405) bytes . Finished: 0 Debug: 05-18 19:25:39 ====reading 0 of (1405) bytes . Finished: 0 Warning: 05-18 19:25:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:27:35 translating from clipboard or selection Debug: 05-18 19:27:35 clipboard data: "era um cara lendo a biblia " Debug: 05-18 19:27:35 Current state: true false true true Debug: 05-18 19:27:35 getResource: "gdlookup://localhost/?word=era um cara lendo a biblia&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:27:35 scheme: "gdlookup" Debug: 05-18 19:27:35 host: "localhost" Debug: 05-18 19:27:35 clear current dictionaries: "era um cara lendo a biblia" Debug: 05-18 19:27:35 some body finished Debug: 05-18 19:27:35 one not finished. Debug: 05-18 19:27:35 ====reading 1429 of (1429) bytes . Finished: 0 Debug: 05-18 19:27:35 ====reading 0 of (1429) bytes . Finished: 0 Debug: 05-18 19:27:35 ====reading 0 of (1429) bytes . Finished: 0 Warning: 05-18 19:27:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:27:57 translating from clipboard or selection Debug: 05-18 19:27:57 clipboard data: "" Debug: 05-18 19:27:59 translating from clipboard or selection Debug: 05-18 19:27:59 clipboard data: "" Debug: 05-18 19:28:01 translating from clipboard or selection Debug: 05-18 19:28:01 clipboard data: "ideos/" Debug: 05-18 19:28:01 Current state: true false true true Debug: 05-18 19:28:01 getResource: "gdlookup://localhost/?word=ideos/&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:28:01 scheme: "gdlookup" Debug: 05-18 19:28:01 host: "localhost" Debug: 05-18 19:28:01 clear current dictionaries: "ideos/" Debug: 05-18 19:28:01 some body finished Debug: 05-18 19:28:01 one not finished. Debug: 05-18 19:28:01 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 19:28:01 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 19:28:01 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 19:28:01 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:29:59 translating from clipboard or selection Debug: 05-18 19:29:59 clipboard data: "dai p" Debug: 05-18 19:29:59 Current state: true false true true Debug: 05-18 19:29:59 getResource: "gdlookup://localhost/?word=dai p&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:29:59 scheme: "gdlookup" Debug: 05-18 19:29:59 host: "localhost" Debug: 05-18 19:29:59 clear current dictionaries: "dai p" Debug: 05-18 19:29:59 some body finished Debug: 05-18 19:29:59 one not finished. Debug: 05-18 19:29:59 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 19:29:59 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 19:29:59 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 19:29:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:30:03 translating from clipboard or selection Debug: 05-18 19:30:03 clipboard data: "p mim bomba" Debug: 05-18 19:30:03 Current state: true false true true Debug: 05-18 19:30:03 getResource: "gdlookup://localhost/?word=p mim bomba&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:30:03 scheme: "gdlookup" Debug: 05-18 19:30:03 host: "localhost" Debug: 05-18 19:30:03 clear current dictionaries: "p mim bomba" Debug: 05-18 19:30:03 some body finished Debug: 05-18 19:30:03 one not finished. Debug: 05-18 19:30:03 ====reading 1414 of (1414) bytes . Finished: 0 Debug: 05-18 19:30:03 ====reading 0 of (1414) bytes . Finished: 0 Debug: 05-18 19:30:03 ====reading 0 of (1414) bytes . Finished: 0 Warning: 05-18 19:30:03 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:30:06 translating from clipboard or selection Debug: 05-18 19:30:06 clipboard data: "nao eh coin" Debug: 05-18 19:30:06 Current state: true false true true Debug: 05-18 19:30:06 getResource: "gdlookup://localhost/?word=nao eh coin&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:30:06 scheme: "gdlookup" Debug: 05-18 19:30:06 host: "localhost" Debug: 05-18 19:30:06 clear current dictionaries: "nao eh coin" Debug: 05-18 19:30:06 some body finished Debug: 05-18 19:30:06 one not finished. Debug: 05-18 19:30:06 ====reading 1414 of (1414) bytes . Finished: 0 Debug: 05-18 19:30:06 ====reading 0 of (1414) bytes . Finished: 0 Debug: 05-18 19:30:06 ====reading 0 of (1414) bytes . Finished: 0 Warning: 05-18 19:30:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:30:30 translating from clipboard or selection Debug: 05-18 19:30:30 clipboard data: "judaimos fi," Debug: 05-18 19:30:30 Current state: true false true true Debug: 05-18 19:30:30 getResource: "gdlookup://localhost/?word=judaimos fi,&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:30:30 scheme: "gdlookup" Debug: 05-18 19:30:30 host: "localhost" Debug: 05-18 19:30:30 clear current dictionaries: "judaimos fi," Debug: 05-18 19:30:30 some body finished Debug: 05-18 19:30:30 one not finished. Debug: 05-18 19:30:30 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 19:30:30 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 19:30:30 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 19:30:30 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:32:52 translating from clipboard or selection Debug: 05-18 19:32:52 clipboard data: "sex inv" Debug: 05-18 19:32:52 Current state: true false true true Debug: 05-18 19:32:52 getResource: "gdlookup://localhost/?word=sex inv&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:32:52 scheme: "gdlookup" Debug: 05-18 19:32:52 host: "localhost" Debug: 05-18 19:32:52 clear current dictionaries: "sex inv" Debug: 05-18 19:32:52 some body finished Debug: 05-18 19:32:52 one not finished. Debug: 05-18 19:32:52 ====reading 1410 of (1410) bytes . Finished: 0 Debug: 05-18 19:32:52 ====reading 0 of (1410) bytes . Finished: 0 Debug: 05-18 19:32:52 ====reading 0 of (1410) bytes . Finished: 0 Warning: 05-18 19:32:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:33:24 translating from clipboard or selection Debug: 05-18 19:33:24 clipboard data: "akai chou\"" Debug: 05-18 19:33:24 Current state: true false true true Debug: 05-18 19:33:24 getResource: "gdlookup://localhost/?word=akai chou%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:33:24 scheme: "gdlookup" Debug: 05-18 19:33:24 host: "localhost" Debug: 05-18 19:33:24 clear current dictionaries: "akai chou\"" Debug: 05-18 19:33:24 some body finished Debug: 05-18 19:33:24 one not finished. Debug: 05-18 19:33:24 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 19:33:24 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 19:33:24 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 19:33:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:33:25 translating from clipboard or selection Debug: 05-18 19:33:25 clipboard data: "\"akai chou\"" Debug: 05-18 19:33:25 Current state: true false true true Debug: 05-18 19:33:25 getResource: "gdlookup://localhost/?word=%22akai chou%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:33:25 scheme: "gdlookup" Debug: 05-18 19:33:25 host: "localhost" Debug: 05-18 19:33:25 clear current dictionaries: "\"akai chou\"" Debug: 05-18 19:33:25 some body finished Debug: 05-18 19:33:25 one not finished. Debug: 05-18 19:33:25 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 19:33:25 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 19:33:25 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 19:33:25 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:33:43 translating from clipboard or selection Debug: 05-18 19:33:43 clipboard data: "bor" Debug: 05-18 19:33:43 Current state: true false true true Debug: 05-18 19:33:43 getResource: "gdlookup://localhost/?word=bor&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:33:43 scheme: "gdlookup" Debug: 05-18 19:33:43 host: "localhost" Debug: 05-18 19:33:43 clear current dictionaries: "bor" Debug: 05-18 19:33:43 some body finished Debug: 05-18 19:33:43 one not finished. Debug: 05-18 19:33:43 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 19:33:43 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 19:33:43 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 19:33:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:34:06 translating from clipboard or selection Debug: 05-18 19:34:06 clipboard data: "principalm" Debug: 05-18 19:34:06 Current state: true false true true Debug: 05-18 19:34:06 getResource: "gdlookup://localhost/?word=principalm&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:34:06 scheme: "gdlookup" Debug: 05-18 19:34:06 host: "localhost" Debug: 05-18 19:34:06 clear current dictionaries: "principalm" Debug: 05-18 19:34:06 some body finished Debug: 05-18 19:34:06 one not finished. Debug: 05-18 19:34:06 ====reading 1413 of (1413) bytes . Finished: 0 Debug: 05-18 19:34:06 ====reading 0 of (1413) bytes . Finished: 0 Debug: 05-18 19:34:06 ====reading 0 of (1413) bytes . Finished: 0 Warning: 05-18 19:34:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:37:02 translating from clipboard or selection Debug: 05-18 19:37:02 clipboard data: "" Debug: 05-18 19:38:21 translating from clipboard or selection Debug: 05-18 19:38:21 clipboard data: "ha!\n" Debug: 05-18 19:38:21 Current state: true false true true Debug: 05-18 19:38:21 getResource: "gdlookup://localhost/?word=ha!&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:38:21 scheme: "gdlookup" Debug: 05-18 19:38:21 host: "localhost" Debug: 05-18 19:38:21 clear current dictionaries: "ha!" Debug: 05-18 19:38:21 some body finished Debug: 05-18 19:38:21 one not finished. Debug: 05-18 19:38:21 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 19:38:21 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 19:38:21 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 19:38:21 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:38:59 translating from clipboard or selection Debug: 05-18 19:38:59 clipboard data: "com" Debug: 05-18 19:38:59 Current state: true false true true Debug: 05-18 19:38:59 getResource: "gdlookup://localhost/?word=com&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:38:59 scheme: "gdlookup" Debug: 05-18 19:38:59 host: "localhost" Debug: 05-18 19:38:59 clear current dictionaries: "com" Debug: 05-18 19:38:59 some body finished Debug: 05-18 19:38:59 one not finished. Debug: 05-18 19:38:59 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 19:38:59 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 19:38:59 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 19:38:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:44:00 translating from clipboard or selection Debug: 05-18 19:44:00 clipboard data: "o agricultor" Debug: 05-18 19:44:00 Current state: true false true true Debug: 05-18 19:44:00 getResource: "gdlookup://localhost/?word=o agricultor&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:44:00 scheme: "gdlookup" Debug: 05-18 19:44:00 host: "localhost" Debug: 05-18 19:44:00 clear current dictionaries: "o agricultor" Debug: 05-18 19:44:00 some body finished Debug: 05-18 19:44:00 one not finished. Debug: 05-18 19:44:00 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 19:44:00 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 19:44:00 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 19:44:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:45:00 translating from clipboard or selection Debug: 05-18 19:45:00 clipboard data: "carr" Debug: 05-18 19:45:00 Current state: true false true true Debug: 05-18 19:45:00 getResource: "gdlookup://localhost/?word=carr&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:45:00 scheme: "gdlookup" Debug: 05-18 19:45:00 host: "localhost" Debug: 05-18 19:45:00 clear current dictionaries: "carr" Debug: 05-18 19:45:00 some body finished Debug: 05-18 19:45:00 one not finished. Debug: 05-18 19:45:00 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 19:45:00 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 19:45:00 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 19:45:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:45:17 translating from clipboard or selection Debug: 05-18 19:45:17 clipboard data: "jamais vao deixar o pobre sem nada pra fazer" Debug: 05-18 19:45:17 Current state: true false true true Debug: 05-18 19:45:17 getResource: "gdlookup://localhost/?word=jamais vao deixar o pobre sem nada pra fazer&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:45:17 scheme: "gdlookup" Debug: 05-18 19:45:17 host: "localhost" Debug: 05-18 19:45:17 clear current dictionaries: "jamais vao deixar o pobre sem nada pra fazer" Debug: 05-18 19:45:17 some body finished Debug: 05-18 19:45:17 one not finished. Debug: 05-18 19:45:17 ====reading 1447 of (1447) bytes . Finished: 0 Debug: 05-18 19:45:17 ====reading 0 of (1447) bytes . Finished: 0 Debug: 05-18 19:45:17 ====reading 0 of (1447) bytes . Finished: 0 Warning: 05-18 19:45:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:45:22 translating from clipboard or selection Debug: 05-18 19:45:22 clipboard data: "duvido " Debug: 05-18 19:45:22 Current state: true false true true Debug: 05-18 19:45:22 getResource: "gdlookup://localhost/?word=duvido&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:45:22 scheme: "gdlookup" Debug: 05-18 19:45:22 host: "localhost" Debug: 05-18 19:45:22 clear current dictionaries: "duvido" Debug: 05-18 19:45:22 some body finished Debug: 05-18 19:45:22 one not finished. Debug: 05-18 19:45:22 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 19:45:22 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 19:45:22 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 19:45:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:45:43 translating from clipboard or selection Debug: 05-18 19:45:43 clipboard data: "e msm se acontecesse, vc sabe mt bem q precisa d" Debug: 05-18 19:45:43 Current state: true false true true Debug: 05-18 19:45:43 getResource: "gdlookup://localhost/?word=e msm se acontecesse, vc sabe mt bem q precisa d&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:45:43 scheme: "gdlookup" Debug: 05-18 19:45:43 host: "localhost" Debug: 05-18 19:45:43 clear current dictionaries: "e msm se acontecesse, vc sabe mt bem q precisa d" Debug: 05-18 19:45:43 some body finished Debug: 05-18 19:45:43 one not finished. Debug: 05-18 19:45:43 ====reading 1451 of (1451) bytes . Finished: 0 Debug: 05-18 19:45:43 ====reading 0 of (1451) bytes . Finished: 0 Debug: 05-18 19:45:43 ====reading 0 of (1451) bytes . Finished: 0 Warning: 05-18 19:45:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:46:27 translating from clipboard or selection Debug: 05-18 19:46:27 clipboard data: "nao vao " Debug: 05-18 19:46:27 Current state: true false true true Debug: 05-18 19:46:27 getResource: "gdlookup://localhost/?word=nao vao&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:46:27 scheme: "gdlookup" Debug: 05-18 19:46:27 host: "localhost" Debug: 05-18 19:46:27 clear current dictionaries: "nao vao" Debug: 05-18 19:46:27 some body finished Debug: 05-18 19:46:27 one not finished. Debug: 05-18 19:46:27 ====reading 1410 of (1410) bytes . Finished: 0 Debug: 05-18 19:46:27 ====reading 0 of (1410) bytes . Finished: 0 Debug: 05-18 19:46:27 ====reading 0 of (1410) bytes . Finished: 0 Warning: 05-18 19:46:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:47:00 translating from clipboard or selection Debug: 05-18 19:47:00 clipboard data: "leve " Debug: 05-18 19:47:00 Current state: true false true true Debug: 05-18 19:47:00 getResource: "gdlookup://localhost/?word=leve&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:47:00 scheme: "gdlookup" Debug: 05-18 19:47:00 host: "localhost" Debug: 05-18 19:47:00 clear current dictionaries: "leve" Debug: 05-18 19:47:00 some body finished Debug: 05-18 19:47:00 one not finished. Debug: 05-18 19:47:00 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 19:47:00 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 19:47:00 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 19:47:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:48:53 translating from clipboard or selection Debug: 05-18 19:48:53 clipboard data: "(tenho diciomar" Debug: 05-18 19:48:53 Current state: true false true true Debug: 05-18 19:48:53 getResource: "gdlookup://localhost/?word=(tenho diciomar&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:48:53 scheme: "gdlookup" Debug: 05-18 19:48:53 host: "localhost" Debug: 05-18 19:48:53 clear current dictionaries: "(tenho diciomar" Debug: 05-18 19:48:53 some body finished Debug: 05-18 19:48:53 one not finished. Debug: 05-18 19:48:53 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 19:48:53 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 19:48:53 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 19:48:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:52:16 translating from clipboard or selection Debug: 05-18 19:52:16 clipboard data: "liberais " Debug: 05-18 19:52:16 Current state: true false true true Debug: 05-18 19:52:16 getResource: "gdlookup://localhost/?word=liberais&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:52:16 scheme: "gdlookup" Debug: 05-18 19:52:16 host: "localhost" Debug: 05-18 19:52:16 clear current dictionaries: "liberais" Debug: 05-18 19:52:16 some body finished Debug: 05-18 19:52:16 one not finished. Debug: 05-18 19:52:16 ====reading 1411 of (1411) bytes . Finished: 0 Debug: 05-18 19:52:16 ====reading 0 of (1411) bytes . Finished: 0 Debug: 05-18 19:52:16 ====reading 0 of (1411) bytes . Finished: 0 Warning: 05-18 19:52:16 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:52:22 translating from clipboard or selection Debug: 05-18 19:52:22 clipboard data: "\"let people be a\"" Debug: 05-18 19:52:22 Current state: true false true true Debug: 05-18 19:52:22 getResource: "gdlookup://localhost/?word=%22let people be a%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:52:22 scheme: "gdlookup" Debug: 05-18 19:52:22 host: "localhost" Debug: 05-18 19:52:22 clear current dictionaries: "\"let people be a\"" Debug: 05-18 19:52:22 some body finished Debug: 05-18 19:52:22 one not finished. Debug: 05-18 19:52:22 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 19:52:22 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 19:52:22 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 19:52:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:52:24 translating from clipboard or selection Debug: 05-18 19:52:24 clipboard data: "niggas" Debug: 05-18 19:52:24 Current state: true false true true Debug: 05-18 19:52:24 getResource: "gdlookup://localhost/?word=niggas&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:52:24 scheme: "gdlookup" Debug: 05-18 19:52:24 host: "localhost" Debug: 05-18 19:52:24 clear current dictionaries: "niggas" Debug: 05-18 19:52:24 some body finished Debug: 05-18 19:52:24 one not finished. Debug: 05-18 19:52:24 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 19:52:24 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 19:52:24 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 19:52:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:52:41 translating from clipboard or selection Debug: 05-18 19:52:41 clipboard data: "😢😅💞🐮🥲🤮😩🇧🇷\n" Debug: 05-18 19:52:41 Current state: true false true true Debug: 05-18 19:52:41 getResource: "gdlookup://localhost/?word=😢😅💞🐮🥲🤮😩🇧🇷&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:52:41 scheme: "gdlookup" Debug: 05-18 19:52:41 host: "localhost" Debug: 05-18 19:52:41 clear current dictionaries: "😢😅💞🐮🥲🤮😩🇧🇷" Debug: 05-18 19:52:41 some body finished Debug: 05-18 19:52:41 one not finished. Debug: 05-18 19:52:41 ====reading 1439 of (1439) bytes . Finished: 0 Debug: 05-18 19:52:41 ====reading 0 of (1439) bytes . Finished: 0 Debug: 05-18 19:52:41 ====reading 0 of (1439) bytes . Finished: 0 Warning: 05-18 19:52:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:53:40 translating from clipboard or selection Debug: 05-18 19:53:40 clipboard data: "morte" Debug: 05-18 19:53:40 Current state: true false true true Debug: 05-18 19:53:40 getResource: "gdlookup://localhost/?word=morte&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:53:40 scheme: "gdlookup" Debug: 05-18 19:53:40 host: "localhost" Debug: 05-18 19:53:40 clear current dictionaries: "morte" Debug: 05-18 19:53:40 some body finished Debug: 05-18 19:53:40 one not finished. Debug: 05-18 19:53:40 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 19:53:40 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 19:53:40 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 19:53:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:54:59 translating from clipboard or selection Debug: 05-18 19:54:59 clipboard data: "eh tipo eu ameacar um cara e ele " Debug: 05-18 19:54:59 Current state: true false true true Debug: 05-18 19:54:59 getResource: "gdlookup://localhost/?word=eh tipo eu ameacar um cara e ele&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:54:59 scheme: "gdlookup" Debug: 05-18 19:54:59 host: "localhost" Debug: 05-18 19:54:59 clear current dictionaries: "eh tipo eu ameacar um cara e ele" Debug: 05-18 19:54:59 some body finished Debug: 05-18 19:54:59 one not finished. Debug: 05-18 19:54:59 ====reading 1435 of (1435) bytes . Finished: 0 Debug: 05-18 19:54:59 ====reading 0 of (1435) bytes . Finished: 0 Debug: 05-18 19:54:59 ====reading 0 of (1435) bytes . Finished: 0 Warning: 05-18 19:54:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:55:48 translating from clipboard or selection Debug: 05-18 19:55:48 clipboard data: "precisam de alguem p" Debug: 05-18 19:55:48 Current state: true false true true Debug: 05-18 19:55:48 getResource: "gdlookup://localhost/?word=precisam de alguem p&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:55:48 scheme: "gdlookup" Debug: 05-18 19:55:48 host: "localhost" Debug: 05-18 19:55:48 clear current dictionaries: "precisam de alguem p" Debug: 05-18 19:55:48 some body finished Debug: 05-18 19:55:48 one not finished. Debug: 05-18 19:55:48 ====reading 1423 of (1423) bytes . Finished: 0 Debug: 05-18 19:55:48 ====reading 0 of (1423) bytes . Finished: 0 Debug: 05-18 19:55:48 ====reading 0 of (1423) bytes . Finished: 0 Warning: 05-18 19:55:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:56:14 translating from clipboard or selection Debug: 05-18 19:56:14 clipboard data: "no sentido de que a vida humana nao vale nadinha pra esses caras, querem so msm u" Debug: 05-18 19:56:14 Current state: true false true true Debug: 05-18 19:56:14 getResource: "gdlookup://localhost/?word=no sentido de que a vida humana nao vale nadinha pra esses caras, querem so msm u&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:56:14 scheme: "gdlookup" Debug: 05-18 19:56:14 host: "localhost" Debug: 05-18 19:56:14 clear current dictionaries: "no sentido de que a vida humana nao vale nadinha pra esses caras, querem so msm u" Debug: 05-18 19:56:14 some body finished Debug: 05-18 19:56:14 one not finished. Debug: 05-18 19:56:14 ====reading 1484 of (1484) bytes . Finished: 0 Debug: 05-18 19:56:14 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-18 19:56:14 ====reading 0 of (1484) bytes . Finished: 0 Warning: 05-18 19:56:14 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 19:57:34 translating from clipboard or selection Debug: 05-18 19:57:34 clipboard data: "n acho q foi sempre," Debug: 05-18 19:57:34 Current state: true false true true Debug: 05-18 19:57:35 getResource: "gdlookup://localhost/?word=n acho q foi sempre,&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 19:57:35 scheme: "gdlookup" Debug: 05-18 19:57:35 host: "localhost" Debug: 05-18 19:57:35 clear current dictionaries: "n acho q foi sempre," Debug: 05-18 19:57:35 some body finished Debug: 05-18 19:57:35 one not finished. Debug: 05-18 19:57:35 ====reading 1423 of (1423) bytes . Finished: 0 Debug: 05-18 19:57:35 ====reading 0 of (1423) bytes . Finished: 0 Debug: 05-18 19:57:35 ====reading 0 of (1423) bytes . Finished: 0 Warning: 05-18 19:57:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:08:14 translating from clipboard or selection Debug: 05-18 20:08:14 clipboard data: "o ego comeca quand" Debug: 05-18 20:08:14 Current state: true false true true Debug: 05-18 20:08:14 getResource: "gdlookup://localhost/?word=o ego comeca quand&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:08:14 scheme: "gdlookup" Debug: 05-18 20:08:14 host: "localhost" Debug: 05-18 20:08:14 clear current dictionaries: "o ego comeca quand" Debug: 05-18 20:08:14 some body finished Debug: 05-18 20:08:14 one not finished. Debug: 05-18 20:08:14 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 20:08:14 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 20:08:14 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 20:08:14 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:09:42 translating from clipboard or selection Debug: 05-18 20:09:42 clipboard data: "" Debug: 05-18 20:09:43 translating from clipboard or selection Debug: 05-18 20:09:43 clipboard data: "" Debug: 05-18 20:11:10 translating from clipboard or selection Debug: 05-18 20:11:10 clipboard data: "a aplicacao eh chamada por outra aplicacao e " Debug: 05-18 20:11:10 Current state: true false true true Debug: 05-18 20:11:10 getResource: "gdlookup://localhost/?word=a aplicacao eh chamada por outra aplicacao e&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:11:10 scheme: "gdlookup" Debug: 05-18 20:11:10 host: "localhost" Debug: 05-18 20:11:10 clear current dictionaries: "a aplicacao eh chamada por outra aplicacao e" Debug: 05-18 20:11:10 some body finished Debug: 05-18 20:11:10 one not finished. Debug: 05-18 20:11:10 ====reading 1447 of (1447) bytes . Finished: 0 Debug: 05-18 20:11:10 ====reading 0 of (1447) bytes . Finished: 0 Debug: 05-18 20:11:10 ====reading 0 of (1447) bytes . Finished: 0 Warning: 05-18 20:11:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:11:13 translating from clipboard or selection Debug: 05-18 20:11:13 clipboard data: "programa " Debug: 05-18 20:11:13 Current state: true false true true Debug: 05-18 20:11:13 getResource: "gdlookup://localhost/?word=programa&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:11:13 scheme: "gdlookup" Debug: 05-18 20:11:13 host: "localhost" Debug: 05-18 20:11:13 clear current dictionaries: "programa" Debug: 05-18 20:11:13 some body finished Debug: 05-18 20:11:13 one not finished. Debug: 05-18 20:11:13 ====reading 1411 of (1411) bytes . Finished: 0 Debug: 05-18 20:11:13 ====reading 0 of (1411) bytes . Finished: 0 Debug: 05-18 20:11:13 ====reading 0 of (1411) bytes . Finished: 0 Warning: 05-18 20:11:13 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:12:54 translating from clipboard or selection Debug: 05-18 20:12:54 clipboard data: "" Debug: 05-18 20:12:57 translating from clipboard or selection Debug: 05-18 20:12:57 clipboard data: "" Debug: 05-18 20:22:30 translating from clipboard or selection Debug: 05-18 20:22:30 clipboard data: "nunca" Debug: 05-18 20:22:30 Current state: true false true true Debug: 05-18 20:22:30 getResource: "gdlookup://localhost/?word=nunca&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:22:30 scheme: "gdlookup" Debug: 05-18 20:22:30 host: "localhost" Debug: 05-18 20:22:30 clear current dictionaries: "nunca" Debug: 05-18 20:22:30 some body finished Debug: 05-18 20:22:30 one not finished. Debug: 05-18 20:22:30 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 20:22:30 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 20:22:30 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 20:22:30 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:24:45 translating from clipboard or selection Debug: 05-18 20:24:45 clipboard data: "resistir a isso eh " Debug: 05-18 20:24:45 Current state: true false true true Debug: 05-18 20:24:45 getResource: "gdlookup://localhost/?word=resistir a isso eh&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:24:45 scheme: "gdlookup" Debug: 05-18 20:24:45 host: "localhost" Debug: 05-18 20:24:45 clear current dictionaries: "resistir a isso eh" Debug: 05-18 20:24:45 some body finished Debug: 05-18 20:24:45 one not finished. Debug: 05-18 20:24:45 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 20:24:45 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 20:24:45 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 20:24:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:25:26 translating from clipboard or selection Debug: 05-18 20:25:26 clipboard data: "lost of personality " Debug: 05-18 20:25:26 Current state: true false true true Debug: 05-18 20:25:26 getResource: "gdlookup://localhost/?word=lost of personality&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:25:26 scheme: "gdlookup" Debug: 05-18 20:25:26 host: "localhost" Debug: 05-18 20:25:26 clear current dictionaries: "lost of personality" Debug: 05-18 20:25:26 some body finished Debug: 05-18 20:25:26 one not finished. Debug: 05-18 20:25:26 ====reading 1422 of (1422) bytes . Finished: 0 Debug: 05-18 20:25:26 ====reading 0 of (1422) bytes . Finished: 0 Debug: 05-18 20:25:26 ====reading 0 of (1422) bytes . Finished: 0 Warning: 05-18 20:25:26 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:25:26 translating from clipboard or selection Debug: 05-18 20:25:26 clipboard data: "lost of personality " Debug: 05-18 20:25:26 Current state: true false true true Debug: 05-18 20:25:26 getResource: "gdlookup://localhost/?word=lost of personality&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:25:26 scheme: "gdlookup" Debug: 05-18 20:25:26 host: "localhost" Debug: 05-18 20:25:26 clear current dictionaries: "lost of personality" Debug: 05-18 20:25:26 some body finished Debug: 05-18 20:25:26 one not finished. Debug: 05-18 20:25:26 ====reading 1422 of (1422) bytes . Finished: 0 Debug: 05-18 20:25:26 ====reading 0 of (1422) bytes . Finished: 0 Debug: 05-18 20:25:26 ====reading 0 of (1422) bytes . Finished: 0 Warning: 05-18 20:25:26 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:26:27 translating from clipboard or selection Debug: 05-18 20:26:27 clipboard data: "This" Debug: 05-18 20:26:27 Current state: true false true true Debug: 05-18 20:26:27 getResource: "gdlookup://localhost/?word=This&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:26:27 scheme: "gdlookup" Debug: 05-18 20:26:27 host: "localhost" Debug: 05-18 20:26:27 clear current dictionaries: "This" Debug: 05-18 20:26:27 some body finished Debug: 05-18 20:26:27 one not finished. Debug: 05-18 20:26:27 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 20:26:27 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 20:26:27 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 20:26:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:26:52 translating from clipboard or selection Debug: 05-18 20:26:52 clipboard data: "ou vc ama voce, ou vc " Debug: 05-18 20:26:52 Current state: true false true true Debug: 05-18 20:26:52 getResource: "gdlookup://localhost/?word=ou vc ama voce, ou vc&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:26:52 scheme: "gdlookup" Debug: 05-18 20:26:52 host: "localhost" Debug: 05-18 20:26:52 clear current dictionaries: "ou vc ama voce, ou vc" Debug: 05-18 20:26:52 some body finished Debug: 05-18 20:26:52 one not finished. Debug: 05-18 20:26:52 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 20:26:52 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 20:26:52 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 20:26:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:26:59 translating from clipboard or selection Debug: 05-18 20:26:59 clipboard data: "n adi" Debug: 05-18 20:26:59 Current state: true false true true Debug: 05-18 20:26:59 getResource: "gdlookup://localhost/?word=n adi&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:26:59 scheme: "gdlookup" Debug: 05-18 20:26:59 host: "localhost" Debug: 05-18 20:26:59 clear current dictionaries: "n adi" Debug: 05-18 20:26:59 some body finished Debug: 05-18 20:26:59 one not finished. Debug: 05-18 20:26:59 ====reading 1408 of (1408) bytes . Finished: 0 Debug: 05-18 20:26:59 ====reading 0 of (1408) bytes . Finished: 0 Debug: 05-18 20:26:59 ====reading 0 of (1408) bytes . Finished: 0 Warning: 05-18 20:26:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:27:01 translating from clipboard or selection Debug: 05-18 20:27:01 clipboard data: "n adianta " Debug: 05-18 20:27:01 Current state: true false true true Debug: 05-18 20:27:01 getResource: "gdlookup://localhost/?word=n adianta&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:27:01 scheme: "gdlookup" Debug: 05-18 20:27:01 host: "localhost" Debug: 05-18 20:27:01 clear current dictionaries: "n adianta" Debug: 05-18 20:27:01 some body finished Debug: 05-18 20:27:01 one not finished. Debug: 05-18 20:27:01 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:27:01 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:27:01 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:27:01 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:28:00 translating from clipboard or selection Debug: 05-18 20:28:00 clipboard data: "ate hoje psessa" Debug: 05-18 20:28:00 Current state: true false true true Debug: 05-18 20:28:00 getResource: "gdlookup://localhost/?word=ate hoje psessa&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:28:00 scheme: "gdlookup" Debug: 05-18 20:28:00 host: "localhost" Debug: 05-18 20:28:00 clear current dictionaries: "ate hoje psessa" Debug: 05-18 20:28:00 some body finished Debug: 05-18 20:28:00 one not finished. Debug: 05-18 20:28:00 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 20:28:00 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 20:28:00 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 20:28:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:28:06 translating from clipboard or selection Debug: 05-18 20:28:06 clipboard data: "mas dai eu sei mt bem" Debug: 05-18 20:28:06 Current state: true false true true Debug: 05-18 20:28:06 getResource: "gdlookup://localhost/?word=mas dai eu sei mt bem&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:28:06 scheme: "gdlookup" Debug: 05-18 20:28:06 host: "localhost" Debug: 05-18 20:28:06 clear current dictionaries: "mas dai eu sei mt bem" Debug: 05-18 20:28:06 some body finished Debug: 05-18 20:28:06 one not finished. Debug: 05-18 20:28:06 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 20:28:06 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 20:28:06 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 20:28:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:29:46 translating from clipboard or selection Debug: 05-18 20:29:46 clipboard data: "minha familia sabe que eu levo is" Debug: 05-18 20:29:46 Current state: true false true true Debug: 05-18 20:29:46 getResource: "gdlookup://localhost/?word=minha familia sabe que eu levo is&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:29:46 scheme: "gdlookup" Debug: 05-18 20:29:46 host: "localhost" Debug: 05-18 20:29:46 clear current dictionaries: "minha familia sabe que eu levo is" Debug: 05-18 20:29:46 some body finished Debug: 05-18 20:29:46 one not finished. Debug: 05-18 20:29:46 ====reading 1436 of (1436) bytes . Finished: 0 Debug: 05-18 20:29:46 ====reading 0 of (1436) bytes . Finished: 0 Debug: 05-18 20:29:46 ====reading 0 of (1436) bytes . Finished: 0 Warning: 05-18 20:29:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:29:59 translating from clipboard or selection Debug: 05-18 20:29:59 clipboard data: "bem, nunca liguei pra conquistar respeito, isso nao me " Debug: 05-18 20:29:59 Current state: true false true true Debug: 05-18 20:29:59 getResource: "gdlookup://localhost/?word=bem, nunca liguei pra conquistar respeito, isso nao me&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:29:59 scheme: "gdlookup" Debug: 05-18 20:29:59 host: "localhost" Debug: 05-18 20:29:59 clear current dictionaries: "bem, nunca liguei pra conquistar respeito, isso nao me" Debug: 05-18 20:29:59 some body finished Debug: 05-18 20:29:59 one not finished. Debug: 05-18 20:29:59 ====reading 1457 of (1457) bytes . Finished: 0 Debug: 05-18 20:29:59 ====reading 0 of (1457) bytes . Finished: 0 Debug: 05-18 20:29:59 ====reading 0 of (1457) bytes . Finished: 0 Warning: 05-18 20:29:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:34:56 translating from clipboard or selection Debug: 05-18 20:34:56 clipboard data: "\"teu marido pegou gonorreia!\"\nui que emocao " Debug: 05-18 20:34:56 Current state: true false true true Debug: 05-18 20:34:56 getResource: "gdlookup://localhost/?word=%22teu marido pegou gonorreia!%22 ui que emocao&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:34:56 scheme: "gdlookup" Debug: 05-18 20:34:56 host: "localhost" Debug: 05-18 20:34:56 clear current dictionaries: "\"teu marido pegou gonorreia!\" ui que emocao" Debug: 05-18 20:34:56 some body finished Debug: 05-18 20:34:56 one not finished. Debug: 05-18 20:34:56 ====reading 1456 of (1456) bytes . Finished: 0 Debug: 05-18 20:34:56 ====reading 0 of (1456) bytes . Finished: 0 Debug: 05-18 20:34:56 ====reading 0 of (1456) bytes . Finished: 0 Warning: 05-18 20:34:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:35:19 translating from clipboard or selection Debug: 05-18 20:35:19 clipboard data: "libof68651@fincainc.com" Debug: 05-18 20:35:19 Current state: true false true true Debug: 05-18 20:35:19 getResource: "gdlookup://localhost/?word=libof68651@fincainc.com&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:35:19 scheme: "gdlookup" Debug: 05-18 20:35:19 host: "localhost" Debug: 05-18 20:35:19 clear current dictionaries: "libof68651@fincainc.com" Debug: 05-18 20:35:19 some body finished Debug: 05-18 20:35:19 one not finished. Debug: 05-18 20:35:19 ====reading 1426 of (1426) bytes . Finished: 0 Debug: 05-18 20:35:19 ====reading 0 of (1426) bytes . Finished: 0 Debug: 05-18 20:35:19 ====reading 0 of (1426) bytes . Finished: 0 Warning: 05-18 20:35:19 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:37:44 translating from clipboard or selection Debug: 05-18 20:37:44 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:37:44 Current state: true false true true Debug: 05-18 20:37:44 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:37:44 scheme: "gdlookup" Debug: 05-18 20:37:44 host: "localhost" Debug: 05-18 20:37:44 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:37:44 some body finished Debug: 05-18 20:37:44 one not finished. Debug: 05-18 20:37:44 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 20:37:44 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 20:37:44 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 20:37:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:37:44 translating from clipboard or selection Debug: 05-18 20:37:44 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:37:44 Current state: true false true true Debug: 05-18 20:37:44 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:37:44 scheme: "gdlookup" Debug: 05-18 20:37:44 host: "localhost" Debug: 05-18 20:37:44 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:37:44 some body finished Debug: 05-18 20:37:44 one not finished. Debug: 05-18 20:37:44 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 20:37:44 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 20:37:44 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 20:37:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:37:45 translating from clipboard or selection Debug: 05-18 20:37:45 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:37:45 Current state: true false true true Debug: 05-18 20:37:45 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:37:45 scheme: "gdlookup" Debug: 05-18 20:37:45 host: "localhost" Debug: 05-18 20:37:45 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:37:45 some body finished Debug: 05-18 20:37:45 one not finished. Debug: 05-18 20:37:45 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 20:37:45 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 20:37:45 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 20:37:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:39:40 translating from clipboard or selection Debug: 05-18 20:39:40 clipboard data: "turn the whole " Debug: 05-18 20:39:40 Current state: true false true true Debug: 05-18 20:39:40 getResource: "gdlookup://localhost/?word=turn the whole&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:39:40 scheme: "gdlookup" Debug: 05-18 20:39:40 host: "localhost" Debug: 05-18 20:39:40 clear current dictionaries: "turn the whole" Debug: 05-18 20:39:40 some body finished Debug: 05-18 20:39:40 one not finished. Debug: 05-18 20:39:40 ====reading 1417 of (1417) bytes . Finished: 0 Debug: 05-18 20:39:40 ====reading 0 of (1417) bytes . Finished: 0 Debug: 05-18 20:39:40 ====reading 0 of (1417) bytes . Finished: 0 Warning: 05-18 20:39:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:39:45 translating from clipboard or selection Debug: 05-18 20:39:45 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include // Include for file operations\n#include // Include for getting the current time\n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution() {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Error: Unable to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n log_execution(); // Log the execution\n\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:39:45 Current state: true false true true Debug: 05-18 20:39:45 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E // Include for file operations %23include %3Cctime%3E // Include for getting the current time // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution() %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Error: Unable to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file.close(); %7D int main(const int argc, char* argv[]) %7B log_execution(); // Log the execution bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:39:45 scheme: "gdlookup" Debug: 05-18 20:39:45 host: "localhost" Debug: 05-18 20:39:45 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include // Include for file operations #include // Include for getting the current time // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution() { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Error: Unable to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file.close(); } int main(const int argc, char* argv[]) { log_execution(); // Log the execution bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:39:45 some body finished Debug: 05-18 20:39:45 one not finished. Debug: 05-18 20:39:45 ====reading 11826 of (11826) bytes . Finished: 0 Debug: 05-18 20:39:45 ====reading 0 of (11826) bytes . Finished: 0 Debug: 05-18 20:39:45 ====reading 0 of (11826) bytes . Finished: 0 Warning: 05-18 20:39:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:39:47 translating from clipboard or selection Debug: 05-18 20:39:47 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:39:47 Current state: true false true true Debug: 05-18 20:39:47 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:39:47 scheme: "gdlookup" Debug: 05-18 20:39:47 host: "localhost" Debug: 05-18 20:39:47 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:39:47 some body finished Debug: 05-18 20:39:47 one not finished. Debug: 05-18 20:39:47 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 20:39:47 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 20:39:47 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 20:39:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:39:48 translating from clipboard or selection Debug: 05-18 20:39:48 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t // Skip the next argument as it's the dictionary file path\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
\" + substring + \"\";\n\n\t// Adding alternatives for the current substring\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
    \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
  • \" + alt + \"
  • \";\n\t }\n\t output_html += \"
\";\n\t}\n\n\toutput_html += \"
\"; // Close segment div\n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:39:48 Current state: true false true true Debug: 05-18 20:39:48 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:39:48 scheme: "gdlookup" Debug: 05-18 20:39:48 host: "localhost" Debug: 05-18 20:39:48 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:39:48 some body finished Debug: 05-18 20:39:48 one not finished. Debug: 05-18 20:39:48 ====reading 11307 of (11307) bytes . Finished: 0 Debug: 05-18 20:39:48 ====reading 0 of (11307) bytes . Finished: 0 Debug: 05-18 20:39:48 ====reading 0 of (11307) bytes . Finished: 0 Warning: 05-18 20:39:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:40:15 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:40:15 scheme: "gdlookup" Debug: 05-18 20:40:15 host: "localhost" Debug: 05-18 20:40:15 clear current dictionaries: "違和感" Debug: 05-18 20:40:15 some body finished Debug: 05-18 20:40:15 one not finished. Debug: 05-18 20:40:15 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:15 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:15 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:40:15 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:40:20 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:40:20 scheme: "gdlookup" Debug: 05-18 20:40:20 host: "localhost" Debug: 05-18 20:40:20 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:40:20 some body finished Debug: 05-18 20:40:20 one not finished. Debug: 05-18 20:40:20 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:40:20 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:40:20 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:40:20 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:40:21 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:40:21 scheme: "gdlookup" Debug: 05-18 20:40:21 host: "localhost" Debug: 05-18 20:40:21 clear current dictionaries: "違和感" Debug: 05-18 20:40:21 some body finished Debug: 05-18 20:40:21 one not finished. Debug: 05-18 20:40:21 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:21 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:21 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:40:21 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:40:22 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:40:22 scheme: "gdlookup" Debug: 05-18 20:40:22 host: "localhost" Debug: 05-18 20:40:22 clear current dictionaries: "違和感" Debug: 05-18 20:40:22 some body finished Debug: 05-18 20:40:22 one not finished. Debug: 05-18 20:40:22 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:22 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:22 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:40:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:40:23 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:40:23 scheme: "gdlookup" Debug: 05-18 20:40:23 host: "localhost" Debug: 05-18 20:40:23 clear current dictionaries: "違和感" Debug: 05-18 20:40:23 some body finished Debug: 05-18 20:40:23 one not finished. Debug: 05-18 20:40:23 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:23 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:23 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:40:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:40:25 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:40:25 scheme: "gdlookup" Debug: 05-18 20:40:25 host: "localhost" Debug: 05-18 20:40:25 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:40:25 some body finished Debug: 05-18 20:40:25 one not finished. Debug: 05-18 20:40:25 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:40:25 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:40:25 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:40:25 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:40:27 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:40:27 scheme: "gdlookup" Debug: 05-18 20:40:27 host: "localhost" Debug: 05-18 20:40:27 clear current dictionaries: "違和感" Debug: 05-18 20:40:27 some body finished Debug: 05-18 20:40:27 one not finished. Debug: 05-18 20:40:27 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:27 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:40:27 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:40:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:24 translating from clipboard or selection Debug: 05-18 20:42:24 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include // Include for file operations\n#include // Include for getting the current time\n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:42:24 Current state: true true false true Debug: 05-18 20:42:24 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E // Include for file operations %23include %3Cctime%3E // Include for getting the current time // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:24 scheme: "gdlookup" Debug: 05-18 20:42:24 host: "localhost" Debug: 05-18 20:42:24 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include // Include for file operations #include // Include for getting the current time // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:42:24 some body finished Debug: 05-18 20:42:24 one not finished. Debug: 05-18 20:42:24 ====reading 12658 of (12658) bytes . Finished: 0 Debug: 05-18 20:42:24 ====reading 0 of (12658) bytes . Finished: 0 Debug: 05-18 20:42:24 ====reading 0 of (12658) bytes . Finished: 0 Warning: 05-18 20:42:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:27 translating from clipboard or selection Debug: 05-18 20:42:27 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include // Include for file operations\n#include // Include for getting the current time\n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution() {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Error: Unable to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n log_execution(); // Log the execution\n\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:42:27 Current state: true false false true Debug: 05-18 20:42:27 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E // Include for file operations %23include %3Cctime%3E // Include for getting the current time // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution() %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Error: Unable to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file.close(); %7D int main(const int argc, char* argv[]) %7B log_execution(); // Log the execution bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:27 scheme: "gdlookup" Debug: 05-18 20:42:27 host: "localhost" Debug: 05-18 20:42:27 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include // Include for file operations #include // Include for getting the current time // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution() { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Error: Unable to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file.close(); } int main(const int argc, char* argv[]) { log_execution(); // Log the execution bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:42:27 some body finished Debug: 05-18 20:42:27 one not finished. Debug: 05-18 20:42:27 ====reading 11826 of (11826) bytes . Finished: 0 Debug: 05-18 20:42:27 ====reading 0 of (11826) bytes . Finished: 0 Debug: 05-18 20:42:27 ====reading 0 of (11826) bytes . Finished: 0 Warning: 05-18 20:42:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:28 translating from clipboard or selection Debug: 05-18 20:42:28 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include // Include for file operations\n#include // Include for getting the current time\n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution() {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Error: Unable to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n log_execution(); // Log the execution\n\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:42:28 Current state: true false true true Debug: 05-18 20:42:28 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E // Include for file operations %23include %3Cctime%3E // Include for getting the current time // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution() %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Error: Unable to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file.close(); %7D int main(const int argc, char* argv[]) %7B log_execution(); // Log the execution bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:28 scheme: "gdlookup" Debug: 05-18 20:42:28 host: "localhost" Debug: 05-18 20:42:28 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include // Include for file operations #include // Include for getting the current time // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution() { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Error: Unable to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file.close(); } int main(const int argc, char* argv[]) { log_execution(); // Log the execution bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:42:28 some body finished Debug: 05-18 20:42:28 one not finished. Debug: 05-18 20:42:28 ====reading 11826 of (11826) bytes . Finished: 0 Debug: 05-18 20:42:28 ====reading 0 of (11826) bytes . Finished: 0 Debug: 05-18 20:42:28 ====reading 0 of (11826) bytes . Finished: 0 Warning: 05-18 20:42:28 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:38 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:38 scheme: "gdlookup" Debug: 05-18 20:42:38 host: "localhost" Debug: 05-18 20:42:38 clear current dictionaries: "違和感" Debug: 05-18 20:42:38 some body finished Debug: 05-18 20:42:38 one not finished. Debug: 05-18 20:42:38 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:38 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:38 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:42:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:39 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:39 scheme: "gdlookup" Debug: 05-18 20:42:39 host: "localhost" Debug: 05-18 20:42:39 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:42:39 some body finished Debug: 05-18 20:42:39 one not finished. Debug: 05-18 20:42:39 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:39 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:39 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:42:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:40 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:40 scheme: "gdlookup" Debug: 05-18 20:42:40 host: "localhost" Debug: 05-18 20:42:40 clear current dictionaries: "違和感" Debug: 05-18 20:42:40 some body finished Debug: 05-18 20:42:40 one not finished. Debug: 05-18 20:42:40 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:40 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:40 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:42:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:40 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:40 scheme: "gdlookup" Debug: 05-18 20:42:40 host: "localhost" Debug: 05-18 20:42:40 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:42:40 some body finished Debug: 05-18 20:42:40 one not finished. Debug: 05-18 20:42:40 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:40 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:40 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:42:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:41 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:41 scheme: "gdlookup" Debug: 05-18 20:42:41 host: "localhost" Debug: 05-18 20:42:41 clear current dictionaries: "違和感" Debug: 05-18 20:42:41 some body finished Debug: 05-18 20:42:41 one not finished. Debug: 05-18 20:42:41 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:41 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:41 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:42:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:42 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:42 scheme: "gdlookup" Debug: 05-18 20:42:42 host: "localhost" Debug: 05-18 20:42:42 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:42:42 some body finished Debug: 05-18 20:42:42 one not finished. Debug: 05-18 20:42:42 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:42 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:42 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:42:42 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:42 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:42 scheme: "gdlookup" Debug: 05-18 20:42:42 host: "localhost" Debug: 05-18 20:42:42 clear current dictionaries: "違和感" Debug: 05-18 20:42:42 some body finished Debug: 05-18 20:42:42 one not finished. Debug: 05-18 20:42:42 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:42 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:42 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:42:42 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:48 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:48 scheme: "gdlookup" Debug: 05-18 20:42:48 host: "localhost" Debug: 05-18 20:42:48 clear current dictionaries: "ゆっくり" Debug: 05-18 20:42:48 some body finished Debug: 05-18 20:42:48 one not finished. Debug: 05-18 20:42:48 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 20:42:48 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 20:42:48 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 20:42:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:48 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:48 scheme: "gdlookup" Debug: 05-18 20:42:48 host: "localhost" Debug: 05-18 20:42:48 clear current dictionaries: "違和感" Debug: 05-18 20:42:48 some body finished Debug: 05-18 20:42:48 one not finished. Debug: 05-18 20:42:48 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:48 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:42:48 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:42:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:53 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:53 scheme: "gdlookup" Debug: 05-18 20:42:53 host: "localhost" Debug: 05-18 20:42:53 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:42:53 some body finished Debug: 05-18 20:42:53 one not finished. Debug: 05-18 20:42:53 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:53 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:53 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:42:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:42:54 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:42:54 scheme: "gdlookup" Debug: 05-18 20:42:54 host: "localhost" Debug: 05-18 20:42:54 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:42:54 some body finished Debug: 05-18 20:42:54 one not finished. Debug: 05-18 20:42:54 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:54 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:42:54 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:42:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:43:00 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:43:00 scheme: "gdlookup" Debug: 05-18 20:43:00 host: "localhost" Debug: 05-18 20:43:00 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:43:00 some body finished Debug: 05-18 20:43:00 one not finished. Debug: 05-18 20:43:00 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:43:00 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:43:00 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:43:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:43:03 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:43:03 scheme: "gdlookup" Debug: 05-18 20:43:03 host: "localhost" Debug: 05-18 20:43:03 clear current dictionaries: "違和感" Debug: 05-18 20:43:03 some body finished Debug: 05-18 20:43:03 one not finished. Debug: 05-18 20:43:03 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:43:03 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:43:03 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:43:03 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:43:04 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:43:04 scheme: "gdlookup" Debug: 05-18 20:43:04 host: "localhost" Debug: 05-18 20:43:04 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:43:04 some body finished Debug: 05-18 20:43:04 one not finished. Debug: 05-18 20:43:04 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:43:04 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:43:04 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:43:04 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:43:06 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:43:06 scheme: "gdlookup" Debug: 05-18 20:43:06 host: "localhost" Debug: 05-18 20:43:06 clear current dictionaries: "違和感" Debug: 05-18 20:43:06 some body finished Debug: 05-18 20:43:06 one not finished. Debug: 05-18 20:43:06 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:43:06 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:43:06 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:43:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:43:06 getResource: "gdlookup://localhost/?word=reproductible&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:43:06 scheme: "gdlookup" Debug: 05-18 20:43:06 host: "localhost" Debug: 05-18 20:43:06 clear current dictionaries: "reproductible" Debug: 05-18 20:43:06 some body finished Debug: 05-18 20:43:06 one not finished. Debug: 05-18 20:43:06 ====reading 1416 of (1416) bytes . Finished: 0 Debug: 05-18 20:43:06 ====reading 0 of (1416) bytes . Finished: 0 Debug: 05-18 20:43:06 ====reading 0 of (1416) bytes . Finished: 0 Warning: 05-18 20:43:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:43:50 translating from clipboard or selection Debug: 05-18 20:43:50 clipboard data: "eh o dialogo de " Debug: 05-18 20:43:50 Current state: true true false true Debug: 05-18 20:43:50 getResource: "gdlookup://localhost/?word=eh o dialogo de&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:43:50 scheme: "gdlookup" Debug: 05-18 20:43:50 host: "localhost" Debug: 05-18 20:43:50 clear current dictionaries: "eh o dialogo de" Debug: 05-18 20:43:50 some body finished Debug: 05-18 20:43:50 one not finished. Debug: 05-18 20:43:50 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 20:43:50 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 20:43:50 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 20:43:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:44:39 translating from clipboard or selection Debug: 05-18 20:44:39 clipboard data: "自分宛てに" Debug: 05-18 20:44:39 Current state: true false false true Debug: 05-18 20:44:39 getResource: "gdlookup://localhost/?word=自分宛てに&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:44:39 scheme: "gdlookup" Debug: 05-18 20:44:39 host: "localhost" Debug: 05-18 20:44:39 clear current dictionaries: "自分宛てに" Debug: 05-18 20:44:39 some body finished Debug: 05-18 20:44:39 one not finished. Debug: 05-18 20:44:39 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 20:44:39 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 20:44:39 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 20:44:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:45:28 translating from clipboard or selection Debug: 05-18 20:45:28 clipboard data: "Texto Platão_Mênon" Debug: 05-18 20:45:28 Current state: true false true true Debug: 05-18 20:45:28 getResource: "gdlookup://localhost/?word=Texto Platão_Mênon&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:45:28 scheme: "gdlookup" Debug: 05-18 20:45:28 host: "localhost" Debug: 05-18 20:45:28 clear current dictionaries: "Texto Platão_Mênon" Debug: 05-18 20:45:28 some body finished Debug: 05-18 20:45:28 one not finished. Debug: 05-18 20:45:28 ====reading 1423 of (1423) bytes . Finished: 0 Debug: 05-18 20:45:28 ====reading 0 of (1423) bytes . Finished: 0 Debug: 05-18 20:45:28 ====reading 0 of (1423) bytes . Finished: 0 Warning: 05-18 20:45:28 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:45:30 translating from clipboard or selection Debug: 05-18 20:45:30 clipboard data: "" Debug: 05-18 20:45:46 translating from clipboard or selection Debug: 05-18 20:45:46 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:45:46 Current state: true false true true Debug: 05-18 20:45:46 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:45:46 scheme: "gdlookup" Debug: 05-18 20:45:46 host: "localhost" Debug: 05-18 20:45:46 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:45:46 some body finished Debug: 05-18 20:45:46 one not finished. Debug: 05-18 20:45:46 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:45:46 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:45:46 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:45:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:45:51 translating from clipboard or selection Debug: 05-18 20:45:51 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include // Include for file operations\n#include // Include for getting the current time\n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n\n search_string = new_search_string;\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n return 0;\n}\n" Debug: 05-18 20:45:51 Current state: true false true true Debug: 05-18 20:45:51 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E // Include for file operations %23include %3Cctime%3E // Include for getting the current time // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D search_string %3D new_search_string; // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:45:51 scheme: "gdlookup" Debug: 05-18 20:45:51 host: "localhost" Debug: 05-18 20:45:51 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include // Include for file operations #include // Include for getting the current time // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); if (goldendict_mode && !sentence.empty()) { search_string = sentence; } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; break; } search_string = new_search_string; // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } return 0; }" Debug: 05-18 20:45:51 some body finished Debug: 05-18 20:45:51 one not finished. Debug: 05-18 20:45:51 ====reading 12658 of (12658) bytes . Finished: 0 Debug: 05-18 20:45:51 ====reading 0 of (12658) bytes . Finished: 0 Debug: 05-18 20:45:51 ====reading 0 of (12658) bytes . Finished: 0 Warning: 05-18 20:45:51 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:46:02 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:46:02 scheme: "gdlookup" Debug: 05-18 20:46:02 host: "localhost" Debug: 05-18 20:46:02 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:46:02 some body finished Debug: 05-18 20:46:02 one not finished. Debug: 05-18 20:46:02 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:46:02 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:46:02 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:46:02 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:46:10 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:46:10 scheme: "gdlookup" Debug: 05-18 20:46:10 host: "localhost" Debug: 05-18 20:46:10 clear current dictionaries: "ゆっくり" Debug: 05-18 20:46:10 some body finished Debug: 05-18 20:46:10 one not finished. Debug: 05-18 20:46:10 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 20:46:10 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 20:46:10 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 20:46:10 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:46:16 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:46:16 scheme: "gdlookup" Debug: 05-18 20:46:16 host: "localhost" Debug: 05-18 20:46:16 clear current dictionaries: "違和感" Debug: 05-18 20:46:16 some body finished Debug: 05-18 20:46:16 one not finished. Debug: 05-18 20:46:16 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 20:46:16 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 20:46:16 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 20:46:16 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:46:37 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:46:37 scheme: "gdlookup" Debug: 05-18 20:46:37 host: "localhost" Debug: 05-18 20:46:37 clear current dictionaries: "議" Debug: 05-18 20:46:37 some body finished Debug: 05-18 20:46:37 one not finished. Debug: 05-18 20:46:37 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 20:46:37 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 20:46:37 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 20:46:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:46:38 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:46:38 scheme: "gdlookup" Debug: 05-18 20:46:38 host: "localhost" Debug: 05-18 20:46:38 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 20:46:38 some body finished Debug: 05-18 20:46:38 one not finished. Debug: 05-18 20:46:38 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 20:46:38 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 20:46:38 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 20:46:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:46:44 translating from clipboard or selection Debug: 05-18 20:46:44 clipboard data: "地獄の苦しみ" Debug: 05-18 20:46:44 Current state: true false false true Debug: 05-18 20:46:44 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:46:44 scheme: "gdlookup" Debug: 05-18 20:46:44 host: "localhost" Debug: 05-18 20:46:44 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 20:46:44 some body finished Debug: 05-18 20:46:44 one not finished. Debug: 05-18 20:46:44 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 20:46:44 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 20:46:44 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 20:46:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:47:08 translating from clipboard or selection Debug: 05-18 20:47:08 clipboard data: "" Debug: 05-18 20:49:12 translating from clipboard or selection Debug: 05-18 20:49:12 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n output_html += \"
HTML delivered to GoldenDict successfully.
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* const argv[]) {\n const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) {\n return std::strcmp(arg, \"--goldendict\") == 0;\n });\n\n const std::string search_string = get_input(argc, argv, goldendict_mode);\n\n log_internal(\"Search string: \" + search_string);\n\n std::filesystem::path dic_file;\n try {\n dic_file = find_dic_file();\n } catch (const std::exception& e) {\n std::cerr << e.what() << std::endl;\n log_internal(std::string(\"Error: \") + e.what());\n return 1;\n }\n\n log_internal(\"Dictionary file found: \" + dic_file.string());\n\n xcdat::Xcdat dic;\n dic.load(dic_file.string());\n log_internal(\"Dictionary loaded successfully.\");\n\n std::map> alternatives_map;\n const auto entry = dic.find(search_string);\n std::vector substrings;\n\n if (!entry) {\n std::cerr << \"Not found\" << std::endl;\n log_internal(\"Entry not found for: \" + search_string);\n } else {\n substrings.push_back(search_string);\n alternatives_map.emplace(search_string, std::set());\n\n for (const auto& suffix : entry->suffixes) {\n substrings.push_back(suffix);\n alternatives_map[search_string].insert(suffix);\n }\n }\n\n std::string sentence = search_string;\n wrap_html_output(substrings, alternatives_map, sentence);\n\n if (goldendict_mode) {\n log_internal(\"HTML delivered to GoldenDict successfully.\");\n }\n\n return 0;\n}\n" Debug: 05-18 20:49:12 Current state: true true false true Debug: 05-18 20:49:12 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cdiv style%3D%27color: green; font-weight: bold;%27%3EHTML delivered to GoldenDict successfully.%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* const argv[]) %7B const bool goldendict_mode %3D std::any_of(argv, argv + argc, [](const char* arg) %7B return std::strcmp(arg, %22--goldendict%22) %3D%3D 0; %7D); const std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); std::filesystem::path dic_file; try %7B dic_file %3D find_dic_file(); %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C e.what() %3C%3C std::endl; log_internal(std::string(%22Error: %22) + e.what()); return 1; %7D log_internal(%22Dictionary file found: %22 + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(%22Dictionary loaded successfully.%22); std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; const auto entry %3D dic.find(search_string); std::vector%3Cstd::string%3E substrings; if (!entry) %7B std::cerr %3C%3C %22Not found%22 %3C%3C std::endl; log_internal(%22Entry not found for: %22 + search_string); %7D else %7B substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set%3Cstd::string%3E()); for (const auto%26 suffix : entry-%3Esuffixes) %7B substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); %7D %7D std::string sentence %3D search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) %7B log_internal(%22HTML delivered to GoldenDict successfully.%22); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:49:12 scheme: "gdlookup" Debug: 05-18 20:49:12 host: "localhost" Debug: 05-18 20:49:12 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; output_html += \"
HTML delivered to GoldenDict successfully.
\"; std::cout << output_html << std::endl; } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* const argv[]) { const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) { return std::strcmp(arg, \"--goldendict\") == 0; }); const std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); std::filesystem::path dic_file; try { dic_file = find_dic_file(); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; log_internal(std::string(\"Error: \") + e.what()); return 1; } log_internal(\"Dictionary file found: \" + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(\"Dictionary loaded successfully.\"); std::map> alternatives_map; const auto entry = dic.find(search_string); std::vector substrings; if (!entry) { std::cerr << \"Not found\" << std::endl; log_internal(\"Entry not found for: \" + search_string); } else { substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set()); for (const auto& suffix : entry->suffixes) { substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); } } std::string sentence = search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) { log_internal(\"HTML delivered to GoldenDict successfully.\"); } return 0; }" Debug: 05-18 20:49:12 some body finished Debug: 05-18 20:49:12 one not finished. Debug: 05-18 20:49:12 ====reading 10415 of (10415) bytes . Finished: 0 Debug: 05-18 20:49:12 ====reading 0 of (10415) bytes . Finished: 0 Debug: 05-18 20:49:12 ====reading 0 of (10415) bytes . Finished: 0 Warning: 05-18 20:49:12 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:49:16 translating from clipboard or selection Debug: 05-18 20:49:16 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:49:16 Current state: true false false true Debug: 05-18 20:49:16 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:49:16 scheme: "gdlookup" Debug: 05-18 20:49:16 host: "localhost" Debug: 05-18 20:49:16 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:49:16 some body finished Debug: 05-18 20:49:16 one not finished. Debug: 05-18 20:49:16 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:49:16 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:49:16 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:49:16 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:50:28 translating from clipboard or selection Debug: 05-18 20:50:28 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:50:28 Current state: true true false true Debug: 05-18 20:50:28 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:50:28 scheme: "gdlookup" Debug: 05-18 20:50:28 host: "localhost" Debug: 05-18 20:50:28 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:50:28 some body finished Debug: 05-18 20:50:28 one not finished. Debug: 05-18 20:50:28 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:50:28 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:50:28 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:50:28 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:22 translating from clipboard or selection Debug: 05-18 20:51:22 clipboard data: "\n log_internal(\"Program finished\");\n return 0;\n}" Debug: 05-18 20:51:22 Current state: true false false true Debug: 05-18 20:51:22 getResource: "gdlookup://localhost/?word=log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:22 scheme: "gdlookup" Debug: 05-18 20:51:22 host: "localhost" Debug: 05-18 20:51:22 clear current dictionaries: "log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:51:22 some body finished Debug: 05-18 20:51:22 one not finished. Debug: 05-18 20:51:22 ====reading 1458 of (1458) bytes . Finished: 0 Debug: 05-18 20:51:22 ====reading 0 of (1458) bytes . Finished: 0 Debug: 05-18 20:51:22 ====reading 0 of (1458) bytes . Finished: 0 Warning: 05-18 20:51:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:25 translating from clipboard or selection Debug: 05-18 20:51:25 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n output_html += \"
HTML delivered to GoldenDict successfully.
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* const argv[]) {\n const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) {\n return std::strcmp(arg, \"--goldendict\") == 0;\n });\n\n const std::string search_string = get_input(argc, argv, goldendict_mode);\n\n log_internal(\"Search string: \" + search_string);\n\n std::filesystem::path dic_file;\n try {\n dic_file = find_dic_file();\n } catch (const std::exception& e) {\n std::cerr << e.what() << std::endl;\n log_internal(std::string(\"Error: \") + e.what());\n return 1;\n }\n\n log_internal(\"Dictionary file found: \" + dic_file.string());\n\n xcdat::Xcdat dic;\n dic.load(dic_file.string());\n log_internal(\"Dictionary loaded successfully.\");\n\n std::map> alternatives_map;\n const auto entry = dic.find(search_string);\n std::vector substrings;\n\n if (!entry) {\n std::cerr << \"Not found\" << std::endl;\n log_internal(\"Entry not found for: \" + search_string);\n } else {\n substrings.push_back(search_string);\n alternatives_map.emplace(search_string, std::set());\n\n for (const auto& suffix : entry->suffixes) {\n substrings.push_back(suffix);\n alternatives_map[search_string].insert(suffix);\n }\n }\n\n std::string sentence = search_string;\n wrap_html_output(substrings, alternatives_map, sentence);\n\n if (goldendict_mode) {\n log_internal(\"HTML delivered to GoldenDict successfully.\");\n }\n\n return 0;\n}\n" Debug: 05-18 20:51:25 Current state: true false true true Debug: 05-18 20:51:25 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cdiv style%3D%27color: green; font-weight: bold;%27%3EHTML delivered to GoldenDict successfully.%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* const argv[]) %7B const bool goldendict_mode %3D std::any_of(argv, argv + argc, [](const char* arg) %7B return std::strcmp(arg, %22--goldendict%22) %3D%3D 0; %7D); const std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); std::filesystem::path dic_file; try %7B dic_file %3D find_dic_file(); %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C e.what() %3C%3C std::endl; log_internal(std::string(%22Error: %22) + e.what()); return 1; %7D log_internal(%22Dictionary file found: %22 + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(%22Dictionary loaded successfully.%22); std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; const auto entry %3D dic.find(search_string); std::vector%3Cstd::string%3E substrings; if (!entry) %7B std::cerr %3C%3C %22Not found%22 %3C%3C std::endl; log_internal(%22Entry not found for: %22 + search_string); %7D else %7B substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set%3Cstd::string%3E()); for (const auto%26 suffix : entry-%3Esuffixes) %7B substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); %7D %7D std::string sentence %3D search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) %7B log_internal(%22HTML delivered to GoldenDict successfully.%22); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:25 scheme: "gdlookup" Debug: 05-18 20:51:25 host: "localhost" Debug: 05-18 20:51:25 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; output_html += \"
HTML delivered to GoldenDict successfully.
\"; std::cout << output_html << std::endl; } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* const argv[]) { const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) { return std::strcmp(arg, \"--goldendict\") == 0; }); const std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); std::filesystem::path dic_file; try { dic_file = find_dic_file(); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; log_internal(std::string(\"Error: \") + e.what()); return 1; } log_internal(\"Dictionary file found: \" + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(\"Dictionary loaded successfully.\"); std::map> alternatives_map; const auto entry = dic.find(search_string); std::vector substrings; if (!entry) { std::cerr << \"Not found\" << std::endl; log_internal(\"Entry not found for: \" + search_string); } else { substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set()); for (const auto& suffix : entry->suffixes) { substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); } } std::string sentence = search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) { log_internal(\"HTML delivered to GoldenDict successfully.\"); } return 0; }" Debug: 05-18 20:51:25 some body finished Debug: 05-18 20:51:25 one not finished. Debug: 05-18 20:51:25 ====reading 10415 of (10415) bytes . Finished: 0 Debug: 05-18 20:51:25 ====reading 0 of (10415) bytes . Finished: 0 Debug: 05-18 20:51:25 ====reading 0 of (10415) bytes . Finished: 0 Warning: 05-18 20:51:25 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:25 translating from clipboard or selection Debug: 05-18 20:51:25 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Struct to hold the view and id of each entry\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\n// Function to remove one UTF-8 character and return the character along with the new string\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { // 1-byte character\n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { // 2-byte character\n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { // 3-byte character\n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { // 4-byte character\n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\n// Function to check input from command line or piped input\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n\n if (!isatty(fileno(stdin))) { // If input is piped\n std::getline(std::cin, search_string);\n } else { // If input is provided as command line argument\n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n // Skip the next argument as it's the dictionary file path\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; // Open container div\n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n // Adding alternatives for the current substring\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; // Close segment div\n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; // Close container div\n output_html += \"
\";\n output_html += \"
HTML delivered to GoldenDict successfully.
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* const argv[]) {\n const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) {\n return std::strcmp(arg, \"--goldendict\") == 0;\n });\n\n const std::string search_string = get_input(argc, argv, goldendict_mode);\n\n log_internal(\"Search string: \" + search_string);\n\n std::filesystem::path dic_file;\n try {\n dic_file = find_dic_file();\n } catch (const std::exception& e) {\n std::cerr << e.what() << std::endl;\n log_internal(std::string(\"Error: \") + e.what());\n return 1;\n }\n\n log_internal(\"Dictionary file found: \" + dic_file.string());\n\n xcdat::Xcdat dic;\n dic.load(dic_file.string());\n log_internal(\"Dictionary loaded successfully.\");\n\n std::map> alternatives_map;\n const auto entry = dic.find(search_string);\n std::vector substrings;\n\n if (!entry) {\n std::cerr << \"Not found\" << std::endl;\n log_internal(\"Entry not found for: \" + search_string);\n } else {\n substrings.push_back(search_string);\n alternatives_map.emplace(search_string, std::set());\n\n for (const auto& suffix : entry->suffixes) {\n substrings.push_back(suffix);\n alternatives_map[search_string].insert(suffix);\n }\n }\n\n std::string sentence = search_string;\n wrap_html_output(substrings, alternatives_map, sentence);\n\n if (goldendict_mode) {\n log_internal(\"HTML delivered to GoldenDict successfully.\");\n }\n\n return 0;\n}\n" Debug: 05-18 20:51:25 Current state: true false true true Debug: 05-18 20:51:25 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E // Struct to hold the view and id of each entry struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B // 1-byte character return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B // 2-byte character return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B // 3-byte character return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B // 4-byte character return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B // If input is piped std::getline(std::cin, search_string); %7D else %7B // If input is provided as command line argument if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B // Skip the next argument as it%27s the dictionary file path i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; // Open container div while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; // Adding alternatives for the current substring auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; // Close segment div output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; // Adjusted container class output_html +%3D %22.segment %7B display: inline-block; %7D%22; // Adjusted segment class output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; // Close container div output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cdiv style%3D%27color: green; font-weight: bold;%27%3EHTML delivered to GoldenDict successfully.%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* const argv[]) %7B const bool goldendict_mode %3D std::any_of(argv, argv + argc, [](const char* arg) %7B return std::strcmp(arg, %22--goldendict%22) %3D%3D 0; %7D); const std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); std::filesystem::path dic_file; try %7B dic_file %3D find_dic_file(); %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C e.what() %3C%3C std::endl; log_internal(std::string(%22Error: %22) + e.what()); return 1; %7D log_internal(%22Dictionary file found: %22 + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(%22Dictionary loaded successfully.%22); std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; const auto entry %3D dic.find(search_string); std::vector%3Cstd::string%3E substrings; if (!entry) %7B std::cerr %3C%3C %22Not found%22 %3C%3C std::endl; log_internal(%22Entry not found for: %22 + search_string); %7D else %7B substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set%3Cstd::string%3E()); for (const auto%26 suffix : entry-%3Esuffixes) %7B substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); %7D %7D std::string sentence %3D search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) %7B log_internal(%22HTML delivered to GoldenDict successfully.%22); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:25 scheme: "gdlookup" Debug: 05-18 20:51:25 host: "localhost" Debug: 05-18 20:51:25 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include // Struct to hold the view and id of each entry struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; // Function to remove one UTF-8 character and return the character along with the new string inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { // 1-byte character return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { // 2-byte character return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { // 3-byte character return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { // 4-byte character return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } // Function to check input from command line or piped input inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { // If input is piped std::getline(std::cin, search_string); } else { // If input is provided as command line argument if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { // Skip the next argument as it's the dictionary file path i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; // Open container div while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; // Adding alternatives for the current substring auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; // Close segment div output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; // Close container div output_html += \"
\"; output_html += \"
HTML delivered to GoldenDict successfully.
\"; std::cout << output_html << std::endl; } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* const argv[]) { const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) { return std::strcmp(arg, \"--goldendict\") == 0; }); const std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); std::filesystem::path dic_file; try { dic_file = find_dic_file(); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; log_internal(std::string(\"Error: \") + e.what()); return 1; } log_internal(\"Dictionary file found: \" + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(\"Dictionary loaded successfully.\"); std::map> alternatives_map; const auto entry = dic.find(search_string); std::vector substrings; if (!entry) { std::cerr << \"Not found\" << std::endl; log_internal(\"Entry not found for: \" + search_string); } else { substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set()); for (const auto& suffix : entry->suffixes) { substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); } } std::string sentence = search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) { log_internal(\"HTML delivered to GoldenDict successfully.\"); } return 0; }" Debug: 05-18 20:51:26 some body finished Debug: 05-18 20:51:26 one not finished. Debug: 05-18 20:51:26 ====reading 10415 of (10415) bytes . Finished: 0 Debug: 05-18 20:51:26 ====reading 0 of (10415) bytes . Finished: 0 Debug: 05-18 20:51:26 ====reading 0 of (10415) bytes . Finished: 0 Warning: 05-18 20:51:26 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:35 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:35 scheme: "gdlookup" Debug: 05-18 20:51:35 host: "localhost" Debug: 05-18 20:51:35 clear current dictionaries: "議" Debug: 05-18 20:51:35 some body finished Debug: 05-18 20:51:35 one not finished. Debug: 05-18 20:51:35 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 20:51:35 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 20:51:35 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 20:51:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:40 translating from clipboard or selection Debug: 05-18 20:51:40 clipboard data: "!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* const argv[]) { const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) { return std::strcmp(arg, \"--goldendict\") == 0; }); const std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); std::filesystem::path dic_file; try { dic_file = find_dic_file(); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; log_internal(std::string(\"Error: \") + e.what()); return 1; } log_internal(\"Dictionary file found: \" + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(\"Dictionary loaded successfully.\"); std::map> alternatives_map; const auto entry = dic.find(search_string); std::vector substrings; if (!entry) { std::cerr << \"Not found\" << std::endl; log_internal(\"Entry not found for: \" + search_string); } else { substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set()); for (const auto& suffix : entry->suffixes) { substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); } } std::string sentence = search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) { log_internal(\"HTML delivered to GoldenDict successfully.\"); } return 0; }" Debug: 05-18 20:51:40 Current state: true false false true Debug: 05-18 20:51:40 getResource: "gdlookup://localhost/?word=!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* const argv[]) %7B const bool goldendict_mode %3D std::any_of(argv, argv + argc, [](const char* arg) %7B return std::strcmp(arg, %22--goldendict%22) %3D%3D 0; %7D); const std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); std::filesystem::path dic_file; try %7B dic_file %3D find_dic_file(); %7D catch (const std::exception%26 e) %7B std::cerr %3C%3C e.what() %3C%3C std::endl; log_internal(std::string(%22Error: %22) + e.what()); return 1; %7D log_internal(%22Dictionary file found: %22 + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(%22Dictionary loaded successfully.%22); std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; const auto entry %3D dic.find(search_string); std::vector%3Cstd::string%3E substrings; if (!entry) %7B std::cerr %3C%3C %22Not found%22 %3C%3C std::endl; log_internal(%22Entry not found for: %22 + search_string); %7D else %7B substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set%3Cstd::string%3E()); for (const auto%26 suffix : entry-%3Esuffixes) %7B substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); %7D %7D std::string sentence %3D search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) %7B log_internal(%22HTML delivered to GoldenDict successfully.%22); %7D return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:40 scheme: "gdlookup" Debug: 05-18 20:51:40 host: "localhost" Debug: 05-18 20:51:40 clear current dictionaries: "!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* const argv[]) { const bool goldendict_mode = std::any_of(argv, argv + argc, [](const char* arg) { return std::strcmp(arg, \"--goldendict\") == 0; }); const std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); std::filesystem::path dic_file; try { dic_file = find_dic_file(); } catch (const std::exception& e) { std::cerr << e.what() << std::endl; log_internal(std::string(\"Error: \") + e.what()); return 1; } log_internal(\"Dictionary file found: \" + dic_file.string()); xcdat::Xcdat dic; dic.load(dic_file.string()); log_internal(\"Dictionary loaded successfully.\"); std::map> alternatives_map; const auto entry = dic.find(search_string); std::vector substrings; if (!entry) { std::cerr << \"Not found\" << std::endl; log_internal(\"Entry not found for: \" + search_string); } else { substrings.push_back(search_string); alternatives_map.emplace(search_string, std::set()); for (const auto& suffix : entry->suffixes) { substrings.push_back(suffix); alternatives_map[search_string].insert(suffix); } } std::string sentence = search_string; wrap_html_output(substrings, alternatives_map, sentence); if (goldendict_mode) { log_internal(\"HTML delivered to GoldenDict successfully.\"); } return 0; }" Debug: 05-18 20:51:40 some body finished Debug: 05-18 20:51:40 one not finished. Debug: 05-18 20:51:40 ====reading 3140 of (3140) bytes . Finished: 0 Debug: 05-18 20:51:40 ====reading 0 of (3140) bytes . Finished: 0 Debug: 05-18 20:51:40 ====reading 0 of (3140) bytes . Finished: 0 Warning: 05-18 20:51:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:45 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:45 scheme: "gdlookup" Debug: 05-18 20:51:45 host: "localhost" Debug: 05-18 20:51:45 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 20:51:45 some body finished Debug: 05-18 20:51:45 one not finished. Debug: 05-18 20:51:45 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 20:51:45 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 20:51:45 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 20:51:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:56 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:56 scheme: "gdlookup" Debug: 05-18 20:51:56 host: "localhost" Debug: 05-18 20:51:56 clear current dictionaries: "ゆっくり" Debug: 05-18 20:51:56 some body finished Debug: 05-18 20:51:56 one not finished. Debug: 05-18 20:51:56 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 20:51:56 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 20:51:56 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 20:51:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:51:57 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:51:57 scheme: "gdlookup" Debug: 05-18 20:51:57 host: "localhost" Debug: 05-18 20:51:57 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:51:57 some body finished Debug: 05-18 20:51:57 one not finished. Debug: 05-18 20:51:57 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:51:57 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:51:57 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:51:57 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:52:10 translating from clipboard or selection Debug: 05-18 20:52:10 clipboard data: "転生したら剣でした" Debug: 05-18 20:52:10 Current state: true false false true Debug: 05-18 20:52:10 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:52:10 scheme: "gdlookup" Debug: 05-18 20:52:10 host: "localhost" Debug: 05-18 20:52:10 clear current dictionaries: "転生したら剣でした" Debug: 05-18 20:52:10 some body finished Debug: 05-18 20:52:10 one not finished. Debug: 05-18 20:52:10 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 20:52:10 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 20:52:10 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 20:52:10 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:52:23 getResource: "gdlookup://localhost/?word=意識&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:52:23 scheme: "gdlookup" Debug: 05-18 20:52:23 host: "localhost" Debug: 05-18 20:52:23 clear current dictionaries: "意識" Debug: 05-18 20:52:23 some body finished Debug: 05-18 20:52:23 one not finished. Debug: 05-18 20:52:23 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 20:52:23 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 20:52:23 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 20:52:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:52:23 getResource: "gdlookup://localhost/?word=猿猴捉月。&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:52:23 scheme: "gdlookup" Debug: 05-18 20:52:23 host: "localhost" Debug: 05-18 20:52:23 clear current dictionaries: "猿猴捉月。" Debug: 05-18 20:52:23 some body finished Debug: 05-18 20:52:23 one not finished. Debug: 05-18 20:52:23 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 20:52:23 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 20:52:23 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 20:52:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:53:58 translating from clipboard or selection Debug: 05-18 20:53:58 clipboard data: "rixope2409@huleos.com" Debug: 05-18 20:53:58 Current state: true true false true Debug: 05-18 20:53:58 getResource: "gdlookup://localhost/?word=rixope2409@huleos.com&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:53:58 scheme: "gdlookup" Debug: 05-18 20:53:58 host: "localhost" Debug: 05-18 20:53:58 clear current dictionaries: "rixope2409@huleos.com" Debug: 05-18 20:53:58 some body finished Debug: 05-18 20:53:58 one not finished. Debug: 05-18 20:53:58 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 20:53:58 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 20:53:58 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 20:53:58 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:55:39 translating from clipboard or selection Debug: 05-18 20:55:39 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:55:39 Current state: true false false true Debug: 05-18 20:55:39 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:55:39 scheme: "gdlookup" Debug: 05-18 20:55:39 host: "localhost" Debug: 05-18 20:55:39 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:55:39 some body finished Debug: 05-18 20:55:39 one not finished. Debug: 05-18 20:55:39 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:55:39 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:55:39 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:55:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:55:39 translating from clipboard or selection Debug: 05-18 20:55:39 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:55:39 Current state: true false true true Debug: 05-18 20:55:39 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:55:39 scheme: "gdlookup" Debug: 05-18 20:55:39 host: "localhost" Debug: 05-18 20:55:39 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:55:39 some body finished Debug: 05-18 20:55:39 one not finished. Debug: 05-18 20:55:39 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:55:39 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:55:39 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:55:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:55:40 translating from clipboard or selection Debug: 05-18 20:55:40 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:55:40 Current state: true false true true Debug: 05-18 20:55:40 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:55:40 scheme: "gdlookup" Debug: 05-18 20:55:40 host: "localhost" Debug: 05-18 20:55:40 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:55:40 some body finished Debug: 05-18 20:55:40 one not finished. Debug: 05-18 20:55:40 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:55:40 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:55:40 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:55:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:56:45 translating from clipboard or selection Debug: 05-18 20:56:45 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n// Other includes and function definitions remain unchanged\n\nvoid print_success_message() {\n std::cout << \"\\033[32mSuccessfully delivered HTML to GoldenDict!\\033[0m\" << std::endl;\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n print_success_message(); // Print success message when HTML is delivered\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:56:45 Current state: true false true true Debug: 05-18 20:56:45 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E // Other includes and function definitions remain unchanged void print_success_message() %7B std::cout %3C%3C %22%5C033[32mSuccessfully delivered HTML to GoldenDict!%5C033[0m%22 %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); print_success_message(); // Print success message when HTML is delivered %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:56:45 scheme: "gdlookup" Debug: 05-18 20:56:45 host: "localhost" Debug: 05-18 20:56:45 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include // Other includes and function definitions remain unchanged void print_success_message() { std::cout << \"\\033[32mSuccessfully delivered HTML to GoldenDict!\\033[0m\" << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); print_success_message(); // Print success message when HTML is delivered } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:56:45 some body finished Debug: 05-18 20:56:45 one not finished. Debug: 05-18 20:56:45 ====reading 6028 of (6028) bytes . Finished: 0 Debug: 05-18 20:56:45 ====reading 0 of (6028) bytes . Finished: 0 Debug: 05-18 20:56:45 ====reading 0 of (6028) bytes . Finished: 0 Warning: 05-18 20:56:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:56:54 translating from clipboard or selection Debug: 05-18 20:56:54 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:56:54 Current state: true true false true Debug: 05-18 20:56:54 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:56:54 scheme: "gdlookup" Debug: 05-18 20:56:54 host: "localhost" Debug: 05-18 20:56:54 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:56:54 some body finished Debug: 05-18 20:56:54 one not finished. Debug: 05-18 20:56:54 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:56:54 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:56:54 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:56:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:56:55 translating from clipboard or selection Debug: 05-18 20:56:55 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:56:55 Current state: true false false true Debug: 05-18 20:56:55 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:56:55 scheme: "gdlookup" Debug: 05-18 20:56:55 host: "localhost" Debug: 05-18 20:56:55 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:56:55 some body finished Debug: 05-18 20:56:55 one not finished. Debug: 05-18 20:56:55 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:56:55 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:56:55 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:56:55 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:57:31 translating from clipboard or selection Debug: 05-18 20:57:31 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:57:31 Current state: true false true true Debug: 05-18 20:57:31 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:57:31 scheme: "gdlookup" Debug: 05-18 20:57:31 host: "localhost" Debug: 05-18 20:57:31 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:57:31 some body finished Debug: 05-18 20:57:31 one not finished. Debug: 05-18 20:57:31 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:57:31 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:57:31 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:57:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:57:31 translating from clipboard or selection Debug: 05-18 20:57:31 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:57:31 Current state: true false true true Debug: 05-18 20:57:31 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:57:31 scheme: "gdlookup" Debug: 05-18 20:57:31 host: "localhost" Debug: 05-18 20:57:31 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:57:31 some body finished Debug: 05-18 20:57:31 one not finished. Debug: 05-18 20:57:31 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:57:31 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:57:31 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:57:31 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:58:44 translating from clipboard or selection Debug: 05-18 20:58:44 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:58:44 Current state: true false true true Debug: 05-18 20:58:44 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:58:44 scheme: "gdlookup" Debug: 05-18 20:58:44 host: "localhost" Debug: 05-18 20:58:44 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:58:44 some body finished Debug: 05-18 20:58:44 one not finished. Debug: 05-18 20:58:44 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:58:44 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:58:44 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:58:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:58:46 translating from clipboard or selection Debug: 05-18 20:58:46 clipboard data: "" Debug: 05-18 20:58:47 translating from clipboard or selection Debug: 05-18 20:58:47 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 20:58:47 Current state: true false true true Debug: 05-18 20:58:47 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:58:47 scheme: "gdlookup" Debug: 05-18 20:58:47 host: "localhost" Debug: 05-18 20:58:47 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 20:58:47 some body finished Debug: 05-18 20:58:47 one not finished. Debug: 05-18 20:58:47 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 20:58:47 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 20:58:47 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 20:58:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:58:56 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:58:56 scheme: "gdlookup" Debug: 05-18 20:58:56 host: "localhost" Debug: 05-18 20:58:56 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 20:58:56 some body finished Debug: 05-18 20:58:56 one not finished. Debug: 05-18 20:58:56 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 20:58:56 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 20:58:56 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 20:58:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:58:58 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:58:58 scheme: "gdlookup" Debug: 05-18 20:58:58 host: "localhost" Debug: 05-18 20:58:58 clear current dictionaries: "議" Debug: 05-18 20:58:58 some body finished Debug: 05-18 20:58:58 one not finished. Debug: 05-18 20:58:58 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 20:58:58 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 20:58:58 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 20:58:58 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 20:59:05 translating from clipboard or selection Debug: 05-18 20:59:05 clipboard data: "\"Program finished\"); " Debug: 05-18 20:59:05 Current state: true false false true Debug: 05-18 20:59:05 getResource: "gdlookup://localhost/?word=%22Program finished%22);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 20:59:05 scheme: "gdlookup" Debug: 05-18 20:59:05 host: "localhost" Debug: 05-18 20:59:05 clear current dictionaries: "\"Program finished\");" Debug: 05-18 20:59:05 some body finished Debug: 05-18 20:59:05 one not finished. Debug: 05-18 20:59:05 ====reading 1433 of (1433) bytes . Finished: 0 Debug: 05-18 20:59:05 ====reading 0 of (1433) bytes . Finished: 0 Debug: 05-18 20:59:05 ====reading 0 of (1433) bytes . Finished: 0 Warning: 05-18 20:59:05 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:00:28 translating from clipboard or selection Debug: 05-18 21:00:28 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:00:28 Current state: true true true true Debug: 05-18 21:00:28 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:00:28 scheme: "gdlookup" Debug: 05-18 21:00:28 host: "localhost" Debug: 05-18 21:00:28 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:00:28 some body finished Debug: 05-18 21:00:28 one not finished. Debug: 05-18 21:00:28 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 21:00:28 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 21:00:28 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 21:00:28 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:00:28 translating from clipboard or selection Debug: 05-18 21:00:28 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:00:28 Current state: true false true true Debug: 05-18 21:00:28 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:00:28 scheme: "gdlookup" Debug: 05-18 21:00:28 host: "localhost" Debug: 05-18 21:00:28 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:00:28 some body finished Debug: 05-18 21:00:28 one not finished. Debug: 05-18 21:00:28 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 21:00:28 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 21:00:28 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 21:00:28 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:20:00 translating from clipboard or selection Debug: 05-18 21:20:00 clipboard data: "" Debug: 05-18 21:20:01 translating from clipboard or selection Debug: 05-18 21:20:01 clipboard data: "" Debug: 05-18 21:20:40 translating from clipboard or selection Debug: 05-18 21:20:40 clipboard data: "" Debug: 05-18 21:20:41 translating from clipboard or selection Debug: 05-18 21:20:41 clipboard data: "" Debug: 05-18 21:21:18 translating from clipboard or selection Debug: 05-18 21:21:18 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:21:18 Current state: true false true true Debug: 05-18 21:21:18 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:18 scheme: "gdlookup" Debug: 05-18 21:21:18 host: "localhost" Debug: 05-18 21:21:18 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:21:18 some body finished Debug: 05-18 21:21:18 one not finished. Debug: 05-18 21:21:18 ====reading 13355 of (13355) bytes . Finished: 0 Debug: 05-18 21:21:18 ====reading 0 of (13355) bytes . Finished: 0 Debug: 05-18 21:21:18 ====reading 0 of (13355) bytes . Finished: 0 Warning: 05-18 21:21:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:20 translating from clipboard or selection Debug: 05-18 21:21:20 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:21:20 Current state: true false true true Debug: 05-18 21:21:20 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:20 scheme: "gdlookup" Debug: 05-18 21:21:20 host: "localhost" Debug: 05-18 21:21:20 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:21:20 some body finished Debug: 05-18 21:21:20 one not finished. Debug: 05-18 21:21:20 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 21:21:20 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 21:21:20 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 21:21:20 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:21 translating from clipboard or selection Debug: 05-18 21:21:21 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:21:21 Current state: true false true true Debug: 05-18 21:21:21 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:21 scheme: "gdlookup" Debug: 05-18 21:21:21 host: "localhost" Debug: 05-18 21:21:21 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:21:21 some body finished Debug: 05-18 21:21:21 one not finished. Debug: 05-18 21:21:21 ====reading 13346 of (13346) bytes . Finished: 0 Debug: 05-18 21:21:21 ====reading 0 of (13346) bytes . Finished: 0 Debug: 05-18 21:21:21 ====reading 0 of (13346) bytes . Finished: 0 Warning: 05-18 21:21:21 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:36 translating from clipboard or selection Debug: 05-18 21:21:36 clipboard data: "src/main.cc: In function ‘int main(int, char* const*)’:\nsrc/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’\n 206 | xcdat::Xcdat dic;\n | ^~~~~\nsrc/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’?\n 207 | dic.load(dic_file.string());\n | ^~~\n | div\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ " Debug: 05-18 21:21:36 Current state: true true false true Debug: 05-18 21:21:36 getResource: "gdlookup://localhost/?word=src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 %7C xcdat::Xcdat dic; %7C %5E~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 %7C dic.load(dic_file.string()); %7C %5E~~ %7C div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:36 scheme: "gdlookup" Debug: 05-18 21:21:36 host: "localhost" Debug: 05-18 21:21:36 clear current dictionaries: "src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 | xcdat::Xcdat dic; | ^~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 | dic.load(dic_file.string()); | ^~~ | div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $" Debug: 05-18 21:21:36 some body finished Debug: 05-18 21:21:36 one not finished. Debug: 05-18 21:21:36 ====reading 1844 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:36 ====reading 0 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:36 ====reading 0 of (1844) bytes . Finished: 0 Warning: 05-18 21:21:36 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:37 translating from clipboard or selection Debug: 05-18 21:21:37 clipboard data: "src/main.cc: In function ‘int main(int, char* const*)’:\nsrc/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’\n 206 | xcdat::Xcdat dic;\n | ^~~~~\nsrc/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’?\n 207 | dic.load(dic_file.string());\n | ^~~\n | div\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ " Debug: 05-18 21:21:37 Current state: true false false true Debug: 05-18 21:21:37 getResource: "gdlookup://localhost/?word=src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 %7C xcdat::Xcdat dic; %7C %5E~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 %7C dic.load(dic_file.string()); %7C %5E~~ %7C div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:37 scheme: "gdlookup" Debug: 05-18 21:21:37 host: "localhost" Debug: 05-18 21:21:37 clear current dictionaries: "src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 | xcdat::Xcdat dic; | ^~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 | dic.load(dic_file.string()); | ^~~ | div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $" Debug: 05-18 21:21:37 some body finished Debug: 05-18 21:21:37 one not finished. Debug: 05-18 21:21:37 ====reading 1844 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:37 ====reading 0 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:37 ====reading 0 of (1844) bytes . Finished: 0 Warning: 05-18 21:21:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:38 translating from clipboard or selection Debug: 05-18 21:21:38 clipboard data: "src/main.cc: In function ‘int main(int, char* const*)’:\nsrc/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’\n 206 | xcdat::Xcdat dic;\n | ^~~~~\nsrc/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’?\n 207 | dic.load(dic_file.string());\n | ^~~\n | div\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ " Debug: 05-18 21:21:38 Current state: true false true true Debug: 05-18 21:21:38 getResource: "gdlookup://localhost/?word=src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 %7C xcdat::Xcdat dic; %7C %5E~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 %7C dic.load(dic_file.string()); %7C %5E~~ %7C div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:38 scheme: "gdlookup" Debug: 05-18 21:21:38 host: "localhost" Debug: 05-18 21:21:38 clear current dictionaries: "src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 | xcdat::Xcdat dic; | ^~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 | dic.load(dic_file.string()); | ^~~ | div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $" Debug: 05-18 21:21:38 some body finished Debug: 05-18 21:21:38 one not finished. Debug: 05-18 21:21:38 ====reading 1844 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:38 ====reading 0 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:38 ====reading 0 of (1844) bytes . Finished: 0 Warning: 05-18 21:21:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:39 translating from clipboard or selection Debug: 05-18 21:21:39 clipboard data: "src/main.cc: In function ‘int main(int, char* const*)’:\nsrc/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’\n 206 | xcdat::Xcdat dic;\n | ^~~~~\nsrc/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’?\n 207 | dic.load(dic_file.string());\n | ^~~\n | div\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ g++ src/main.cc -o hakurei\n/tmp/Hakurei $ " Debug: 05-18 21:21:39 Current state: true false true true Debug: 05-18 21:21:39 getResource: "gdlookup://localhost/?word=src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 %7C xcdat::Xcdat dic; %7C %5E~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 %7C dic.load(dic_file.string()); %7C %5E~~ %7C div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:39 scheme: "gdlookup" Debug: 05-18 21:21:39 host: "localhost" Debug: 05-18 21:21:39 clear current dictionaries: "src/main.cc: In function ‘int main(int, char* const*)’: src/main.cc:206:12: error: ‘Xcdat’ is not a member of ‘xcdat’ 206 | xcdat::Xcdat dic; | ^~~~~ src/main.cc:207:5: error: ‘dic’ was not declared in this scope; did you mean ‘div’? 207 | dic.load(dic_file.string()); | ^~~ | div /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $ g++ src/main.cc -o hakurei /tmp/Hakurei $" Debug: 05-18 21:21:39 some body finished Debug: 05-18 21:21:39 one not finished. Debug: 05-18 21:21:39 ====reading 1844 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:39 ====reading 0 of (1844) bytes . Finished: 0 Debug: 05-18 21:21:39 ====reading 0 of (1844) bytes . Finished: 0 Warning: 05-18 21:21:39 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:52 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:52 scheme: "gdlookup" Debug: 05-18 21:21:52 host: "localhost" Debug: 05-18 21:21:52 clear current dictionaries: "ゆっくり" Debug: 05-18 21:21:52 some body finished Debug: 05-18 21:21:52 one not finished. Debug: 05-18 21:21:52 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 21:21:52 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 21:21:52 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 21:21:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:21:57 translating from clipboard or selection Debug: 05-18 21:21:57 clipboard data: " to: ゆっくり\n\n\n\n" Debug: 05-18 21:21:57 Current state: true false false true Debug: 05-18 21:21:57 getResource: "gdlookup://localhost/?word=to: ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:21:57 scheme: "gdlookup" Debug: 05-18 21:21:57 host: "localhost" Debug: 05-18 21:21:57 clear current dictionaries: "to: ゆっくり" Debug: 05-18 21:21:57 some body finished Debug: 05-18 21:21:57 one not finished. Debug: 05-18 21:21:57 ====reading 1419 of (1419) bytes . Finished: 0 Debug: 05-18 21:21:57 ====reading 0 of (1419) bytes . Finished: 0 Debug: 05-18 21:21:57 ====reading 0 of (1419) bytes . Finished: 0 Warning: 05-18 21:21:57 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:22:00 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:22:00 scheme: "gdlookup" Debug: 05-18 21:22:00 host: "localhost" Debug: 05-18 21:22:00 clear current dictionaries: "納得が行く" Debug: 05-18 21:22:00 some body finished Debug: 05-18 21:22:00 one not finished. Debug: 05-18 21:22:00 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 21:22:00 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 21:22:00 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 21:22:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:22:20 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:22:20 scheme: "gdlookup" Debug: 05-18 21:22:20 host: "localhost" Debug: 05-18 21:22:20 clear current dictionaries: "納得が行く" Debug: 05-18 21:22:20 some body finished Debug: 05-18 21:22:20 one not finished. Debug: 05-18 21:22:20 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 21:22:20 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 21:22:21 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 21:22:21 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:22:27 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:22:27 scheme: "gdlookup" Debug: 05-18 21:22:27 host: "localhost" Debug: 05-18 21:22:27 clear current dictionaries: "納得が行く" Debug: 05-18 21:22:27 some body finished Debug: 05-18 21:22:27 one not finished. Debug: 05-18 21:22:27 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 21:22:27 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 21:22:27 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 21:22:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:23:36 translating from clipboard or selection Debug: 05-18 21:23:36 clipboard data: "inline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n" Debug: 05-18 21:23:36 Current state: true true false true Debug: 05-18 21:23:36 getResource: "gdlookup://localhost/?word=inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:23:36 scheme: "gdlookup" Debug: 05-18 21:23:36 host: "localhost" Debug: 05-18 21:23:36 clear current dictionaries: "inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; }" Debug: 05-18 21:23:36 some body finished Debug: 05-18 21:23:36 one not finished. Debug: 05-18 21:23:36 ====reading 4907 of (4907) bytes . Finished: 0 Debug: 05-18 21:23:36 ====reading 0 of (4907) bytes . Finished: 0 Debug: 05-18 21:23:36 ====reading 0 of (4907) bytes . Finished: 0 Warning: 05-18 21:23:36 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:23:37 translating from clipboard or selection Debug: 05-18 21:23:37 clipboard data: "cpp\n" Debug: 05-18 21:23:37 Current state: true false false true Debug: 05-18 21:23:37 getResource: "gdlookup://localhost/?word=cpp&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:23:37 scheme: "gdlookup" Debug: 05-18 21:23:37 host: "localhost" Debug: 05-18 21:23:37 clear current dictionaries: "cpp" Debug: 05-18 21:23:37 some body finished Debug: 05-18 21:23:37 one not finished. Debug: 05-18 21:23:37 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 21:23:37 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 21:23:37 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 21:23:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:23:47 translating from clipboard or selection Debug: 05-18 21:23:47 clipboard data: "ze) / 4); max-width: 100%; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; }\";\n output_html += \".hakurei .alternatives > ul { list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0% 50% / 0.05); box-shadow: 0 0 4px hsl(0 0% 0% / 0.1); border-radius: 0.2rem; }\";\n output_html += \".hakurei .alternatives > ul > li { margin-right: 1rem; }\";\n output_html += \".container { display: flex; flex-wrap: wrap; gap: 10px; }\"; \n output_html += \".segment { display: inline-block; }\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"\"; \n output_html += \"\";\n std::cout << output_html << std::endl;\n}\n" Debug: 05-18 21:23:47 Current state: true false true true Debug: 05-18 21:23:47 getResource: "gdlookup://localhost/?word=ze) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:23:47 scheme: "gdlookup" Debug: 05-18 21:23:47 host: "localhost" Debug: 05-18 21:23:47 clear current dictionaries: "ze) / 4); max-width: 100%; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; }\"; output_html += \".hakurei .alternatives > ul { list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0% 50% / 0.05); box-shadow: 0 0 4px hsl(0 0% 0% / 0.1); border-radius: 0.2rem; }\"; output_html += \".hakurei .alternatives > ul > li { margin-right: 1rem; }\"; output_html += \".container { display: flex; flex-wrap: wrap; gap: 10px; }\"; output_html += \".segment { display: inline-block; }\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"\"; output_html += \"\"; std::cout << output_html << std::endl; }" Debug: 05-18 21:23:47 some body finished Debug: 05-18 21:23:47 one not finished. Debug: 05-18 21:23:47 ====reading 2762 of (2762) bytes . Finished: 0 Debug: 05-18 21:23:47 ====reading 0 of (2762) bytes . Finished: 0 Debug: 05-18 21:23:47 ====reading 0 of (2762) bytes . Finished: 0 Warning: 05-18 21:23:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:23:55 translating from clipboard or selection Debug: 05-18 21:23:55 clipboard data: "inline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n" Debug: 05-18 21:23:55 Current state: true false true true Debug: 05-18 21:23:55 getResource: "gdlookup://localhost/?word=inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:23:55 scheme: "gdlookup" Debug: 05-18 21:23:55 host: "localhost" Debug: 05-18 21:23:55 clear current dictionaries: "inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; }" Debug: 05-18 21:23:55 some body finished Debug: 05-18 21:23:55 one not finished. Debug: 05-18 21:23:55 ====reading 4768 of (4768) bytes . Finished: 0 Debug: 05-18 21:23:55 ====reading 0 of (4768) bytes . Finished: 0 Debug: 05-18 21:23:55 ====reading 0 of (4768) bytes . Finished: 0 Warning: 05-18 21:23:55 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:23:56 translating from clipboard or selection Debug: 05-18 21:23:56 clipboard data: "inline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n" Debug: 05-18 21:23:56 Current state: true false true true Debug: 05-18 21:23:56 getResource: "gdlookup://localhost/?word=inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:23:56 scheme: "gdlookup" Debug: 05-18 21:23:56 host: "localhost" Debug: 05-18 21:23:56 clear current dictionaries: "inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; }" Debug: 05-18 21:23:56 some body finished Debug: 05-18 21:23:56 one not finished. Debug: 05-18 21:23:56 ====reading 4768 of (4768) bytes . Finished: 0 Debug: 05-18 21:23:56 ====reading 0 of (4768) bytes . Finished: 0 Debug: 05-18 21:23:56 ====reading 0 of (4768) bytes . Finished: 0 Warning: 05-18 21:23:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:24:01 translating from clipboard or selection Debug: 05-18 21:24:01 clipboard data: "void log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n" Debug: 05-18 21:24:01 Current state: true false true true Debug: 05-18 21:24:01 getResource: "gdlookup://localhost/?word=void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:24:01 scheme: "gdlookup" Debug: 05-18 21:24:01 host: "localhost" Debug: 05-18 21:24:01 clear current dictionaries: "void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); }" Debug: 05-18 21:24:01 some body finished Debug: 05-18 21:24:01 one not finished. Debug: 05-18 21:24:01 ====reading 1804 of (1804) bytes . Finished: 0 Debug: 05-18 21:24:01 ====reading 0 of (1804) bytes . Finished: 0 Debug: 05-18 21:24:01 ====reading 0 of (1804) bytes . Finished: 0 Warning: 05-18 21:24:01 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:24:06 translating from clipboard or selection Debug: 05-18 21:24:06 clipboard data: "void log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n" Debug: 05-18 21:24:06 Current state: true false true true Debug: 05-18 21:24:06 getResource: "gdlookup://localhost/?word=void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:24:06 scheme: "gdlookup" Debug: 05-18 21:24:06 host: "localhost" Debug: 05-18 21:24:06 clear current dictionaries: "void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); }" Debug: 05-18 21:24:06 some body finished Debug: 05-18 21:24:06 one not finished. Debug: 05-18 21:24:06 ====reading 1804 of (1804) bytes . Finished: 0 Debug: 05-18 21:24:06 ====reading 0 of (1804) bytes . Finished: 0 Debug: 05-18 21:24:06 ====reading 0 of (1804) bytes . Finished: 0 Warning: 05-18 21:24:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:24:15 translating from clipboard or selection Debug: 05-18 21:24:15 clipboard data: "mp/Hakurei $ g++ src/main.cc -o hakurei\nsrc/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’:\nsrc/main.cc:110:5: error: ‘log_internal’ was not declared in this scope\n 110 | log_internal(\"HTML output is being called\");\n | ^~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 21:24:15 Current state: true false true true Debug: 05-18 21:24:15 getResource: "gdlookup://localhost/?word=mp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘void wrap_html_output(const std::vector%3Cstd::__cxx11::basic_string%3Cchar%3E %3E%26, const std::map%3Cstd::__cxx11::basic_string%3Cchar%3E, std::set%3Cstd::__cxx11::basic_string%3Cchar%3E %3E %3E%26, std::string%26)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 %7C log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); %7C %5E~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:24:15 scheme: "gdlookup" Debug: 05-18 21:24:15 host: "localhost" Debug: 05-18 21:24:15 clear current dictionaries: "mp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 | log_internal(\"HTML output is being called\"); | ^~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 21:24:15 some body finished Debug: 05-18 21:24:15 one not finished. Debug: 05-18 21:24:15 ====reading 1933 of (1933) bytes . Finished: 0 Debug: 05-18 21:24:15 ====reading 0 of (1933) bytes . Finished: 0 Debug: 05-18 21:24:15 ====reading 0 of (1933) bytes . Finished: 0 Warning: 05-18 21:24:15 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:24:16 translating from clipboard or selection Debug: 05-18 21:24:16 clipboard data: "src/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’:\nsrc/main.cc:110:5: error: ‘log_internal’ was not declared in this scope\n 110 | log_internal(\"HTML output is being called\");\n | ^~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 21:24:16 Current state: true false true true Debug: 05-18 21:24:16 getResource: "gdlookup://localhost/?word=src/main.cc: In function ‘void wrap_html_output(const std::vector%3Cstd::__cxx11::basic_string%3Cchar%3E %3E%26, const std::map%3Cstd::__cxx11::basic_string%3Cchar%3E, std::set%3Cstd::__cxx11::basic_string%3Cchar%3E %3E %3E%26, std::string%26)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 %7C log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); %7C %5E~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:24:16 scheme: "gdlookup" Debug: 05-18 21:24:16 host: "localhost" Debug: 05-18 21:24:16 clear current dictionaries: "src/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 | log_internal(\"HTML output is being called\"); | ^~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 21:24:16 some body finished Debug: 05-18 21:24:16 one not finished. Debug: 05-18 21:24:16 ====reading 1893 of (1893) bytes . Finished: 0 Debug: 05-18 21:24:16 ====reading 0 of (1893) bytes . Finished: 0 Debug: 05-18 21:24:16 ====reading 0 of (1893) bytes . Finished: 0 Warning: 05-18 21:24:16 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:24:17 translating from clipboard or selection Debug: 05-18 21:24:17 clipboard data: "/tmp/Hakurei $ g++ src/main.cc -o hakurei\nsrc/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’:\nsrc/main.cc:110:5: error: ‘log_internal’ was not declared in this scope\n 110 | log_internal(\"HTML output is being called\");\n | ^~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 21:24:17 Current state: true false true true Debug: 05-18 21:24:17 getResource: "gdlookup://localhost/?word=/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘void wrap_html_output(const std::vector%3Cstd::__cxx11::basic_string%3Cchar%3E %3E%26, const std::map%3Cstd::__cxx11::basic_string%3Cchar%3E, std::set%3Cstd::__cxx11::basic_string%3Cchar%3E %3E %3E%26, std::string%26)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 %7C log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); %7C %5E~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:24:17 scheme: "gdlookup" Debug: 05-18 21:24:17 host: "localhost" Debug: 05-18 21:24:17 clear current dictionaries: "/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 | log_internal(\"HTML output is being called\"); | ^~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 21:24:17 some body finished Debug: 05-18 21:24:17 one not finished. Debug: 05-18 21:24:17 ====reading 1935 of (1935) bytes . Finished: 0 Debug: 05-18 21:24:17 ====reading 0 of (1935) bytes . Finished: 0 Debug: 05-18 21:24:17 ====reading 0 of (1935) bytes . Finished: 0 Warning: 05-18 21:24:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:24:18 translating from clipboard or selection Debug: 05-18 21:24:18 clipboard data: "/tmp/Hakurei $ g++ src/main.cc -o hakurei\nsrc/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’:\nsrc/main.cc:110:5: error: ‘log_internal’ was not declared in this scope\n 110 | log_internal(\"HTML output is being called\");\n | ^~~~~~~~~~~~\n/tmp/Hakurei $ " Debug: 05-18 21:24:18 Current state: true false true true Debug: 05-18 21:24:18 getResource: "gdlookup://localhost/?word=/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘void wrap_html_output(const std::vector%3Cstd::__cxx11::basic_string%3Cchar%3E %3E%26, const std::map%3Cstd::__cxx11::basic_string%3Cchar%3E, std::set%3Cstd::__cxx11::basic_string%3Cchar%3E %3E %3E%26, std::string%26)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 %7C log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); %7C %5E~~~~~~~~~~~ /tmp/Hakurei $&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:24:18 scheme: "gdlookup" Debug: 05-18 21:24:18 host: "localhost" Debug: 05-18 21:24:18 clear current dictionaries: "/tmp/Hakurei $ g++ src/main.cc -o hakurei src/main.cc: In function ‘void wrap_html_output(const std::vector >&, const std::map, std::set > >&, std::string&)’: src/main.cc:110:5: error: ‘log_internal’ was not declared in this scope 110 | log_internal(\"HTML output is being called\"); | ^~~~~~~~~~~~ /tmp/Hakurei $" Debug: 05-18 21:24:18 some body finished Debug: 05-18 21:24:18 one not finished. Debug: 05-18 21:24:18 ====reading 1935 of (1935) bytes . Finished: 0 Debug: 05-18 21:24:18 ====reading 0 of (1935) bytes . Finished: 0 Debug: 05-18 21:24:18 ====reading 0 of (1935) bytes . Finished: 0 Warning: 05-18 21:24:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:27:08 translating from clipboard or selection Debug: 05-18 21:27:08 clipboard data: "jaremos598@huleos.com" Debug: 05-18 21:27:08 Current state: true false true true Debug: 05-18 21:27:08 getResource: "gdlookup://localhost/?word=jaremos598@huleos.com&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:27:08 scheme: "gdlookup" Debug: 05-18 21:27:08 host: "localhost" Debug: 05-18 21:27:08 clear current dictionaries: "jaremos598@huleos.com" Debug: 05-18 21:27:08 some body finished Debug: 05-18 21:27:08 one not finished. Debug: 05-18 21:27:08 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 21:27:08 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 21:27:08 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 21:27:08 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:27:53 translating from clipboard or selection Debug: 05-18 21:27:53 clipboard data: "tudo" Debug: 05-18 21:27:53 Current state: true false true true Debug: 05-18 21:27:53 getResource: "gdlookup://localhost/?word=tudo&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:27:53 scheme: "gdlookup" Debug: 05-18 21:27:53 host: "localhost" Debug: 05-18 21:27:53 clear current dictionaries: "tudo" Debug: 05-18 21:27:53 some body finished Debug: 05-18 21:27:53 one not finished. Debug: 05-18 21:27:53 ====reading 1407 of (1407) bytes . Finished: 0 Debug: 05-18 21:27:53 ====reading 0 of (1407) bytes . Finished: 0 Debug: 05-18 21:27:53 ====reading 0 of (1407) bytes . Finished: 0 Warning: 05-18 21:27:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:29:11 translating from clipboard or selection Debug: 05-18 21:29:11 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:29:11 Current state: true false true true Debug: 05-18 21:29:11 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:29:11 scheme: "gdlookup" Debug: 05-18 21:29:11 host: "localhost" Debug: 05-18 21:29:11 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:29:11 some body finished Debug: 05-18 21:29:11 one not finished. Debug: 05-18 21:29:11 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 21:29:11 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 21:29:11 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 21:29:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:29:11 translating from clipboard or selection Debug: 05-18 21:29:11 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:29:11 Current state: true false true true Debug: 05-18 21:29:11 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:29:11 scheme: "gdlookup" Debug: 05-18 21:29:11 host: "localhost" Debug: 05-18 21:29:11 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:29:11 some body finished Debug: 05-18 21:29:11 one not finished. Debug: 05-18 21:29:11 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 21:29:11 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 21:29:11 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 21:29:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:29:11 translating from clipboard or selection Debug: 05-18 21:29:11 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:29:11 Current state: true false true true Debug: 05-18 21:29:11 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:29:11 scheme: "gdlookup" Debug: 05-18 21:29:11 host: "localhost" Debug: 05-18 21:29:11 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:29:11 some body finished Debug: 05-18 21:29:11 one not finished. Debug: 05-18 21:29:11 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 21:29:11 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 21:29:11 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 21:29:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:39:51 translating from clipboard or selection Debug: 05-18 21:39:51 clipboard data: "void log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n" Debug: 05-18 21:39:51 Current state: true false true true Debug: 05-18 21:39:51 getResource: "gdlookup://localhost/?word=void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:39:51 scheme: "gdlookup" Debug: 05-18 21:39:51 host: "localhost" Debug: 05-18 21:39:51 clear current dictionaries: "void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); }" Debug: 05-18 21:39:51 some body finished Debug: 05-18 21:39:51 one not finished. Debug: 05-18 21:39:51 ====reading 1804 of (1804) bytes . Finished: 0 Debug: 05-18 21:39:51 ====reading 0 of (1804) bytes . Finished: 0 Debug: 05-18 21:39:51 ====reading 0 of (1804) bytes . Finished: 0 Warning: 05-18 21:39:51 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:39:51 translating from clipboard or selection Debug: 05-18 21:39:52 clipboard data: "void log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n" Debug: 05-18 21:39:52 Current state: true false true true Debug: 05-18 21:39:52 getResource: "gdlookup://localhost/?word=void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:39:52 scheme: "gdlookup" Debug: 05-18 21:39:52 host: "localhost" Debug: 05-18 21:39:52 clear current dictionaries: "void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); }" Debug: 05-18 21:39:52 some body finished Debug: 05-18 21:39:52 one not finished. Debug: 05-18 21:39:52 ====reading 1804 of (1804) bytes . Finished: 0 Debug: 05-18 21:39:52 ====reading 0 of (1804) bytes . Finished: 0 Debug: 05-18 21:39:52 ====reading 0 of (1804) bytes . Finished: 0 Warning: 05-18 21:39:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:39:52 translating from clipboard or selection Debug: 05-18 21:39:52 clipboard data: "void log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n" Debug: 05-18 21:39:52 Current state: true false true true Debug: 05-18 21:39:52 getResource: "gdlookup://localhost/?word=void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:39:52 scheme: "gdlookup" Debug: 05-18 21:39:52 host: "localhost" Debug: 05-18 21:39:52 clear current dictionaries: "void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); }" Debug: 05-18 21:39:52 some body finished Debug: 05-18 21:39:52 one not finished. Debug: 05-18 21:39:52 ====reading 1804 of (1804) bytes . Finished: 0 Debug: 05-18 21:39:52 ====reading 0 of (1804) bytes . Finished: 0 Debug: 05-18 21:39:52 ====reading 0 of (1804) bytes . Finished: 0 Warning: 05-18 21:39:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:40:07 translating from clipboard or selection Debug: 05-18 21:40:07 clipboard data: "void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n" Debug: 05-18 21:40:07 Current state: true false true true Debug: 05-18 21:40:07 getResource: "gdlookup://localhost/?word=void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:40:07 scheme: "gdlookup" Debug: 05-18 21:40:07 host: "localhost" Debug: 05-18 21:40:07 clear current dictionaries: "void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); }" Debug: 05-18 21:40:07 some body finished Debug: 05-18 21:40:07 one not finished. Debug: 05-18 21:40:07 ====reading 2523 of (2523) bytes . Finished: 0 Debug: 05-18 21:40:07 ====reading 0 of (2523) bytes . Finished: 0 Debug: 05-18 21:40:07 ====reading 0 of (2523) bytes . Finished: 0 Warning: 05-18 21:40:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:40:07 translating from clipboard or selection Debug: 05-18 21:40:07 clipboard data: "void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n" Debug: 05-18 21:40:07 Current state: true false true true Debug: 05-18 21:40:07 getResource: "gdlookup://localhost/?word=void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:40:07 scheme: "gdlookup" Debug: 05-18 21:40:07 host: "localhost" Debug: 05-18 21:40:07 clear current dictionaries: "void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); }" Debug: 05-18 21:40:07 some body finished Debug: 05-18 21:40:07 one not finished. Debug: 05-18 21:40:07 ====reading 2523 of (2523) bytes . Finished: 0 Debug: 05-18 21:40:07 ====reading 0 of (2523) bytes . Finished: 0 Debug: 05-18 21:40:07 ====reading 0 of (2523) bytes . Finished: 0 Warning: 05-18 21:40:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:40:26 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:40:26 scheme: "gdlookup" Debug: 05-18 21:40:26 host: "localhost" Debug: 05-18 21:40:26 clear current dictionaries: "ゆっくり" Debug: 05-18 21:40:26 some body finished Debug: 05-18 21:40:26 one not finished. Debug: 05-18 21:40:26 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 21:40:26 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 21:40:26 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 21:40:26 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:41:37 translating from clipboard or selection Debug: 05-18 21:41:37 clipboard data: "\n // Print debug information if in debug mode\n if (debug\n" Debug: 05-18 21:41:37 Current state: true true false true Debug: 05-18 21:41:37 getResource: "gdlookup://localhost/?word=// Print debug information if in debug mode if (debug&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:41:37 scheme: "gdlookup" Debug: 05-18 21:41:37 host: "localhost" Debug: 05-18 21:41:37 clear current dictionaries: "// Print debug information if in debug mode if (debug" Debug: 05-18 21:41:37 some body finished Debug: 05-18 21:41:37 one not finished. Debug: 05-18 21:41:37 ====reading 1456 of (1456) bytes . Finished: 0 Debug: 05-18 21:41:37 ====reading 0 of (1456) bytes . Finished: 0 Debug: 05-18 21:41:37 ====reading 0 of (1456) bytes . Finished: 0 Debug: 05-18 21:41:37 some body finished Debug: 05-18 21:41:37 one finished. Debug: 05-18 21:41:37 erasing.. Debug: 05-18 21:41:37 erase done.. Debug: 05-18 21:41:37 send dicts(finished): "groupId:1,word:// Print debug information if in debug mode if (debug,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:41:37 ====reading 1292 of (2748) bytes . Finished: 1 Debug: 05-18 21:41:37 receive dicts, current word: "// Print debug information if in debug mode if (debug" "// Print debug information if in debug mode if (debug" : QList("9dfe38c28e4eb0d417245e761da52517") Warning: 05-18 21:41:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:41:37 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:41:37 scheme: "gico" Debug: 05-18 21:41:37 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:41:37 article view loaded url: "gdlookup://localhost/?word=// Print debug information if in debug mode if (debug&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f4" true Debug: 05-18 21:42:07 translating from clipboard or selection Debug: 05-18 21:42:07 clipboard data: "how to delete the last commit " Debug: 05-18 21:42:07 Current state: true false false true Debug: 05-18 21:42:07 getResource: "gdlookup://localhost/?word=how to delete the last commit&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:42:07 scheme: "gdlookup" Debug: 05-18 21:42:07 host: "localhost" Debug: 05-18 21:42:07 clear current dictionaries: "how to delete the last commit" Debug: 05-18 21:42:07 some body finished Debug: 05-18 21:42:07 one not finished. Debug: 05-18 21:42:07 ====reading 1432 of (1432) bytes . Finished: 0 Debug: 05-18 21:42:07 ====reading 0 of (1432) bytes . Finished: 0 Debug: 05-18 21:42:07 ====reading 0 of (1432) bytes . Finished: 0 Debug: 05-18 21:42:07 some body finished Debug: 05-18 21:42:07 one finished. Debug: 05-18 21:42:07 erasing.. Debug: 05-18 21:42:07 erase done.. Debug: 05-18 21:42:07 send dicts(finished): "groupId:1,word:how to delete the last commit,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:42:07 receive dicts, current word: "how to delete the last commit" "how to delete the last commit" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:42:07 ====reading 1292 of (2724) bytes . Finished: 1 Debug: 05-18 21:42:07 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:42:07 scheme: "gico" Debug: 05-18 21:42:07 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:42:07 article view loaded url: "gdlookup://localhost/?word=how to delete the last commit&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae276920" true Debug: 05-18 21:42:41 translating from clipboard or selection Debug: 05-18 21:42:41 clipboard data: "git reset --hard HEAD~1\n" Debug: 05-18 21:42:41 Current state: true false true true Debug: 05-18 21:42:41 getResource: "gdlookup://localhost/?word=git reset --hard HEAD~1&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:42:41 scheme: "gdlookup" Debug: 05-18 21:42:41 host: "localhost" Debug: 05-18 21:42:41 clear current dictionaries: "git reset --hard HEAD~1" Debug: 05-18 21:42:41 some body finished Debug: 05-18 21:42:41 one not finished. Debug: 05-18 21:42:41 ====reading 1426 of (1426) bytes . Finished: 0 Debug: 05-18 21:42:41 ====reading 0 of (1426) bytes . Finished: 0 Debug: 05-18 21:42:41 ====reading 0 of (1426) bytes . Finished: 0 Debug: 05-18 21:42:41 some body finished Debug: 05-18 21:42:41 one finished. Debug: 05-18 21:42:41 erasing.. Debug: 05-18 21:42:41 erase done.. Debug: 05-18 21:42:41 send dicts(finished): "groupId:1,word:git reset --hard HEAD~1,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:42:41 ====reading 1292 of (2718) bytes . Finished: 1 Debug: 05-18 21:42:41 receive dicts, current word: "git reset --hard HEAD~1" "git reset --hard HEAD~1" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:42:41 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:42:41 scheme: "gico" Debug: 05-18 21:42:41 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:42:41 article view loaded url: "gdlookup://localhost/?word=git reset --hard HEAD~1&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6da" true Debug: 05-18 21:44:45 translating from clipboard or selection Debug: 05-18 21:44:45 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:44:45 Current state: true false true true Debug: 05-18 21:44:45 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:44:45 scheme: "gdlookup" Debug: 05-18 21:44:45 host: "localhost" Debug: 05-18 21:44:45 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:44:45 some body finished Debug: 05-18 21:44:45 one not finished. Debug: 05-18 21:44:45 some body finished Debug: 05-18 21:44:45 one finished. Debug: 05-18 21:44:45 erasing.. Debug: 05-18 21:44:45 erase done.. Debug: 05-18 21:44:45 send dicts(finished): "groupId:1,word:#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; },dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:44:45 ====reading 14786 of (14786) bytes . Finished: 1 Debug: 05-18 21:44:45 receive dicts, current word: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:44:45 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:44:45 scheme: "gico" Debug: 05-18 21:44:45 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:44:45 article view loaded url: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp" true Debug: 05-18 21:44:46 translating from clipboard or selection Debug: 05-18 21:44:46 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:44:46 Current state: true false true true Debug: 05-18 21:44:46 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:44:46 scheme: "gdlookup" Debug: 05-18 21:44:46 host: "localhost" Debug: 05-18 21:44:46 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:44:46 some body finished Debug: 05-18 21:44:46 one not finished. Debug: 05-18 21:44:46 some body finished Debug: 05-18 21:44:46 one finished. Debug: 05-18 21:44:46 erasing.. Debug: 05-18 21:44:46 erase done.. Debug: 05-18 21:44:46 send dicts(finished): "groupId:1,word:#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; },dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:44:46 ====reading 14786 of (14786) bytes . Finished: 1 Debug: 05-18 21:44:46 receive dicts, current word: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:44:46 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:44:46 scheme: "gico" Debug: 05-18 21:44:46 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:44:46 article view loaded url: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp" true Debug: 05-18 21:44:46 translating from clipboard or selection Debug: 05-18 21:44:46 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:44:46 Current state: true false true true Debug: 05-18 21:44:46 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:44:46 scheme: "gdlookup" Debug: 05-18 21:44:46 host: "localhost" Debug: 05-18 21:44:46 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:44:46 some body finished Debug: 05-18 21:44:46 one not finished. Debug: 05-18 21:44:46 some body finished Debug: 05-18 21:44:46 one finished. Debug: 05-18 21:44:46 erasing.. Debug: 05-18 21:44:46 erase done.. Debug: 05-18 21:44:46 send dicts(finished): "groupId:1,word:#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; },dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:44:46 ====reading 14786 of (14786) bytes . Finished: 1 Debug: 05-18 21:44:46 receive dicts, current word: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:44:46 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:44:46 scheme: "gico" Debug: 05-18 21:44:46 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:44:46 article view loaded url: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp" true Debug: 05-18 21:45:15 translating from clipboard or selection Debug: 05-18 21:45:15 clipboard data: "" Debug: 05-18 21:45:34 translating from clipboard or selection Debug: 05-18 21:45:34 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 21:45:34 Current state: true false true true Debug: 05-18 21:45:34 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:45:34 scheme: "gdlookup" Debug: 05-18 21:45:34 host: "localhost" Debug: 05-18 21:45:34 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:45:34 some body finished Debug: 05-18 21:45:34 one not finished. Debug: 05-18 21:45:34 some body finished Debug: 05-18 21:45:34 one finished. Debug: 05-18 21:45:34 erasing.. Debug: 05-18 21:45:34 erase done.. Debug: 05-18 21:45:34 send dicts(finished): "groupId:1,word:#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; },dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:45:34 ====reading 14786 of (14786) bytes . Finished: 1 Debug: 05-18 21:45:34 receive dicts, current word: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:45:34 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:45:34 scheme: "gico" Debug: 05-18 21:45:34 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:45:34 article view loaded url: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp" true Debug: 05-18 21:45:38 translating from clipboard or selection Debug: 05-18 21:45:38 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
\";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
\"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
\" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
  • \" + alt + \"
  • \";\n }\n output_html += \"
\";\n }\n\n output_html += \"
\"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
\" + removed_char + \"
\";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
\"; \n output_html += \"
\";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}" Debug: 05-18 21:45:38 Current state: true false true true Debug: 05-18 21:45:38 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:45:38 scheme: "gdlookup" Debug: 05-18 21:45:38 host: "localhost" Debug: 05-18 21:45:38 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 21:45:38 some body finished Debug: 05-18 21:45:38 one not finished. Debug: 05-18 21:45:38 some body finished Debug: 05-18 21:45:38 one finished. Debug: 05-18 21:45:38 erasing.. Debug: 05-18 21:45:38 erase done.. Debug: 05-18 21:45:38 send dicts(finished): "groupId:1,word:#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; },dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:45:38 ====reading 14786 of (14786) bytes . Finished: 1 Debug: 05-18 21:45:38 receive dicts, current word: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
\"; std::string sentence_copy = sentence; output_html += \"
\"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
\" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
    \"; for (const auto& alt : alt_itr->second) { output_html += \"
  • \" + alt + \"
  • \"; } output_html += \"
\"; } output_html += \"
\"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
\" + removed_char + \"
\"; sentence_copy = new_sentence_copy; } } output_html += \"
\"; output_html += \"
\"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:45:38 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:45:38 scheme: "gico" Debug: 05-18 21:45:38 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:45:38 article view loaded url: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp" true Debug: 05-18 21:46:36 translating from clipboard or selection Debug: 05-18 21:46:36 clipboard data: "" Debug: 05-18 21:46:43 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:46:43 scheme: "gdlookup" Debug: 05-18 21:46:43 host: "localhost" Debug: 05-18 21:46:43 clear current dictionaries: "違和感" Debug: 05-18 21:46:43 some body finished Debug: 05-18 21:46:43 one not finished. Debug: 05-18 21:46:43 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 21:46:43 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 21:46:43 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 21:46:43 some body finished Debug: 05-18 21:46:43 one finished. Debug: 05-18 21:46:43 erasing.. Debug: 05-18 21:46:43 erase done.. Debug: 05-18 21:46:43 send dicts(finished): "groupId:1,word:違和感,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:43 receive dicts, current word: "違和感" "違和感" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:46:43 ====reading 1292 of (2704) bytes . Finished: 1 Debug: 05-18 21:46:43 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:46:43 scheme: "gico" Debug: 05-18 21:46:43 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:43 article view loaded url: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96631" true Debug: 05-18 21:46:44 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:46:44 scheme: "gdlookup" Debug: 05-18 21:46:44 host: "localhost" Debug: 05-18 21:46:44 clear current dictionaries: "ゆっくり" Debug: 05-18 21:46:44 some body finished Debug: 05-18 21:46:44 one not finished. Debug: 05-18 21:46:44 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 21:46:44 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 21:46:44 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 21:46:44 some body finished Debug: 05-18 21:46:44 one finished. Debug: 05-18 21:46:44 erasing.. Debug: 05-18 21:46:44 erase done.. Debug: 05-18 21:46:44 send dicts(finished): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:44 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:46:44 ====reading 1292 of (2707) bytes . Finished: 1 Debug: 05-18 21:46:44 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:46:44 scheme: "gico" Debug: 05-18 21:46:44 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:44 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b9663" true Debug: 05-18 21:46:45 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:46:45 scheme: "gdlookup" Debug: 05-18 21:46:45 host: "localhost" Debug: 05-18 21:46:45 clear current dictionaries: "議" Debug: 05-18 21:46:45 some body finished Debug: 05-18 21:46:45 one not finished. Debug: 05-18 21:46:45 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 21:46:45 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 21:46:45 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 21:46:45 some body finished Debug: 05-18 21:46:45 one finished. Debug: 05-18 21:46:45 erasing.. Debug: 05-18 21:46:45 erase done.. Debug: 05-18 21:46:45 send dicts(finished): "groupId:1,word:議,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:45 receive dicts, current word: "議" "議" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:46:45 ====reading 1292 of (2698) bytes . Finished: 1 Debug: 05-18 21:46:45 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:46:45 scheme: "gico" Debug: 05-18 21:46:45 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:45 article view loaded url: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a" true Debug: 05-18 21:46:46 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:46:46 scheme: "gdlookup" Debug: 05-18 21:46:46 host: "localhost" Debug: 05-18 21:46:46 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 21:46:46 some body finished Debug: 05-18 21:46:46 one not finished. Debug: 05-18 21:46:46 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 21:46:46 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 21:46:46 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 21:46:46 some body finished Debug: 05-18 21:46:46 one finished. Debug: 05-18 21:46:46 erasing.. Debug: 05-18 21:46:46 erase done.. Debug: 05-18 21:46:46 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:46 ====reading 1292 of (2713) bytes . Finished: 1 Debug: 05-18 21:46:46 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:46:46 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:46:46 scheme: "gico" Debug: 05-18 21:46:46 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:46:46 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 21:52:47 translating from clipboard or selection Debug: 05-18 21:52:47 clipboard data: "diff --git a/hakurei.cpp b/hakurei.cpp\nindex 1234567..89abcde 100644\n--- a/hakurei.cpp\n+++ b/hakurei.cpp\n@@ -1,6 +1,7 @@\n #include \n #include \n #include \n+#include \n #include \n #include \n #include \n@@ -9,6 +10,7 @@\n #include \n #include \n #include \n+#include \n #include \n \n struct Entry {\n@@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n+ log_internal(\"Received search string from stdin: \" + search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n@@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n search_string = argv[i + 1];\n break;\n }\n+ log_internal(\"Received search string from command line in goldendict mode: \" + search_string);\n }\n } else {\n if (argc < 2) {\n@@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n+ log_internal(\"Parsing command line arguments\");\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n@@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n+ log_internal(\"Search string not provided\");\n exit(1);\n }\n return search_string;\n@@ -131,12 +138,18 @@ inline void wrap_html_output(\n output_html += \"
\";\n \n std::string sentence_copy = sentence;\n+ log_internal(\"HTML output is being called\");\n \n output_html += \"
\"; \n \n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n+ log_internal(\"Processing substring: \" + substring);\n if (sentence_copy.rfind(substring, 0) == 0) {\n+ log_internal(\"Found substring match: \" + substring);\n output_html += \"
\" + substring + \"\";\n \n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
    \";\n@@ -179,6 +192,8 @@ inline void wrap_html_output(\n found = true;\n break;\n }\n+ log_internal(\"No match found for substring: \" + substring);\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n+ log_internal(\"Removed one UTF-8 character: \" + removed_char);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\");\n@@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin\n }\n \n void log_internal(const std::string& message) {\n+ log_internal(\"Logging message: \" + message);\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n@@ -283,6 +299,17 @@ void log_internal(const std::string& message) {\n }\n \n std::string get_current_time() {\n+ std::time_t now = std::time(nullptr);\n+ char buf[80];\n+ std::strftime(buf, sizeof(buf), \"%Y-%m-%d %H:%M:%S\", std::localtime(&now));\n+ return std::string(buf);\n+}\n+\n+int main(const int argc, char* argv[]) {\n+ bool debug_mode = false;\n+ bool goldendict_mode = false;\n+ std::string word, sentence;\n+ std::string dict_file = find_dic_file().string(); // Default dictionary file path\n \n log_internal(\"Program started at \" + get_current_time());\n \n@@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) {\n \n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string + \" at \" + get_current_time());\n+ log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string + \" at \" + get_current_time());\n@@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) {\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n+ log_internal(\"Current search string: \" + search_string);\n auto itr = trie.make_prefix_iterator(search_string);\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()) + \" at \" + get_current_time());\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n@@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) {\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring + \" at \" + get_current_time());\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n \n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char + \" at \" + get_current_time());\n \n@@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at \" + get_current_time());\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string + \" at \" + get_current_time());\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n@@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) {\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n \n log_internal(\"Program finished at \" + get_current_time());\n return 0;\n }\n" Debug: 05-18 21:52:47 Current state: true true false true Debug: 05-18 21:52:47 getResource: "gdlookup://localhost/?word=diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E +%23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E @@ -9,6 +10,7 @@ %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E +%23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B @@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); + log_internal(%22Received search string from stdin: %22 + search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B @@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold search_string %3D argv[i + 1]; break; %7D + log_internal(%22Received search string from command line in goldendict mode: %22 + search_string); %7D %7D else %7B if (argc %3C 2) %7B @@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B + log_internal(%22Parsing command line arguments%22); if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B @@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; + log_internal(%22Search string not provided%22); exit(1); %7D return search_string; @@ -131,12 +138,18 @@ inline void wrap_html_output( output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; + log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B + log_internal(%22Processing substring: %22 + substring); if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B + log_internal(%22Found substring match: %22 + substring); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; @@ -179,6 +192,8 @@ inline void wrap_html_output( found %3D true; break; %7D + log_internal(%22No match found for substring: %22 + substring); %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); + log_internal(%22Removed one UTF-8 character: %22 + removed_char); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22); @@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string%26 search_strin %7D void log_internal(const std::string%26 message) %7B + log_internal(%22Logging message: %22 + message); std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B @@ -283,6 +299,17 @@ void log_internal(const std::string%26 message) %7B %7D std::string get_current_time() %7B + std::time_t now %3D std::time(nullptr); + char buf[80]; + std::strftime(buf, sizeof(buf), %22%25Y-%25m-%25d %25H:%25M:%25S%22, std::localtime(%26now)); + return std::string(buf); +%7D + +int main(const int argc, char* argv[]) %7B + bool debug_mode %3D false; + bool goldendict_mode %3D false; + std::string word, sentence; + std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started at %22 + get_current_time()); @@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) %7B std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string + %22 at %22 + get_current_time()); + log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string + %22 at %22 + get_current_time()); @@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) %7B std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B + log_internal(%22Current search string: %22 + search_string); auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view()) + %22 at %22 + get_current_time()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); @@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) %7B alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring + %22 at %22 + get_current_time()); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char + %22 at %22 + get_current_time()); @@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at %22 + get_current_time()); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string + %22 at %22 + get_current_time()); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); @@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) %7B // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished at %22 + get_current_time()); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:52:47 scheme: "gdlookup" Debug: 05-18 21:52:47 host: "localhost" Debug: 05-18 21:52:47 clear current dictionaries: "diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include #include struct Entry { @@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); + log_internal(\"Received search string from stdin: \" + search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { @@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold search_string = argv[i + 1]; break; } + log_internal(\"Received search string from command line in goldendict mode: \" + search_string); } } else { if (argc < 2) { @@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold exit(1); } for (int i = 1; i < argc; ++i) { + log_internal(\"Parsing command line arguments\"); if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { @@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; + log_internal(\"Search string not provided\"); exit(1); } return search_string; @@ -131,12 +138,18 @@ inline void wrap_html_output( output_html += \"
    \"; std::string sentence_copy = sentence; + log_internal(\"HTML output is being called\"); output_html += \"
    \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { + log_internal(\"Processing substring: \" + substring); if (sentence_copy.rfind(substring, 0) == 0) { + log_internal(\"Found substring match: \" + substring); output_html += \"
    \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
      \"; @@ -179,6 +192,8 @@ inline void wrap_html_output( found = true; break; } + log_internal(\"No match found for substring: \" + substring); } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); + log_internal(\"Removed one UTF-8 character: \" + removed_char); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\"); @@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin } void log_internal(const std::string& message) { + log_internal(\"Logging message: \" + message); std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { @@ -283,6 +299,17 @@ void log_internal(const std::string& message) { } std::string get_current_time() { + std::time_t now = std::time(nullptr); + char buf[80]; + std::strftime(buf, sizeof(buf), \"%Y-%m-%d %H:%M:%S\", std::localtime(&now)); + return std::string(buf); +} + +int main(const int argc, char* argv[]) { + bool debug_mode = false; + bool goldendict_mode = false; + std::string word, sentence; + std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started at \" + get_current_time()); @@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) { std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string + \" at \" + get_current_time()); + log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string + \" at \" + get_current_time()); @@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) { std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { + log_internal(\"Current search string: \" + search_string); auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view()) + \" at \" + get_current_time()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); @@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) { alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring + \" at \" + get_current_time()); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char + \" at \" + get_current_time()); @@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at \" + get_current_time()); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string + \" at \" + get_current_time()); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); @@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) { // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished at \" + get_current_time()); return 0; }" Debug: 05-18 21:52:47 some body finished Debug: 05-18 21:52:47 one not finished. Debug: 05-18 21:52:47 some body finished Debug: 05-18 21:52:47 one finished. Debug: 05-18 21:52:47 erasing.. Debug: 05-18 21:52:47 erase done.. Debug: 05-18 21:52:47 send dicts(finished): "groupId:1,word:diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include #include struct Entry { @@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); + log_internal(\"Received search string from stdin: \" + search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { @@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold search_string = argv[i + 1]; break; } + log_internal(\"Received search string from command line in goldendict mode: \" + search_string); } } else { if (argc < 2) { @@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold exit(1); } for (int i = 1; i < argc; ++i) { + log_internal(\"Parsing command line arguments\"); if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { @@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; + log_internal(\"Search string not provided\"); exit(1); } return search_string; @@ -131,12 +138,18 @@ inline void wrap_html_output( output_html += \"
      \"; std::string sentence_copy = sentence; + log_internal(\"HTML output is being called\"); output_html += \"
      \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { + log_internal(\"Processing substring: \" + substring); if (sentence_copy.rfind(substring, 0) == 0) { + log_internal(\"Found substring match: \" + substring); output_html += \"
      \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
        \"; @@ -179,6 +192,8 @@ inline void wrap_html_output( found = true; break; } + log_internal(\"No match found for substring: \" + substring); } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); + log_internal(\"Removed one UTF-8 character: \" + removed_char); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\"); @@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin } void log_internal(const std::string& message) { + log_internal(\"Logging message: \" + message); std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { @@ -283,6 +299,17 @@ void log_internal(const std::string& message) { } std::string get_current_time() { + std::time_t now = std::time(nullptr); + char buf[80]; + std::strftime(buf, sizeof(buf), \"%Y-%m-%d %H:%M:%S\", std::localtime(&now)); + return std::string(buf); +} + +int main(const int argc, char* argv[]) { + bool debug_mode = false; + bool goldendict_mode = false; + std::string word, sentence; + std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started at \" + get_current_time()); @@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) { std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string + \" at \" + get_current_time()); + log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string + \" at \" + get_current_time()); @@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) { std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { + log_internal(\"Current search string: \" + search_string); auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view()) + \" at \" + get_current_time()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); @@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) { alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring + \" at \" + get_current_time()); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char + \" at \" + get_current_time()); @@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at \" + get_current_time()); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string + \" at \" + get_current_time()); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); @@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) { // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished at \" + get_current_time()); return 0; },dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:52:47 receive dicts, current word: "diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include #include struct Entry { @@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); + log_internal(\"Received search string from stdin: \" + search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { @@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold search_string = argv[i + 1]; break; } + log_internal(\"Received search string from command line in goldendict mode: \" + search_string); } } else { if (argc < 2) { @@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold exit(1); } for (int i = 1; i < argc; ++i) { + log_internal(\"Parsing command line arguments\"); if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { @@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; + log_internal(\"Search string not provided\"); exit(1); } return search_string; @@ -131,12 +138,18 @@ inline void wrap_html_output( output_html += \"
        \"; std::string sentence_copy = sentence; + log_internal(\"HTML output is being called\"); output_html += \"
        \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { + log_internal(\"Processing substring: \" + substring); if (sentence_copy.rfind(substring, 0) == 0) { + log_internal(\"Found substring match: \" + substring); output_html += \"
        \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
          \"; @@ -179,6 +192,8 @@ inline void wrap_html_output( found = true; break; } + log_internal(\"No match found for substring: \" + substring); } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); + log_internal(\"Removed one UTF-8 character: \" + removed_char); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\"); @@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin } void log_internal(const std::string& message) { + log_internal(\"Logging message: \" + message); std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { @@ -283,6 +299,17 @@ void log_internal(const std::string& message) { } std::string get_current_time() { + std::time_t now = std::time(nullptr); + char buf[80]; + std::strftime(buf, sizeof(buf), \"%Y-%m-%d %H:%M:%S\", std::localtime(&now)); + return std::string(buf); +} + +int main(const int argc, char* argv[]) { + bool debug_mode = false; + bool goldendict_mode = false; + std::string word, sentence; + std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started at \" + get_current_time()); @@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) { std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string + \" at \" + get_current_time()); + log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string + \" at \" + get_current_time()); @@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) { std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { + log_internal(\"Current search string: \" + search_string); auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view()) + \" at \" + get_current_time()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); @@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) { alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring + \" at \" + get_current_time()); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char + \" at \" + get_current_time()); @@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at \" + get_current_time()); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string + \" at \" + get_current_time()); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); @@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) { // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished at \" + get_current_time()); return 0; }" "diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include #include struct Entry { @@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); + log_internal(\"Received search string from stdin: \" + search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { @@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold search_string = argv[i + 1]; break; } + log_internal(\"Received search string from command line in goldendict mode: \" + search_string); } } else { if (argc < 2) { @@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold exit(1); } for (int i = 1; i < argc; ++i) { + log_internal(\"Parsing command line arguments\"); if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { @@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; + log_internal(\"Search string not provided\"); exit(1); } return search_string; @@ -131,12 +138,18 @@ inline void wrap_html_output( output_html += \"
          \"; std::string sentence_copy = sentence; + log_internal(\"HTML output is being called\"); output_html += \"
          \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { + log_internal(\"Processing substring: \" + substring); if (sentence_copy.rfind(substring, 0) == 0) { + log_internal(\"Found substring match: \" + substring); output_html += \"
          \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
            \"; @@ -179,6 +192,8 @@ inline void wrap_html_output( found = true; break; } + log_internal(\"No match found for substring: \" + substring); } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); + log_internal(\"Removed one UTF-8 character: \" + removed_char); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\"); @@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin } void log_internal(const std::string& message) { + log_internal(\"Logging message: \" + message); std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { @@ -283,6 +299,17 @@ void log_internal(const std::string& message) { } std::string get_current_time() { + std::time_t now = std::time(nullptr); + char buf[80]; + std::strftime(buf, sizeof(buf), \"%Y-%m-%d %H:%M:%S\", std::localtime(&now)); + return std::string(buf); +} + +int main(const int argc, char* argv[]) { + bool debug_mode = false; + bool goldendict_mode = false; + std::string word, sentence; + std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started at \" + get_current_time()); @@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) { std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string + \" at \" + get_current_time()); + log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string + \" at \" + get_current_time()); @@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) { std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { + log_internal(\"Current search string: \" + search_string); auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view()) + \" at \" + get_current_time()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); @@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) { alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring + \" at \" + get_current_time()); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char + \" at \" + get_current_time()); @@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at \" + get_current_time()); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string + \" at \" + get_current_time()); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); @@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) { // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished at \" + get_current_time()); return 0; }" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:52:47 ====reading 9857 of (9857) bytes . Finished: 1 Debug: 05-18 21:52:47 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:52:47 scheme: "gico" Debug: 05-18 21:52:47 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:52:47 article view loaded url: "gdlookup://localhost/?word=diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ %23include %3Ciostream%3E %23include %3Cvector%3E %2" true Debug: 05-18 21:53:28 translating from clipboard or selection Debug: 05-18 21:53:28 clipboard data: "MOVE(*" Debug: 05-18 21:53:28 Current state: true false false true Debug: 05-18 21:53:28 getResource: "gdlookup://localhost/?word=MOVE(*&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:53:28 scheme: "gdlookup" Debug: 05-18 21:53:28 host: "localhost" Debug: 05-18 21:53:28 clear current dictionaries: "MOVE(*" Debug: 05-18 21:53:28 some body finished Debug: 05-18 21:53:28 one not finished. Debug: 05-18 21:53:28 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 21:53:28 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 21:53:28 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 21:53:28 some body finished Debug: 05-18 21:53:28 one finished. Debug: 05-18 21:53:28 erasing.. Debug: 05-18 21:53:28 erase done.. Debug: 05-18 21:53:28 send dicts(finished): "groupId:1,word:MOVE(*,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:53:28 receive dicts, current word: "MOVE(*" "MOVE(*" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:53:28 ====reading 1292 of (2701) bytes . Finished: 1 Debug: 05-18 21:53:28 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:53:28 scheme: "gico" Debug: 05-18 21:53:28 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:53:28 article view loaded url: "gdlookup://localhost/?word=MOVE(*&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 21:53:28 translating from clipboard or selection Debug: 05-18 21:53:28 clipboard data: "MOVE(*(__first" Debug: 05-18 21:53:28 Current state: true false true true Debug: 05-18 21:53:28 getResource: "gdlookup://localhost/?word=MOVE(*(__first&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:53:28 scheme: "gdlookup" Debug: 05-18 21:53:28 host: "localhost" Debug: 05-18 21:53:28 clear current dictionaries: "MOVE(*(__first" Debug: 05-18 21:53:28 some body finished Debug: 05-18 21:53:28 one not finished. Debug: 05-18 21:53:28 ====reading 1417 of (1417) bytes . Finished: 0 Debug: 05-18 21:53:28 ====reading 0 of (1417) bytes . Finished: 0 Debug: 05-18 21:53:28 ====reading 0 of (1417) bytes . Finished: 0 Debug: 05-18 21:53:28 some body finished Debug: 05-18 21:53:28 one finished. Debug: 05-18 21:53:28 erasing.. Debug: 05-18 21:53:28 erase done.. Debug: 05-18 21:53:28 send dicts(finished): "groupId:1,word:MOVE(*(__first,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:53:28 ====reading 1292 of (2709) bytes . Finished: 1 Debug: 05-18 21:53:28 receive dicts, current word: "MOVE(*(__first" "MOVE(*(__first" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 21:53:28 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 21:53:28 scheme: "gico" Debug: 05-18 21:53:28 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 21:53:28 article view loaded url: "gdlookup://localhost/?word=MOVE(*(__first&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb32" true Debug: 05-18 21:56:09 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:56:09 scheme: "gdlookup" Debug: 05-18 21:56:09 host: "localhost" Debug: 05-18 21:56:09 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 21:56:09 some body finished Debug: 05-18 21:56:09 one not finished. Debug: 05-18 21:56:09 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 21:56:09 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 21:56:09 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 21:56:22 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:56:22 scheme: "gdlookup" Debug: 05-18 21:56:22 host: "localhost" Debug: 05-18 21:56:22 clear current dictionaries: "ゆっくり" Debug: 05-18 21:56:22 some body finished Debug: 05-18 21:56:22 one not finished. Debug: 05-18 21:56:22 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 21:56:22 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 21:56:22 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 21:56:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:56:23 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:56:23 scheme: "gdlookup" Debug: 05-18 21:56:23 host: "localhost" Debug: 05-18 21:56:23 clear current dictionaries: "違和感" Debug: 05-18 21:56:23 some body finished Debug: 05-18 21:56:23 one not finished. Debug: 05-18 21:56:23 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 21:56:23 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 21:56:23 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 21:56:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:56:24 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:56:24 scheme: "gdlookup" Debug: 05-18 21:56:24 host: "localhost" Debug: 05-18 21:56:24 clear current dictionaries: "転生したら剣でした" Debug: 05-18 21:56:24 some body finished Debug: 05-18 21:56:24 one not finished. Debug: 05-18 21:56:24 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 21:56:24 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 21:56:24 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 21:56:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:56:28 translating from clipboard or selection Debug: 05-18 21:56:28 clipboard data: "転生したら剣でした" Debug: 05-18 21:56:28 Current state: true false false true Debug: 05-18 21:56:28 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:56:28 scheme: "gdlookup" Debug: 05-18 21:56:28 host: "localhost" Debug: 05-18 21:56:28 clear current dictionaries: "転生したら剣でした" Debug: 05-18 21:56:28 some body finished Debug: 05-18 21:56:28 one not finished. Debug: 05-18 21:56:28 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 21:56:28 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 21:56:28 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 21:56:28 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 21:56:29 translating from clipboard or selection Debug: 05-18 21:56:29 clipboard data: "転生したら剣でした" Debug: 05-18 21:56:29 Current state: true false true true Debug: 05-18 21:56:29 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 21:56:29 scheme: "gdlookup" Debug: 05-18 21:56:29 host: "localhost" Debug: 05-18 21:56:29 clear current dictionaries: "転生したら剣でした" Debug: 05-18 21:56:29 some body finished Debug: 05-18 21:56:29 one not finished. Debug: 05-18 21:56:29 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 21:56:29 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 21:56:29 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 21:56:29 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:07:16 translating from clipboard or selection Debug: 05-18 22:07:16 clipboard data: "slc" Debug: 05-18 22:07:16 Current state: true true true true Debug: 05-18 22:07:16 getResource: "gdlookup://localhost/?word=slc&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:07:16 scheme: "gdlookup" Debug: 05-18 22:07:16 host: "localhost" Debug: 05-18 22:07:16 clear current dictionaries: "slc" Debug: 05-18 22:07:16 some body finished Debug: 05-18 22:07:16 one not finished. Debug: 05-18 22:07:16 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 22:07:16 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 22:07:16 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 22:07:16 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:07:20 translating from clipboard or selection Debug: 05-18 22:07:20 clipboard data: "" Debug: 05-18 22:08:10 translating from clipboard or selection Debug: 05-18 22:08:10 clipboard data: "lofiga3778@huleos.com" Debug: 05-18 22:08:10 Current state: true false true true Debug: 05-18 22:08:10 getResource: "gdlookup://localhost/?word=lofiga3778@huleos.com&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:08:10 scheme: "gdlookup" Debug: 05-18 22:08:10 host: "localhost" Debug: 05-18 22:08:10 clear current dictionaries: "lofiga3778@huleos.com" Debug: 05-18 22:08:10 some body finished Debug: 05-18 22:08:10 one not finished. Debug: 05-18 22:08:10 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 22:08:10 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 22:08:10 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 22:08:10 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Info: 05-18 22:08:25 libpng warning: iCCP: known incorrect sRGB profile Info: 05-18 22:08:25 libpng warning: iCCP: cHRM chunk does not match sRGB Debug: 05-18 22:08:27 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 22:08:27 Epwing: found "EIDAI6" Debug: 05-18 22:08:27 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 22:08:27 Epwing: found "HYOGEN" Debug: 05-18 22:08:27 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:08:27 Epwing: found "RUIGIGO" Debug: 05-18 22:08:27 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:08:27 Epwing: found "RUIGIGO" Debug: 05-18 22:08:28 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 22:08:28 Epwing: found "ENCY" Debug: 05-18 22:08:28 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 22:08:28 Epwing: found "Snmkg99" Debug: 05-18 22:08:28 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 22:08:28 Epwing: found "BODY" Debug: 05-18 22:08:28 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 22:08:28 Epwing: found "MEIKYOJJ" Info: 05-18 22:08:28 libpng warning: iCCP: known incorrect sRGB profile Info: 05-18 22:08:29 libpng warning: iCCP: known incorrect sRGB profile Info: 05-18 22:08:29 libpng warning: iCCP: known incorrect sRGB profile Debug: 05-18 22:08:31 "OrderAndProps" Debug: 05-18 22:08:32 "Sources" Debug: 05-18 22:08:51 handle path: "/mnt/Reading/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:08:51 handle path: "/mnt/Data/Chinese caligraphy dictionaries" Debug: 05-18 22:08:51 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/dicts" Debug: 05-18 22:08:54 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 22:08:54 Epwing: found "EIDAI6" Warning: 05-18 22:08:54 "Epwing dictionary initializing failed: , error: EB library report error EB \"eb_set_subbook\" function error: EB_ERR_FAIL_OPEN_TEXT (failed to open a text file)\n" Debug: 05-18 22:08:54 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 22:08:54 Epwing: found "HYOGEN" Debug: 05-18 22:08:54 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:08:54 Epwing: found "RUIGIGO" Debug: 05-18 22:09:17 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:09:17 Epwing: found "RUIGIGO" Debug: 05-18 22:09:18 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 22:09:18 Epwing: found "ENCY" Debug: 05-18 22:09:19 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 22:09:19 Epwing: found "Snmkg99" Debug: 05-18 22:09:19 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 22:09:19 Epwing: found "BODY" Debug: 05-18 22:09:19 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 22:09:19 Epwing: found "MEIKYOJJ" Debug: 05-18 22:09:19 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/pronounciation" Debug: 05-18 22:09:19 handle path: "/mnt/Reading/Wikipedia Japa" Debug: 05-18 22:09:19 handle path: "/mnt/Data/Documents/dict - concise encyclopedia of mathematics" Debug: 05-18 22:09:19 handle path: "/home/hashirama/Downloads/Port" Debug: 05-18 22:09:19 handle path: "/mnt/Data/Documents/english_dictionary" Debug: 05-18 22:09:19 handle path: "/mnt/Sources/Epistularum's Tidy EPWing Collection [Version 1.0]" Debug: 05-18 22:09:19 handle path: "/mnt/Sources/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:09:20 Load done Debug: 05-18 22:09:20 Loading 198 abbrv Debug: 05-18 22:09:20 Loading 210 abbrv Debug: 05-18 22:09:20 Loading 183 abbrv Debug: 05-18 22:09:21 Loading 200 abbrv Debug: 05-18 22:09:21 received: "220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <312122721.20588.1716084561@dict.dict.org>\r\n" Debug: 05-18 22:09:21 received: "110 166 databases present\r\n" Debug: 05-18 22:09:21 receive db: "gcide \"The Collaborative International Dictionary of English v.0.48\"" Debug: 05-18 22:09:21 receive db: "wn \"WordNet (r) 3.0 (2006)\"" Debug: 05-18 22:09:21 receive db: "moby-thesaurus \"Moby Thesaurus II by Grady Ward, 1.0\"" Debug: 05-18 22:09:21 receive db: "elements \"The Elements (07Nov00)\"" Debug: 05-18 22:09:21 receive db: "vera \"V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)\"" Debug: 05-18 22:09:21 receive db: "jargon \"The Jargon File (version 4.4.7, 29 Dec 2003)\"" Debug: 05-18 22:09:21 receive db: "foldoc \"The Free On-line Dictionary of Computing (30 December 2018)\"" Debug: 05-18 22:09:21 receive db: "easton \"Easton's 1897 Bible Dictionary\"" Debug: 05-18 22:09:21 receive db: "hitchcock \"Hitchcock's Bible Names Dictionary (late 1800's)\"" Debug: 05-18 22:09:21 receive db: "bouvier \"Bouvier's Law Dictionary, Revised 6th Ed (1856)\"" Debug: 05-18 22:09:21 receive db: "devil \"The Devil's Dictionary (1881-1906)\"" Debug: 05-18 22:09:21 receive db: "world02 \"CIA World Factbook 2002\"" Debug: 05-18 22:09:21 receive db: "gaz2k-counties \"U.S. Gazetteer Counties (2000)\"" Debug: 05-18 22:09:21 receive db: "gaz2k-places \"U.S. Gazetteer Places (2000)\"" Debug: 05-18 22:09:21 receive db: "gaz2k-zips \"U.S. Gazetteer Zip Code Tabulation Areas (2000)\"" Debug: 05-18 22:09:21 receive db: "fd-hrv-eng \"Croatian-English FreeDict Dictionary ver. 0.1.2\"" Debug: 05-18 22:09:21 receive db: "fd-fin-por \"suomi-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:09:21 receive db: "fd-fin-bul \"suomi-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:09:21 receive db: "fd-fra-bul \"fran\xC3\xA7""ais-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:09:21 receive db: "fd-deu-swe \"Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:09:21 receive db: "fd-fin-swe \"suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:09:21 receive db: "fd-jpn-rus \"Japanese-Russian FreeDict Dictionary ver. 0.1\"" Debug: 05-18 22:09:21 receive db: "fd-wol-fra \"Wolof - French FreeDict dictionary ver. 0.1\"" Debug: 05-18 22:09:21 receive db: "fd-fra-pol \"fran\xC3\xA7""ais-j\xC4\x99zyk" Debug: 05-18 22:09:21 received: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-deu \"English-German FreeDict Dictionary ver. 0.3.7\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-nld \"German-Dutch FreeDict Dictionary ver. 0.1.4\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-por-eng \"Portuguese-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-spa-deu \"Spanish-German FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ces-eng \"Czech-English FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-fin \"Svenska-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-pol \"English - Polish Piotrowski+Saloni/FreeDict dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-nor \"j\xC4\x99zyk polski-Norsk FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-rom \"English-Romanian FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-fra \"English-French FreeDict Dictionary ver. 0.1.6\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fin-ell \"suomi-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-lit \"English-Lithuanian FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ckb-kmr \"Sorani-Kurmanji Ferheng/FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-eng \"Italian-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-eng \"j\xC4\x99zyk polski-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-gle-eng \"Irish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-tur \"English-Turkish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-gle-pol \"Irish-Polish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-deu \"j\xC4\x99zyk polski-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-spa \"fran\xC3\xA7""ais-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-lit-eng \"Lithuanian-English FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-jpn \"English-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ara-eng \"Arabic-English FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-nld-ita \"Nederlands-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-lat \"English-Latin FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-hun \"English-Hungarian FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-jpn \"italiano-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-dan-eng \"Danish-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-hun-eng \"Hungarian-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-gle \"Polish-Irish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-fin \"fran\xC3\xA7""ais-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-nld-swe \"Nederlands-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-nld-eng \"Dutch-English Freedict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-kur \"German-Kurdish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-spa \"Deutsch-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-afr \"English-Afrikaans FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-swe \"English-Swedish FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-jpn-deu \"Japanese-German FreeDict Dictionary ver. 0.2.0\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-epo-eng \"Esperanto-English FreeDict dictionary ver. 1.0.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-nld \"j\xC4\x99zyk polski-Nederlands FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-lat-deu \"Lateinisch-Deutsch FreeDict-W\xC3\xB6rterbuch ver. 1.0.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-cym \"Eurfa Saesneg, English-Welsh Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-por-spa \"portugu\xC3\xAAs-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-spa \"English-Spanish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-tur \"Svenska-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-tur-eng \"Turkish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-tur-deu \"Turkish-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-fra \"j\xC4\x99zyk polski-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-por \"English-Portuguese FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-pol \"italiano-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-ces \"English-Czech dicts.info/FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-tur \"German-Turkish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-jpn \"fran\xC3\xA7""ais-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-cym-eng \"Eurfa Cymraeg, Welsh-English Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-bre-fra \"Breton-French FreeDict Dictionary (Geriadur Tomaz) ver. 0.8.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-jpn-fra \"Japanese-French FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-nld-deu \"Dutch-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-nld \"English-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-por \"German-Portuguese FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-hrv \"English-Croatian FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-mkd-bul \"Macedonian - Bulgarian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-eng \"Swedish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-spa \"j\xC4\x99zyk polski-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-jpn-eng \"Japanese-English FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-ell \"English - Modern Greek XDXF/FreeDict dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-por \"italiano-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-swe \"j\xC4\x99zyk polski-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-fin \"j\xC4\x99zyk polski-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-kur-tur \"Kurdish-Turkish Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-swe \"italiano-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-swh \"English-Swahili xFried/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-kha-eng \"Khasi-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fin-eng \"suomi-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-hin \"English-Hindi FreeDict Dictionary ver. 1.6\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-spa-eng \"Spanish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-afr-eng \"Afrikaans-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-fin \"italiano-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-fin \"English-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-ita \"fran\xC3\xA7""ais-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-rus \"Deutsch-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-bul \"Deutsch-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-pol \"Deutsch-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-kur-deu \"Kurdish-German Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-spa-por \"Spanish-Portuguese FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-pol \"Svenska-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-rus \"Svenska-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-nld-spa \"Nederlands-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swh-pol \"Swahili-Polish SSSP/FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-oci-cat \"Lenga d'\xC3\xB2""c - Catal\xC3\xA0 FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-rus \"italiano-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-ell \"fran\xC3\xA7""ais-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-srp \"English-Serbian FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-tur \"fran\xC3\xA7""ais-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-eng \"French-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-ita-ell \"italiano-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-kur-eng \"Kurdish-English Ferheng/FreeDict Dictionary ver. 1.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-deu \"Svenska-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-fra \"Svenska-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-lat \"Svenska-latine FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-ell \"Svenska-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-rus \"English-Russian FreeDict Dictionary ver. 0.3.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-por \"j\xC4\x99zyk polski-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-gla-deu \"Scottish Gaelic-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-ita \"English-Italian FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-pol-ita \"j\xC4\x99zyk polski-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-swe \"fran\xC3\xA7""ais-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-isl-eng \"\xC3\xADslenska - English FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-spa \"Svenska-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-nno-nob \"Norwegian Nynorsk-Norwegian Bokm\xC3\xA5l FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swe-ita \"Svenska-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-deu \"fran\xC3\xA7""ais-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fin-ita \"suomi-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-nld-fra \"Nederlands-French FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-eng-ara \"English-Arabic FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-slk-eng \"Slovak-English FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fra-por \"fran\xC3\xA7""ais-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-spa-ast \"Spanish - Asturian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fin-jpn \"suomi-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-deu-ita \"German-Italian FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-swh-eng \"Swahili-English xFried/FreeDict Dictionary ver. 0.4.4\"\r\n" Debug: 05-18 22:09:21 receive db: "fd-fin-nor \"suomi-Norsk FreeDict+WikDict dictionary ver. 2018" Debug: 05-18 22:09:22 received: ".09.13\"\r\n" Debug: 05-18 22:09:22 receive db: ".09.13\"\r\n" Debug: 05-18 22:09:22 received: "fd-fra-nld \"French-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:09:23 Reloading all the tabs... Debug: 05-18 22:09:23 starting create the fts with thread: 11 Debug: 05-18 22:09:23 waiting for all the fts creation to finish. Debug: 05-18 22:09:23 finished/cancel all the fts creation Debug: 05-18 22:09:23 getResource: "gdlookup://localhost/?word=lofiga3778@huleos.com&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:09:23 scheme: "gdlookup" Debug: 05-18 22:09:23 host: "localhost" Debug: 05-18 22:09:23 clear current dictionaries: "lofiga3778@huleos.com" Debug: 05-18 22:09:23 some body finished Debug: 05-18 22:09:23 one not finished. Debug: 05-18 22:09:23 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 22:09:23 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 22:09:23 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 22:09:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:09:26 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:09:26 scheme: "gdlookup" Debug: 05-18 22:09:26 host: "localhost" Debug: 05-18 22:09:26 clear current dictionaries: "ゆっくり" Debug: 05-18 22:09:26 some body finished Debug: 05-18 22:09:26 one not finished. Debug: 05-18 22:09:26 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 22:09:26 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 22:09:26 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 22:09:26 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:10:07 translating from clipboard or selection Debug: 05-18 22:10:07 clipboard data: "" Debug: 05-18 22:10:30 getResource: "gdlookup://localhost/?word=猿猴捉月。&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:10:30 scheme: "gdlookup" Debug: 05-18 22:10:30 host: "localhost" Debug: 05-18 22:10:30 clear current dictionaries: "猿猴捉月。" Debug: 05-18 22:10:30 some body finished Debug: 05-18 22:10:30 one not finished. Debug: 05-18 22:10:30 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 22:10:30 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 22:10:30 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 22:10:30 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:10:35 translating from clipboard or selection Debug: 05-18 22:10:35 clipboard data: ": 猿猴捉月" Debug: 05-18 22:10:35 Current state: true false false true Debug: 05-18 22:10:35 getResource: "gdlookup://localhost/?word=: 猿猴捉月&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:10:35 scheme: "gdlookup" Debug: 05-18 22:10:35 host: "localhost" Debug: 05-18 22:10:35 clear current dictionaries: ": 猿猴捉月" Debug: 05-18 22:10:35 some body finished Debug: 05-18 22:10:35 one not finished. Debug: 05-18 22:10:35 ====reading 1417 of (1417) bytes . Finished: 0 Debug: 05-18 22:10:35 ====reading 0 of (1417) bytes . Finished: 0 Debug: 05-18 22:10:35 ====reading 0 of (1417) bytes . Finished: 0 Warning: 05-18 22:10:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:11:12 handle path: "/mnt/Reading/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:11:12 handle path: "/mnt/Data/Chinese caligraphy dictionaries" Debug: 05-18 22:11:12 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/dicts" Debug: 05-18 22:11:12 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 22:11:12 Epwing: found "EIDAI6" Warning: 05-18 22:11:12 "Epwing dictionary initializing failed: , error: EB library report error EB \"eb_set_subbook\" function error: EB_ERR_FAIL_OPEN_TEXT (failed to open a text file)\n" Debug: 05-18 22:11:12 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 22:11:12 Epwing: found "HYOGEN" Debug: 05-18 22:11:12 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:11:12 Epwing: found "RUIGIGO" Debug: 05-18 22:11:13 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:11:13 Epwing: found "RUIGIGO" Debug: 05-18 22:11:14 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 22:11:14 Epwing: found "ENCY" Debug: 05-18 22:11:14 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 22:11:14 Epwing: found "Snmkg99" Debug: 05-18 22:11:14 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 22:11:14 Epwing: found "BODY" Debug: 05-18 22:11:14 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 22:11:14 Epwing: found "MEIKYOJJ" Debug: 05-18 22:11:14 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/pronounciation" Debug: 05-18 22:11:14 handle path: "/mnt/Reading/Wikipedia Japa" Debug: 05-18 22:11:14 handle path: "/mnt/Data/Documents/dict - concise encyclopedia of mathematics" Debug: 05-18 22:11:14 handle path: "/home/hashirama/Downloads/Port" Debug: 05-18 22:11:14 handle path: "/mnt/Data/Documents/english_dictionary" Debug: 05-18 22:11:14 handle path: "/mnt/Sources/Epistularum's Tidy EPWing Collection [Version 1.0]" Debug: 05-18 22:11:14 handle path: "/mnt/Sources/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:11:14 Load done Debug: 05-18 22:11:14 Loading 183 abbrv Debug: 05-18 22:11:14 Loading 200 abbrv Debug: 05-18 22:11:14 Loading 198 abbrv Debug: 05-18 22:11:14 Loading 210 abbrv Debug: 05-18 22:11:14 received: "220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <312123469.22099.1716084674@dict.dict.org>\r\n" Debug: 05-18 22:11:14 received: "110 166 databases present\r\n" Debug: 05-18 22:11:14 receive db: "gcide \"The Collaborative International Dictionary of English v.0.48\"" Debug: 05-18 22:11:14 receive db: "wn \"WordNet (r) 3.0 (2006)\"" Debug: 05-18 22:11:14 receive db: "moby-thesaurus \"Moby Thesaurus II by Grady Ward, 1.0\"" Debug: 05-18 22:11:14 receive db: "elements \"The Elements (07Nov00)\"" Debug: 05-18 22:11:14 receive db: "vera \"V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)\"" Debug: 05-18 22:11:14 receive db: "jargon \"The Jargon File (version 4.4.7, 29 Dec 2003)\"" Debug: 05-18 22:11:14 receive db: "foldoc \"The Free On-line Dictionary of Computing (30 December 2018)\"" Debug: 05-18 22:11:14 receive db: "easton \"Easton's 1897 Bible Dictionary\"" Debug: 05-18 22:11:14 receive db: "hitchcock \"Hitchcock's Bible Names Dictionary (late 1800's)\"" Debug: 05-18 22:11:14 receive db: "bouvier \"Bouvier's Law Dictionary, Revised 6th Ed (1856)\"" Debug: 05-18 22:11:14 receive db: "devil \"The Devil's Dictionary (1881-1906)\"" Debug: 05-18 22:11:14 receive db: "world02 \"CIA World Factbook 2002\"" Debug: 05-18 22:11:14 receive db: "gaz2k-counties \"U.S. Gazetteer Counties (2000)\"" Debug: 05-18 22:11:14 receive db: "gaz2k-places \"U.S. Gazetteer Places (2000)\"" Debug: 05-18 22:11:14 receive db: "gaz2k-zips \"U.S. Gazetteer Zip Code Tabulation Areas (2000)\"" Debug: 05-18 22:11:14 receive db: "fd-hrv-eng \"Croatian-English FreeDict Dictionary ver. 0.1.2\"" Debug: 05-18 22:11:14 receive db: "fd-fin-por \"suomi-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:14 receive db: "fd-fin-bul \"suomi-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:14 receive db: "fd-fra-bul \"fran\xC3\xA7""ais-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:14 receive db: "fd-deu-swe \"Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:14 receive db: "fd-fin-swe \"suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:14 receive db: "fd-jpn-rus \"Japanese-Russian FreeDict Dictionary ver. 0.1\"" Debug: 05-18 22:11:14 receive db: "fd-wol-fra \"Wolof - French FreeDict dictionary ver. 0.1\"" Debug: 05-18 22:11:14 receive db: "fd-fra-pol \"fran\xC3\xA7""ais-j\xC4\x99zyk" Debug: 05-18 22:11:14 received: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-deu \"English-German FreeDict Dictionary ver. 0.3.7\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-nld \"German-Dutch FreeDict Dictionary ver. 0.1.4\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-por-eng \"Portuguese-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-spa-deu \"Spanish-German FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ces-eng \"Czech-English FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-fin \"Svenska-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-pol \"English - Polish Piotrowski+Saloni/FreeDict dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-nor \"j\xC4\x99zyk polski-Norsk FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-rom \"English-Romanian FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-fra \"English-French FreeDict Dictionary ver. 0.1.6\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fin-ell \"suomi-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-lit \"English-Lithuanian FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ckb-kmr \"Sorani-Kurmanji Ferheng/FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-eng \"Italian-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-eng \"j\xC4\x99zyk polski-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-gle-eng \"Irish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-tur \"English-Turkish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-gle-pol \"Irish-Polish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-deu \"j\xC4\x99zyk polski-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-spa \"fran\xC3\xA7""ais-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-lit-eng \"Lithuanian-English FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-jpn \"English-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ara-eng \"Arabic-English FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-nld-ita \"Nederlands-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-lat \"English-Latin FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-hun \"English-Hungarian FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-jpn \"italiano-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-dan-eng \"Danish-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-hun-eng \"Hungarian-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-gle \"Polish-Irish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-fin \"fran\xC3\xA7""ais-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-nld-swe \"Nederlands-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-nld-eng \"Dutch-English Freedict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-kur \"German-Kurdish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-spa \"Deutsch-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-afr \"English-Afrikaans FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-swe \"English-Swedish FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-jpn-deu \"Japanese-German FreeDict Dictionary ver. 0.2.0\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-epo-eng \"Esperanto-English FreeDict dictionary ver. 1.0.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-nld \"j\xC4\x99zyk polski-Nederlands FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-lat-deu \"Lateinisch-Deutsch FreeDict-W\xC3\xB6rterbuch ver. 1.0.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-cym \"Eurfa Saesneg, English-Welsh Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-por-spa \"portugu\xC3\xAAs-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-spa \"English-Spanish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-tur \"Svenska-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-tur-eng \"Turkish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-tur-deu \"Turkish-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-fra \"j\xC4\x99zyk polski-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-por \"English-Portuguese FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-pol \"italiano-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-ces \"English-Czech dicts.info/FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-tur \"German-Turkish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-jpn \"fran\xC3\xA7""ais-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-cym-eng \"Eurfa Cymraeg, Welsh-English Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-bre-fra \"Breton-French FreeDict Dictionary (Geriadur Tomaz) ver. 0.8.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-jpn-fra \"Japanese-French FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-nld-deu \"Dutch-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-nld \"English-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-por \"German-Portuguese FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-hrv \"English-Croatian FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-mkd-bul \"Macedonian - Bulgarian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-eng \"Swedish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-spa \"j\xC4\x99zyk polski-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-jpn-eng \"Japanese-English FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-ell \"English - Modern Greek XDXF/FreeDict dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-por \"italiano-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-swe \"j\xC4\x99zyk polski-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-fin \"j\xC4\x99zyk polski-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-kur-tur \"Kurdish-Turkish Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-swe \"italiano-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-swh \"English-Swahili xFried/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-kha-eng \"Khasi-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fin-eng \"suomi-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-hin \"English-Hindi FreeDict Dictionary ver. 1.6\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-spa-eng \"Spanish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-afr-eng \"Afrikaans-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-fin \"italiano-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-fin \"English-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-ita \"fran\xC3\xA7""ais-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-rus \"Deutsch-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-bul \"Deutsch-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-pol \"Deutsch-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-" Debug: 05-18 22:11:14 received: "srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-kur-deu \"Kurdish-German Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-spa-por \"Spanish-Portuguese FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-pol \"Svenska-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-rus \"Svenska-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-nld-spa \"Nederlands-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swh-pol \"Swahili-Polish SSSP/FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-oci-cat \"Lenga d'\xC3\xB2""c - Catal\xC3\xA0 FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-rus \"italiano-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-ell \"fran\xC3\xA7""ais-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-srp \"English-Serbian FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-tur \"fran\xC3\xA7""ais-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-eng \"French-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-ita-ell \"italiano-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-kur-eng \"Kurdish-English Ferheng/FreeDict Dictionary ver. 1.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-deu \"Svenska-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-fra \"Svenska-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-lat \"Svenska-latine FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-ell \"Svenska-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-rus \"English-Russian FreeDict Dictionary ver. 0.3.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-por \"j\xC4\x99zyk polski-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-gla-deu \"Scottish Gaelic-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-ita \"English-Italian FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-pol-ita \"j\xC4\x99zyk polski-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-swe \"fran\xC3\xA7""ais-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-isl-eng \"\xC3\xADslenska - English FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-spa \"Svenska-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-nno-nob \"Norwegian Nynorsk-Norwegian Bokm\xC3\xA5l FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swe-ita \"Svenska-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-deu \"fran\xC3\xA7""ais-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fin-ita \"suomi-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-nld-fra \"Nederlands-French FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-eng-ara \"English-Arabic FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-slk-eng \"Slovak-English FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fra-por \"fran\xC3\xA7""ais-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-spa-ast \"Spanish - Asturian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fin-jpn \"suomi-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-deu-ita \"German-Italian FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-swh-eng \"Swahili-English xFried/FreeDict Dictionary ver. 0.4.4\"\r\n" Debug: 05-18 22:11:14 receive db: "fd-fin-nor \"suomi-Norsk FreeDict+WikDict dictionary ver. 2018" Debug: 05-18 22:11:15 received: ".09.13\"\r\n" Debug: 05-18 22:11:15 receive db: ".09.13\"\r\n" Debug: 05-18 22:11:15 received: "fd-fra-nld \"French-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:15 Reloading all the tabs... Debug: 05-18 22:11:15 starting create the fts with thread: 11 Debug: 05-18 22:11:15 waiting for all the fts creation to finish. Debug: 05-18 22:11:15 finished/cancel all the fts creation Debug: 05-18 22:11:15 getResource: "gdlookup://localhost/?word=: 猿猴捉月&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:11:15 scheme: "gdlookup" Debug: 05-18 22:11:15 host: "localhost" Debug: 05-18 22:11:15 clear current dictionaries: ": 猿猴捉月" Debug: 05-18 22:11:15 some body finished Debug: 05-18 22:11:15 one not finished. Debug: 05-18 22:11:15 ====reading 1417 of (1417) bytes . Finished: 0 Debug: 05-18 22:11:15 ====reading 0 of (1417) bytes . Finished: 0 Debug: 05-18 22:11:15 ====reading 0 of (1417) bytes . Finished: 0 Warning: 05-18 22:11:15 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:11:29 handle path: "/mnt/Reading/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:11:29 handle path: "/mnt/Data/Chinese caligraphy dictionaries" Debug: 05-18 22:11:29 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/dicts" Debug: 05-18 22:11:29 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 22:11:29 Epwing: found "EIDAI6" Warning: 05-18 22:11:29 "Epwing dictionary initializing failed: , error: EB library report error EB \"eb_set_subbook\" function error: EB_ERR_FAIL_OPEN_TEXT (failed to open a text file)\n" Debug: 05-18 22:11:29 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 22:11:29 Epwing: found "HYOGEN" Debug: 05-18 22:11:29 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:11:29 Epwing: found "RUIGIGO" Debug: 05-18 22:11:30 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:11:30 Epwing: found "RUIGIGO" Debug: 05-18 22:11:30 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 22:11:30 Epwing: found "ENCY" Debug: 05-18 22:11:30 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 22:11:30 Epwing: found "Snmkg99" Debug: 05-18 22:11:30 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 22:11:30 Epwing: found "BODY" Debug: 05-18 22:11:30 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 22:11:30 Epwing: found "MEIKYOJJ" Debug: 05-18 22:11:30 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/pronounciation" Debug: 05-18 22:11:31 handle path: "/mnt/Reading/Wikipedia Japa" Debug: 05-18 22:11:31 handle path: "/mnt/Data/Documents/dict - concise encyclopedia of mathematics" Debug: 05-18 22:11:31 handle path: "/home/hashirama/Downloads/Port" Debug: 05-18 22:11:31 handle path: "/mnt/Data/Documents/english_dictionary" Debug: 05-18 22:11:31 handle path: "/mnt/Sources/Epistularum's Tidy EPWing Collection [Version 1.0]" Debug: 05-18 22:11:31 handle path: "/mnt/Sources/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:11:31 Load done Debug: 05-18 22:11:31 Loading 198 abbrv Debug: 05-18 22:11:31 Loading 183 abbrv Debug: 05-18 22:11:31 Loading 200 abbrv Debug: 05-18 22:11:31 Loading 210 abbrv Debug: 05-18 22:11:31 received: "220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <312123564.22288.1716084691@dict.dict.org>\r\n" Debug: 05-18 22:11:31 received: "110 166 databases present\r\n" Debug: 05-18 22:11:31 receive db: "gcide \"The Collaborative International Dictionary of English v.0.48\"" Debug: 05-18 22:11:31 receive db: "wn \"WordNet (r) 3.0 (2006)\"" Debug: 05-18 22:11:31 receive db: "moby-thesaurus \"Moby Thesaurus II by Grady Ward, 1.0\"" Debug: 05-18 22:11:31 receive db: "elements \"The Elements (07Nov00)\"" Debug: 05-18 22:11:31 receive db: "vera \"V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)\"" Debug: 05-18 22:11:31 receive db: "jargon \"The Jargon File (version 4.4.7, 29 Dec 2003)\"" Debug: 05-18 22:11:31 receive db: "foldoc \"The Free On-line Dictionary of Computing (30 December 2018)\"" Debug: 05-18 22:11:31 receive db: "easton \"Easton's 1897 Bible Dictionary\"" Debug: 05-18 22:11:31 receive db: "hitchcock \"Hitchcock's Bible Names Dictionary (late 1800's)\"" Debug: 05-18 22:11:31 receive db: "bouvier \"Bouvier's Law Dictionary, Revised 6th Ed (1856)\"" Debug: 05-18 22:11:31 receive db: "devil \"The Devil's Dictionary (1881-1906)\"" Debug: 05-18 22:11:31 receive db: "world02 \"CIA World Factbook 2002\"" Debug: 05-18 22:11:31 receive db: "gaz2k-counties \"U.S. Gazetteer Counties (2000)\"" Debug: 05-18 22:11:31 receive db: "gaz2k-places \"U.S. Gazetteer Places (2000)\"" Debug: 05-18 22:11:31 receive db: "gaz2k-zips \"U.S. Gazetteer Zip Code Tabulation Areas (2000)\"" Debug: 05-18 22:11:31 receive db: "fd-hrv-eng \"Croatian-English FreeDict Dictionary ver. 0.1.2\"" Debug: 05-18 22:11:31 receive db: "fd-fin-por \"suomi-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:31 receive db: "fd-fin-bul \"suomi-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:31 receive db: "fd-fra-bul \"fran\xC3\xA7""ais-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:31 receive db: "fd-deu-swe \"Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:31 receive db: "fd-fin-swe \"suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:31 receive db: "fd-jpn-rus \"Japanese-Russian FreeDict Dictionary ver. 0.1\"" Debug: 05-18 22:11:31 receive db: "fd-wol-fra \"Wolof - French FreeDict dictionary ver. 0.1\"" Debug: 05-18 22:11:31 receive db: "fd-fra-pol \"fran\xC3\xA7""ais-j\xC4\x99zyk" Debug: 05-18 22:11:31 received: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-deu \"English-German FreeDict Dictionary ver. 0.3.7\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-nld \"German-Dutch FreeDict Dictionary ver. 0.1.4\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-por-eng \"Portuguese-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-spa-deu \"Spanish-German FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ces-eng \"Czech-English FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-fin \"Svenska-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-pol \"English - Polish Piotrowski+Saloni/FreeDict dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-nor \"j\xC4\x99zyk polski-Norsk FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-rom \"English-Romanian FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-fra \"English-French FreeDict Dictionary ver. 0.1.6\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fin-ell \"suomi-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-lit \"English-Lithuanian FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ckb-kmr \"Sorani-Kurmanji Ferheng/FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-eng \"Italian-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-eng \"j\xC4\x99zyk polski-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-gle-eng \"Irish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-tur \"English-Turkish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-gle-pol \"Irish-Polish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-deu \"j\xC4\x99zyk polski-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-spa \"fran\xC3\xA7""ais-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-lit-eng \"Lithuanian-English FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-jpn \"English-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ara-eng \"Arabic-English FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-nld-ita \"Nederlands-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-lat \"English-Latin FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-hun \"English-Hungarian FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-jpn \"italiano-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-dan-eng \"Danish-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-hun-eng \"Hungarian-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-gle \"Polish-Irish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-fin \"fran\xC3\xA7""ais-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-nld-swe \"Nederlands-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-nld-eng \"Dutch-English Freedict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-kur \"German-Kurdish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-spa \"Deutsch-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-afr \"English-Afrikaans FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-swe \"English-Swedish FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-jpn-deu \"Japanese-German FreeDict Dictionary ver. 0.2.0\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-epo-eng \"Esperanto-English FreeDict dictionary ver. 1.0.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-nld \"j\xC4\x99zyk polski-Nederlands FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-lat-deu \"Lateinisch-Deutsch FreeDict-W\xC3\xB6rterbuch ver. 1.0.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-cym \"Eurfa Saesneg, English-Welsh Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-por-spa \"portugu\xC3\xAAs-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-spa \"English-Spanish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-tur \"Svenska-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-tur-eng \"Turkish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-tur-deu \"Turkish-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-fra \"j\xC4\x99zyk polski-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-por \"English-Portuguese FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-pol \"italiano-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-ces \"English-Czech dicts.info/FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-tur \"German-Turkish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-jpn \"fran\xC3\xA7""ais-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-cym-eng \"Eurfa Cymraeg, Welsh-English Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-bre-fra \"Breton-French FreeDict Dictionary (Geriadur Tomaz) ver. 0.8.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-jpn-fra \"Japanese-French FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-nld-deu \"Dutch-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-nld \"English-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-por \"German-Portuguese FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-hrv \"English-Croatian FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-mkd-bul \"Macedonian - Bulgarian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-eng \"Swedish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-spa \"j\xC4\x99zyk polski-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-jpn-eng \"Japanese-English FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-ell \"English - Modern Greek XDXF/FreeDict dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-por \"italiano-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-swe \"j\xC4\x99zyk polski-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-fin \"j\xC4\x99zyk polski-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-kur-tur \"Kurdish-Turkish Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-swe \"italiano-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-swh \"English-Swahili xFried/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-kha-eng \"Khasi-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fin-eng \"suomi-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-hin \"English-Hindi FreeDict Dictionary ver. 1.6\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-spa-eng \"Spanish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-afr-eng \"Afrikaans-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-fin \"italiano-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-fin \"English-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-ita \"fran\xC3\xA7""ais-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-rus \"Deutsch-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-bul \"Deutsch-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-pol \"Deutsch-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-kur-deu \"Kurdish-German Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-spa-por \"Spanish-Portuguese FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-pol \"Svenska-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-rus \"Svenska-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-nld-spa \"Nederlands-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swh-pol \"Swahili-Polish SSSP/FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-oci-cat \"Lenga d'\xC3\xB2""c - Catal\xC3\xA0 FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-rus \"italiano-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-ell \"fran\xC3\xA7""ais-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-srp \"English-Serbian FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-tur \"fran\xC3\xA7""ais-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-eng \"French-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-ita-ell \"italiano-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-kur-eng \"Kurdish-English Ferheng/FreeDict Dictionary ver. 1.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-deu \"Svenska-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-fra \"Svenska-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-lat \"Svenska-latine FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-ell \"Svenska-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-rus \"English-Russian FreeDict Dictionary ver. 0.3.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-por \"j\xC4\x99zyk polski-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-gla-deu \"Scottish Gaelic-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-ita \"English-Italian FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-pol-ita \"j\xC4\x99zyk polski-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-swe \"fran\xC3\xA7""ais-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-isl-eng \"\xC3\xADslenska - English FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-spa \"Svenska-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-nno-nob \"Norwegian Nynorsk-Norwegian Bokm\xC3\xA5l FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swe-ita \"Svenska-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-deu \"fran\xC3\xA7""ais-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fin-ita \"suomi-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-nld-fra \"Nederlands-French FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-eng-ara \"English-Arabic FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-slk-eng \"Slovak-English FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fra-por \"fran\xC3\xA7""ais-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-spa-ast \"Spanish - Asturian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fin-jpn \"suomi-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-deu-ita \"German-Italian FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-swh-eng \"Swahili-English xFried/FreeDict Dictionary ver. 0.4.4\"\r\n" Debug: 05-18 22:11:31 receive db: "fd-fin-nor \"suomi-Norsk FreeDict+WikDict dictionary ver. 2018" Debug: 05-18 22:11:31 received: ".09.13\"\r\n" Debug: 05-18 22:11:31 receive db: ".09.13\"\r\n" Debug: 05-18 22:11:31 received: "fd-fra-nld \"French-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:40 handle path: "/mnt/Reading/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:11:40 handle path: "/mnt/Data/Chinese caligraphy dictionaries" Debug: 05-18 22:11:40 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/dicts" Debug: 05-18 22:11:40 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 22:11:40 Epwing: found "EIDAI6" Warning: 05-18 22:11:40 "Epwing dictionary initializing failed: , error: EB library report error EB \"eb_set_subbook\" function error: EB_ERR_FAIL_OPEN_TEXT (failed to open a text file)\n" Debug: 05-18 22:11:40 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 22:11:40 Epwing: found "HYOGEN" Debug: 05-18 22:11:40 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:11:40 Epwing: found "RUIGIGO" Debug: 05-18 22:11:41 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:11:41 Epwing: found "RUIGIGO" Debug: 05-18 22:11:41 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 22:11:41 Epwing: found "ENCY" Debug: 05-18 22:11:41 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 22:11:41 Epwing: found "Snmkg99" Debug: 05-18 22:11:41 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 22:11:41 Epwing: found "BODY" Debug: 05-18 22:11:41 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 22:11:41 Epwing: found "MEIKYOJJ" Debug: 05-18 22:11:41 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/pronounciation" Debug: 05-18 22:11:41 handle path: "/mnt/Reading/Wikipedia Japa" Debug: 05-18 22:11:41 handle path: "/mnt/Data/Documents/dict - concise encyclopedia of mathematics" Debug: 05-18 22:11:41 handle path: "/home/hashirama/Downloads/Port" Debug: 05-18 22:11:41 handle path: "/mnt/Data/Documents/english_dictionary" Debug: 05-18 22:11:41 handle path: "/mnt/Sources/Epistularum's Tidy EPWing Collection [Version 1.0]" Debug: 05-18 22:11:41 handle path: "/mnt/Sources/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:11:42 Load done Debug: 05-18 22:11:42 Loading 210 abbrv Debug: 05-18 22:11:42 Loading 198 abbrv Debug: 05-18 22:11:42 Loading 183 abbrv Debug: 05-18 22:11:42 Loading 200 abbrv Debug: 05-18 22:11:42 received: "220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <312123626.22414.1716084702@dict.dict.org>\r\n" Debug: 05-18 22:11:42 received: "110 166 databases present\r\n" Debug: 05-18 22:11:42 receive db: "gcide \"The Collaborative International Dictionary of English v.0.48\"" Debug: 05-18 22:11:42 receive db: "wn \"WordNet (r) 3.0 (2006)\"" Debug: 05-18 22:11:42 receive db: "moby-thesaurus \"Moby Thesaurus II by Grady Ward, 1.0\"" Debug: 05-18 22:11:42 receive db: "elements \"The Elements (07Nov00)\"" Debug: 05-18 22:11:42 receive db: "vera \"V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)\"" Debug: 05-18 22:11:42 receive db: "jargon \"The Jargon File (version 4.4.7, 29 Dec 2003)\"" Debug: 05-18 22:11:42 receive db: "foldoc \"The Free On-line Dictionary of Computing (30 December 2018)\"" Debug: 05-18 22:11:42 receive db: "easton \"Easton's 1897 Bible Dictionary\"" Debug: 05-18 22:11:42 receive db: "hitchcock \"Hitchcock's Bible Names Dictionary (late 1800's)\"" Debug: 05-18 22:11:42 receive db: "bouvier \"Bouvier's Law Dictionary, Revised 6th Ed (1856)\"" Debug: 05-18 22:11:42 receive db: "devil \"The Devil's Dictionary (1881-1906)\"" Debug: 05-18 22:11:42 receive db: "world02 \"CIA World Factbook 2002\"" Debug: 05-18 22:11:42 receive db: "gaz2k-counties \"U.S. Gazetteer Counties (2000)\"" Debug: 05-18 22:11:42 receive db: "gaz2k-places \"U.S. Gazetteer Places (2000)\"" Debug: 05-18 22:11:42 receive db: "gaz2k-zips \"U.S. Gazetteer Zip Code Tabulation Areas (2000)\"" Debug: 05-18 22:11:42 receive db: "fd-hrv-eng \"Croatian-English FreeDict Dictionary ver. 0.1.2\"" Debug: 05-18 22:11:42 receive db: "fd-fin-por \"suomi-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:42 receive db: "fd-fin-bul \"suomi-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:42 receive db: "fd-fra-bul \"fran\xC3\xA7""ais-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:42 receive db: "fd-deu-swe \"Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:42 receive db: "fd-fin-swe \"suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:11:42 receive db: "fd-jpn-rus \"Japanese-Russian FreeDict Dictionary ver. 0.1\"" Debug: 05-18 22:11:42 receive db: "fd-wol-fra \"Wolof - French FreeDict dictionary ver. 0.1\"" Debug: 05-18 22:11:42 receive db: "fd-fra-pol \"fran\xC3\xA7""ais-j\xC4\x99zyk" Debug: 05-18 22:11:42 received: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-deu \"English-German FreeDict Dictionary ver. 0.3.7\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-nld \"German-Dutch FreeDict Dictionary ver. 0.1.4\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-por-eng \"Portuguese-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-spa-deu \"Spanish-German FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ces-eng \"Czech-English FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-fin \"Svenska-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-pol \"English - Polish Piotrowski+Saloni/FreeDict dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-nor \"j\xC4\x99zyk polski-Norsk FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-rom \"English-Romanian FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-fra \"English-French FreeDict Dictionary ver. 0.1.6\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fin-ell \"suomi-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-lit \"English-Lithuanian FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ckb-kmr \"Sorani-Kurmanji Ferheng/FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-eng \"Italian-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-eng \"j\xC4\x99zyk polski-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-gle-eng \"Irish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-tur \"English-Turkish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-gle-pol \"Irish-Polish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-deu \"j\xC4\x99zyk polski-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-spa \"fran\xC3\xA7""ais-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-lit-eng \"Lithuanian-English FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-jpn \"English-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ara-eng \"Arabic-English FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-nld-ita \"Nederlands-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-lat \"English-Latin FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-hun \"English-Hungarian FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-jpn \"italiano-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-dan-eng \"Danish-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-hun-eng \"Hungarian-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-gle \"Polish-Irish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-fin \"fran\xC3\xA7""ais-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-nld-swe \"Nederlands-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-nld-eng \"Dutch-English Freedict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-kur \"German-Kurdish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-spa \"Deutsch-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-afr \"English-Afrikaans FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-swe \"English-Swedish FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-jpn-deu \"Japanese-German FreeDict Dictionary ver. 0.2.0\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-epo-eng \"Esperanto-English FreeDict dictionary ver. 1.0.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-nld \"j\xC4\x99zyk polski-Nederlands FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-lat-deu \"Lateinisch-Deutsch FreeDict-W\xC3\xB6rterbuch ver. 1.0.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-cym \"Eurfa Saesneg, English-Welsh Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-por-spa \"portugu\xC3\xAAs-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-spa \"English-Spanish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-tur \"Svenska-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-tur-eng \"Turkish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-tur-deu \"Turkish-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-fra \"j\xC4\x99zyk polski-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-por \"English-Portuguese FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-pol \"italiano-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-ces \"English-Czech dicts.info/FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-tur \"German-Turkish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-jpn \"fran\xC3\xA7""ais-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-cym-eng \"Eurfa Cymraeg, Welsh-English Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-bre-fra \"Breton-French FreeDict Dictionary (Geriadur Tomaz) ver. 0.8.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-jpn-fra \"Japanese-French FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-nld-deu \"Dutch-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-nld \"English-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-por \"German-Portuguese FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-hrv \"English-Croatian FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-mkd-bul \"Macedonian - Bulgarian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-eng \"Swedish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-spa \"j\xC4\x99zyk polski-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-jpn-eng \"Japanese-English FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-ell \"English - Modern Greek XDXF/FreeDict dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-por \"italiano-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-swe \"j\xC4\x99zyk polski-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-fin \"j\xC4\x99zyk polski-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-kur-tur \"Kurdish-Turkish Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-swe \"italiano-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-swh \"English-Swahili xFried/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-kha-eng \"Khasi-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fin-eng \"suomi-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-hin \"English-Hindi FreeDict Dictionary ver. 1.6\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-spa-eng \"Spanish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-afr-eng \"Afrikaans-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-fin \"italiano-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-fin \"English-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-ita \"fran\xC3\xA7""ais-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-rus \"Deutsch-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-bul \"Deutsch-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-pol \"Deutsch-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-kur-deu \"Kurdish-German Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-spa-por \"Spanish-Portuguese FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-pol \"Svenska-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-rus \"Svenska-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-nld-spa \"Nederlands-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swh-pol \"Swahili-Polish SSSP/FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-oci-cat \"Lenga d'\xC3\xB2""c - Catal\xC3\xA0 FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-rus \"italiano-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-ell \"fran\xC3\xA7""ais-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-srp \"English-Serbian FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-tur \"fran\xC3\xA7""ais-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-eng \"French-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-ita-ell \"italiano-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-kur-eng \"Kurdish-English Ferheng/FreeDict Dictionary ver. 1.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-deu \"Svenska-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-fra \"Svenska-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-lat \"Svenska-latine FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-ell \"Svenska-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-rus \"English-Russian FreeDict Dictionary ver. 0.3.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-por \"j\xC4\x99zyk polski-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-gla-deu \"Scottish Gaelic-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-ita \"English-Italian FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-pol-ita \"j\xC4\x99zyk polski-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-swe \"fran\xC3\xA7""ais-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-isl-eng \"\xC3\xADslenska - English FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-spa \"Svenska-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-nno-nob \"Norwegian Nynorsk-Norwegian Bokm\xC3\xA5l FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swe-ita \"Svenska-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-deu \"fran\xC3\xA7""ais-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fin-ita \"suomi-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-nld-fra \"Nederlands-French FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-eng-ara \"English-Arabic FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-slk-eng \"Slovak-English FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fra-por \"fran\xC3\xA7""ais-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-spa-ast \"Spanish - Asturian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fin-jpn \"suomi-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-deu-ita \"German-Italian FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-swh-eng \"Swahili-English xFried/FreeDict Dictionary ver. 0.4.4\"\r\n" Debug: 05-18 22:11:42 receive db: "fd-fin-nor \"suomi-Norsk FreeDict+WikDict dictionary ver. 2018" Debug: 05-18 22:11:42 received: ".09.13\"\r\n" Debug: 05-18 22:11:42 receive db: ".09.13\"\r\n" Debug: 05-18 22:11:42 received: "fd-fra-nld \"French-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:11:54 Reloading all the tabs... Debug: 05-18 22:11:54 starting create the fts with thread: 11 Debug: 05-18 22:11:54 waiting for all the fts creation to finish. Debug: 05-18 22:11:54 finished/cancel all the fts creation Debug: 05-18 22:11:54 getResource: "gdlookup://localhost/?word=: 猿猴捉月&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:11:54 scheme: "gdlookup" Debug: 05-18 22:11:54 host: "localhost" Debug: 05-18 22:11:54 clear current dictionaries: ": 猿猴捉月" Debug: 05-18 22:11:54 some body finished Debug: 05-18 22:11:54 one not finished. Debug: 05-18 22:11:54 ====reading 1417 of (1417) bytes . Finished: 0 Debug: 05-18 22:11:54 ====reading 0 of (1417) bytes . Finished: 0 Debug: 05-18 22:11:54 ====reading 0 of (1417) bytes . Finished: 0 Warning: 05-18 22:11:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:11:56 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:11:56 scheme: "gdlookup" Debug: 05-18 22:11:56 host: "localhost" Debug: 05-18 22:11:56 clear current dictionaries: "納得が行く" Debug: 05-18 22:11:56 some body finished Debug: 05-18 22:11:56 one not finished. Debug: 05-18 22:11:56 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 22:11:56 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 22:11:56 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 22:11:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:12:20 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:12:20 scheme: "gdlookup" Debug: 05-18 22:12:20 host: "localhost" Debug: 05-18 22:12:20 clear current dictionaries: "違和感" Debug: 05-18 22:12:20 some body finished Debug: 05-18 22:12:20 one not finished. Debug: 05-18 22:12:20 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 22:12:20 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 22:12:20 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 22:12:20 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:12:23 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:12:23 scheme: "gdlookup" Debug: 05-18 22:12:23 host: "localhost" Debug: 05-18 22:12:23 clear current dictionaries: "ゆっくり" Debug: 05-18 22:12:23 some body finished Debug: 05-18 22:12:23 one not finished. Debug: 05-18 22:12:23 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 22:12:23 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 22:12:23 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 22:12:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:12:23 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:12:23 scheme: "gdlookup" Debug: 05-18 22:12:23 host: "localhost" Debug: 05-18 22:12:23 clear current dictionaries: "違和感" Debug: 05-18 22:12:23 some body finished Debug: 05-18 22:12:23 one not finished. Debug: 05-18 22:12:23 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 22:12:23 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 22:12:23 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 22:12:23 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:13:02 translating from clipboard or selection Debug: 05-18 22:13:02 clipboard data: "lofiga3778@huleos.com" Debug: 05-18 22:13:02 Current state: true true false true Debug: 05-18 22:13:02 translating from clipboard or selection Debug: 05-18 22:13:02 clipboard data: "lofiga3778@huleos.com" Debug: 05-18 22:13:02 Current state: true false false true Debug: 05-18 22:13:02 getResource: "gdlookup://localhost/?word=lofiga3778@huleos.com&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:13:02 scheme: "gdlookup" Debug: 05-18 22:13:02 host: "localhost" Debug: 05-18 22:13:02 clear current dictionaries: "lofiga3778@huleos.com" Debug: 05-18 22:13:02 some body finished Debug: 05-18 22:13:02 one not finished. Debug: 05-18 22:13:02 ====reading 1424 of (1424) bytes . Finished: 0 Debug: 05-18 22:13:02 ====reading 0 of (1424) bytes . Finished: 0 Debug: 05-18 22:13:02 ====reading 0 of (1424) bytes . Finished: 0 Warning: 05-18 22:13:02 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:14:56 translating from clipboard or selection Debug: 05-18 22:14:56 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
            \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
            \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
            \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
              \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
            • \" + alt + \"
            • \";\n }\n output_html += \"
            \";\n }\n\n output_html += \"
            \"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
            \" + removed_char + \"
            \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
            \"; \n output_html += \"
            \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 22:14:56 Current state: true false true true Debug: 05-18 22:14:56 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:14:56 scheme: "gdlookup" Debug: 05-18 22:14:56 host: "localhost" Debug: 05-18 22:14:56 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
            \"; std::string sentence_copy = sentence; output_html += \"
            \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
            \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
              \"; for (const auto& alt : alt_itr->second) { output_html += \"
            • \" + alt + \"
            • \"; } output_html += \"
            \"; } output_html += \"
            \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
            \" + removed_char + \"
            \"; sentence_copy = new_sentence_copy; } } output_html += \"
            \"; output_html += \"
            \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:14:56 some body finished Debug: 05-18 22:14:56 one not finished. Debug: 05-18 22:14:56 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 22:14:56 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 22:14:56 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 22:14:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:14:56 translating from clipboard or selection Debug: 05-18 22:14:56 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
            \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
            \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
            \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
              \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
            • \" + alt + \"
            • \";\n }\n output_html += \"
            \";\n }\n\n output_html += \"
            \"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
            \" + removed_char + \"
            \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
            \"; \n output_html += \"
            \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 22:14:56 Current state: true false true true Debug: 05-18 22:14:56 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:14:56 scheme: "gdlookup" Debug: 05-18 22:14:56 host: "localhost" Debug: 05-18 22:14:56 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
            \"; std::string sentence_copy = sentence; output_html += \"
            \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
            \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
              \"; for (const auto& alt : alt_itr->second) { output_html += \"
            • \" + alt + \"
            • \"; } output_html += \"
            \"; } output_html += \"
            \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
            \" + removed_char + \"
            \"; sentence_copy = new_sentence_copy; } } output_html += \"
            \"; output_html += \"
            \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:14:56 some body finished Debug: 05-18 22:14:56 one not finished. Debug: 05-18 22:14:56 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 22:14:56 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 22:14:56 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 22:14:56 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:14:57 translating from clipboard or selection Debug: 05-18 22:14:57 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
            \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
            \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
            \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
              \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
            • \" + alt + \"
            • \";\n }\n output_html += \"
            \";\n }\n\n output_html += \"
            \"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
            \" + removed_char + \"
            \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
            \"; \n output_html += \"
            \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 22:14:57 Current state: true false true true Debug: 05-18 22:14:57 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:14:57 scheme: "gdlookup" Debug: 05-18 22:14:57 host: "localhost" Debug: 05-18 22:14:57 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
            \"; std::string sentence_copy = sentence; output_html += \"
            \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
            \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
              \"; for (const auto& alt : alt_itr->second) { output_html += \"
            • \" + alt + \"
            • \"; } output_html += \"
            \"; } output_html += \"
            \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
            \" + removed_char + \"
            \"; sentence_copy = new_sentence_copy; } } output_html += \"
            \"; output_html += \"
            \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:14:57 some body finished Debug: 05-18 22:14:57 one not finished. Debug: 05-18 22:14:57 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 22:14:57 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 22:14:57 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 22:14:57 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:15:05 translating from clipboard or selection Debug: 05-18 22:15:05 clipboard data: "assert that" Debug: 05-18 22:15:05 Current state: true false true true Debug: 05-18 22:15:05 getResource: "gdlookup://localhost/?word=assert that&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:15:05 scheme: "gdlookup" Debug: 05-18 22:15:05 host: "localhost" Debug: 05-18 22:15:05 clear current dictionaries: "assert that" Debug: 05-18 22:15:05 some body finished Debug: 05-18 22:15:05 one not finished. Debug: 05-18 22:15:05 ====reading 1414 of (1414) bytes . Finished: 0 Debug: 05-18 22:15:05 ====reading 0 of (1414) bytes . Finished: 0 Debug: 05-18 22:15:05 ====reading 0 of (1414) bytes . Finished: 0 Warning: 05-18 22:15:05 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:17:03 translating from clipboard or selection Debug: 05-18 22:17:03 clipboard data: "@@ -144,7 +144,8 @@\n \n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n- bool goldendict_mode = false;\n+ bool goldendict_mode = false;\n+ std::string word, sentence;\n std::string dict_file;\n \n log_internal(\"Program started\");\n@@ -163,9 +164,11 @@\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n+ if (!std::filesystem::exists(dict_file)) {\n+ log_internal(\"Error: Dictionary file not found at \" + dict_file);\n+ std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n+ return 1;\n+ }\n i++; // Skip the next argument as it's the dictionary file path\n- } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n- goldendict_mode = true;\n- log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n@@ -172,10 +173,16 @@\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n+ } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n+ goldendict_mode = true;\n+ log_internal(\"GoldenDict mode enabled\");\n }\n }\n \n- std::string search_string = get_input(argc, argv, goldendict_mode);\n+ try {\n+ dict_file = find_dic_file().string(); // Default dictionary file path\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n \n log_internal(\"Dictionary file located at: \" + dict_file);\n \n@@ -183,8 +190,8 @@\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n- std::cerr << \"Error: \" << e.what() << std::endl;\n- return 1;\n+ std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n+ exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n@@ -196,10 +203,19 @@\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n- const auto trie = xcdat::load(dict_file);\n- log_internal(\"Trie loaded from dictionary file\");\n+ xcdat::trie_15_type trie;\n+ try {\n+ trie = xcdat::load(dict_file);\n+ log_internal(\"Trie loaded from dictionary file\");\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n+ std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n+ return 1;\n+ }\n \n std::vector substrings;\n+ std::vector results;\n+ std::map> derived_map;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n@@ -207,14 +223,19 @@\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n+ log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n+ log_internal(\"Substring added: \" + substring);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n@@ -238,14 +259,21 @@\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n+ log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n+ log_internal(\"New search string: \" + search_string);\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n+ raw_output += search_string + '\\n';\n+ }\n+ results.clear();\n+\n+ // Remove leading whitespace\n+ search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n // Print debug information if in debug mode\n@@ -262,8 +290,8 @@\n \n log_internal(\"Program finished\");\n- return 0;\n }\n \n+ return 0;\n }\n" Debug: 05-18 22:17:03 Current state: true false true true Debug: 05-18 22:17:03 getResource: "gdlookup://localhost/?word=@@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; - bool goldendict_mode %3D false; + bool goldendict_mode %3D false; + std::string word, sentence; std::string dict_file; log_internal(%22Program started%22); @@ -163,9 +164,11 @@ %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); + if (!std::filesystem::exists(dict_file)) %7B + log_internal(%22Error: Dictionary file not found at %22 + dict_file); + std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; + return 1; + %7D i++; // Skip the next argument as it%27s the dictionary file path - %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B - goldendict_mode %3D true; - log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); @@ -172,10 +173,16 @@ sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; + %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B + goldendict_mode %3D true; + log_internal(%22GoldenDict mode enabled%22); %7D %7D - std::string search_string %3D get_input(argc, argv, goldendict_mode); + try %7B + dict_file %3D find_dic_file().string(); // Default dictionary file path + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D log_internal(%22Dictionary file located at: %22 + dict_file); @@ -183,8 +190,8 @@ log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); - std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; - return 1; + std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; + exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B @@ -196,10 +203,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); - log_internal(%22Trie loaded from dictionary file%22); + xcdat::trie_15_type trie; + try %7B + trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); + log_internal(%22Trie loaded from dictionary file%22); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); + std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; + return 1; + %7D std::vector%3Cstd::string%3E substrings; + std::vector%3CEntry%3E results; + std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B @@ -207,14 +223,19 @@ while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); + log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); + log_internal(%22Substring added: %22 + substring); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; @@ -238,14 +259,21 @@ if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; + log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; + log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; + raw_output +%3D search_string + %27%5Cn%27; + %7D + results.clear(); + + // Remove leading whitespace + search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode @@ -262,8 +290,8 @@ log_internal(%22Program finished%22); - return 0; %7D + return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:17:03 scheme: "gdlookup" Debug: 05-18 22:17:03 host: "localhost" Debug: 05-18 22:17:03 clear current dictionaries: "@@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) { bool debug_mode = false; - bool goldendict_mode = false; + bool goldendict_mode = false; + std::string word, sentence; std::string dict_file; log_internal(\"Program started\"); @@ -163,9 +164,11 @@ } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); + if (!std::filesystem::exists(dict_file)) { + log_internal(\"Error: Dictionary file not found at \" + dict_file); + std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; + return 1; + } i++; // Skip the next argument as it's the dictionary file path - } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { - goldendict_mode = true; - log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); @@ -172,10 +173,16 @@ sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; + } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { + goldendict_mode = true; + log_internal(\"GoldenDict mode enabled\"); } } - std::string search_string = get_input(argc, argv, goldendict_mode); + try { + dict_file = find_dic_file().string(); // Default dictionary file path + } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } log_internal(\"Dictionary file located at: \" + dict_file); @@ -183,8 +190,8 @@ log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); - std::cerr << \"Error: \" << e.what() << std::endl; - return 1; + std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; + exit(1); } if (goldendict_mode && !sentence.empty()) { @@ -196,10 +203,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie = xcdat::load(dict_file); - log_internal(\"Trie loaded from dictionary file\"); + xcdat::trie_15_type trie; + try { + trie = xcdat::load(dict_file); + log_internal(\"Trie loaded from dictionary file\"); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); + std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; + return 1; + } std::vector substrings; + std::vector results; + std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { @@ -207,14 +223,19 @@ while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); + log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); + log_internal(\"Substring added: \" + substring); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; @@ -238,14 +259,21 @@ if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; + log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; + log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; + raw_output += search_string + '\\n'; + } + results.clear(); + + // Remove leading whitespace + search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode @@ -262,8 +290,8 @@ log_internal(\"Program finished\"); - return 0; } + return 0; }" Debug: 05-18 22:17:03 some body finished Debug: 05-18 22:17:03 one not finished. Debug: 05-18 22:17:03 ====reading 6003 of (6003) bytes . Finished: 0 Debug: 05-18 22:17:03 ====reading 0 of (6003) bytes . Finished: 0 Debug: 05-18 22:17:03 ====reading 0 of (6003) bytes . Finished: 0 Warning: 05-18 22:17:03 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:17:06 translating from clipboard or selection Debug: 05-18 22:17:06 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
            \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
            \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
            \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
              \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
            • \" + alt + \"
            • \";\n }\n output_html += \"
            \";\n }\n\n output_html += \"
            \"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
            \" + removed_char + \"
            \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
            \"; \n output_html += \"
            \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 22:17:06 Current state: true false true true Debug: 05-18 22:17:06 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:17:06 scheme: "gdlookup" Debug: 05-18 22:17:06 host: "localhost" Debug: 05-18 22:17:06 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
            \"; std::string sentence_copy = sentence; output_html += \"
            \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
            \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
              \"; for (const auto& alt : alt_itr->second) { output_html += \"
            • \" + alt + \"
            • \"; } output_html += \"
            \"; } output_html += \"
            \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
            \" + removed_char + \"
            \"; sentence_copy = new_sentence_copy; } } output_html += \"
            \"; output_html += \"
            \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:17:06 some body finished Debug: 05-18 22:17:06 one not finished. Debug: 05-18 22:17:06 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 22:17:06 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 22:17:06 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 22:17:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:17:07 translating from clipboard or selection Debug: 05-18 22:17:07 clipboard data: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
            \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
            \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
            \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
              \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
            • \" + alt + \"
            • \";\n }\n output_html += \"
            \";\n }\n\n output_html += \"
            \"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
            \" + removed_char + \"
            \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
            \"; \n output_html += \"
            \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 22:17:07 Current state: true false true true Debug: 05-18 22:17:07 getResource: "gdlookup://localhost/?word=%23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:17:07 scheme: "gdlookup" Debug: 05-18 22:17:07 host: "localhost" Debug: 05-18 22:17:07 clear current dictionaries: "#include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
            \"; std::string sentence_copy = sentence; output_html += \"
            \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
            \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
              \"; for (const auto& alt : alt_itr->second) { output_html += \"
            • \" + alt + \"
            • \"; } output_html += \"
            \"; } output_html += \"
            \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
            \" + removed_char + \"
            \"; sentence_copy = new_sentence_copy; } } output_html += \"
            \"; output_html += \"
            \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:17:07 some body finished Debug: 05-18 22:17:07 one not finished. Debug: 05-18 22:17:07 ====reading 13494 of (13494) bytes . Finished: 0 Debug: 05-18 22:17:07 ====reading 0 of (13494) bytes . Finished: 0 Debug: 05-18 22:17:07 ====reading 0 of (13494) bytes . Finished: 0 Warning: 05-18 22:17:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:17:14 translating from clipboard or selection Debug: 05-18 22:17:14 clipboard data: "diff --git a/hakurei.cpp b/hakurei.cpp\nindex 1234567..89abcde 100644\n--- a/hakurei.cpp\n+++ b/hakurei.cpp\n@@ -1,6 +1,7 @@\n #include \n #include \n #include \n+#include \n #include \n #include \n #include \n@@ -9,6 +10,7 @@\n #include \n #include \n #include \n+#include \n #include \n \n struct Entry {\n@@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n+ log_internal(\"Received search string from stdin: \" + search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n@@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n search_string = argv[i + 1];\n break;\n }\n+ log_internal(\"Received search string from command line in goldendict mode: \" + search_string);\n }\n } else {\n if (argc < 2) {\n@@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n+ log_internal(\"Parsing command line arguments\");\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n@@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n+ log_internal(\"Search string not provided\");\n exit(1);\n }\n return search_string;\n@@ -131,12 +138,18 @@ inline void wrap_html_output(\n output_html += \"
            \";\n \n std::string sentence_copy = sentence;\n+ log_internal(\"HTML output is being called\");\n \n output_html += \"
            \"; \n \n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n+ log_internal(\"Processing substring: \" + substring);\n if (sentence_copy.rfind(substring, 0) == 0) {\n+ log_internal(\"Found substring match: \" + substring);\n output_html += \"
            \" + substring + \"\";\n \n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
              \";\n@@ -179,6 +192,8 @@ inline void wrap_html_output(\n found = true;\n break;\n }\n+ log_internal(\"No match found for substring: \" + substring);\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n+ log_internal(\"Removed one UTF-8 character: \" + removed_char);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\");\n@@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin\n }\n \n void log_internal(const std::string& message) {\n+ log_internal(\"Logging message: \" + message);\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n@@ -283,6 +299,17 @@ void log_internal(const std::string& message) {\n }\n \n std::string get_current_time() {\n+ std::time_t now = std::time(nullptr);\n+ char buf[80];\n+ std::strftime(buf, sizeof(buf), \"%Y-%m-%d %H:%M:%S\", std::localtime(&now));\n+ return std::string(buf);\n+}\n+\n+int main(const int argc, char* argv[]) {\n+ bool debug_mode = false;\n+ bool goldendict_mode = false;\n+ std::string word, sentence;\n+ std::string dict_file = find_dic_file().string(); // Default dictionary file path\n \n log_internal(\"Program started at \" + get_current_time());\n \n@@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) {\n \n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string + \" at \" + get_current_time());\n+ log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string + \" at \" + get_current_time());\n@@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) {\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n+ log_internal(\"Current search string: \" + search_string);\n auto itr = trie.make_prefix_iterator(search_string);\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()) + \" at \" + get_current_time());\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n@@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) {\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring + \" at \" + get_current_time());\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n \n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char + \" at \" + get_current_time());\n \n@@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at \" + get_current_time());\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string + \" at \" + get_current_time());\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n@@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) {\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n \n log_internal(\"Program finished at \" + get_current_time());\n return 0;\n }\n" Debug: 05-18 22:17:14 Current state: true false true true Debug: 05-18 22:17:14 getResource: "gdlookup://localhost/?word=diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E +%23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E @@ -9,6 +10,7 @@ %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E +%23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B @@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); + log_internal(%22Received search string from stdin: %22 + search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B @@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold search_string %3D argv[i + 1]; break; %7D + log_internal(%22Received search string from command line in goldendict mode: %22 + search_string); %7D %7D else %7B if (argc %3C 2) %7B @@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B + log_internal(%22Parsing command line arguments%22); if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B @@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; + log_internal(%22Search string not provided%22); exit(1); %7D return search_string; @@ -131,12 +138,18 @@ inline void wrap_html_output( output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; + log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B + log_internal(%22Processing substring: %22 + substring); if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B + log_internal(%22Found substring match: %22 + substring); output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; @@ -179,6 +192,8 @@ inline void wrap_html_output( found %3D true; break; %7D + log_internal(%22No match found for substring: %22 + substring); %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); + log_internal(%22Removed one UTF-8 character: %22 + removed_char); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22); @@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string%26 search_strin %7D void log_internal(const std::string%26 message) %7B + log_internal(%22Logging message: %22 + message); std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B @@ -283,6 +299,17 @@ void log_internal(const std::string%26 message) %7B %7D std::string get_current_time() %7B + std::time_t now %3D std::time(nullptr); + char buf[80]; + std::strftime(buf, sizeof(buf), %22%25Y-%25m-%25d %25H:%25M:%25S%22, std::localtime(%26now)); + return std::string(buf); +%7D + +int main(const int argc, char* argv[]) %7B + bool debug_mode %3D false; + bool goldendict_mode %3D false; + std::string word, sentence; + std::string dict_file %3D find_dic_file().string(); // Default dictionary file path log_internal(%22Program started at %22 + get_current_time()); @@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) %7B std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string + %22 at %22 + get_current_time()); + log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string + %22 at %22 + get_current_time()); @@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) %7B std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B + log_internal(%22Current search string: %22 + search_string); auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view()) + %22 at %22 + get_current_time()); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); @@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) %7B alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring + %22 at %22 + get_current_time()); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char + %22 at %22 + get_current_time()); @@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at %22 + get_current_time()); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string + %22 at %22 + get_current_time()); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); @@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) %7B // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished at %22 + get_current_time()); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:17:14 scheme: "gdlookup" Debug: 05-18 22:17:14 host: "localhost" Debug: 05-18 22:17:14 clear current dictionaries: "diff --git a/hakurei.cpp b/hakurei.cpp index 1234567..89abcde 100644 --- a/hakurei.cpp +++ b/hakurei.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -9,6 +10,7 @@ #include #include #include +#include #include struct Entry { @@ -63,6 +65,8 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); + log_internal(\"Received search string from stdin: \" + search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { @@ -71,6 +75,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold search_string = argv[i + 1]; break; } + log_internal(\"Received search string from command line in goldendict mode: \" + search_string); } } else { if (argc < 2) { @@ -79,6 +84,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold exit(1); } for (int i = 1; i < argc; ++i) { + log_internal(\"Parsing command line arguments\"); if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { @@ -92,6 +98,7 @@ inline std::string get_input(const int argc, char* const argv[], const bool gold } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; + log_internal(\"Search string not provided\"); exit(1); } return search_string; @@ -131,12 +138,18 @@ inline void wrap_html_output( output_html += \"
              \"; std::string sentence_copy = sentence; + log_internal(\"HTML output is being called\"); output_html += \"
              \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { + log_internal(\"Processing substring: \" + substring); if (sentence_copy.rfind(substring, 0) == 0) { + log_internal(\"Found substring match: \" + substring); output_html += \"
              \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                \"; @@ -179,6 +192,8 @@ inline void wrap_html_output( found = true; break; } + log_internal(\"No match found for substring: \" + substring); } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); + log_internal(\"Removed one UTF-8 character: \" + removed_char); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\"); @@ -271,6 +286,7 @@ void log_execution(const int argc, char* argv[], const std::string& search_strin } void log_internal(const std::string& message) { + log_internal(\"Logging message: \" + message); std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { @@ -283,6 +299,17 @@ void log_internal(const std::string& message) { } std::string get_current_time() { + std::time_t now = std::time(nullptr); + char buf[80]; + std::strftime(buf, sizeof(buf), \"%Y-%m-%d %H:%M:%S\", std::localtime(&now)); + return std::string(buf); +} + +int main(const int argc, char* argv[]) { + bool debug_mode = false; + bool goldendict_mode = false; + std::string word, sentence; + std::string dict_file = find_dic_file().string(); // Default dictionary file path log_internal(\"Program started at \" + get_current_time()); @@ -331,6 +358,7 @@ int main(const int argc, char* argv[]) { std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string + \" at \" + get_current_time()); + log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string + \" at \" + get_current_time()); @@ -372,12 +400,14 @@ int main(const int argc, char* argv[]) { std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { + log_internal(\"Current search string: \" + search_string); auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view()) + \" at \" + get_current_time()); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); @@ -385,6 +415,7 @@ int main(const int argc, char* argv[]) { alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring + \" at \" + get_current_time()); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char + \" at \" + get_current_time()); @@ -402,6 +433,7 @@ int main(const int argc, char* argv[]) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop. at \" + get_current_time()); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string + \" at \" + get_current_time()); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); @@ -418,6 +450,7 @@ int main(const int argc, char* argv[]) { // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished at \" + get_current_time()); return 0; }" Debug: 05-18 22:17:14 some body finished Debug: 05-18 22:17:14 one not finished. Debug: 05-18 22:17:14 ====reading 8565 of (8565) bytes . Finished: 0 Debug: 05-18 22:17:14 ====reading 0 of (8565) bytes . Finished: 0 Debug: 05-18 22:17:14 ====reading 0 of (8565) bytes . Finished: 0 Warning: 05-18 22:17:14 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:19:04 translating from clipboard or selection Debug: 05-18 22:19:04 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -174,6 +174,12 @@\n try {\n dict_file = find_dic_file().string(); // Default dictionary file path\n } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n+\n+ log_internal(\"Dictionary file located at: \" + dict_file);\n \n std::string search_string;\n try {\n@@ -182,8 +188,8 @@\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n- std::cerr << \"Error: \" << e.what() << std::endl;\n- return 1;\n+ std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n+ exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n@@ -195,10 +201,19 @@\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n- const auto trie = xcdat::load(dict_file);\n- log_internal(\"Trie loaded from dictionary file\");\n+ xcdat::trie_15_type trie;\n+ try {\n+ trie = xcdat::load(dict_file);\n+ log_internal(\"Trie loaded from dictionary file\");\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n+ std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n+ return 1;\n+ }\n \n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n@@ -225,12 +240,16 @@\n \n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n \n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n \n@@ -241,11 +260,15 @@\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n \n@@ -256,6 +279,6 @@\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n \n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:19:04 Current state: true true false true Debug: 05-18 22:19:04 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -174,6 +174,12 @@ try %7B dict_file %3D find_dic_file().string(); // Default dictionary file path %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D + + log_internal(%22Dictionary file located at: %22 + dict_file); std::string search_string; try %7B @@ -182,8 +188,8 @@ log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); - std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; - return 1; + std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; + exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B @@ -195,10 +201,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); - log_internal(%22Trie loaded from dictionary file%22); + xcdat::trie_15_type trie; + try %7B + trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); + log_internal(%22Trie loaded from dictionary file%22); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); + std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; + return 1; + %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B @@ -225,12 +240,16 @@ const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); @@ -241,11 +260,15 @@ raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D @@ -256,6 +279,6 @@ // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:19:04 scheme: "gdlookup" Debug: 05-18 22:19:04 host: "localhost" Debug: 05-18 22:19:04 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -174,6 +174,12 @@ try { dict_file = find_dic_file().string(); // Default dictionary file path } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } + + log_internal(\"Dictionary file located at: \" + dict_file); std::string search_string; try { @@ -182,8 +188,8 @@ log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); - std::cerr << \"Error: \" << e.what() << std::endl; - return 1; + std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; + exit(1); } if (goldendict_mode && !sentence.empty()) { @@ -195,10 +201,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie = xcdat::load(dict_file); - log_internal(\"Trie loaded from dictionary file\"); + xcdat::trie_15_type trie; + try { + trie = xcdat::load(dict_file); + log_internal(\"Trie loaded from dictionary file\"); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); + std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; + return 1; + } std::vector substrings; std::vector results; std::map> alternatives_map; while (!search_string.empty()) { @@ -225,12 +240,16 @@ const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); @@ -241,11 +260,15 @@ raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } @@ -256,6 +279,6 @@ // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:19:04 some body finished Debug: 05-18 22:19:04 one not finished. Debug: 05-18 22:19:04 ====reading 4412 of (4412) bytes . Finished: 0 Debug: 05-18 22:19:04 ====reading 0 of (4412) bytes . Finished: 0 Debug: 05-18 22:19:04 ====reading 0 of (4412) bytes . Finished: 0 Warning: 05-18 22:19:04 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:19:21 translating from clipboard or selection Debug: 05-18 22:19:21 clipboard data: "@@ -144,7 +144,8 @@\n \n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n- bool goldendict_mode = false;\n+ bool goldendict_mode = false;\n+ std::string word, sentence;\n std::string dict_file;\n \n log_internal(\"Program started\");\n@@ -163,9 +164,11 @@\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n+ if (!std::filesystem::exists(dict_file)) {\n+ log_internal(\"Error: Dictionary file not found at \" + dict_file);\n+ std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n+ return 1;\n+ }\n i++; // Skip the next argument as it's the dictionary file path\n- } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n- goldendict_mode = true;\n- log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n@@ -172,10 +173,16 @@\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n+ } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n+ goldendict_mode = true;\n+ log_internal(\"GoldenDict mode enabled\");\n }\n }\n \n- std::string search_string = get_input(argc, argv, goldendict_mode);\n+ try {\n+ dict_file = find_dic_file().string(); // Default dictionary file path\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n \n log_internal(\"Dictionary file located at: \" + dict_file);\n \n@@ -183,8 +190,8 @@\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n- std::cerr << \"Error: \" << e.what() << std::endl;\n- return 1;\n+ std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n+ exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n@@ -196,10 +203,19 @@\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n- const auto trie = xcdat::load(dict_file);\n- log_internal(\"Trie loaded from dictionary file\");\n+ xcdat::trie_15_type trie;\n+ try {\n+ trie = xcdat::load(dict_file);\n+ log_internal(\"Trie loaded from dictionary file\");\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n+ std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n+ return 1;\n+ }\n \n std::vector substrings;\n+ std::vector results;\n+ std::map> derived_map;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n@@ -207,14 +223,19 @@\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n+ log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n+ log_internal(\"Substring added: \" + substring);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n@@ -238,14 +259,21 @@\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n+ log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n+ log_internal(\"New search string: \" + search_string);\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n+ raw_output += search_string + '\\n';\n+ }\n+ results.clear();\n+\n+ // Remove leading whitespace\n+ search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n // Print debug information if in debug mode\n@@ -262,8 +290,8 @@\n \n log_internal(\"Program finished\");\n- return 0;\n }\n \n+ return 0;\n }\n" Debug: 05-18 22:19:21 Current state: true false false true Debug: 05-18 22:19:21 getResource: "gdlookup://localhost/?word=@@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; - bool goldendict_mode %3D false; + bool goldendict_mode %3D false; + std::string word, sentence; std::string dict_file; log_internal(%22Program started%22); @@ -163,9 +164,11 @@ %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); + if (!std::filesystem::exists(dict_file)) %7B + log_internal(%22Error: Dictionary file not found at %22 + dict_file); + std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; + return 1; + %7D i++; // Skip the next argument as it%27s the dictionary file path - %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B - goldendict_mode %3D true; - log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); @@ -172,10 +173,16 @@ sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; + %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B + goldendict_mode %3D true; + log_internal(%22GoldenDict mode enabled%22); %7D %7D - std::string search_string %3D get_input(argc, argv, goldendict_mode); + try %7B + dict_file %3D find_dic_file().string(); // Default dictionary file path + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D log_internal(%22Dictionary file located at: %22 + dict_file); @@ -183,8 +190,8 @@ log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); - std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; - return 1; + std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; + exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B @@ -196,10 +203,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); - log_internal(%22Trie loaded from dictionary file%22); + xcdat::trie_15_type trie; + try %7B + trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); + log_internal(%22Trie loaded from dictionary file%22); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); + std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; + return 1; + %7D std::vector%3Cstd::string%3E substrings; + std::vector%3CEntry%3E results; + std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B @@ -207,14 +223,19 @@ while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); + log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); + log_internal(%22Substring added: %22 + substring); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; @@ -238,14 +259,21 @@ if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; + log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; + log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; + raw_output +%3D search_string + %27%5Cn%27; + %7D + results.clear(); + + // Remove leading whitespace + search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode @@ -262,8 +290,8 @@ log_internal(%22Program finished%22); - return 0; %7D + return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:19:21 scheme: "gdlookup" Debug: 05-18 22:19:21 host: "localhost" Debug: 05-18 22:19:21 clear current dictionaries: "@@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) { bool debug_mode = false; - bool goldendict_mode = false; + bool goldendict_mode = false; + std::string word, sentence; std::string dict_file; log_internal(\"Program started\"); @@ -163,9 +164,11 @@ } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); + if (!std::filesystem::exists(dict_file)) { + log_internal(\"Error: Dictionary file not found at \" + dict_file); + std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; + return 1; + } i++; // Skip the next argument as it's the dictionary file path - } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { - goldendict_mode = true; - log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); @@ -172,10 +173,16 @@ sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; + } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { + goldendict_mode = true; + log_internal(\"GoldenDict mode enabled\"); } } - std::string search_string = get_input(argc, argv, goldendict_mode); + try { + dict_file = find_dic_file().string(); // Default dictionary file path + } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } log_internal(\"Dictionary file located at: \" + dict_file); @@ -183,8 +190,8 @@ log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); - std::cerr << \"Error: \" << e.what() << std::endl; - return 1; + std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; + exit(1); } if (goldendict_mode && !sentence.empty()) { @@ -196,10 +203,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie = xcdat::load(dict_file); - log_internal(\"Trie loaded from dictionary file\"); + xcdat::trie_15_type trie; + try { + trie = xcdat::load(dict_file); + log_internal(\"Trie loaded from dictionary file\"); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); + std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; + return 1; + } std::vector substrings; + std::vector results; + std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { @@ -207,14 +223,19 @@ while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); + log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); + log_internal(\"Substring added: \" + substring); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; @@ -238,14 +259,21 @@ if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; + log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; + log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; + raw_output += search_string + '\\n'; + } + results.clear(); + + // Remove leading whitespace + search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode @@ -262,8 +290,8 @@ log_internal(\"Program finished\"); - return 0; } + return 0; }" Debug: 05-18 22:19:21 some body finished Debug: 05-18 22:19:21 one not finished. Debug: 05-18 22:19:21 ====reading 6003 of (6003) bytes . Finished: 0 Debug: 05-18 22:19:21 ====reading 0 of (6003) bytes . Finished: 0 Debug: 05-18 22:19:21 ====reading 0 of (6003) bytes . Finished: 0 Warning: 05-18 22:19:21 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:19:22 translating from clipboard or selection Debug: 05-18 22:19:22 clipboard data: "@@ -144,7 +144,8 @@\n \n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n- bool goldendict_mode = false;\n+ bool goldendict_mode = false;\n+ std::string word, sentence;\n std::string dict_file;\n \n log_internal(\"Program started\");\n@@ -163,9 +164,11 @@\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n+ if (!std::filesystem::exists(dict_file)) {\n+ log_internal(\"Error: Dictionary file not found at \" + dict_file);\n+ std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n+ return 1;\n+ }\n i++; // Skip the next argument as it's the dictionary file path\n- } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n- goldendict_mode = true;\n- log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n@@ -172,10 +173,16 @@\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n+ } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n+ goldendict_mode = true;\n+ log_internal(\"GoldenDict mode enabled\");\n }\n }\n \n- std::string search_string = get_input(argc, argv, goldendict_mode);\n+ try {\n+ dict_file = find_dic_file().string(); // Default dictionary file path\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n \n log_internal(\"Dictionary file located at: \" + dict_file);\n \n@@ -183,8 +190,8 @@\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n- std::cerr << \"Error: \" << e.what() << std::endl;\n- return 1;\n+ std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n+ exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n@@ -196,10 +203,19 @@\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n- const auto trie = xcdat::load(dict_file);\n- log_internal(\"Trie loaded from dictionary file\");\n+ xcdat::trie_15_type trie;\n+ try {\n+ trie = xcdat::load(dict_file);\n+ log_internal(\"Trie loaded from dictionary file\");\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n+ std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n+ return 1;\n+ }\n \n std::vector substrings;\n+ std::vector results;\n+ std::map> derived_map;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n@@ -207,14 +223,19 @@\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n+ log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n+ log_internal(\"Substring added: \" + substring);\n alternatives_map[search_string].insert(substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n@@ -238,14 +259,21 @@\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n+ log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n+ log_internal(\"New search string: \" + search_string);\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n+ raw_output += search_string + '\\n';\n+ }\n+ results.clear();\n+\n+ // Remove leading whitespace\n+ search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n // Print debug information if in debug mode\n@@ -262,8 +290,8 @@\n \n log_internal(\"Program finished\");\n- return 0;\n }\n \n+ return 0;\n }\n" Debug: 05-18 22:19:22 Current state: true false true true Debug: 05-18 22:19:22 getResource: "gdlookup://localhost/?word=@@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; - bool goldendict_mode %3D false; + bool goldendict_mode %3D false; + std::string word, sentence; std::string dict_file; log_internal(%22Program started%22); @@ -163,9 +164,11 @@ %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); + if (!std::filesystem::exists(dict_file)) %7B + log_internal(%22Error: Dictionary file not found at %22 + dict_file); + std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; + return 1; + %7D i++; // Skip the next argument as it%27s the dictionary file path - %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B - goldendict_mode %3D true; - log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); @@ -172,10 +173,16 @@ sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; + %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B + goldendict_mode %3D true; + log_internal(%22GoldenDict mode enabled%22); %7D %7D - std::string search_string %3D get_input(argc, argv, goldendict_mode); + try %7B + dict_file %3D find_dic_file().string(); // Default dictionary file path + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D log_internal(%22Dictionary file located at: %22 + dict_file); @@ -183,8 +190,8 @@ log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); - std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; - return 1; + std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; + exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B @@ -196,10 +203,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); - log_internal(%22Trie loaded from dictionary file%22); + xcdat::trie_15_type trie; + try %7B + trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); + log_internal(%22Trie loaded from dictionary file%22); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); + std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; + return 1; + %7D std::vector%3Cstd::string%3E substrings; + std::vector%3CEntry%3E results; + std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B @@ -207,14 +223,19 @@ while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); + log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); + log_internal(%22Substring added: %22 + substring); alternatives_map[search_string].insert(substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; @@ -238,14 +259,21 @@ if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; + log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; + log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; + raw_output +%3D search_string + %27%5Cn%27; + %7D + results.clear(); + + // Remove leading whitespace + search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode @@ -262,8 +290,8 @@ log_internal(%22Program finished%22); - return 0; %7D + return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:19:22 scheme: "gdlookup" Debug: 05-18 22:19:22 host: "localhost" Debug: 05-18 22:19:22 clear current dictionaries: "@@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) { bool debug_mode = false; - bool goldendict_mode = false; + bool goldendict_mode = false; + std::string word, sentence; std::string dict_file; log_internal(\"Program started\"); @@ -163,9 +164,11 @@ } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); + if (!std::filesystem::exists(dict_file)) { + log_internal(\"Error: Dictionary file not found at \" + dict_file); + std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; + return 1; + } i++; // Skip the next argument as it's the dictionary file path - } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { - goldendict_mode = true; - log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); @@ -172,10 +173,16 @@ sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; + } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { + goldendict_mode = true; + log_internal(\"GoldenDict mode enabled\"); } } - std::string search_string = get_input(argc, argv, goldendict_mode); + try { + dict_file = find_dic_file().string(); // Default dictionary file path + } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } log_internal(\"Dictionary file located at: \" + dict_file); @@ -183,8 +190,8 @@ log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); - std::cerr << \"Error: \" << e.what() << std::endl; - return 1; + std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; + exit(1); } if (goldendict_mode && !sentence.empty()) { @@ -196,10 +203,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie = xcdat::load(dict_file); - log_internal(\"Trie loaded from dictionary file\"); + xcdat::trie_15_type trie; + try { + trie = xcdat::load(dict_file); + log_internal(\"Trie loaded from dictionary file\"); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); + std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; + return 1; + } std::vector substrings; + std::vector results; + std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { @@ -207,14 +223,19 @@ while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); + log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); + log_internal(\"Substring added: \" + substring); alternatives_map[search_string].insert(substring); if (!goldendict_mode) { std::cout << substring << std::endl; @@ -238,14 +259,21 @@ if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; + log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; + log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; + raw_output += search_string + '\\n'; + } + results.clear(); + + // Remove leading whitespace + search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode @@ -262,8 +290,8 @@ log_internal(\"Program finished\"); - return 0; } + return 0; }" Debug: 05-18 22:19:22 some body finished Debug: 05-18 22:19:22 one not finished. Debug: 05-18 22:19:22 ====reading 6003 of (6003) bytes . Finished: 0 Debug: 05-18 22:19:22 ====reading 0 of (6003) bytes . Finished: 0 Debug: 05-18 22:19:22 ====reading 0 of (6003) bytes . Finished: 0 Warning: 05-18 22:19:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:20:03 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:20:03 scheme: "gdlookup" Debug: 05-18 22:20:03 host: "localhost" Debug: 05-18 22:20:03 clear current dictionaries: "転生したら剣でした" Debug: 05-18 22:20:03 some body finished Debug: 05-18 22:20:03 one not finished. Debug: 05-18 22:20:03 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 22:20:03 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 22:20:03 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 22:20:03 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:20:10 translating from clipboard or selection Debug: 05-18 22:20:10 clipboard data: "tmp/dict.bi" Debug: 05-18 22:20:10 Current state: true false false true Debug: 05-18 22:20:10 getResource: "gdlookup://localhost/?word=tmp/dict.bi&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:20:10 scheme: "gdlookup" Debug: 05-18 22:20:10 host: "localhost" Debug: 05-18 22:20:10 clear current dictionaries: "tmp/dict.bi" Debug: 05-18 22:20:10 some body finished Debug: 05-18 22:20:10 one not finished. Debug: 05-18 22:20:10 ====reading 1414 of (1414) bytes . Finished: 0 Debug: 05-18 22:20:10 ====reading 0 of (1414) bytes . Finished: 0 Debug: 05-18 22:20:10 ====reading 0 of (1414) bytes . Finished: 0 Warning: 05-18 22:20:10 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:20:13 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:20:13 scheme: "gdlookup" Debug: 05-18 22:20:13 host: "localhost" Debug: 05-18 22:20:13 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 22:20:13 some body finished Debug: 05-18 22:20:13 one not finished. Debug: 05-18 22:20:13 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 22:20:13 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:20:13 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 22:20:13 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:21:10 translating from clipboard or selection Debug: 05-18 22:21:10 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -144,7 +144,8 @@\n \n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n- bool goldendict_mode = false;\n+ bool goldendict_mode = false;\n+ std::string word, sentence;\n std::string dict_file;\n\n+ log_internal(\"Program started\");\n \n+ // Check for the dictionary file\n+ try {\n+ dict_file = find_dic_file().string(); // Default dictionary file path\n+ log_internal(\"Dictionary file located at: \" + dict_file);\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n \n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n+ if (!std::filesystem::exists(dict_file)) {\n+ log_internal(\"Error: Dictionary file not found at \" + dict_file);\n+ std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n+ return 1;\n+ }\n i++; // Skip the next argument as it's the dictionary file path\n+ } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n+ goldendict_mode = true;\n+ log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n \n std::string search_string;\n try {\n search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n xcdat::trie_15_type trie;\n try {\n trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n return 1;\n }\n \n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n \n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n \n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n \n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:21:10 Current state: true true false true Debug: 05-18 22:21:10 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; - bool goldendict_mode %3D false; + bool goldendict_mode %3D false; + std::string word, sentence; std::string dict_file; + log_internal(%22Program started%22); + // Check for the dictionary file + try %7B + dict_file %3D find_dic_file().string(); // Default dictionary file path + log_internal(%22Dictionary file located at: %22 + dict_file); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); + if (!std::filesystem::exists(dict_file)) %7B + log_internal(%22Error: Dictionary file not found at %22 + dict_file); + std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; + return 1; + %7D i++; // Skip the next argument as it%27s the dictionary file path + %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B + goldendict_mode %3D true; + log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string; try %7B search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try %7B trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; return 1; %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:21:10 scheme: "gdlookup" Debug: 05-18 22:21:10 host: "localhost" Debug: 05-18 22:21:10 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) { bool debug_mode = false; - bool goldendict_mode = false; + bool goldendict_mode = false; + std::string word, sentence; std::string dict_file; + log_internal(\"Program started\"); + // Check for the dictionary file + try { + dict_file = find_dic_file().string(); // Default dictionary file path + log_internal(\"Dictionary file located at: \" + dict_file); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); + if (!std::filesystem::exists(dict_file)) { + log_internal(\"Error: Dictionary file not found at \" + dict_file); + std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; + return 1; + } i++; // Skip the next argument as it's the dictionary file path + } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { + goldendict_mode = true; + log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string; try { search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; exit(1); } if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try { trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); } catch (const std::exception& e) { log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; return 1; } std::vector substrings; std::vector results; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:21:10 some body finished Debug: 05-18 22:21:10 one not finished. Debug: 05-18 22:21:10 ====reading 6527 of (6527) bytes . Finished: 0 Debug: 05-18 22:21:10 ====reading 0 of (6527) bytes . Finished: 0 Debug: 05-18 22:21:10 ====reading 0 of (6527) bytes . Finished: 0 Warning: 05-18 22:21:10 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:21:18 translating from clipboard or selection Debug: 05-18 22:21:18 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -174,6 +174,12 @@\n try {\n dict_file = find_dic_file().string(); // Default dictionary file path\n } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n+\n+ log_internal(\"Dictionary file located at: \" + dict_file);\n \n std::string search_string;\n try {\n@@ -182,8 +188,8 @@\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n- std::cerr << \"Error: \" << e.what() << std::endl;\n- return 1;\n+ std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n+ exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n@@ -195,10 +201,19 @@\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n- const auto trie = xcdat::load(dict_file);\n- log_internal(\"Trie loaded from dictionary file\");\n+ xcdat::trie_15_type trie;\n+ try {\n+ trie = xcdat::load(dict_file);\n+ log_internal(\"Trie loaded from dictionary file\");\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n+ std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n+ return 1;\n+ }\n \n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n@@ -225,12 +240,16 @@\n \n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n \n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n \n@@ -241,11 +260,15 @@\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n \n@@ -256,6 +279,6 @@\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n \n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:21:18 Current state: true false false true Debug: 05-18 22:21:18 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -174,6 +174,12 @@ try %7B dict_file %3D find_dic_file().string(); // Default dictionary file path %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D + + log_internal(%22Dictionary file located at: %22 + dict_file); std::string search_string; try %7B @@ -182,8 +188,8 @@ log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); - std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; - return 1; + std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; + exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B @@ -195,10 +201,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); - log_internal(%22Trie loaded from dictionary file%22); + xcdat::trie_15_type trie; + try %7B + trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); + log_internal(%22Trie loaded from dictionary file%22); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); + std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; + return 1; + %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B @@ -225,12 +240,16 @@ const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); @@ -241,11 +260,15 @@ raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D @@ -256,6 +279,6 @@ // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:21:18 scheme: "gdlookup" Debug: 05-18 22:21:18 host: "localhost" Debug: 05-18 22:21:18 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -174,6 +174,12 @@ try { dict_file = find_dic_file().string(); // Default dictionary file path } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } + + log_internal(\"Dictionary file located at: \" + dict_file); std::string search_string; try { @@ -182,8 +188,8 @@ log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); - std::cerr << \"Error: \" << e.what() << std::endl; - return 1; + std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; + exit(1); } if (goldendict_mode && !sentence.empty()) { @@ -195,10 +201,19 @@ log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); - const auto trie = xcdat::load(dict_file); - log_internal(\"Trie loaded from dictionary file\"); + xcdat::trie_15_type trie; + try { + trie = xcdat::load(dict_file); + log_internal(\"Trie loaded from dictionary file\"); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); + std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; + return 1; + } std::vector substrings; std::vector results; std::map> alternatives_map; while (!search_string.empty()) { @@ -225,12 +240,16 @@ const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); @@ -241,11 +260,15 @@ raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } @@ -256,6 +279,6 @@ // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:21:18 some body finished Debug: 05-18 22:21:18 one not finished. Debug: 05-18 22:21:18 ====reading 4412 of (4412) bytes . Finished: 0 Debug: 05-18 22:21:18 ====reading 0 of (4412) bytes . Finished: 0 Debug: 05-18 22:21:18 ====reading 0 of (4412) bytes . Finished: 0 Warning: 05-18 22:21:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:21:38 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:21:38 scheme: "gdlookup" Debug: 05-18 22:21:38 host: "localhost" Debug: 05-18 22:21:38 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 22:21:38 some body finished Debug: 05-18 22:21:38 one not finished. Debug: 05-18 22:21:38 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 22:21:38 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:21:38 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 22:21:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:21:42 socket error message: QAbstractSocket::RemoteHostClosedError Debug: 05-18 22:21:43 translating from clipboard or selection Debug: 05-18 22:21:43 clipboard data: ": Program started\nSat May 18 22:21:38 2024\n: Dictionary file set to: /tmp/dict.bin\nSat May 18 22:21:38 2024\n: GoldenDict mode enabled\nSat May 18 22:21:38 2024\n: Sentence set to: 地獄の苦しみ" Debug: 05-18 22:21:43 Current state: true false false true Debug: 05-18 22:21:43 getResource: "gdlookup://localhost/?word=: Program started Sat May 18 22:21:38 2024 : Dictionary file set to: /tmp/dict.bin Sat May 18 22:21:38 2024 : GoldenDict mode enabled Sat May 18 22:21:38 2024 : Sentence set to: 地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:21:43 scheme: "gdlookup" Debug: 05-18 22:21:43 host: "localhost" Debug: 05-18 22:21:43 clear current dictionaries: ": Program started Sat May 18 22:21:38 2024 : Dictionary file set to: /tmp/dict.bin Sat May 18 22:21:38 2024 : GoldenDict mode enabled Sat May 18 22:21:38 2024 : Sentence set to: 地獄の苦しみ" Debug: 05-18 22:21:43 some body finished Debug: 05-18 22:21:43 one not finished. Debug: 05-18 22:21:43 ====reading 1599 of (1599) bytes . Finished: 0 Debug: 05-18 22:21:43 ====reading 0 of (1599) bytes . Finished: 0 Debug: 05-18 22:21:43 ====reading 0 of (1599) bytes . Finished: 0 Warning: 05-18 22:21:43 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:21:48 translating from clipboard or selection Debug: 05-18 22:21:48 clipboard data: ": Program started\nSat May 18 22:21:38 2024\n: Dictionary file set to: /tmp/dict.bin\nSat May 18 22:21:38 2024\n: GoldenDict mode enabled\nSat May 18 22:21:38 2024\n: Sentence set to: 地獄の苦しみ" Debug: 05-18 22:21:48 Current state: true false true true Debug: 05-18 22:21:48 getResource: "gdlookup://localhost/?word=: Program started Sat May 18 22:21:38 2024 : Dictionary file set to: /tmp/dict.bin Sat May 18 22:21:38 2024 : GoldenDict mode enabled Sat May 18 22:21:38 2024 : Sentence set to: 地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:21:48 scheme: "gdlookup" Debug: 05-18 22:21:48 host: "localhost" Debug: 05-18 22:21:48 clear current dictionaries: ": Program started Sat May 18 22:21:38 2024 : Dictionary file set to: /tmp/dict.bin Sat May 18 22:21:38 2024 : GoldenDict mode enabled Sat May 18 22:21:38 2024 : Sentence set to: 地獄の苦しみ" Debug: 05-18 22:21:48 some body finished Debug: 05-18 22:21:48 one not finished. Debug: 05-18 22:21:48 ====reading 1599 of (1599) bytes . Finished: 0 Debug: 05-18 22:21:48 ====reading 0 of (1599) bytes . Finished: 0 Debug: 05-18 22:21:48 ====reading 0 of (1599) bytes . Finished: 0 Warning: 05-18 22:21:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:22:40 translating from clipboard or selection Debug: 05-18 22:22:40 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -144,7 +144,8 @@\n \n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n+ std::string dict_file;\n \n log_internal(\"Program started\");\n \n+ // Check for the dictionary file\n+ try {\n+ dict_file = find_dic_file().string(); // Default dictionary file path\n+ log_internal(\"Dictionary file located at: \" + dict_file);\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n \n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n+ if (!std::filesystem::exists(dict_file)) {\n+ log_internal(\"Error: Dictionary file not found at \" + dict_file);\n+ std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n+ return 1;\n+ }\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n \n std::string search_string;\n try {\n search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n xcdat::trie_15_type trie;\n try {\n trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n return 1;\n }\n \n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n \n+ log_internal(\"Starting search loop with search string: \" + search_string);\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n \n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n \n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n+ log_internal(\"Search loop ended\");\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n+ log_internal(\"HTML output wrapped\");\n exit(0);\n }\n \n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:22:40 Current state: true true true true Debug: 05-18 22:22:40 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; + std::string dict_file; log_internal(%22Program started%22); + // Check for the dictionary file + try %7B + dict_file %3D find_dic_file().string(); // Default dictionary file path + log_internal(%22Dictionary file located at: %22 + dict_file); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); + if (!std::filesystem::exists(dict_file)) %7B + log_internal(%22Error: Dictionary file not found at %22 + dict_file); + std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; + return 1; + %7D i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string; try %7B search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try %7B trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; return 1; %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; + log_internal(%22Starting search loop with search string: %22 + search_string); while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D + log_internal(%22Search loop ended%22); // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); + log_internal(%22HTML output wrapped%22); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:22:40 scheme: "gdlookup" Debug: 05-18 22:22:40 host: "localhost" Debug: 05-18 22:22:40 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; + std::string dict_file; log_internal(\"Program started\"); + // Check for the dictionary file + try { + dict_file = find_dic_file().string(); // Default dictionary file path + log_internal(\"Dictionary file located at: \" + dict_file); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); + if (!std::filesystem::exists(dict_file)) { + log_internal(\"Error: Dictionary file not found at \" + dict_file); + std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; + return 1; + } i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string; try { search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; exit(1); } if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try { trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); } catch (const std::exception& e) { log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; return 1; } std::vector substrings; std::vector results; std::map> alternatives_map; + log_internal(\"Starting search loop with search string: \" + search_string); while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } + log_internal(\"Search loop ended\"); // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); + log_internal(\"HTML output wrapped\"); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:22:40 some body finished Debug: 05-18 22:22:40 one not finished. Debug: 05-18 22:22:40 ====reading 6668 of (6668) bytes . Finished: 0 Debug: 05-18 22:22:40 ====reading 0 of (6668) bytes . Finished: 0 Debug: 05-18 22:22:40 ====reading 0 of (6668) bytes . Finished: 0 Warning: 05-18 22:22:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:22:44 translating from clipboard or selection Debug: 05-18 22:22:44 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -144,7 +144,8 @@\n \n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n- bool goldendict_mode = false;\n+ bool goldendict_mode = false;\n+ std::string word, sentence;\n std::string dict_file;\n\n+ log_internal(\"Program started\");\n \n+ // Check for the dictionary file\n+ try {\n+ dict_file = find_dic_file().string(); // Default dictionary file path\n+ log_internal(\"Dictionary file located at: \" + dict_file);\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n \n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n+ if (!std::filesystem::exists(dict_file)) {\n+ log_internal(\"Error: Dictionary file not found at \" + dict_file);\n+ std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n+ return 1;\n+ }\n i++; // Skip the next argument as it's the dictionary file path\n+ } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n+ goldendict_mode = true;\n+ log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n \n std::string search_string;\n try {\n search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n xcdat::trie_15_type trie;\n try {\n trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n return 1;\n }\n \n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n \n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n \n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n \n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n \n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:22:44 Current state: true false true true Debug: 05-18 22:22:44 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; - bool goldendict_mode %3D false; + bool goldendict_mode %3D false; + std::string word, sentence; std::string dict_file; + log_internal(%22Program started%22); + // Check for the dictionary file + try %7B + dict_file %3D find_dic_file().string(); // Default dictionary file path + log_internal(%22Dictionary file located at: %22 + dict_file); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); + if (!std::filesystem::exists(dict_file)) %7B + log_internal(%22Error: Dictionary file not found at %22 + dict_file); + std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; + return 1; + %7D i++; // Skip the next argument as it%27s the dictionary file path + %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B + goldendict_mode %3D true; + log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string; try %7B search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try %7B trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; return 1; %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:22:44 scheme: "gdlookup" Debug: 05-18 22:22:44 host: "localhost" Debug: 05-18 22:22:44 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) { bool debug_mode = false; - bool goldendict_mode = false; + bool goldendict_mode = false; + std::string word, sentence; std::string dict_file; + log_internal(\"Program started\"); + // Check for the dictionary file + try { + dict_file = find_dic_file().string(); // Default dictionary file path + log_internal(\"Dictionary file located at: \" + dict_file); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); + if (!std::filesystem::exists(dict_file)) { + log_internal(\"Error: Dictionary file not found at \" + dict_file); + std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; + return 1; + } i++; // Skip the next argument as it's the dictionary file path + } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { + goldendict_mode = true; + log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string; try { search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; exit(1); } if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try { trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); } catch (const std::exception& e) { log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; return 1; } std::vector substrings; std::vector results; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:22:44 some body finished Debug: 05-18 22:22:44 one not finished. Debug: 05-18 22:22:44 ====reading 6527 of (6527) bytes . Finished: 0 Debug: 05-18 22:22:44 ====reading 0 of (6527) bytes . Finished: 0 Debug: 05-18 22:22:44 ====reading 0 of (6527) bytes . Finished: 0 Warning: 05-18 22:22:44 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:01 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:01 scheme: "gdlookup" Debug: 05-18 22:23:01 host: "localhost" Debug: 05-18 22:23:01 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 22:23:01 some body finished Debug: 05-18 22:23:01 one not finished. Debug: 05-18 22:23:01 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 22:23:01 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:23:01 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 22:23:01 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:09 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:09 scheme: "gdlookup" Debug: 05-18 22:23:09 host: "localhost" Debug: 05-18 22:23:09 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 22:23:09 some body finished Debug: 05-18 22:23:09 one not finished. Debug: 05-18 22:23:09 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 22:23:09 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:23:09 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 22:23:09 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:53 translating from clipboard or selection Debug: 05-18 22:23:53 clipboard data: "const auto trie = xcdat::load(dict_file);" Debug: 05-18 22:23:53 Current state: true true false true Debug: 05-18 22:23:53 getResource: "gdlookup://localhost/?word=const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:53 scheme: "gdlookup" Debug: 05-18 22:23:53 host: "localhost" Debug: 05-18 22:23:53 clear current dictionaries: "const auto trie = xcdat::load(dict_file);" Debug: 05-18 22:23:53 some body finished Debug: 05-18 22:23:53 one not finished. Debug: 05-18 22:23:53 ====reading 1471 of (1471) bytes . Finished: 0 Debug: 05-18 22:23:53 ====reading 0 of (1471) bytes . Finished: 0 Debug: 05-18 22:23:53 ====reading 0 of (1471) bytes . Finished: 0 Warning: 05-18 22:23:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:54 translating from clipboard or selection Debug: 05-18 22:23:54 clipboard data: "const auto trie = xcdat::load(dict_file);" Debug: 05-18 22:23:54 Current state: true false false true Debug: 05-18 22:23:54 getResource: "gdlookup://localhost/?word=const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:54 scheme: "gdlookup" Debug: 05-18 22:23:54 host: "localhost" Debug: 05-18 22:23:54 clear current dictionaries: "const auto trie = xcdat::load(dict_file);" Debug: 05-18 22:23:54 some body finished Debug: 05-18 22:23:54 one not finished. Debug: 05-18 22:23:54 ====reading 1471 of (1471) bytes . Finished: 0 Debug: 05-18 22:23:54 ====reading 0 of (1471) bytes . Finished: 0 Debug: 05-18 22:23:54 ====reading 0 of (1471) bytes . Finished: 0 Warning: 05-18 22:23:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:55 translating from clipboard or selection Debug: 05-18 22:23:55 clipboard data: " log_internal(\"Trie loaded from dictionary file\");\n" Debug: 05-18 22:23:55 Current state: true false true true Debug: 05-18 22:23:55 getResource: "gdlookup://localhost/?word=log_internal(%22Trie loaded from dictionary file%22);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:55 scheme: "gdlookup" Debug: 05-18 22:23:55 host: "localhost" Debug: 05-18 22:23:55 clear current dictionaries: "log_internal(\"Trie loaded from dictionary file\");" Debug: 05-18 22:23:55 some body finished Debug: 05-18 22:23:55 one not finished. Debug: 05-18 22:23:55 ====reading 1462 of (1462) bytes . Finished: 0 Debug: 05-18 22:23:55 ====reading 0 of (1462) bytes . Finished: 0 Debug: 05-18 22:23:55 ====reading 0 of (1462) bytes . Finished: 0 Warning: 05-18 22:23:55 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:55 translating from clipboard or selection Debug: 05-18 22:23:55 clipboard data: " const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n" Debug: 05-18 22:23:55 Current state: true false true true Debug: 05-18 22:23:55 getResource: "gdlookup://localhost/?word=const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:55 scheme: "gdlookup" Debug: 05-18 22:23:55 host: "localhost" Debug: 05-18 22:23:55 clear current dictionaries: "const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\");" Debug: 05-18 22:23:55 some body finished Debug: 05-18 22:23:55 one not finished. Debug: 05-18 22:23:55 ====reading 1531 of (1531) bytes . Finished: 0 Debug: 05-18 22:23:55 ====reading 0 of (1531) bytes . Finished: 0 Debug: 05-18 22:23:55 ====reading 0 of (1531) bytes . Finished: 0 Warning: 05-18 22:23:55 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:58 translating from clipboard or selection Debug: 05-18 22:23:58 clipboard data: " const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n" Debug: 05-18 22:23:58 Current state: true false true true Debug: 05-18 22:23:58 getResource: "gdlookup://localhost/?word=const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:58 scheme: "gdlookup" Debug: 05-18 22:23:58 host: "localhost" Debug: 05-18 22:23:58 clear current dictionaries: "const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\");" Debug: 05-18 22:23:58 some body finished Debug: 05-18 22:23:58 one not finished. Debug: 05-18 22:23:58 ====reading 1531 of (1531) bytes . Finished: 0 Debug: 05-18 22:23:58 ====reading 0 of (1531) bytes . Finished: 0 Debug: 05-18 22:23:58 ====reading 0 of (1531) bytes . Finished: 0 Warning: 05-18 22:23:58 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:23:59 translating from clipboard or selection Debug: 05-18 22:23:59 clipboard data: " const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n" Debug: 05-18 22:23:59 Current state: true false true true Debug: 05-18 22:23:59 getResource: "gdlookup://localhost/?word=const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:23:59 scheme: "gdlookup" Debug: 05-18 22:23:59 host: "localhost" Debug: 05-18 22:23:59 clear current dictionaries: "const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\");" Debug: 05-18 22:23:59 some body finished Debug: 05-18 22:23:59 one not finished. Debug: 05-18 22:23:59 ====reading 1531 of (1531) bytes . Finished: 0 Debug: 05-18 22:23:59 ====reading 0 of (1531) bytes . Finished: 0 Debug: 05-18 22:23:59 ====reading 0 of (1531) bytes . Finished: 0 Warning: 05-18 22:23:59 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:24:00 translating from clipboard or selection Debug: 05-18 22:24:00 clipboard data: " const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n" Debug: 05-18 22:24:00 Current state: true false true true Debug: 05-18 22:24:00 getResource: "gdlookup://localhost/?word=const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:24:00 scheme: "gdlookup" Debug: 05-18 22:24:00 host: "localhost" Debug: 05-18 22:24:00 clear current dictionaries: "const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\");" Debug: 05-18 22:24:00 some body finished Debug: 05-18 22:24:00 one not finished. Debug: 05-18 22:24:00 ====reading 1531 of (1531) bytes . Finished: 0 Debug: 05-18 22:24:00 ====reading 0 of (1531) bytes . Finished: 0 Debug: 05-18 22:24:00 ====reading 0 of (1531) bytes . Finished: 0 Warning: 05-18 22:24:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:24:17 translating from clipboard or selection Debug: 05-18 22:24:17 clipboard data: " std::string dict_file = find_dic_file().string(); // Default dictionary file path\n" Debug: 05-18 22:24:17 Current state: true false true true Debug: 05-18 22:24:17 getResource: "gdlookup://localhost/?word=std::string dict_file %3D find_dic_file().string(); // Default dictionary file path&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:24:17 scheme: "gdlookup" Debug: 05-18 22:24:17 host: "localhost" Debug: 05-18 22:24:17 clear current dictionaries: "std::string dict_file = find_dic_file().string(); // Default dictionary file path" Debug: 05-18 22:24:17 some body finished Debug: 05-18 22:24:17 one not finished. Debug: 05-18 22:24:17 ====reading 1484 of (1484) bytes . Finished: 0 Debug: 05-18 22:24:17 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-18 22:24:17 ====reading 0 of (1484) bytes . Finished: 0 Warning: 05-18 22:24:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:24:17 translating from clipboard or selection Debug: 05-18 22:24:17 clipboard data: " std::string dict_file = find_dic_file().string(); // Default dictionary file path\n" Debug: 05-18 22:24:17 Current state: true false true true Debug: 05-18 22:24:17 getResource: "gdlookup://localhost/?word=std::string dict_file %3D find_dic_file().string(); // Default dictionary file path&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:24:17 scheme: "gdlookup" Debug: 05-18 22:24:17 host: "localhost" Debug: 05-18 22:24:17 clear current dictionaries: "std::string dict_file = find_dic_file().string(); // Default dictionary file path" Debug: 05-18 22:24:17 some body finished Debug: 05-18 22:24:17 one not finished. Debug: 05-18 22:24:17 ====reading 1484 of (1484) bytes . Finished: 0 Debug: 05-18 22:24:17 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-18 22:24:17 ====reading 0 of (1484) bytes . Finished: 0 Warning: 05-18 22:24:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:24:17 translating from clipboard or selection Debug: 05-18 22:24:17 clipboard data: " std::string dict_file = find_dic_file().string(); // Default dictionary file path\n" Debug: 05-18 22:24:17 Current state: true false true true Debug: 05-18 22:24:17 getResource: "gdlookup://localhost/?word=std::string dict_file %3D find_dic_file().string(); // Default dictionary file path&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:24:17 scheme: "gdlookup" Debug: 05-18 22:24:17 host: "localhost" Debug: 05-18 22:24:17 clear current dictionaries: "std::string dict_file = find_dic_file().string(); // Default dictionary file path" Debug: 05-18 22:24:17 some body finished Debug: 05-18 22:24:17 one not finished. Debug: 05-18 22:24:17 ====reading 1484 of (1484) bytes . Finished: 0 Debug: 05-18 22:24:17 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-18 22:24:17 ====reading 0 of (1484) bytes . Finished: 0 Warning: 05-18 22:24:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:24:24 translating from clipboard or selection Debug: 05-18 22:24:24 clipboard data: " const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
                \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
                  \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
                • \" + alt + \"
                • \";\n }\n output_html += \"
                \";\n }\n\n output_html += \"
                \"; \n output_html += \"\";\n\n sentence_copy = sentence_copy.substr(substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n break;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 22:24:24 Current state: true false true true Debug: 05-18 22:24:24 getResource: "gdlookup://localhost/?word=const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:24:24 scheme: "gdlookup" Debug: 05-18 22:24:24 host: "localhost" Debug: 05-18 22:24:24 clear current dictionaries: "const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:24:24 some body finished Debug: 05-18 22:24:24 one not finished. Debug: 05-18 22:24:24 ====reading 13133 of (13133) bytes . Finished: 0 Debug: 05-18 22:24:24 ====reading 0 of (13133) bytes . Finished: 0 Debug: 05-18 22:24:24 ====reading 0 of (13133) bytes . Finished: 0 Warning: 05-18 22:24:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:24:40 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:24:40 scheme: "gdlookup" Debug: 05-18 22:24:40 host: "localhost" Debug: 05-18 22:24:40 clear current dictionaries: "ゆっくり" Debug: 05-18 22:24:40 some body finished Debug: 05-18 22:24:40 one not finished. Debug: 05-18 22:24:40 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 22:24:40 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 22:24:40 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 22:24:40 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:25:02 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:25:02 scheme: "gdlookup" Debug: 05-18 22:25:02 host: "localhost" Debug: 05-18 22:25:02 clear current dictionaries: "ゆっくり" Debug: 05-18 22:25:02 some body finished Debug: 05-18 22:25:02 one not finished. Debug: 05-18 22:25:02 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 22:25:02 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 22:25:02 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 22:25:02 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:26:45 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:26:45 scheme: "gdlookup" Debug: 05-18 22:26:45 host: "localhost" Debug: 05-18 22:26:45 clear current dictionaries: "転生したら剣でした" Debug: 05-18 22:26:45 some body finished Debug: 05-18 22:26:45 one not finished. Debug: 05-18 22:26:45 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 22:26:45 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 22:26:45 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 22:26:45 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:27:04 translating from clipboard or selection Debug: 05-18 22:27:04 clipboard data: "\n: Sentence set to: " Debug: 05-18 22:27:04 Current state: true false false true Debug: 05-18 22:27:04 getResource: "gdlookup://localhost/?word=: Sentence set to:&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:27:04 scheme: "gdlookup" Debug: 05-18 22:27:04 host: "localhost" Debug: 05-18 22:27:04 clear current dictionaries: ": Sentence set to:" Debug: 05-18 22:27:04 some body finished Debug: 05-18 22:27:04 one not finished. Debug: 05-18 22:27:04 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 22:27:04 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:27:04 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 22:27:04 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:27:05 translating from clipboard or selection Debug: 05-18 22:27:05 clipboard data: "転生したら剣でした" Debug: 05-18 22:27:05 Current state: true false true true Debug: 05-18 22:27:05 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:27:05 scheme: "gdlookup" Debug: 05-18 22:27:05 host: "localhost" Debug: 05-18 22:27:05 clear current dictionaries: "転生したら剣でした" Debug: 05-18 22:27:05 some body finished Debug: 05-18 22:27:05 one not finished. Debug: 05-18 22:27:05 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 22:27:05 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 22:27:05 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 22:27:05 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:27:06 translating from clipboard or selection Debug: 05-18 22:27:06 clipboard data: "転生したら剣でした" Debug: 05-18 22:27:06 Current state: true false true true Debug: 05-18 22:27:06 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:27:06 scheme: "gdlookup" Debug: 05-18 22:27:06 host: "localhost" Debug: 05-18 22:27:06 clear current dictionaries: "転生したら剣でした" Debug: 05-18 22:27:06 some body finished Debug: 05-18 22:27:06 one not finished. Debug: 05-18 22:27:06 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 22:27:06 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 22:27:06 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 22:27:06 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Warning: 05-18 22:28:15 can not found the corresponding language from locale: "crowdin" Warning: 05-18 22:28:15 can not found the corresponding language from locale: "qt_extra_es" Warning: 05-18 22:28:15 can not found the corresponding language from locale: "qt_extra_it" Warning: 05-18 22:28:15 can not found the corresponding language from locale: "qt_extra_lt" Warning: 05-18 22:28:15 can not found the corresponding language from locale: "qtwebengine_zh_CN" Debug: 05-18 22:28:25 starting create the fts with thread: 11 Debug: 05-18 22:28:25 waiting for all the fts creation to finish. Debug: 05-18 22:28:25 finished/cancel all the fts creation Debug: 05-18 22:28:43 handle path: "/mnt/Reading/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:28:43 handle path: "/mnt/Data/Chinese caligraphy dictionaries" Debug: 05-18 22:28:43 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/dicts" Debug: 05-18 22:28:44 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 22:28:44 Epwing: found "EIDAI6" Warning: 05-18 22:28:44 "Epwing dictionary initializing failed: , error: EB library report error EB \"eb_set_subbook\" function error: EB_ERR_FAIL_OPEN_TEXT (failed to open a text file)\n" Debug: 05-18 22:28:44 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 22:28:44 Epwing: found "HYOGEN" Debug: 05-18 22:28:44 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:28:44 Epwing: found "RUIGIGO" Debug: 05-18 22:28:45 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:28:45 Epwing: found "RUIGIGO" Debug: 05-18 22:28:45 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 22:28:45 Epwing: found "ENCY" Debug: 05-18 22:28:45 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 22:28:45 Epwing: found "Snmkg99" Debug: 05-18 22:28:45 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 22:28:45 Epwing: found "BODY" Debug: 05-18 22:28:45 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 22:28:45 Epwing: found "MEIKYOJJ" Debug: 05-18 22:28:45 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/pronounciation" Debug: 05-18 22:28:45 handle path: "/mnt/Reading/Wikipedia Japa" Debug: 05-18 22:28:45 handle path: "/mnt/Data/Documents/dict - concise encyclopedia of mathematics" Debug: 05-18 22:28:45 handle path: "/home/hashirama/Downloads/Port" Debug: 05-18 22:28:45 handle path: "/mnt/Data/Documents/english_dictionary" Debug: 05-18 22:28:45 handle path: "/mnt/Sources/Epistularum's Tidy EPWing Collection [Version 1.0]" Debug: 05-18 22:28:45 handle path: "/mnt/Sources/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:28:46 Load done Debug: 05-18 22:28:46 Loading 200 abbrv Debug: 05-18 22:28:46 Loading 198 abbrv Debug: 05-18 22:28:46 Loading 183 abbrv Debug: 05-18 22:28:46 Loading 210 abbrv Debug: 05-18 22:28:46 received: "220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <312130797.3959.1716085726@dict.dict.org>\r\n" Debug: 05-18 22:28:46 received: "110 166 databases present\r\n" Debug: 05-18 22:28:46 receive db: "gcide \"The Collaborative International Dictionary of English v.0.48\"" Debug: 05-18 22:28:46 receive db: "wn \"WordNet (r) 3.0 (2006)\"" Debug: 05-18 22:28:46 receive db: "moby-thesaurus \"Moby Thesaurus II by Grady Ward, 1.0\"" Debug: 05-18 22:28:46 receive db: "elements \"The Elements (07Nov00)\"" Debug: 05-18 22:28:46 receive db: "vera \"V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)\"" Debug: 05-18 22:28:46 receive db: "jargon \"The Jargon File (version 4.4.7, 29 Dec 2003)\"" Debug: 05-18 22:28:46 receive db: "foldoc \"The Free On-line Dictionary of Computing (30 December 2018)\"" Debug: 05-18 22:28:46 receive db: "easton \"Easton's 1897 Bible Dictionary\"" Debug: 05-18 22:28:46 receive db: "hitchcock \"Hitchcock's Bible Names Dictionary (late 1800's)\"" Debug: 05-18 22:28:46 receive db: "bouvier \"Bouvier's Law Dictionary, Revised 6th Ed (1856)\"" Debug: 05-18 22:28:46 receive db: "devil \"The Devil's Dictionary (1881-1906)\"" Debug: 05-18 22:28:46 receive db: "world02 \"CIA World Factbook 2002\"" Debug: 05-18 22:28:46 receive db: "gaz2k-counties \"U.S. Gazetteer Counties (2000)\"" Debug: 05-18 22:28:46 receive db: "gaz2k-places \"U.S. Gazetteer Places (2000)\"" Debug: 05-18 22:28:46 receive db: "gaz2k-zips \"U.S. Gazetteer Zip Code Tabulation Areas (2000)\"" Debug: 05-18 22:28:46 receive db: "fd-hrv-eng \"Croatian-English FreeDict Dictionary ver. 0.1.2\"" Debug: 05-18 22:28:46 receive db: "fd-fin-por \"suomi-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:28:46 receive db: "fd-fin-bul \"suomi-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:28:46 receive db: "fd-fra-bul \"fran\xC3\xA7""ais-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:28:46 receive db: "fd-deu-swe \"Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:28:46 receive db: "fd-fin-swe \"suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:28:46 receive db: "fd-jpn-rus \"Japanese-Russian FreeDict Dictionary ver. 0.1\"" Debug: 05-18 22:28:46 receive db: "fd-wol-fra \"Wolof - French FreeDict dictionary ver. 0.1\"" Debug: 05-18 22:28:46 receive db: "fd-fra-pol \"fran\xC3\xA7""ais-j\xC4\x99zyk" Debug: 05-18 22:28:46 received: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-deu \"English-German FreeDict Dictionary ver. 0.3.7\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-nld \"German-Dutch FreeDict Dictionary ver. 0.1.4\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-por-eng \"Portuguese-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-spa-deu \"Spanish-German FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ces-eng \"Czech-English FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-fin \"Svenska-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-pol \"English - Polish Piotrowski+Saloni/FreeDict dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-nor \"j\xC4\x99zyk polski-Norsk FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-rom \"English-Romanian FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-fra \"English-French FreeDict Dictionary ver. 0.1.6\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fin-ell \"suomi-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-lit \"English-Lithuanian FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ckb-kmr \"Sorani-Kurmanji Ferheng/FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-eng \"Italian-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-eng \"j\xC4\x99zyk polski-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-gle-eng \"Irish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-tur \"English-Turkish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-gle-pol \"Irish-Polish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-deu \"j\xC4\x99zyk polski-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-spa \"fran\xC3\xA7""ais-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-lit-eng \"Lithuanian-English FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-jpn \"English-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ara-eng \"Arabic-English FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-nld-ita \"Nederlands-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-lat \"English-Latin FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-hun \"English-Hungarian FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-jpn \"italiano-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-dan-eng \"Danish-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-hun-eng \"Hungarian-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-gle \"Polish-Irish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-fin \"fran\xC3\xA7""ais-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-nld-swe \"Nederlands-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-nld-eng \"Dutch-English Freedict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-kur \"German-Kurdish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-spa \"Deutsch-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-afr \"English-Afrikaans FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-swe \"English-Swedish FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-jpn-deu \"Japanese-German FreeDict Dictionary ver. 0.2.0\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-epo-eng \"Esperanto-English FreeDict dictionary ver. 1.0.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-nld \"j\xC4\x99zyk polski-Nederlands FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-lat-deu \"Lateinisch-Deutsch FreeDict-W\xC3\xB6rterbuch ver. 1.0.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-cym \"Eurfa Saesneg, English-Welsh Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-por-spa \"portugu\xC3\xAAs-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-spa \"English-Spanish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-tur \"Svenska-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-tur-eng \"Turkish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-tur-deu \"Turkish-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-fra \"j\xC4\x99zyk polski-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-por \"English-Portuguese FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-pol \"italiano-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-ces \"English-Czech dicts.info/FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-tur \"German-Turkish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-jpn \"fran\xC3\xA7""ais-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-cym-eng \"Eurfa Cymraeg, Welsh-English Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-bre-fra \"Breton-French FreeDict Dictionary (Geriadur Tomaz) ver. 0.8.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-jpn-fra \"Japanese-French FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-nld-deu \"Dutch-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-nld \"English-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-por \"German-Portuguese FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-hrv \"English-Croatian FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-mkd-bul \"Macedonian - Bulgarian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-eng \"Swedish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-spa \"j\xC4\x99zyk polski-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-jpn-eng \"Japanese-English FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-ell \"English - Modern Greek XDXF/FreeDict dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-por \"italiano-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-swe \"j\xC4\x99zyk polski-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-fin \"j\xC4\x99zyk polski-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-kur-tur \"Kurdish-Turkish Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-swe \"italiano-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-swh \"English-Swahili xFried/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-kha-eng \"Khasi-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fin-eng \"suomi-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-hin \"English-Hindi FreeDict Dictionary ver. 1.6\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-spa-eng \"Spanish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-afr-eng \"Afrikaans-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-fin \"italiano-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-fin \"English-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-ita \"fran\xC3\xA7""ais-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-rus \"Deutsch-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-bul \"Deutsch-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-pol \"Deutsch-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-kur-deu \"Kurdish-German Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-spa-por \"Spanish-Portuguese FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-pol \"Svenska-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-rus \"Svenska-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-nld-spa \"Nederlands-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swh-pol \"Swahili-Polish SSSP/FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-oci-cat \"Lenga d'\xC3\xB2""c - Catal\xC3\xA0 FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-rus \"italiano-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-ell \"fran\xC3\xA7""ais-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-srp \"English-Serbian FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-tur \"fran\xC3\xA7""ais-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-eng \"French-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-ita-ell \"italiano-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-kur-eng \"Kurdish-English Ferheng/FreeDict Dictionary ver. 1.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-deu \"Svenska-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-fra \"Svenska-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-lat \"Svenska-latine FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-ell \"Svenska-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-rus \"English-Russian FreeDict Dictionary ver. 0.3.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-por \"j\xC4\x99zyk polski-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-gla-deu \"Scottish Gaelic-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-ita \"English-Italian FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-pol-ita \"j\xC4\x99zyk polski-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-swe \"fran\xC3\xA7""ais-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-isl-eng \"\xC3\xADslenska - English FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-spa \"Svenska-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-nno-nob \"Norwegian Nynorsk-Norwegian Bokm\xC3\xA5l FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swe-ita \"Svenska-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-deu \"fran\xC3\xA7""ais-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fin-ita \"suomi-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-nld-fra \"Nederlands-French FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-eng-ara \"English-Arabic FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-slk-eng \"Slovak-English FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fra-por \"fran\xC3\xA7""ais-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-spa-ast \"Spanish - Asturian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fin-jpn \"suomi-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-deu-ita \"German-Italian FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-swh-eng \"Swahili-English xFried/FreeDict Dictionary ver. 0.4.4\"\r\n" Debug: 05-18 22:28:46 receive db: "fd-fin-nor \"suomi-Norsk FreeDict+WikDict dictionary ver. 2018" Debug: 05-18 22:28:46 Reloading all the tabs... Debug: 05-18 22:28:46 starting create the fts with thread: 11 Debug: 05-18 22:28:46 waiting for all the fts creation to finish. Debug: 05-18 22:28:46 finished/cancel all the fts creation Debug: 05-18 22:28:46 received: ".09.13\"\r\n" Debug: 05-18 22:28:46 receive db: ".09.13\"\r\n" Debug: 05-18 22:28:46 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:28:46 scheme: "gdlookup" Debug: 05-18 22:28:46 host: "localhost" Debug: 05-18 22:28:46 clear current dictionaries: "転生したら剣でした" Debug: 05-18 22:28:46 some body finished Debug: 05-18 22:28:46 one not finished. Debug: 05-18 22:28:46 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 22:28:46 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 22:28:46 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 22:28:46 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:28:46 received: "fd-fra-nld \"French-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:28:55 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:28:55 scheme: "gdlookup" Debug: 05-18 22:28:55 host: "localhost" Debug: 05-18 22:28:55 clear current dictionaries: "違和感" Debug: 05-18 22:28:55 some body finished Debug: 05-18 22:28:55 one not finished. Debug: 05-18 22:28:55 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 22:28:55 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 22:28:55 ====reading 0 of (1412) bytes . Finished: 0 Warning: 05-18 22:28:55 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:29:01 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:29:01 scheme: "gdlookup" Debug: 05-18 22:29:01 host: "localhost" Debug: 05-18 22:29:01 clear current dictionaries: "ゆっくり" Debug: 05-18 22:29:01 some body finished Debug: 05-18 22:29:01 one not finished. Debug: 05-18 22:29:01 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 22:29:01 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 22:29:01 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 22:29:01 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:31:04 translating from clipboard or selection Debug: 05-18 22:31:04 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -2,6 +2,7 @@\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n\n struct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n };\n\n inline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n }\n\n inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n }\n\n inline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n }\n\n inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n }\n\n void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n }\n\n void log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n }\n\n inline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
                \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
                  \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
                • \" + alt + \"
                • \";\n }\n output_html += \"
                \";\n }\n\n output_html += \"
                \"; \n output_html += \"\";\n sentence_copy.erase(0, substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n output_html += sentence_copy[0];\n sentence_copy.erase(0, 1);\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n\n std::cout << output_html << std::endl;\n }\n\n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file;\n\n log_internal(\"Program started\");\n\n try {\n dict_file = find_dic_file().string(); \n log_internal(\"Dictionary file located at: \" + dict_file);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: \" << e.what() << std::endl;\n return 1;\n }\n\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n if (!std::filesystem::exists(dict_file)) {\n log_internal(\"Error: Dictionary file not found at \" + dict_file);\n std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n return 1;\n }\n i++;\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string;\n try {\n search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n exit(1);\n }\n\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n xcdat::trie_15_type trie;\n try {\n trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n return 1;\n }\n\n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n\n log_internal(\"Starting search loop with search string: \" + search_string);\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n log_internal(\"Search loop ended\");\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n log_internal(\"HTML output wrapped\");\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:31:04 Current state: true true false true Debug: 05-18 22:31:04 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -2,6 +2,7 @@ %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy.erase(0, substring.size()); found %3D true; break; %7D %7D if (!found) %7B output_html +%3D sentence_copy[0]; sentence_copy.erase(0, 1); %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file; log_internal(%22Program started%22); try %7B dict_file %3D find_dic_file().string(); log_internal(%22Dictionary file located at: %22 + dict_file); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); if (!std::filesystem::exists(dict_file)) %7B log_internal(%22Error: Dictionary file not found at %22 + dict_file); std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; return 1; %7D i++; %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string; try %7B search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try %7B trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; return 1; %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; log_internal(%22Starting search loop with search string: %22 + search_string); while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D log_internal(%22Search loop ended%22); if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); log_internal(%22HTML output wrapped%22); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:31:04 scheme: "gdlookup" Debug: 05-18 22:31:04 host: "localhost" Debug: 05-18 22:31:04 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -2,6 +2,7 @@ #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy.erase(0, substring.size()); found = true; break; } } if (!found) { output_html += sentence_copy[0]; sentence_copy.erase(0, 1); } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file; log_internal(\"Program started\"); try { dict_file = find_dic_file().string(); log_internal(\"Dictionary file located at: \" + dict_file); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: \" << e.what() << std::endl; return 1; } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); if (!std::filesystem::exists(dict_file)) { log_internal(\"Error: Dictionary file not found at \" + dict_file); std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; return 1; } i++; } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string; try { search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; exit(1); } if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try { trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); } catch (const std::exception& e) { log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; return 1; } std::vector substrings; std::vector results; std::map> alternatives_map; log_internal(\"Starting search loop with search string: \" + search_string); while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } log_internal(\"Search loop ended\"); if (debug_mode) { print_debug_info(substrings, raw_output); } if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); log_internal(\"HTML output wrapped\"); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:31:04 some body finished Debug: 05-18 22:31:04 one not finished. Debug: 05-18 22:31:04 ====reading 13682 of (13682) bytes . Finished: 0 Debug: 05-18 22:31:04 ====reading 0 of (13682) bytes . Finished: 0 Debug: 05-18 22:31:04 ====reading 0 of (13682) bytes . Finished: 0 Warning: 05-18 22:31:04 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:31:11 translating from clipboard or selection Debug: 05-18 22:31:11 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -144,7 +144,8 @@\n \n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n+ std::string dict_file;\n \n log_internal(\"Program started\");\n \n+ // Check for the dictionary file\n+ try {\n+ dict_file = find_dic_file().string(); // Default dictionary file path\n+ log_internal(\"Dictionary file located at: \" + dict_file);\n+ } catch (const std::exception& e) {\n+ log_internal(std::string(\"Error: \") + e.what());\n+ std::cerr << \"Error: \" << e.what() << std::endl;\n+ return 1;\n+ }\n \n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n+ if (!std::filesystem::exists(dict_file)) {\n+ log_internal(\"Error: Dictionary file not found at \" + dict_file);\n+ std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n+ return 1;\n+ }\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n \n std::string search_string;\n try {\n search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n exit(1);\n }\n \n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n \n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n \n xcdat::trie_15_type trie;\n try {\n trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n return 1;\n }\n \n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n \n+ log_internal(\"Starting search loop with search string: \" + search_string);\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n \n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n \n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n \n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n \n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n \n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n \n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n \n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n \n results.clear();\n \n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n \n+ log_internal(\"Search loop ended\");\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n \n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n+ log_internal(\"HTML output wrapped\");\n exit(0);\n }\n \n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:31:11 Current state: true false false true Debug: 05-18 22:31:11 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; + std::string dict_file; log_internal(%22Program started%22); + // Check for the dictionary file + try %7B + dict_file %3D find_dic_file().string(); // Default dictionary file path + log_internal(%22Dictionary file located at: %22 + dict_file); + %7D catch (const std::exception%26 e) %7B + log_internal(std::string(%22Error: %22) + e.what()); + std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; + return 1; + %7D // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); + if (!std::filesystem::exists(dict_file)) %7B + log_internal(%22Error: Dictionary file not found at %22 + dict_file); + std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; + return 1; + %7D i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string; try %7B search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try %7B trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; return 1; %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; + log_internal(%22Starting search loop with search string: %22 + search_string); while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D + log_internal(%22Search loop ended%22); // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); + log_internal(%22HTML output wrapped%22); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:31:11 scheme: "gdlookup" Debug: 05-18 22:31:11 host: "localhost" Debug: 05-18 22:31:11 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -144,7 +144,8 @@ int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; + std::string dict_file; log_internal(\"Program started\"); + // Check for the dictionary file + try { + dict_file = find_dic_file().string(); // Default dictionary file path + log_internal(\"Dictionary file located at: \" + dict_file); + } catch (const std::exception& e) { + log_internal(std::string(\"Error: \") + e.what()); + std::cerr << \"Error: \" << e.what() << std::endl; + return 1; + } // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); + if (!std::filesystem::exists(dict_file)) { + log_internal(\"Error: Dictionary file not found at \" + dict_file); + std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; + return 1; + } i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string; try { search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; exit(1); } if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try { trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); } catch (const std::exception& e) { log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; return 1; } std::vector substrings; std::vector results; std::map> alternatives_map; + log_internal(\"Starting search loop with search string: \" + search_string); while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } + log_internal(\"Search loop ended\"); // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); + log_internal(\"HTML output wrapped\"); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:31:11 some body finished Debug: 05-18 22:31:11 one not finished. Debug: 05-18 22:31:11 ====reading 6668 of (6668) bytes . Finished: 0 Debug: 05-18 22:31:11 ====reading 0 of (6668) bytes . Finished: 0 Debug: 05-18 22:31:11 ====reading 0 of (6668) bytes . Finished: 0 Warning: 05-18 22:31:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:32:12 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:32:12 scheme: "gdlookup" Debug: 05-18 22:32:12 host: "localhost" Debug: 05-18 22:32:12 clear current dictionaries: "ゆっくり" Debug: 05-18 22:32:12 some body finished Debug: 05-18 22:32:12 one not finished. Debug: 05-18 22:32:12 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 22:32:12 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 22:32:12 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 22:32:12 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:32:18 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:32:18 scheme: "gdlookup" Debug: 05-18 22:32:18 host: "localhost" Debug: 05-18 22:32:18 clear current dictionaries: "転生したら剣でした" Debug: 05-18 22:32:18 some body finished Debug: 05-18 22:32:18 one not finished. Debug: 05-18 22:32:18 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 22:32:18 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 22:32:18 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 22:32:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:33:17 translating from clipboard or selection Debug: 05-18 22:33:17 clipboard data: "●●●●" Debug: 05-18 22:33:17 Current state: true true false true Debug: 05-18 22:33:17 getResource: "gdlookup://localhost/?word=●●●●&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:33:17 scheme: "gdlookup" Debug: 05-18 22:33:17 host: "localhost" Debug: 05-18 22:33:17 clear current dictionaries: "●●●●" Debug: 05-18 22:33:17 some body finished Debug: 05-18 22:33:17 one not finished. Debug: 05-18 22:33:17 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 22:33:17 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 22:33:17 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 22:33:17 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:33:18 translating from clipboard or selection Debug: 05-18 22:33:18 clipboard data: "" Debug: 05-18 22:38:09 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:38:09 scheme: "gdlookup" Debug: 05-18 22:38:09 host: "localhost" Debug: 05-18 22:38:09 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 22:38:09 some body finished Debug: 05-18 22:38:09 one not finished. Debug: 05-18 22:38:09 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 22:38:09 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:38:09 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:38:09 some body finished Debug: 05-18 22:38:09 one finished. Debug: 05-18 22:38:09 erasing.. Debug: 05-18 22:38:09 erase done.. Debug: 05-18 22:38:09 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 22:38:09 ====reading 1292 of (2713) bytes . Finished: 1 Debug: 05-18 22:38:09 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Warning: 05-18 22:38:09 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:38:09 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 22:38:09 scheme: "gico" Debug: 05-18 22:38:09 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 22:38:09 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 22:38:25 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:38:25 scheme: "gdlookup" Debug: 05-18 22:38:25 host: "localhost" Debug: 05-18 22:38:25 clear current dictionaries: "議" Debug: 05-18 22:38:25 some body finished Debug: 05-18 22:38:25 one not finished. Debug: 05-18 22:38:25 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 22:38:25 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 22:38:25 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 22:38:27 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:38:27 scheme: "gdlookup" Debug: 05-18 22:38:27 host: "localhost" Debug: 05-18 22:38:27 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 22:38:27 some body finished Debug: 05-18 22:38:27 one not finished. Debug: 05-18 22:38:27 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 22:38:27 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 22:38:27 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 22:38:27 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:38:46 socket error message: QAbstractSocket::RemoteHostClosedError Debug: 05-18 22:40:18 translating from clipboard or selection Debug: 05-18 22:40:18 clipboard data: "--- hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 09:00:00.000000000 +0000\n@@ -2,6 +2,7 @@\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n\n struct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n };\n\n inline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n }\n\n inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n search_string = argv[i + 1];\n break;\n }\n }\n } else {\n if (argc < 2) {\n std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n exit(1);\n }\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n // Handle debug mode\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n i++;\n } else {\n search_string = argv[i];\n break;\n }\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n }\n\n inline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n }\n\n inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n }\n\n void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n }\n\n void log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n }\n\n inline void wrap_html_output(\n const std::vector& substrings,\n const std::map>& alternatives_map,\n std::string& sentence\n ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n output_html += \"
                \" + substring + \"\";\n\n auto alt_itr = alternatives_map.find(sentence_copy);\n if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n output_html += \"
                  \";\n for (const auto& alt : alt_itr->second) {\n output_html += \"
                • \" + alt + \"
                • \";\n }\n output_html += \"
                \";\n }\n\n output_html += \"
                \"; \n output_html += \"\";\n sentence_copy.erase(0, substring.size());\n found = true;\n break;\n }\n }\n if (!found) {\n output_html += sentence_copy[0];\n sentence_copy.erase(0, 1);\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n\n std::cout << output_html << std::endl;\n }\n\n int main(const int argc, char* argv[]) {\n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n std::string dict_file;\n\n log_internal(\"Program started\");\n\n try {\n dict_file = find_dic_file().string(); \n log_internal(\"Dictionary file located at: \" + dict_file);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: \" << e.what() << std::endl;\n return 1;\n }\n\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n if (!std::filesystem::exists(dict_file)) {\n log_internal(\"Error: Dictionary file not found at \" + dict_file);\n std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl;\n return 1;\n }\n i++;\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string;\n try {\n search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: \") + e.what());\n std::cerr << \"Error: Failed to retrieve search string.\" << std::endl;\n exit(1);\n }\n\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n xcdat::trie_15_type trie;\n try {\n trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n } catch (const std::exception& e) {\n log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what());\n std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl;\n return 1;\n }\n\n std::vector substrings;\n std::vector results;\n std::map> alternatives_map;\n\n log_internal(\"Starting search loop with search string: \" + search_string);\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n if (!results.empty()) {\n for (const auto& entry : results) {\n const std::string substring(entry.decoded_view);\n substrings.push_back(substring);\n derived_map[substring].push_back(search_string);\n alternatives_map[search_string].insert(substring);\n log_internal(\"Substring added: \" + substring);\n if (!goldendict_mode) {\n std::cout << substring << std::endl;\n }\n }\n }\n\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n log_internal(\"Search loop ended\");\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n log_internal(\"HTML output wrapped\");\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n }\n" Debug: 05-18 22:40:18 Current state: true true false true Debug: 05-18 22:40:18 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -2,6 +2,7 @@ %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy.erase(0, substring.size()); found %3D true; break; %7D %7D if (!found) %7B output_html +%3D sentence_copy[0]; sentence_copy.erase(0, 1); %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file; log_internal(%22Program started%22); try %7B dict_file %3D find_dic_file().string(); log_internal(%22Dictionary file located at: %22 + dict_file); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); if (!std::filesystem::exists(dict_file)) %7B log_internal(%22Error: Dictionary file not found at %22 + dict_file); std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; return 1; %7D i++; %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string; try %7B search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try %7B trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; return 1; %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; log_internal(%22Starting search loop with search string: %22 + search_string); while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D log_internal(%22Search loop ended%22); if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); log_internal(%22HTML output wrapped%22); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:40:18 scheme: "gdlookup" Debug: 05-18 22:40:18 host: "localhost" Debug: 05-18 22:40:18 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -2,6 +2,7 @@ #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy.erase(0, substring.size()); found = true; break; } } if (!found) { output_html += sentence_copy[0]; sentence_copy.erase(0, 1); } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file; log_internal(\"Program started\"); try { dict_file = find_dic_file().string(); log_internal(\"Dictionary file located at: \" + dict_file); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: \" << e.what() << std::endl; return 1; } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); if (!std::filesystem::exists(dict_file)) { log_internal(\"Error: Dictionary file not found at \" + dict_file); std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; return 1; } i++; } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string; try { search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; exit(1); } if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try { trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); } catch (const std::exception& e) { log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; return 1; } std::vector substrings; std::vector results; std::map> alternatives_map; log_internal(\"Starting search loop with search string: \" + search_string); while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } log_internal(\"Search loop ended\"); if (debug_mode) { print_debug_info(substrings, raw_output); } if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); log_internal(\"HTML output wrapped\"); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:40:18 some body finished Debug: 05-18 22:40:18 one not finished. Debug: 05-18 22:40:18 ====reading 13682 of (13682) bytes . Finished: 0 Debug: 05-18 22:40:18 ====reading 0 of (13682) bytes . Finished: 0 Debug: 05-18 22:40:18 ====reading 0 of (13682) bytes . Finished: 0 Warning: 05-18 22:40:18 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:40:19 translating from clipboard or selection Debug: 05-18 22:40:19 clipboard data: "" Warning: 05-18 22:43:03 can not found the corresponding language from locale: "crowdin" Warning: 05-18 22:43:03 can not found the corresponding language from locale: "qt_extra_es" Warning: 05-18 22:43:03 can not found the corresponding language from locale: "qt_extra_it" Warning: 05-18 22:43:03 can not found the corresponding language from locale: "qt_extra_lt" Warning: 05-18 22:43:03 can not found the corresponding language from locale: "qtwebengine_zh_CN" Debug: 05-18 22:43:05 starting create the fts with thread: 11 Debug: 05-18 22:43:05 waiting for all the fts creation to finish. Debug: 05-18 22:43:05 finished/cancel all the fts creation Debug: 05-18 22:43:19 handle path: "/mnt/Reading/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:43:19 handle path: "/mnt/Data/Chinese caligraphy dictionaries" Debug: 05-18 22:43:19 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/dicts" Debug: 05-18 22:43:20 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-18 22:43:20 Epwing: found "EIDAI6" Warning: 05-18 22:43:20 "Epwing dictionary initializing failed: , error: EB library report error EB \"eb_set_subbook\" function error: EB_ERR_FAIL_OPEN_TEXT (failed to open a text file)\n" Debug: 05-18 22:43:20 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-18 22:43:20 Epwing: found "HYOGEN" Debug: 05-18 22:43:20 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:43:20 Epwing: found "RUIGIGO" Debug: 05-18 22:43:21 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-18 22:43:21 Epwing: found "RUIGIGO" Debug: 05-18 22:43:21 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-18 22:43:21 Epwing: found "ENCY" Debug: 05-18 22:43:21 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-18 22:43:21 Epwing: found "Snmkg99" Debug: 05-18 22:43:21 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-18 22:43:21 Epwing: found "BODY" Debug: 05-18 22:43:21 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-18 22:43:21 Epwing: found "MEIKYOJJ" Debug: 05-18 22:43:21 handle path: "/mnt/Data/Japanese_Resources/languages-study(japanesAndRussian)/pronounciation" Debug: 05-18 22:43:21 handle path: "/mnt/Reading/Wikipedia Japa" Debug: 05-18 22:43:21 handle path: "/mnt/Data/Documents/dict - concise encyclopedia of mathematics" Debug: 05-18 22:43:21 handle path: "/home/hashirama/Downloads/Port" Debug: 05-18 22:43:21 handle path: "/mnt/Data/Documents/english_dictionary" Debug: 05-18 22:43:21 handle path: "/mnt/Sources/Epistularum's Tidy EPWing Collection [Version 1.0]" Debug: 05-18 22:43:21 handle path: "/mnt/Sources/Epistularum's Tidy MDX Collection [Version 1.0]" Debug: 05-18 22:43:21 Load done Debug: 05-18 22:43:21 Loading 198 abbrv Debug: 05-18 22:43:21 Loading 210 abbrv Debug: 05-18 22:43:21 Loading 200 abbrv Debug: 05-18 22:43:21 Loading 183 abbrv Debug: 05-18 22:43:22 received: "220 dict.dict.org dictd 1.12.1/rf on Linux 4.19.0-10-amd64 <312137183.15890.1716086602@dict.dict.org>\r\n" Debug: 05-18 22:43:22 received: "110 166 databases present\r\n" Debug: 05-18 22:43:22 receive db: "gcide \"The Collaborative International Dictionary of English v.0.48\"" Debug: 05-18 22:43:22 receive db: "wn \"WordNet (r) 3.0 (2006)\"" Debug: 05-18 22:43:22 receive db: "moby-thesaurus \"Moby Thesaurus II by Grady Ward, 1.0\"" Debug: 05-18 22:43:22 receive db: "elements \"The Elements (07Nov00)\"" Debug: 05-18 22:43:22 receive db: "vera \"V.E.R.A. -- Virtual Entity of Relevant Acronyms (February 2016)\"" Debug: 05-18 22:43:22 receive db: "jargon \"The Jargon File (version 4.4.7, 29 Dec 2003)\"" Debug: 05-18 22:43:22 receive db: "foldoc \"The Free On-line Dictionary of Computing (30 December 2018)\"" Debug: 05-18 22:43:22 receive db: "easton \"Easton's 1897 Bible Dictionary\"" Debug: 05-18 22:43:22 receive db: "hitchcock \"Hitchcock's Bible Names Dictionary (late 1800's)\"" Debug: 05-18 22:43:22 receive db: "bouvier \"Bouvier's Law Dictionary, Revised 6th Ed (1856)\"" Debug: 05-18 22:43:22 receive db: "devil \"The Devil's Dictionary (1881-1906)\"" Debug: 05-18 22:43:22 receive db: "world02 \"CIA World Factbook 2002\"" Debug: 05-18 22:43:22 receive db: "gaz2k-counties \"U.S. Gazetteer Counties (2000)\"" Debug: 05-18 22:43:22 receive db: "gaz2k-places \"U.S. Gazetteer Places (2000)\"" Debug: 05-18 22:43:22 receive db: "gaz2k-zips \"U.S. Gazetteer Zip Code Tabulation Areas (2000)\"" Debug: 05-18 22:43:22 receive db: "fd-hrv-eng \"Croatian-English FreeDict Dictionary ver. 0.1.2\"" Debug: 05-18 22:43:22 receive db: "fd-fin-por \"suomi-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:43:22 receive db: "fd-fin-bul \"suomi-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:43:22 receive db: "fd-fra-bul \"fran\xC3\xA7""ais-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:43:22 receive db: "fd-deu-swe \"Deutsch-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:43:22 receive db: "fd-fin-swe \"suomi-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"" Debug: 05-18 22:43:22 receive db: "fd-jpn-rus \"Japanese-Russian FreeDict Dictionary ver. 0.1\"" Debug: 05-18 22:43:22 receive db: "fd-wol-fra \"Wolof - French FreeDict dictionary ver. 0.1\"" Debug: 05-18 22:43:22 receive db: "fd-fra-pol \"fran\xC3\xA7""ais-j\xC4\x99zyk" Debug: 05-18 22:43:22 received: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-deu \"English-German FreeDict Dictionary ver. 0.3.7\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-nld \"German-Dutch FreeDict Dictionary ver. 0.1.4\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-por-eng \"Portuguese-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-spa-deu \"Spanish-German FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ces-eng \"Czech-English FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-fin \"Svenska-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-pol \"English - Polish Piotrowski+Saloni/FreeDict dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-nor \"j\xC4\x99zyk polski-Norsk FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-rom \"English-Romanian FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-fra \"English-French FreeDict Dictionary ver. 0.1.6\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fin-ell \"suomi-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-lit \"English-Lithuanian FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ckb-kmr \"Sorani-Kurmanji Ferheng/FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-eng \"Italian-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-eng \"j\xC4\x99zyk polski-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-gle-eng \"Irish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-tur \"English-Turkish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-gle-pol \"Irish-Polish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-deu \"j\xC4\x99zyk polski-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-spa \"fran\xC3\xA7""ais-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-lit-eng \"Lithuanian-English FreeDict Dictionary ver. 0.7.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-jpn \"English-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ara-eng \"Arabic-English FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-nld-ita \"Nederlands-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-lat \"English-Latin FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-hun \"English-Hungarian FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-jpn \"italiano-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-dan-eng \"Danish-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-hun-eng \"Hungarian-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-gle \"Polish-Irish FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-fin \"fran\xC3\xA7""ais-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-nld-swe \"Nederlands-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-nld-eng \"Dutch-English Freedict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-kur \"German-Kurdish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-spa \"Deutsch-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-afr \"English-Afrikaans FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-swe \"English-Swedish FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-jpn-deu \"Japanese-German FreeDict Dictionary ver. 0.2.0\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-epo-eng \"Esperanto-English FreeDict dictionary ver. 1.0.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-nld \"j\xC4\x99zyk polski-Nederlands FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-lat-deu \"Lateinisch-Deutsch FreeDict-W\xC3\xB6rterbuch ver. 1.0.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-cym \"Eurfa Saesneg, English-Welsh Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-por-spa \"portugu\xC3\xAAs-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-spa \"English-Spanish FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-tur \"Svenska-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-tur-eng \"Turkish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-tur-deu \"Turkish-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-fra \"j\xC4\x99zyk polski-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-por \"English-Portuguese FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-pol \"italiano-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-ces \"English-Czech dicts.info/FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-tur \"German-Turkish Ferheng/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-jpn \"fran\xC3\xA7""ais-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-cym-eng \"Eurfa Cymraeg, Welsh-English Eurfa/Freedict dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-bre-fra \"Breton-French FreeDict Dictionary (Geriadur Tomaz) ver. 0.8.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-jpn-fra \"Japanese-French FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-nld-deu \"Dutch-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-nld \"English-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-por \"German-Portuguese FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-hrv \"English-Croatian FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-mkd-bul \"Macedonian - Bulgarian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-eng \"Swedish-English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-spa \"j\xC4\x99zyk polski-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-jpn-eng \"Japanese-English FreeDict Dictionary ver. 0.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-ell \"English - Modern Greek XDXF/FreeDict dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-por \"italiano-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-swe \"j\xC4\x99zyk polski-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-fin \"j\xC4\x99zyk polski-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-kur-tur \"Kurdish-Turkish Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-swe \"italiano-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-swh \"English-Swahili xFried/FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-kha-eng \"Khasi-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fin-eng \"suomi-English FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-hin \"English-Hindi FreeDict Dictionary ver. 1.6\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-spa-eng \"Spanish-English FreeDict Dictionary ver. 0.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-afr-eng \"Afrikaans-English FreeDict Dictionary ver. 0.2.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-fin \"italiano-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-fin \"English-suomi FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-ita \"fran\xC3\xA7""ais-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-rus \"Deutsch-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-bul \"Deutsch-\xD0\xB1\xD1\x8A\xD0\xBB\xD0\xB3\xD0\xB0\xD1\x80\xD1\x81\xD0\xBA\xD0\xB8 \xD0\xB5\xD0\xB7\xD0\xB8\xD0\xBA FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-pol \"Deutsch-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-srp-eng \"Serbian - English FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-kur-deu \"Kurdish-German Ferheng/FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-spa-por \"Spanish-Portuguese FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-pol \"Svenska-j\xC4\x99zyk polski FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-rus \"Svenska-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-nld-spa \"Nederlands-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swh-pol \"Swahili-Polish SSSP/FreeDict Dictionary ver. 0.2.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-oci-cat \"Lenga d'\xC3\xB2""c - Catal\xC3\xA0 FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-rus \"italiano-\xD0\xA0\xD1\x83\xD1\x81\xD1\x81\xD0\xBA\xD0\xB8\xD0\xB9 FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-ell \"fran\xC3\xA7""ais-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-srp \"English-Serbian FreeDict Dictionary ver. 0.1.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-tur \"fran\xC3\xA7""ais-T\xC3\xBCrk\xC3\xA7""e FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-eng \"French-English FreeDict Dictionary ver. 0.4.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-ita-ell \"italiano-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-kur-eng \"Kurdish-English Ferheng/FreeDict Dictionary ver. 1.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-deu \"Svenska-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-fra \"Svenska-fran\xC3\xA7""ais FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-lat \"Svenska-latine FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-ell \"Svenska-\xCE\xB5\xCE\xBB\xCE\xBB\xCE\xB7\xCE\xBD\xCE\xB9\xCE\xBA\xCE\xAC FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-rus \"English-Russian FreeDict Dictionary ver. 0.3.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-por \"j\xC4\x99zyk polski-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-gla-deu \"Scottish Gaelic-German FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-ita \"English-Italian FreeDict Dictionary ver. 0.1.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-pol-ita \"j\xC4\x99zyk polski-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-swe \"fran\xC3\xA7""ais-Svenska FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-isl-eng \"\xC3\xADslenska - English FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-spa \"Svenska-espa\xC3\xB1ol FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-nno-nob \"Norwegian Nynorsk-Norwegian Bokm\xC3\xA5l FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swe-ita \"Svenska-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-deu \"fran\xC3\xA7""ais-Deutsch FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fin-ita \"suomi-italiano FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-nld-fra \"Nederlands-French FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-eng-ara \"English-Arabic FreeDict Dictionary ver. 0.6.3\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-slk-eng \"Slovak-English FreeDict Dictionary ver. 0.2.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fra-por \"fran\xC3\xA7""ais-portugu\xC3\xAAs FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-spa-ast \"Spanish - Asturian FreeDict Dictionary ver. 0.1.1\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fin-jpn \"suomi-\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E (\xE3\x81\xAB\xE3\x81\xBB\xE3\x82\x93\xE3\x81\x94) FreeDict+WikDict dictionary ver. 2018.09.13\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-deu-ita \"German-Italian FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-swh-eng \"Swahili-English xFried/FreeDict Dictionary ver. 0.4.4\"\r\n" Debug: 05-18 22:43:22 receive db: "fd-fin-nor \"suomi-Norsk FreeDict+WikDict dictionary ver. 2018" Debug: 05-18 22:43:22 received: ".09.13\"\r\n" Debug: 05-18 22:43:22 receive db: ".09.13\"\r\n" Debug: 05-18 22:43:22 Reloading all the tabs... Debug: 05-18 22:43:22 starting create the fts with thread: 11 Debug: 05-18 22:43:22 waiting for all the fts creation to finish. Debug: 05-18 22:43:22 finished/cancel all the fts creation Debug: 05-18 22:43:22 getResource: "gdlookup://localhost/?word=--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -2,6 +2,7 @@ %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy.erase(0, substring.size()); found %3D true; break; %7D %7D if (!found) %7B output_html +%3D sentence_copy[0]; sentence_copy.erase(0, 1); %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; std::string dict_file; log_internal(%22Program started%22); try %7B dict_file %3D find_dic_file().string(); log_internal(%22Dictionary file located at: %22 + dict_file); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: %22 %3C%3C e.what() %3C%3C std::endl; return 1; %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); if (!std::filesystem::exists(dict_file)) %7B log_internal(%22Error: Dictionary file not found at %22 + dict_file); std::cerr %3C%3C %22Error: Dictionary file not found at %22 %3C%3C dict_file %3C%3C std::endl; return 1; %7D i++; %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string; try %7B search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to retrieve search string.%22 %3C%3C std::endl; exit(1); %7D if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try %7B trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); %7D catch (const std::exception%26 e) %7B log_internal(std::string(%22Error: Failed to load trie from dictionary file: %22) + e.what()); std::cerr %3C%3C %22Error: Failed to load trie from dictionary file.%22 %3C%3C std::endl; return 1; %7D std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; log_internal(%22Starting search loop with search string: %22 + search_string); while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D log_internal(%22Search loop ended%22); if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); log_internal(%22HTML output wrapped%22); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:43:22 scheme: "gdlookup" Debug: 05-18 22:43:22 host: "localhost" Debug: 05-18 22:43:22 clear current dictionaries: "--- hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 09:00:00.000000000 +0000 @@ -2,6 +2,7 @@ #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy.erase(0, substring.size()); found = true; break; } } if (!found) { output_html += sentence_copy[0]; sentence_copy.erase(0, 1); } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; std::string dict_file; log_internal(\"Program started\"); try { dict_file = find_dic_file().string(); log_internal(\"Dictionary file located at: \" + dict_file); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: \" << e.what() << std::endl; return 1; } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); if (!std::filesystem::exists(dict_file)) { log_internal(\"Error: Dictionary file not found at \" + dict_file); std::cerr << \"Error: Dictionary file not found at \" << dict_file << std::endl; return 1; } i++; } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string; try { search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); } catch (const std::exception& e) { log_internal(std::string(\"Error: \") + e.what()); std::cerr << \"Error: Failed to retrieve search string.\" << std::endl; exit(1); } if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); xcdat::trie_15_type trie; try { trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); } catch (const std::exception& e) { log_internal(std::string(\"Error: Failed to load trie from dictionary file: \") + e.what()); std::cerr << \"Error: Failed to load trie from dictionary file.\" << std::endl; return 1; } std::vector substrings; std::vector results; std::map> alternatives_map; log_internal(\"Starting search loop with search string: \" + search_string); while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } log_internal(\"Search loop ended\"); if (debug_mode) { print_debug_info(substrings, raw_output); } if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); log_internal(\"HTML output wrapped\"); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 22:43:22 some body finished Debug: 05-18 22:43:22 one not finished. Debug: 05-18 22:43:22 ====reading 13682 of (13682) bytes . Finished: 0 Debug: 05-18 22:43:22 ====reading 0 of (13682) bytes . Finished: 0 Debug: 05-18 22:43:22 ====reading 0 of (13682) bytes . Finished: 0 Warning: 05-18 22:43:22 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:43:22 received: "fd-fra-nld \"French-Dutch FreeDict Dictionary ver. 0.2\"\r\n" Debug: 05-18 22:43:30 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 22:43:30 scheme: "gdlookup" Debug: 05-18 22:43:30 host: "localhost" Debug: 05-18 22:43:30 clear current dictionaries: "納得が行く" Debug: 05-18 22:43:30 some body finished Debug: 05-18 22:43:30 one not finished. Debug: 05-18 22:43:30 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 22:43:30 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 22:43:30 ====reading 0 of (1418) bytes . Finished: 0 Warning: 05-18 22:43:30 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 22:44:20 translating from clipboard or selection Debug: 05-18 22:44:20 clipboard data: "" Debug: 05-18 22:53:22 socket error message: QAbstractSocket::RemoteHostClosedError Debug: 05-18 23:07:24 translating from clipboard or selection Debug: 05-18 23:07:24 clipboard data: "l" Debug: 05-18 23:07:24 Current state: true true false true Debug: 05-18 23:07:24 getResource: "gdlookup://localhost/?word=l&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:07:24 scheme: "gdlookup" Debug: 05-18 23:07:24 host: "localhost" Debug: 05-18 23:07:24 clear current dictionaries: "l" Debug: 05-18 23:07:24 some body finished Debug: 05-18 23:07:24 one not finished. Debug: 05-18 23:07:24 ====reading 1404 of (1404) bytes . Finished: 0 Debug: 05-18 23:07:24 ====reading 0 of (1404) bytes . Finished: 0 Debug: 05-18 23:07:24 ====reading 0 of (1404) bytes . Finished: 0 Warning: 05-18 23:07:24 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:13:41 translating from clipboard or selection Debug: 05-18 23:13:41 clipboard data: "転生" Debug: 05-18 23:13:41 Current state: true false false true Debug: 05-18 23:13:41 getResource: "gdlookup://localhost/?word=転生&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:13:41 scheme: "gdlookup" Debug: 05-18 23:13:41 host: "localhost" Debug: 05-18 23:13:41 clear current dictionaries: "転生" Debug: 05-18 23:13:41 some body finished Debug: 05-18 23:13:41 one not finished. Debug: 05-18 23:13:41 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 23:13:41 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 23:13:41 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 23:13:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:13:41 translating from clipboard or selection Debug: 05-18 23:13:41 clipboard data: "転生" Debug: 05-18 23:13:41 Current state: true false true true Debug: 05-18 23:13:41 getResource: "gdlookup://localhost/?word=転生&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:13:41 scheme: "gdlookup" Debug: 05-18 23:13:41 host: "localhost" Debug: 05-18 23:13:41 clear current dictionaries: "転生" Debug: 05-18 23:13:41 some body finished Debug: 05-18 23:13:41 one not finished. Debug: 05-18 23:13:41 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 23:13:41 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 23:13:41 ====reading 0 of (1409) bytes . Finished: 0 Warning: 05-18 23:13:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:40:41 translating from clipboard or selection Debug: 05-18 23:40:41 clipboard data: "input back to GoldenDict as HTML with sentence split into parts" Debug: 05-18 23:40:41 Current state: true true false true Debug: 05-18 23:40:41 getResource: "gdlookup://localhost/?word=input back to GoldenDict as HTML with sentence split into parts&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:40:41 scheme: "gdlookup" Debug: 05-18 23:40:41 host: "localhost" Debug: 05-18 23:40:41 clear current dictionaries: "input back to GoldenDict as HTML with sentence split into parts" Debug: 05-18 23:40:41 some body finished Debug: 05-18 23:40:41 one not finished. Debug: 05-18 23:40:41 ====reading 1466 of (1466) bytes . Finished: 0 Debug: 05-18 23:40:41 ====reading 0 of (1466) bytes . Finished: 0 Debug: 05-18 23:40:41 ====reading 0 of (1466) bytes . Finished: 0 Warning: 05-18 23:40:41 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:41:11 translating from clipboard or selection Debug: 05-18 23:41:11 clipboard data: "cat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF" Debug: 05-18 23:41:11 Current state: true false false true Debug: 05-18 23:41:11 getResource: "gdlookup://localhost/?word=cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:41:11 scheme: "gdlookup" Debug: 05-18 23:41:11 host: "localhost" Debug: 05-18 23:41:11 clear current dictionaries: "cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF" Debug: 05-18 23:41:11 some body finished Debug: 05-18 23:41:11 one not finished. Debug: 05-18 23:41:11 ====reading 1559 of (1559) bytes . Finished: 0 Debug: 05-18 23:41:11 ====reading 0 of (1559) bytes . Finished: 0 Debug: 05-18 23:41:11 ====reading 0 of (1559) bytes . Finished: 0 Warning: 05-18 23:41:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:41:14 translating from clipboard or selection Debug: 05-18 23:41:14 clipboard data: "cat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF" Debug: 05-18 23:41:14 Current state: true false true true Debug: 05-18 23:41:14 getResource: "gdlookup://localhost/?word=cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:41:14 scheme: "gdlookup" Debug: 05-18 23:41:14 host: "localhost" Debug: 05-18 23:41:14 clear current dictionaries: "cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF" Debug: 05-18 23:41:14 some body finished Debug: 05-18 23:41:14 one not finished. Debug: 05-18 23:41:14 ====reading 1559 of (1559) bytes . Finished: 0 Debug: 05-18 23:41:14 ====reading 0 of (1559) bytes . Finished: 0 Debug: 05-18 23:41:14 ====reading 0 of (1559) bytes . Finished: 0 Warning: 05-18 23:41:14 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:42:52 translating from clipboard or selection Debug: 05-18 23:42:52 clipboard data: "// filename: hakurei.cpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
                \" + substring + \"\";\n\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
                  \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
                • \" + alt + \"
                • \";\n\t }\n\t output_html += \"
                \";\n\t}\n\n\toutput_html += \"
                \"; \n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tlog_internal(\"Substring added: \" + substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 23:42:52 Current state: true false true true Debug: 05-18 23:42:52 getResource: "gdlookup://localhost/?word=// filename: hakurei.cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:42:52 scheme: "gdlookup" Debug: 05-18 23:42:52 host: "localhost" Debug: 05-18 23:42:52 clear current dictionaries: "// filename: hakurei.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 23:42:52 some body finished Debug: 05-18 23:42:52 one not finished. Debug: 05-18 23:42:52 ====reading 13519 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:52 ====reading 0 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:52 ====reading 0 of (13519) bytes . Finished: 0 Warning: 05-18 23:42:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:42:52 translating from clipboard or selection Debug: 05-18 23:42:52 clipboard data: "// filename: hakurei.cpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
                \" + substring + \"\";\n\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
                  \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
                • \" + alt + \"
                • \";\n\t }\n\t output_html += \"
                \";\n\t}\n\n\toutput_html += \"
                \"; \n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tlog_internal(\"Substring added: \" + substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 23:42:52 Current state: true false true true Debug: 05-18 23:42:52 getResource: "gdlookup://localhost/?word=// filename: hakurei.cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:42:52 scheme: "gdlookup" Debug: 05-18 23:42:52 host: "localhost" Debug: 05-18 23:42:52 clear current dictionaries: "// filename: hakurei.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 23:42:52 some body finished Debug: 05-18 23:42:52 one not finished. Debug: 05-18 23:42:52 ====reading 13519 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:52 ====reading 0 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:52 ====reading 0 of (13519) bytes . Finished: 0 Warning: 05-18 23:42:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:42:52 translating from clipboard or selection Debug: 05-18 23:42:53 clipboard data: "// filename: hakurei.cpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
                \" + substring + \"\";\n\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
                  \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
                • \" + alt + \"
                • \";\n\t }\n\t output_html += \"
                \";\n\t}\n\n\toutput_html += \"
                \"; \n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tlog_internal(\"Substring added: \" + substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 23:42:53 Current state: true false true true Debug: 05-18 23:42:53 getResource: "gdlookup://localhost/?word=// filename: hakurei.cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:42:53 scheme: "gdlookup" Debug: 05-18 23:42:53 host: "localhost" Debug: 05-18 23:42:53 clear current dictionaries: "// filename: hakurei.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 23:42:53 some body finished Debug: 05-18 23:42:53 one not finished. Debug: 05-18 23:42:53 ====reading 13519 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:53 ====reading 0 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:53 ====reading 0 of (13519) bytes . Finished: 0 Warning: 05-18 23:42:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:42:53 translating from clipboard or selection Debug: 05-18 23:42:53 clipboard data: "// filename: hakurei.cpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
                \" + substring + \"\";\n\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
                  \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
                • \" + alt + \"
                • \";\n\t }\n\t output_html += \"
                \";\n\t}\n\n\toutput_html += \"
                \"; \n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tlog_internal(\"Substring added: \" + substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 23:42:53 Current state: true false true true Debug: 05-18 23:42:53 getResource: "gdlookup://localhost/?word=// filename: hakurei.cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:42:53 scheme: "gdlookup" Debug: 05-18 23:42:53 host: "localhost" Debug: 05-18 23:42:53 clear current dictionaries: "// filename: hakurei.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 23:42:53 some body finished Debug: 05-18 23:42:53 one not finished. Debug: 05-18 23:42:53 ====reading 13519 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:53 ====reading 0 of (13519) bytes . Finished: 0 Debug: 05-18 23:42:53 ====reading 0 of (13519) bytes . Finished: 0 Warning: 05-18 23:42:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:43:11 translating from clipboard or selection Debug: 05-18 23:43:11 clipboard data: "" Debug: 05-18 23:44:03 translating from clipboard or selection Debug: 05-18 23:44:03 clipboard data: "" Debug: 05-18 23:44:08 translating from clipboard or selection Debug: 05-18 23:44:08 clipboard data: "" Debug: 05-18 23:45:07 translating from clipboard or selection Debug: 05-18 23:45:07 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/mecab-cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=\"\"\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_user_dict() {\n\tfind \\\n\t\t\"$USER_DICT\" \\\n\t\t/usr/share/gd-tools/user_dic.dic \\\n\t\t~/.local/share/gd-tools/user_dic.dic \\\n\t\t-type f -print -quit 2>/dev/null\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t/usr/lib/mecab/dic/mecab-ipadic-neologd \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit 2>/dev/null\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tlocal -r user_dict=$(find_user_dict)\n\tlocal -a args=(\n\t\tmecab\n\t\t--node-format='%m'\n\t\t--unk-format='%m'\n\t\t--eos-format='
                '\n\t\t--dicdir=\"$(find_dicdir)\"\n\t\t--userdic=\"${USER_DICT}\"\n\t)\n\tif [[ -n $user_dict ]]; then\n\t\targs+=(\"$user_dict\")\n\tfi\n\t\"${args[@]}\"\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
                '\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
                '\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 23:45:07 Current state: true false true true Debug: 05-18 23:45:07 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/mecab-cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D%22%22 FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_user_dict() %7B find %5C %22$USER_DICT%22 %5C /usr/share/gd-tools/user_dic.dic %5C ~/.local/share/gd-tools/user_dic.dic %5C -type f -print -quit 2%3E/dev/null %7D find_dicdir() %7B dirname -- %22$( find %5C /usr/lib/mecab/dic/mecab-ipadic-neologd %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit 2%3E/dev/null )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi local -r user_dict%3D$(find_user_dict) local -a args%3D( mecab --node-format%3D%27%3Ca href%3D%22bword:%25f[6]%22%3E%25m%3C/a%3E%27 --unk-format%3D%27%3Ca href%3D%22bword:%25m%22%3E%25m%3C/a%3E%27 --eos-format%3D%27%3Cbr%3E%27 --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 ) if [[ -n $user_dict ]]; then args+%3D(%22$user_dict%22) fi %22$%7Bargs[@]%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E * %7B margin: 0; padding: 0; %7D .gd-mecab %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mecab a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mecab a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mecab a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if [[ -n $USER_DICT ]] %26%26 ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mecab%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:45:07 scheme: "gdlookup" Debug: 05-18 23:45:07 host: "localhost" Debug: 05-18 23:45:07 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/mecab-cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=\"\" FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_user_dict() { find \\ \"$USER_DICT\" \\ /usr/share/gd-tools/user_dic.dic \\ ~/.local/share/gd-tools/user_dic.dic \\ -type f -print -quit 2>/dev/null } find_dicdir() { dirname -- \"$( find \\ /usr/lib/mecab/dic/mecab-ipadic-neologd \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit 2>/dev/null )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi local -r user_dict=$(find_user_dict) local -a args=( mecab --node-format='%m' --unk-format='%m' --eos-format='
                ' --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" ) if [[ -n $user_dict ]]; then args+=(\"$user_dict\") fi \"${args[@]}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
                ' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
                ' print_css } main \"$@\"" Debug: 05-18 23:45:07 some body finished Debug: 05-18 23:45:07 one not finished. Debug: 05-18 23:45:07 ====reading 5843 of (5843) bytes . Finished: 0 Debug: 05-18 23:45:07 ====reading 0 of (5843) bytes . Finished: 0 Debug: 05-18 23:45:07 ====reading 0 of (5843) bytes . Finished: 0 Warning: 05-18 23:45:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:45:07 translating from clipboard or selection Debug: 05-18 23:45:07 clipboard data: "#!/bin/bash\n#\n# gd-tools - a set of programs to enhance goldendict for immersion learning.\n# Copyright (C) 2023 Ajatt-Tools\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see .\n\nset -euo pipefail\n\n# Requires installing mecab\n# Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html.\n\nTEMP_FILE=/tmp/mecab-cache\n\n# Default path to user_dic.dic, assuming that the user ran `xmake install`.\nUSER_DICT=\"\"\n\nFONT_SIZE=2rem\nGDWORD=\"\"\nGDSEARCH=\"\"\n\nsanitize_input() {\n\tsed -E \\\n\t\t-e 's, +,,g' \\\n\t\t-e 's,[a-z]+, ,Ig' \\\n\t\t-e 's,\\n, ,g'\n}\n\nusage() {\n\tlocal -r bn=$(basename -- \"$0\")\n\tcat <<-EOF\n\t\tusage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH%\n\n\t\techo input back to GoldenDict as HTML with sentence split into parts\n\n\t\tOPTIONS\n\tEOF\n\tcolumn -t -s'|' <<-EOF\n\t\t --user-dict PATH|path to the user dictionary.\n\t\t --font-size SIZE|font size. The default value is 30px\n\tEOF\n}\n\nfind_user_dict() {\n\tfind \\\n\t\t\"$USER_DICT\" \\\n\t\t/usr/share/gd-tools/user_dic.dic \\\n\t\t~/.local/share/gd-tools/user_dic.dic \\\n\t\t-type f -print -quit 2>/dev/null\n}\n\nfind_dicdir() {\n\tdirname -- \"$(\n\t\tfind \\\n\t\t\t/usr/lib/mecab/dic/mecab-ipadic-neologd \\\n\t\t\t/usr/lib/mecab/dic \\\n\t\t\t~/.local/share/Anki2/addons21 \\\n\t\t\t-type f -name dicrc -print -quit 2>/dev/null\n\t)\"\n}\n\nmecab_split() {\n\tif ! command -v mecab &>/dev/null; then\n\t\techo \"Error: MeCab is not installed. Please install MeCab and try again.\"\n\t\texit 1\n\tfi\n\n\tlocal -r user_dict=$(find_user_dict)\n\tlocal -a args=(\n\t\tmecab\n\t\t--node-format='%m'\n\t\t--unk-format='%m'\n\t\t--eos-format='
                '\n\t\t--dicdir=\"$(find_dicdir)\"\n\t\t--userdic=\"${USER_DICT}\"\n\t)\n\tif [[ -n $user_dict ]]; then\n\t\targs+=(\"$user_dict\")\n\tfi\n\t\"${args[@]}\"\n}\n\nprint_css() {\n\tcat <<-EOF\n\t\t\n\tEOF\n}\n\nhighlight_word() {\n\tlocal target_word=$* search=\"\"\n\tsearch=$(cat -- -)\n\tsearch=${search//\">$target_word<\"/\">${target_word}<\"}\n\techo \"$search\"\n}\n\ndie() {\n\techo \"$*\" >&2\n\tnotify-send \"$(basename -- \"$0\")\" \"$*\" &\n\texit 1\n}\n\nmain() {\n\tif (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then\n\t\tusage\n\t\texit\n\tfi\n\twhile (($# > 0)); do\n\t\tcase $1 in\n\t\t--font-size)\n\t\t\tshift\n\t\t\tFONT_SIZE=$1\n\t\t\t;;\n\t\t--user-dict)\n\t\t\tshift\n\t\t\tUSER_DICT=$1\n\t\t\t;;\n\t\t--word)\n\t\t\tshift\n\t\t\tGDWORD=$1\n\t\t\t;;\n\t\t--sentence)\n\t\t\tshift\n\t\t\tGDSEARCH=$1\n\t\t\t;;\n\t\t*)\n\t\t\tdie \"Invalid argument passed.\"\n\t\t\t;;\n\t\tesac\n\t\tshift\n\tdone\n\n\tif [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then\n\t\tdie \"Provided user dictionary doesn't exist or isn't a file.\"\n\tfi\n\n\tif [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then\n\t\tdie \"Not enough parameters.\"\n\tfi\n\n\tlocal -r input=$(echo \"$GDSEARCH\" | sanitize_input)\n\tlocal -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\")\n\n\techo '
                '\n\tif [[ -n $output ]]; then\n\t\techo \"$output\" |\n\t\t\ttail -1 |\n\t\t\thighlight_word \"$GDWORD\"\n\telse\n\t\techo \"$input\" |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\tmecab_split |\n\t\t\ttee -a \"$TEMP_FILE\" |\n\t\t\thighlight_word \"$GDWORD\"\n\t\tprintf -- '\\n\\n' >>\"$TEMP_FILE\"\n\tfi\n\techo '
                '\n\n\tprint_css\n}\n\nmain \"$@\"\n" Debug: 05-18 23:45:07 Current state: true false true true Debug: 05-18 23:45:07 getResource: "gdlookup://localhost/?word=%23!/bin/bash %23 %23 gd-tools - a set of programs to enhance goldendict for immersion learning. %23 Copyright (C) 2023 Ajatt-Tools %23 %23 This program is free software: you can redistribute it and/or modify %23 it under the terms of the GNU General Public License as published by %23 the Free Software Foundation, either version 3 of the License, or %23 (at your option) any later version. %23 %23 This program is distributed in the hope that it will be useful, %23 but WITHOUT ANY WARRANTY; without even the implied warranty of %23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %23 GNU General Public License for more details. %23 %23 You should have received a copy of the GNU General Public License %23 along with this program. If not, see %3Chttps://www.gnu.org/licenses/%3E. set -euo pipefail %23 Requires installing mecab %23 Open GoldenDict, press %22Edit%22 %3E %22Dictionaries%22 %3E %22Programs%22 and add this script as type html. TEMP_FILE%3D/tmp/mecab-cache %23 Default path to user_dic.dic, assuming that the user ran %60xmake install%60. USER_DICT%3D%22%22 FONT_SIZE%3D2rem GDWORD%3D%22%22 GDSEARCH%3D%22%22 sanitize_input() %7B sed -E %5C -e %27s, +,,g%27 %5C -e %27s,[a-z]+, ,Ig%27 %5C -e %27s,%5Cn, ,g%27 %7D usage() %7B local -r bn%3D$(basename -- %22$0%22) cat %3C%3C-EOF usage: $bn [OPTIONS] --word %25GDWORD%25 --sentence %25GDSEARCH%25 echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s%27%7C%27 %3C%3C-EOF --user-dict PATH%7Cpath to the user dictionary. --font-size SIZE%7Cfont size. The default value is 30px EOF %7D find_user_dict() %7B find %5C %22$USER_DICT%22 %5C /usr/share/gd-tools/user_dic.dic %5C ~/.local/share/gd-tools/user_dic.dic %5C -type f -print -quit 2%3E/dev/null %7D find_dicdir() %7B dirname -- %22$( find %5C /usr/lib/mecab/dic/mecab-ipadic-neologd %5C /usr/lib/mecab/dic %5C ~/.local/share/Anki2/addons21 %5C -type f -name dicrc -print -quit 2%3E/dev/null )%22 %7D mecab_split() %7B if ! command -v mecab %26%3E/dev/null; then echo %22Error: MeCab is not installed. Please install MeCab and try again.%22 exit 1 fi local -r user_dict%3D$(find_user_dict) local -a args%3D( mecab --node-format%3D%27%3Ca href%3D%22bword:%25f[6]%22%3E%25m%3C/a%3E%27 --unk-format%3D%27%3Ca href%3D%22bword:%25m%22%3E%25m%3C/a%3E%27 --eos-format%3D%27%3Cbr%3E%27 --dicdir%3D%22$(find_dicdir)%22 --userdic%3D%22$%7BUSER_DICT%7D%22 ) if [[ -n $user_dict ]]; then args+%3D(%22$user_dict%22) fi %22$%7Bargs[@]%7D%22 %7D print_css() %7B cat %3C%3C-EOF %3Cstyle%3E * %7B margin: 0; padding: 0; %7D .gd-mecab %7B font-size: $%7BFONT_SIZE:-2rem%7D; color: %231268c3; font-weight: normal; %7D .gd-mecab a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; %7D .gd-mecab a:not(:last-of-type)::after %7B content: %22%22; display: inline-block; background-color: %23333; margin: 4px; width: 3px; height: 3px; border-radius: 100vmax; vertical-align: middle; cursor: text; user-select: text; %7D .gd-mecab a b %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D %3C/style%3E EOF %7D highlight_word() %7B local target_word%3D$* search%3D%22%22 search%3D$(cat -- -) search%3D$%7Bsearch//%22%3E$target_word%3C%22/%22%3E%3Cb%3E$%7Btarget_word%7D%3C/b%3E%3C%22%7D echo %22$search%22 %7D die() %7B echo %22$*%22 %3E%262 notify-send %22$(basename -- %22$0%22)%22 %22$*%22 %26 exit 1 %7D main() %7B if (($%23 %3D%3D 0)) %7C%7C [[ $* %3D%3D --help ]] %7C%7C [[ $* %3D%3D -h ]]; then usage exit fi while (($%23 %3E 0)); do case $1 in --font-size) shift FONT_SIZE%3D$1 ;; --user-dict) shift USER_DICT%3D$1 ;; --word) shift GDWORD%3D$1 ;; --sentence) shift GDSEARCH%3D$1 ;; *) die %22Invalid argument passed.%22 ;; esac shift done if [[ -n $USER_DICT ]] %26%26 ! [[ -f $USER_DICT ]]; then die %22Provided user dictionary doesn%27t exist or isn%27t a file.%22 fi if [[ -z $GDSEARCH ]] %7C%7C [[ -z $GDWORD ]]; then die %22Not enough parameters.%22 fi local -r input%3D$(echo %22$GDSEARCH%22 %7C sanitize_input) local -r output%3D$(grep -Fxs -A1 %22$input%22 -- %22$TEMP_FILE%22) echo %27%3Cdiv class%3D%22gd-mecab%22%3E%27 if [[ -n $output ]]; then echo %22$output%22 %7C tail -1 %7C highlight_word %22$GDWORD%22 else echo %22$input%22 %7C tee -a %22$TEMP_FILE%22 %7C mecab_split %7C tee -a %22$TEMP_FILE%22 %7C highlight_word %22$GDWORD%22 printf -- %27%5Cn%5Cn%27 %3E%3E%22$TEMP_FILE%22 fi echo %27%3C/div%3E%27 print_css %7D main %22$@%22&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:45:07 scheme: "gdlookup" Debug: 05-18 23:45:07 host: "localhost" Debug: 05-18 23:45:07 clear current dictionaries: "#!/bin/bash # # gd-tools - a set of programs to enhance goldendict for immersion learning. # Copyright (C) 2023 Ajatt-Tools # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . set -euo pipefail # Requires installing mecab # Open GoldenDict, press \"Edit\" > \"Dictionaries\" > \"Programs\" and add this script as type html. TEMP_FILE=/tmp/mecab-cache # Default path to user_dic.dic, assuming that the user ran `xmake install`. USER_DICT=\"\" FONT_SIZE=2rem GDWORD=\"\" GDSEARCH=\"\" sanitize_input() { sed -E \\ -e 's, +,,g' \\ -e 's,[a-z]+, ,Ig' \\ -e 's,\\n, ,g' } usage() { local -r bn=$(basename -- \"$0\") cat <<-EOF usage: $bn [OPTIONS] --word %GDWORD% --sentence %GDSEARCH% echo input back to GoldenDict as HTML with sentence split into parts OPTIONS EOF column -t -s'|' <<-EOF --user-dict PATH|path to the user dictionary. --font-size SIZE|font size. The default value is 30px EOF } find_user_dict() { find \\ \"$USER_DICT\" \\ /usr/share/gd-tools/user_dic.dic \\ ~/.local/share/gd-tools/user_dic.dic \\ -type f -print -quit 2>/dev/null } find_dicdir() { dirname -- \"$( find \\ /usr/lib/mecab/dic/mecab-ipadic-neologd \\ /usr/lib/mecab/dic \\ ~/.local/share/Anki2/addons21 \\ -type f -name dicrc -print -quit 2>/dev/null )\" } mecab_split() { if ! command -v mecab &>/dev/null; then echo \"Error: MeCab is not installed. Please install MeCab and try again.\" exit 1 fi local -r user_dict=$(find_user_dict) local -a args=( mecab --node-format='%m' --unk-format='%m' --eos-format='
                ' --dicdir=\"$(find_dicdir)\" --userdic=\"${USER_DICT}\" ) if [[ -n $user_dict ]]; then args+=(\"$user_dict\") fi \"${args[@]}\" } print_css() { cat <<-EOF EOF } highlight_word() { local target_word=$* search=\"\" search=$(cat -- -) search=${search//\">$target_word<\"/\">${target_word}<\"} echo \"$search\" } die() { echo \"$*\" >&2 notify-send \"$(basename -- \"$0\")\" \"$*\" & exit 1 } main() { if (($# == 0)) || [[ $* == --help ]] || [[ $* == -h ]]; then usage exit fi while (($# > 0)); do case $1 in --font-size) shift FONT_SIZE=$1 ;; --user-dict) shift USER_DICT=$1 ;; --word) shift GDWORD=$1 ;; --sentence) shift GDSEARCH=$1 ;; *) die \"Invalid argument passed.\" ;; esac shift done if [[ -n $USER_DICT ]] && ! [[ -f $USER_DICT ]]; then die \"Provided user dictionary doesn't exist or isn't a file.\" fi if [[ -z $GDSEARCH ]] || [[ -z $GDWORD ]]; then die \"Not enough parameters.\" fi local -r input=$(echo \"$GDSEARCH\" | sanitize_input) local -r output=$(grep -Fxs -A1 \"$input\" -- \"$TEMP_FILE\") echo '
                ' if [[ -n $output ]]; then echo \"$output\" | tail -1 | highlight_word \"$GDWORD\" else echo \"$input\" | tee -a \"$TEMP_FILE\" | mecab_split | tee -a \"$TEMP_FILE\" | highlight_word \"$GDWORD\" printf -- '\\n\\n' >>\"$TEMP_FILE\" fi echo '
                ' print_css } main \"$@\"" Debug: 05-18 23:45:07 some body finished Debug: 05-18 23:45:07 one not finished. Debug: 05-18 23:45:07 ====reading 5843 of (5843) bytes . Finished: 0 Debug: 05-18 23:45:07 ====reading 0 of (5843) bytes . Finished: 0 Debug: 05-18 23:45:07 ====reading 0 of (5843) bytes . Finished: 0 Warning: 05-18 23:45:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:45:54 translating from clipboard or selection Debug: 05-18 23:45:54 clipboard data: "do " Debug: 05-18 23:45:54 Current state: true false true true Debug: 05-18 23:45:54 getResource: "gdlookup://localhost/?word=do&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:45:54 scheme: "gdlookup" Debug: 05-18 23:45:54 host: "localhost" Debug: 05-18 23:45:54 clear current dictionaries: "do" Debug: 05-18 23:45:54 some body finished Debug: 05-18 23:45:54 one not finished. Debug: 05-18 23:45:54 ====reading 1405 of (1405) bytes . Finished: 0 Debug: 05-18 23:45:54 ====reading 0 of (1405) bytes . Finished: 0 Debug: 05-18 23:45:54 ====reading 0 of (1405) bytes . Finished: 0 Warning: 05-18 23:45:54 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:46:48 translating from clipboard or selection Debug: 05-18 23:46:48 clipboard data: "// filename: hakurei.cpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
                \" + substring + \"\";\n\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
                  \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
                • \" + alt + \"
                • \";\n\t }\n\t output_html += \"
                \";\n\t}\n\n\toutput_html += \"
                \"; \n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tlog_internal(\"Substring added: \" + substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 23:46:48 Current state: true false true true Debug: 05-18 23:46:48 getResource: "gdlookup://localhost/?word=// filename: hakurei.cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:46:48 scheme: "gdlookup" Debug: 05-18 23:46:48 host: "localhost" Debug: 05-18 23:46:48 clear current dictionaries: "// filename: hakurei.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 23:46:48 some body finished Debug: 05-18 23:46:48 one not finished. Debug: 05-18 23:46:48 ====reading 13519 of (13519) bytes . Finished: 0 Debug: 05-18 23:46:48 ====reading 0 of (13519) bytes . Finished: 0 Debug: 05-18 23:46:48 ====reading 0 of (13519) bytes . Finished: 0 Warning: 05-18 23:46:48 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:46:49 translating from clipboard or selection Debug: 05-18 23:46:49 clipboard data: "// filename: hakurei.cpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
                \" + substring + \"\";\n\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
                  \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
                • \" + alt + \"
                • \";\n\t }\n\t output_html += \"
                \";\n\t}\n\n\toutput_html += \"
                \"; \n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tlog_internal(\"Substring added: \" + substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 23:46:49 Current state: true false true true Debug: 05-18 23:46:49 getResource: "gdlookup://localhost/?word=// filename: hakurei.cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:46:49 scheme: "gdlookup" Debug: 05-18 23:46:49 host: "localhost" Debug: 05-18 23:46:49 clear current dictionaries: "// filename: hakurei.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 23:46:49 some body finished Debug: 05-18 23:46:49 one not finished. Debug: 05-18 23:46:49 ====reading 13519 of (13519) bytes . Finished: 0 Debug: 05-18 23:46:49 ====reading 0 of (13519) bytes . Finished: 0 Debug: 05-18 23:46:49 ====reading 0 of (13519) bytes . Finished: 0 Warning: 05-18 23:46:49 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:46:49 translating from clipboard or selection Debug: 05-18 23:46:49 clipboard data: "// filename: hakurei.cpp\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\nstruct Entry {\n const std::string_view decoded_view;\n const uint64_t id;\n inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {}\n};\n\ninline std::pair remove_one_utf8_char(const std::string& str) {\n if (str.empty()) {\n return {\"\", str};\n }\n const size_t len = str.size();\n size_t i = 0;\n while (i < len) {\n const unsigned char c = str[i];\n if (c < 0x80) { \n return {str.substr(i, 1), str.substr(i + 1)};\n } else if ((c >> 5) == 0x6) { \n return {str.substr(i, 2), str.substr(i + 2)};\n } else if ((c >> 4) == 0xe) { \n return {str.substr(i, 3), str.substr(i + 3)};\n } else if ((c >> 3) == 0x1e) { \n return {str.substr(i, 4), str.substr(i + 4)};\n }\n i++;\n }\n return {\"\", \"\"};\n}\n\ninline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n std::string search_string;\n if (!isatty(fileno(stdin))) { \n std::getline(std::cin, search_string);\n } else { \n if (goldendict_mode) {\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n\t search_string = argv[i + 1];\n\t break;\n\t}\n }\n } else {\n if (argc < 2) {\n\tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n\texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n\tif (std::strcmp(argv[i], \"--debug\") == 0) {\n\t // Handle debug mode\n\t} else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n\t i++;\n\t} else {\n\t search_string = argv[i];\n\t break;\n\t}\n }\n }\n }\n if (search_string.empty()) {\n std::cerr << \"Search string not provided.\" << std::endl;\n exit(1);\n }\n return search_string;\n}\n\ninline std::filesystem::path find_dic_file() {\n static const std::vector locations = {\n std::filesystem::path(\"/usr/share/hakurei/\"),\n std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\",\n std::filesystem::current_path()\n };\n for (const auto& location : locations) {\n const auto dict_path = location / \"dict.bin\";\n if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) {\n return dict_path;\n }\n }\n throw std::runtime_error(\"Couldn't find the word list.\");\n}\n\ninline void print_debug_info(const std::vector& substrings, const std::string& raw_output) {\n std::cout << \"Stored raw output:\" << std::endl;\n for (const auto& str : substrings) {\n std::cout << str << std::endl;\n }\n std::cout << \"Raw output:\" << std::endl;\n std::cout << raw_output << std::endl;\n}\n\n\nvoid log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n\n std::time_t now = std::time(nullptr);\n log_file << \"Hakurei executed at \" << std::ctime(&now);\n log_file << \"Command-line arguments:\\n\";\n for (int i = 0; i < argc; ++i) {\n log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\";\n }\n log_file << \"Parsed parameters:\\n\";\n log_file << \"search_string: \" << search_string << \"\\n\";\n log_file << \"dict_file: \" << dict_file << \"\\n\";\n log_file << \"debug_mode: \" << debug_mode << \"\\n\";\n log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\";\n\n log_file.close();\n}\n\n\nvoid log_internal(const std::string& message) {\n std::ofstream log_file;\n log_file.open(\"/tmp/hakurei.log\", std::ios_base::app);\n if (!log_file) {\n std::cerr << \"Failed to open log file.\" << std::endl;\n return;\n }\n std::time_t now = std::time(nullptr);\n log_file << std::ctime(&now) << \": \" << message << std::endl;\n log_file.close();\n}\n\n\ninline void wrap_html_output(\n\t\t\t const std::vector& substrings,\n\t\t\t const std::map>& alternatives_map,\n\t\t\t std::string& sentence\n\t\t\t ) {\n // Log the HTML output call\n log_internal(\"HTML output is being called\");\n\n std::string output_html;\n output_html += \"
                \";\n\n std::string sentence_copy = sentence;\n\n output_html += \"
                \"; \n\n while (!sentence_copy.empty()) {\n bool found = false;\n for (const auto& substring : substrings) {\n if (sentence_copy.rfind(substring, 0) == 0) {\n\toutput_html += \"
                \" + substring + \"\";\n\n\tauto alt_itr = alternatives_map.find(sentence_copy);\n\tif (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) {\n\t output_html += \"
                  \";\n\t for (const auto& alt : alt_itr->second) {\n\t output_html += \"
                • \" + alt + \"
                • \";\n\t }\n\t output_html += \"
                \";\n\t}\n\n\toutput_html += \"
                \"; \n\toutput_html += \"\";\n\n\tsentence_copy = sentence_copy.substr(substring.size());\n\tfound = true;\n\tbreak;\n }\n }\n if (!found) {\n const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy);\n if (removed_char.empty()) {\n\tstd::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl;\n\tbreak;\n }\n output_html += \"
                \" + removed_char + \"
                \";\n sentence_copy = new_sentence_copy;\n }\n }\n\n output_html += \"
                \"; \n output_html += \"
                \";\n std::cout << output_html << std::endl;\n}\n\n\n\nint main(const int argc, char* argv[]) {\n\n std::string dict_file = find_dic_file().string(); // Default dictionary file path\n const auto trie = xcdat::load(dict_file);\n log_internal(\"Trie loaded from dictionary file\");\n\n \n bool debug_mode = false;\n bool goldendict_mode = false;\n std::string word, sentence;\n\n log_internal(\"Program started\");\n\n // Parse command line arguments\n for (int i = 1; i < argc; ++i) {\n if (std::strcmp(argv[i], \"--debug\") == 0) {\n debug_mode = true;\n log_internal(\"Debug mode enabled\");\n } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n dict_file = argv[i + 1];\n log_internal(\"Dictionary file set to: \" + dict_file);\n i++; // Skip the next argument as it's the dictionary file path\n } else if (std::strcmp(argv[i], \"--goldendict\") == 0) {\n goldendict_mode = true;\n log_internal(\"GoldenDict mode enabled\");\n } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) {\n word = argv[i + 1];\n log_internal(\"Word set to: \" + word);\n i++;\n } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n sentence = argv[i + 1];\n log_internal(\"Sentence set to: \" + sentence);\n i++;\n }\n }\n\n std::string search_string = get_input(argc, argv, goldendict_mode);\n log_internal(\"Search string: \" + search_string);\n if (goldendict_mode && !sentence.empty()) {\n search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);\n }\n\n // Log the execution details\n log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode);\n\n std::string raw_output;\n\n std::vector substrings;\n std::vector results;\n std::map> derived_map;\n std::map> alternatives_map;\n\n while (!search_string.empty()) {\n auto itr = trie.make_prefix_iterator(search_string);\n\n while (itr.next()) {\n results.emplace_back(itr.decoded_view(), itr.id());\n log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n }\n\n // Add all substrings to the results\n if (!results.empty()) {\n for (const auto& entry : results) {\n\tconst std::string substring(entry.decoded_view);\n\tsubstrings.push_back(substring);\n\tderived_map[substring].push_back(search_string);\n\talternatives_map[search_string].insert(substring);\n\tlog_internal(\"Substring added: \" + substring);\n\tif (!goldendict_mode) {\n\t std::cout << substring << std::endl;\n\t}\n }\n }\n\n // Remove one UTF-8 character from the search string and get the removed character\n const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n log_internal(\"Removed character: \" + removed_char);\n\n if (!removed_char.empty() && !goldendict_mode) {\n std::cout << removed_char << std::endl;\n }\n\n if (new_search_string == search_string) {\n std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n break;\n }\n\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n raw_output += search_string + '\\n';\n }\n\n results.clear();\n\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n\n // Print debug information if in debug mode\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n exit(0);\n }\n\n log_internal(\"Program finished\");\n return 0;\n}\n" Debug: 05-18 23:46:49 Current state: true false true true Debug: 05-18 23:46:49 getResource: "gdlookup://localhost/?word=// filename: hakurei.cpp %23include %3Ciostream%3E %23include %3Cvector%3E %23include %3Calgorithm%3E %23include %3Climits%3E %23include %3Ccstring%3E %23include %3Ccctype%3E %23include %3Cxcdat.hpp%3E %23include %3Cutility%3E %23include %3Cunistd.h%3E %23include %3Cfilesystem%3E %23include %3Cmap%3E %23include %3Cset%3E %23include %3Cfstream%3E %23include %3Cctime%3E struct Entry %7B const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) %7B%7D %7D; inline std::pair%3Cstd::string, std::string%3E remove_one_utf8_char(const std::string%26 str) %7B if (str.empty()) %7B return %7B%22%22, str%7D; %7D const size_t len %3D str.size(); size_t i %3D 0; while (i %3C len) %7B const unsigned char c %3D str[i]; if (c %3C 0x80) %7B return %7Bstr.substr(i, 1), str.substr(i + 1)%7D; %7D else if ((c %3E%3E 5) %3D%3D 0x6) %7B return %7Bstr.substr(i, 2), str.substr(i + 2)%7D; %7D else if ((c %3E%3E 4) %3D%3D 0xe) %7B return %7Bstr.substr(i, 3), str.substr(i + 3)%7D; %7D else if ((c %3E%3E 3) %3D%3D 0x1e) %7B return %7Bstr.substr(i, 4), str.substr(i + 4)%7D; %7D i++; %7D return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B std::string search_string; if (!isatty(fileno(stdin))) %7B std::getline(std::cin, search_string); %7D else %7B if (goldendict_mode) %7B for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B search_string %3D argv[i + 1]; break; %7D %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B // Handle debug mode %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B i++; %7D else %7B search_string %3D argv[i]; break; %7D %7D %7D %7D if (search_string.empty()) %7B std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; exit(1); %7D return search_string; %7D inline std::filesystem::path find_dic_file() %7B static const std::vector%3Cstd::filesystem::path%3E locations %3D %7B std::filesystem::path(%22/usr/share/hakurei/%22), std::filesystem::path(std::getenv(%22HOME%22)) / %22.local/share/hakurei/%22, std::filesystem::current_path() %7D; for (const auto%26 location : locations) %7B const auto dict_path %3D location / %22dict.bin%22; if (std::filesystem::exists(dict_path) %26%26 std::filesystem::is_regular_file(dict_path)) %7B return dict_path; %7D %7D throw std::runtime_error(%22Couldn%27t find the word list.%22); %7D inline void print_debug_info(const std::vector%3Cstd::string%3E%26 substrings, const std::string%26 raw_output) %7B std::cout %3C%3C %22Stored raw output:%22 %3C%3C std::endl; for (const auto%26 str : substrings) %7B std::cout %3C%3C str %3C%3C std::endl; %7D std::cout %3C%3C %22Raw output:%22 %3C%3C std::endl; std::cout %3C%3C raw_output %3C%3C std::endl; %7D void log_execution(const int argc, char* argv[], const std::string%26 search_string, const std::string%26 dict_file, bool debug_mode, bool goldendict_mode) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C %22Hakurei executed at %22 %3C%3C std::ctime(%26now); log_file %3C%3C %22Command-line arguments:%5Cn%22; for (int i %3D 0; i %3C argc; ++i) %7B log_file %3C%3C %22argv[%22 %3C%3C i %3C%3C %22]: %22 %3C%3C argv[i] %3C%3C %22%5Cn%22; %7D log_file %3C%3C %22Parsed parameters:%5Cn%22; log_file %3C%3C %22search_string: %22 %3C%3C search_string %3C%3C %22%5Cn%22; log_file %3C%3C %22dict_file: %22 %3C%3C dict_file %3C%3C %22%5Cn%22; log_file %3C%3C %22debug_mode: %22 %3C%3C debug_mode %3C%3C %22%5Cn%22; log_file %3C%3C %22goldendict_mode: %22 %3C%3C goldendict_mode %3C%3C %22%5Cn%22; log_file.close(); %7D void log_internal(const std::string%26 message) %7B std::ofstream log_file; log_file.open(%22/tmp/hakurei.log%22, std::ios_base::app); if (!log_file) %7B std::cerr %3C%3C %22Failed to open log file.%22 %3C%3C std::endl; return; %7D std::time_t now %3D std::time(nullptr); log_file %3C%3C std::ctime(%26now) %3C%3C %22: %22 %3C%3C message %3C%3C std::endl; log_file.close(); %7D inline void wrap_html_output( const std::vector%3Cstd::string%3E%26 substrings, const std::map%3Cstd::string, std::set%3Cstd::string%3E%3E%26 alternatives_map, std::string%26 sentence ) %7B // Log the HTML output call log_internal(%22%3Cspan style%3D%5C%22color:red;%5C%22%3EHTML output is being called%3C/span%3E%22); std::string output_html; output_html +%3D %22%3Cdiv class%3D%5C%22hakurei%5C%22%3E%22; std::string sentence_copy %3D sentence; output_html +%3D %22%3Cdiv class%3D%5C%22container%5C%22%3E%22; while (!sentence_copy.empty()) %7B bool found %3D false; for (const auto%26 substring : substrings) %7B if (sentence_copy.rfind(substring, 0) %3D%3D 0) %7B output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%3Ca class%3D%5C%22hakurei-headword%5C%22 href%3D%5C%22bword:%22 + substring + %22%5C%22%3E%22 + substring + %22%3C/a%3E%22; auto alt_itr %3D alternatives_map.find(sentence_copy); if (alt_itr !%3D alternatives_map.end() %26%26 !alt_itr-%3Esecond.empty()) %7B output_html +%3D %22%3Cdiv class%3D%5C%22alternatives%5C%22%3E%3Cul%3E%22; for (const auto%26 alt : alt_itr-%3Esecond) %7B output_html +%3D %22%3Cli%3E%3Ca href%3D%5C%22bword:%22 + alt + %22%5C%22%3E%22 + alt + %22%3C/a%3E%3C/li%3E%22; %7D output_html +%3D %22%3C/ul%3E%3C/div%3E%22; %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3Cstyle%3E%22; output_html +%3D %22.hakurei %7B font-size: 2rem; margin-bottom: 0.05em; margin-top: -0.2em; color: %231268c3; font-weight: normal; %7D%22; output_html +%3D %22.hakurei a %7B display: inline-block; font-weight: normal; color: royalblue; text-decoration: none; border-bottom: dashed max(1px, calc(1em / 16)) currentColor; %7D%22; output_html +%3D %22.hakurei a.hakurei-headword %7B background-color: %23ddeeff; border-radius: 0.2rem; font-weight: 500; %7D%22; output_html +%3D %22.hakurei %3E ul %7B --size: 1rem; font-size: var(--size); padding-inline-start: var(--size); margin-block: 2px; %7D%22; output_html +%3D %22.hakurei .alternatives %7B --size: 1rem; display: grid; font-size: var(--size); gap: calc( var(--size) / 4); max-width: 100%25; margin: 0 auto; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); align-content: start; justify-content: space-around; text-align: left; padding: 5px 0px; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %7B list-style-type: none; margin: 0; padding: calc( var(--size) / 4); background-color: hsl(0 0%25 50%25 / 0.05); box-shadow: 0 0 4px hsl(0 0%25 0%25 / 0.1); border-radius: 0.2rem; %7D%22; output_html +%3D %22.hakurei .alternatives %3E ul %3E li %7B margin-right: 1rem; %7D%22; output_html +%3D %22.container %7B display: flex; flex-wrap: wrap; gap: 10px; %7D%22; output_html +%3D %22.segment %7B display: inline-block; %7D%22; output_html +%3D %22%3C/style%3E%22; sentence_copy %3D sentence_copy.substr(substring.size()); found %3D true; break; %7D %7D if (!found) %7B const auto [removed_char, new_sentence_copy] %3D remove_one_utf8_char(sentence_copy); if (removed_char.empty()) %7B std::cerr %3C%3C %22Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.%22 %3C%3C std::endl; break; %7D output_html +%3D %22%3Cdiv class%3D%5C%22segment%5C%22%3E%22 + removed_char + %22%3C/div%3E%22; sentence_copy %3D new_sentence_copy; %7D %7D output_html +%3D %22%3C/div%3E%22; output_html +%3D %22%3C/div%3E%22; std::cout %3C%3C output_html %3C%3C std::endl; %7D int main(const int argc, char* argv[]) %7B std::string dict_file %3D find_dic_file().string(); // Default dictionary file path const auto trie %3D xcdat::load%3Cxcdat::trie_15_type%3E(dict_file); log_internal(%22Trie loaded from dictionary file%22); bool debug_mode %3D false; bool goldendict_mode %3D false; std::string word, sentence; log_internal(%22Program started%22); // Parse command line arguments for (int i %3D 1; i %3C argc; ++i) %7B if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B debug_mode %3D true; log_internal(%22Debug mode enabled%22); %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B dict_file %3D argv[i + 1]; log_internal(%22Dictionary file set to: %22 + dict_file); i++; // Skip the next argument as it%27s the dictionary file path %7D else if (std::strcmp(argv[i], %22--goldendict%22) %3D%3D 0) %7B goldendict_mode %3D true; log_internal(%22GoldenDict mode enabled%22); %7D else if (std::strcmp(argv[i], %22--word%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B word %3D argv[i + 1]; log_internal(%22Word set to: %22 + word); i++; %7D else if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B sentence %3D argv[i + 1]; log_internal(%22Sentence set to: %22 + sentence); i++; %7D %7D std::string search_string %3D get_input(argc, argv, goldendict_mode); log_internal(%22Search string: %22 + search_string); if (goldendict_mode %26%26 !sentence.empty()) %7B search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string); %7D // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector%3Cstd::string%3E substrings; std::vector%3CEntry%3E results; std::map%3Cstd::string, std::vector%3Cstd::string%3E%3E derived_map; std::map%3Cstd::string, std::set%3Cstd::string%3E%3E alternatives_map; while (!search_string.empty()) %7B auto itr %3D trie.make_prefix_iterator(search_string); while (itr.next()) %7B results.emplace_back(itr.decoded_view(), itr.id()); log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %7D // Add all substrings to the results if (!results.empty()) %7B for (const auto%26 entry : results) %7B const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(%22Substring added: %22 + substring); if (!goldendict_mode) %7B std::cout %3C%3C substring %3C%3C std::endl; %7D %7D %7D // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); log_internal(%22Removed character: %22 + removed_char); if (!removed_char.empty() %26%26 !goldendict_mode) %7B std::cout %3C%3C removed_char %3C%3C std::endl; %7D if (new_search_string %3D%3D search_string) %7B std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); break; %7D search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; raw_output +%3D search_string + %27%5Cn%27; %7D results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D // Print debug information if in debug mode if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence); exit(0); %7D log_internal(%22Program finished%22); return 0; %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:46:49 scheme: "gdlookup" Debug: 05-18 23:46:49 host: "localhost" Debug: 05-18 23:46:49 clear current dictionaries: "// filename: hakurei.cpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct Entry { const std::string_view decoded_view; const uint64_t id; inline Entry(const std::string_view decoded_view, const uint64_t id) : decoded_view(decoded_view), id(id) {} }; inline std::pair remove_one_utf8_char(const std::string& str) { if (str.empty()) { return {\"\", str}; } const size_t len = str.size(); size_t i = 0; while (i < len) { const unsigned char c = str[i]; if (c < 0x80) { return {str.substr(i, 1), str.substr(i + 1)}; } else if ((c >> 5) == 0x6) { return {str.substr(i, 2), str.substr(i + 2)}; } else if ((c >> 4) == 0xe) { return {str.substr(i, 3), str.substr(i + 3)}; } else if ((c >> 3) == 0x1e) { return {str.substr(i, 4), str.substr(i + 4)}; } i++; } return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { std::string search_string; if (!isatty(fileno(stdin))) { std::getline(std::cin, search_string); } else { if (goldendict_mode) { for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { search_string = argv[i + 1]; break; } } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { // Handle debug mode } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { i++; } else { search_string = argv[i]; break; } } } } if (search_string.empty()) { std::cerr << \"Search string not provided.\" << std::endl; exit(1); } return search_string; } inline std::filesystem::path find_dic_file() { static const std::vector locations = { std::filesystem::path(\"/usr/share/hakurei/\"), std::filesystem::path(std::getenv(\"HOME\")) / \".local/share/hakurei/\", std::filesystem::current_path() }; for (const auto& location : locations) { const auto dict_path = location / \"dict.bin\"; if (std::filesystem::exists(dict_path) && std::filesystem::is_regular_file(dict_path)) { return dict_path; } } throw std::runtime_error(\"Couldn't find the word list.\"); } inline void print_debug_info(const std::vector& substrings, const std::string& raw_output) { std::cout << \"Stored raw output:\" << std::endl; for (const auto& str : substrings) { std::cout << str << std::endl; } std::cout << \"Raw output:\" << std::endl; std::cout << raw_output << std::endl; } void log_execution(const int argc, char* argv[], const std::string& search_string, const std::string& dict_file, bool debug_mode, bool goldendict_mode) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << \"Hakurei executed at \" << std::ctime(&now); log_file << \"Command-line arguments:\\n\"; for (int i = 0; i < argc; ++i) { log_file << \"argv[\" << i << \"]: \" << argv[i] << \"\\n\"; } log_file << \"Parsed parameters:\\n\"; log_file << \"search_string: \" << search_string << \"\\n\"; log_file << \"dict_file: \" << dict_file << \"\\n\"; log_file << \"debug_mode: \" << debug_mode << \"\\n\"; log_file << \"goldendict_mode: \" << goldendict_mode << \"\\n\"; log_file.close(); } void log_internal(const std::string& message) { std::ofstream log_file; log_file.open(\"/tmp/hakurei.log\", std::ios_base::app); if (!log_file) { std::cerr << \"Failed to open log file.\" << std::endl; return; } std::time_t now = std::time(nullptr); log_file << std::ctime(&now) << \": \" << message << std::endl; log_file.close(); } inline void wrap_html_output( const std::vector& substrings, const std::map>& alternatives_map, std::string& sentence ) { // Log the HTML output call log_internal(\"HTML output is being called\"); std::string output_html; output_html += \"
                \"; std::string sentence_copy = sentence; output_html += \"
                \"; while (!sentence_copy.empty()) { bool found = false; for (const auto& substring : substrings) { if (sentence_copy.rfind(substring, 0) == 0) { output_html += \"
                \" + substring + \"\"; auto alt_itr = alternatives_map.find(sentence_copy); if (alt_itr != alternatives_map.end() && !alt_itr->second.empty()) { output_html += \"
                  \"; for (const auto& alt : alt_itr->second) { output_html += \"
                • \" + alt + \"
                • \"; } output_html += \"
                \"; } output_html += \"
                \"; output_html += \"\"; sentence_copy = sentence_copy.substr(substring.size()); found = true; break; } } if (!found) { const auto [removed_char, new_sentence_copy] = remove_one_utf8_char(sentence_copy); if (removed_char.empty()) { std::cerr << \"Error: Unable to remove a character from the sentence. Exiting to prevent infinite loop.\" << std::endl; break; } output_html += \"
                \" + removed_char + \"
                \"; sentence_copy = new_sentence_copy; } } output_html += \"
                \"; output_html += \"
                \"; std::cout << output_html << std::endl; } int main(const int argc, char* argv[]) { std::string dict_file = find_dic_file().string(); // Default dictionary file path const auto trie = xcdat::load(dict_file); log_internal(\"Trie loaded from dictionary file\"); bool debug_mode = false; bool goldendict_mode = false; std::string word, sentence; log_internal(\"Program started\"); // Parse command line arguments for (int i = 1; i < argc; ++i) { if (std::strcmp(argv[i], \"--debug\") == 0) { debug_mode = true; log_internal(\"Debug mode enabled\"); } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { dict_file = argv[i + 1]; log_internal(\"Dictionary file set to: \" + dict_file); i++; // Skip the next argument as it's the dictionary file path } else if (std::strcmp(argv[i], \"--goldendict\") == 0) { goldendict_mode = true; log_internal(\"GoldenDict mode enabled\"); } else if (std::strcmp(argv[i], \"--word\") == 0 && i + 1 < argc) { word = argv[i + 1]; log_internal(\"Word set to: \" + word); i++; } else if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { sentence = argv[i + 1]; log_internal(\"Sentence set to: \" + sentence); i++; } } std::string search_string = get_input(argc, argv, goldendict_mode); log_internal(\"Search string: \" + search_string); if (goldendict_mode && !sentence.empty()) { search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string); } // Log the execution details log_execution(argc, argv, search_string, dict_file, debug_mode, goldendict_mode); std::string raw_output; std::vector substrings; std::vector results; std::map> derived_map; std::map> alternatives_map; while (!search_string.empty()) { auto itr = trie.make_prefix_iterator(search_string); while (itr.next()) { results.emplace_back(itr.decoded_view(), itr.id()); log_internal(\"Found result: \" + std::string(itr.decoded_view())); } // Add all substrings to the results if (!results.empty()) { for (const auto& entry : results) { const std::string substring(entry.decoded_view); substrings.push_back(substring); derived_map[substring].push_back(search_string); alternatives_map[search_string].insert(substring); log_internal(\"Substring added: \" + substring); if (!goldendict_mode) { std::cout << substring << std::endl; } } } // Remove one UTF-8 character from the search string and get the removed character const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); log_internal(\"Removed character: \" + removed_char); if (!removed_char.empty() && !goldendict_mode) { std::cout << removed_char << std::endl; } if (new_search_string == search_string) { std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); break; } search_string = new_search_string; log_internal(\"New search string: \" + search_string); // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; raw_output += search_string + '\\n'; } results.clear(); // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } // Print debug information if in debug mode if (debug_mode) { print_debug_info(substrings, raw_output); } // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence); exit(0); } log_internal(\"Program finished\"); return 0; }" Debug: 05-18 23:46:49 some body finished Debug: 05-18 23:46:49 one not finished. Debug: 05-18 23:46:49 ====reading 13519 of (13519) bytes . Finished: 0 Debug: 05-18 23:46:49 ====reading 0 of (13519) bytes . Finished: 0 Debug: 05-18 23:46:49 ====reading 0 of (13519) bytes . Finished: 0 Warning: 05-18 23:46:49 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:48:29 translating from clipboard or selection Debug: 05-18 23:48:29 clipboard data: "88c88\n< }\n---\n> return {\"\", \"\"};\n94,96c94,95\n< if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n< search_string = argv[i + 1];\n< break;\n---\n> if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n> search_string = argv[i + 1];\n100,101c99\n< if (argc < 2) {\n< std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n---\n> if (argc < 2) {\n103,108c101,104\n< exit(1);\n< }\n< for (int i = 1; i < argc; ++i) {\n< if (std::strcmp(argv[i], \"--debug\") == 0) {\n< // Handle debug mode\n< } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n---\n> exit(1);\n> }\n> for (int i = 1; i < argc; ++i) {\n> if (std::strcmp(argv[i], \"--debug\") == 0) {\n110c106\n< } else {\n---\n> } else {\n113,114c109,110\n< break;\n< }\n---\n> break;\n> }\n116,117c112\n< std::cerr << \"Search string not provided.\" << std::endl;\n< exit(1);\n---\n> std::cerr << \"Search string not provided.\" << std::endl;\n119c114\n< return search_string;\n---\n> return search_string;\n247c242\n< std::vector substrings;\n---\n> std::vector substrings;\n251c246\n< while (!search_string.empty()) {\n---\n> while (!search_string.empty()) {\n253,254c248,249\n< while (itr.next()) {\n< results.emplace_back(itr.decoded_view(), itr.id());\n---\n> while (itr.next()) {\n> results.emplace_back(itr.decoded_view(), itr.id());\n256,257c251\n< log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n< }\n---\n> log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n260,261c254,255\n< for (const auto& entry : results) {\n< const std::string substring(entry.decoded_view);\n---\n> for (const auto& entry : results) {\n> const std::string substring(entry.decoded_view);\n263,269c257,263\n< derived_map[substring].push_back(search_string);\n< alternatives_map[search_string].insert(substring);\n< log_internal(\"Substring added: \" + substring);\n< if (!goldendict_mode) {\n< std::cout << substring << std::endl;\n< }\n< }\n---\n> derived_map[substring].push_back(search_string);\n> alternatives_map[search_string].insert(substring);\n> log_internal(\"Substring added: \" + substring);\n> if (!goldendict_mode) {\n> std::cout << substring << std::endl;\n> }\n> }\n273,274c267,268\n< const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n< log_internal(\"Removed character: \" + removed_char);\n---\n> const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n> log_internal(\"Removed character: \" + removed_char);\n276,277c270,271\n< std::cout << removed_char << std::endl;\n< }\n---\n> std::cout << removed_char << std::endl;\n> }\n279,282c273,276\n< std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n< log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n< break;\n< }\n---\n> std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n> log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n> break;\n> }\n284c278\n< log_internal(\"New search string: \" + search_string);\n---\n> log_internal(\"New search string: \" + search_string);\n286,287c280,281\n< std::cout << \"After removing one character: \" << search_string << std::endl;\n< raw_output += search_string + '\\n';\n---\n> std::cout << \"After removing one character: \" << search_string << std::endl;\n> raw_output += search_string + '\\n';\n289c283\n< results.clear();\n---\n> results.clear();\n291c285\n< search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n---\n> search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n293,295c287,288\n< if (debug_mode) {\n< print_debug_info(substrings, raw_output);\n< }\n---\n> if (debug_mode) {\n> print_debug_info(substrings, raw_output);\n297,299c290,291\n< wrap_html_output(substrings, alternatives_map, sentence);\n< exit(0);\n< }\n---\n> wrap_html_output(substrings, alternatives_map, sentence);\n> exit(0);\n301c293\n< return 0;\n---\n> return 0;\n" Debug: 05-18 23:48:29 Current state: true false true true Debug: 05-18 23:48:29 getResource: "gdlookup://localhost/?word=88c88 %3C %7D --- %3E return %7B%22%22, %22%22%7D; 94,96c94,95 %3C if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3C search_string %3D argv[i + 1]; %3C break; --- %3E if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3E search_string %3D argv[i + 1]; 100,101c99 %3C if (argc %3C 2) %7B %3C std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; --- %3E if (argc %3C 2) %7B 103,108c101,104 %3C exit(1); %3C %7D %3C for (int i %3D 1; i %3C argc; ++i) %7B %3C if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B %3C // Handle debug mode %3C %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B --- %3E exit(1); %3E %7D %3E for (int i %3D 1; i %3C argc; ++i) %7B %3E if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B 110c106 %3C %7D else %7B --- %3E %7D else %7B 113,114c109,110 %3C break; %3C %7D --- %3E break; %3E %7D 116,117c112 %3C std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; %3C exit(1); --- %3E std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; 119c114 %3C return search_string; --- %3E return search_string; 247c242 %3C std::vector%3Cstd::string%3E substrings; --- %3E std::vector%3Cstd::string%3E substrings; 251c246 %3C while (!search_string.empty()) %7B --- %3E while (!search_string.empty()) %7B 253,254c248,249 %3C while (itr.next()) %7B %3C results.emplace_back(itr.decoded_view(), itr.id()); --- %3E while (itr.next()) %7B %3E results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 %3C log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %3C %7D --- %3E log_internal(%22Found result: %22 + std::string(itr.decoded_view())); 260,261c254,255 %3C for (const auto%26 entry : results) %7B %3C const std::string substring(entry.decoded_view); --- %3E for (const auto%26 entry : results) %7B %3E const std::string substring(entry.decoded_view); 263,269c257,263 %3C derived_map[substring].push_back(search_string); %3C alternatives_map[search_string].insert(substring); %3C log_internal(%22Substring added: %22 + substring); %3C if (!goldendict_mode) %7B %3C std::cout %3C%3C substring %3C%3C std::endl; %3C %7D %3C %7D --- %3E derived_map[substring].push_back(search_string); %3E alternatives_map[search_string].insert(substring); %3E log_internal(%22Substring added: %22 + substring); %3E if (!goldendict_mode) %7B %3E std::cout %3C%3C substring %3C%3C std::endl; %3E %7D %3E %7D 273,274c267,268 %3C const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3C log_internal(%22Removed character: %22 + removed_char); --- %3E const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3E log_internal(%22Removed character: %22 + removed_char); 276,277c270,271 %3C std::cout %3C%3C removed_char %3C%3C std::endl; %3C %7D --- %3E std::cout %3C%3C removed_char %3C%3C std::endl; %3E %7D 279,282c273,276 %3C std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3C log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3C break; %3C %7D --- %3E std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3E log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3E break; %3E %7D 284c278 %3C log_internal(%22New search string: %22 + search_string); --- %3E log_internal(%22New search string: %22 + search_string); 286,287c280,281 %3C std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3C raw_output +%3D search_string + %27%5Cn%27; --- %3E std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3E raw_output +%3D search_string + %27%5Cn%27; 289c283 %3C results.clear(); --- %3E results.clear(); 291c285 %3C search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); --- %3E search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); 293,295c287,288 %3C if (debug_mode) %7B %3C print_debug_info(substrings, raw_output); %3C %7D --- %3E if (debug_mode) %7B %3E print_debug_info(substrings, raw_output); 297,299c290,291 %3C wrap_html_output(substrings, alternatives_map, sentence); %3C exit(0); %3C %7D --- %3E wrap_html_output(substrings, alternatives_map, sentence); %3E exit(0); 301c293 %3C return 0; --- %3E return 0;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:48:29 scheme: "gdlookup" Debug: 05-18 23:48:29 host: "localhost" Debug: 05-18 23:48:29 clear current dictionaries: "88c88 < } --- > return {\"\", \"\"}; 94,96c94,95 < if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { < search_string = argv[i + 1]; < break; --- > if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { > search_string = argv[i + 1]; 100,101c99 < if (argc < 2) { < std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; --- > if (argc < 2) { 103,108c101,104 < exit(1); < } < for (int i = 1; i < argc; ++i) { < if (std::strcmp(argv[i], \"--debug\") == 0) { < // Handle debug mode < } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { --- > exit(1); > } > for (int i = 1; i < argc; ++i) { > if (std::strcmp(argv[i], \"--debug\") == 0) { 110c106 < } else { --- > } else { 113,114c109,110 < break; < } --- > break; > } 116,117c112 < std::cerr << \"Search string not provided.\" << std::endl; < exit(1); --- > std::cerr << \"Search string not provided.\" << std::endl; 119c114 < return search_string; --- > return search_string; 247c242 < std::vector substrings; --- > std::vector substrings; 251c246 < while (!search_string.empty()) { --- > while (!search_string.empty()) { 253,254c248,249 < while (itr.next()) { < results.emplace_back(itr.decoded_view(), itr.id()); --- > while (itr.next()) { > results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 < log_internal(\"Found result: \" + std::string(itr.decoded_view())); < } --- > log_internal(\"Found result: \" + std::string(itr.decoded_view())); 260,261c254,255 < for (const auto& entry : results) { < const std::string substring(entry.decoded_view); --- > for (const auto& entry : results) { > const std::string substring(entry.decoded_view); 263,269c257,263 < derived_map[substring].push_back(search_string); < alternatives_map[search_string].insert(substring); < log_internal(\"Substring added: \" + substring); < if (!goldendict_mode) { < std::cout << substring << std::endl; < } < } --- > derived_map[substring].push_back(search_string); > alternatives_map[search_string].insert(substring); > log_internal(\"Substring added: \" + substring); > if (!goldendict_mode) { > std::cout << substring << std::endl; > } > } 273,274c267,268 < const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); < log_internal(\"Removed character: \" + removed_char); --- > const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); > log_internal(\"Removed character: \" + removed_char); 276,277c270,271 < std::cout << removed_char << std::endl; < } --- > std::cout << removed_char << std::endl; > } 279,282c273,276 < std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; < log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); < break; < } --- > std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; > log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); > break; > } 284c278 < log_internal(\"New search string: \" + search_string); --- > log_internal(\"New search string: \" + search_string); 286,287c280,281 < std::cout << \"After removing one character: \" << search_string << std::endl; < raw_output += search_string + '\\n'; --- > std::cout << \"After removing one character: \" << search_string << std::endl; > raw_output += search_string + '\\n'; 289c283 < results.clear(); --- > results.clear(); 291c285 < search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); --- > search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); 293,295c287,288 < if (debug_mode) { < print_debug_info(substrings, raw_output); < } --- > if (debug_mode) { > print_debug_info(substrings, raw_output); 297,299c290,291 < wrap_html_output(substrings, alternatives_map, sentence); < exit(0); < } --- > wrap_html_output(substrings, alternatives_map, sentence); > exit(0); 301c293 < return 0; --- > return 0;" Debug: 05-18 23:48:29 some body finished Debug: 05-18 23:48:29 one not finished. Debug: 05-18 23:48:29 ====reading 6216 of (6216) bytes . Finished: 0 Debug: 05-18 23:48:29 ====reading 0 of (6216) bytes . Finished: 0 Debug: 05-18 23:48:29 ====reading 0 of (6216) bytes . Finished: 0 Warning: 05-18 23:48:29 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:48:33 translating from clipboard or selection Debug: 05-18 23:48:33 clipboard data: "\n---\n> if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n> search_string = argv[i + 1];\n100,101c99\n< if (argc < 2) {\n< std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n---\n> if (argc < 2) {\n103,108c101,104\n< exit(1);\n< }\n< for (int i = 1; i < argc; ++i) {\n< if (std::strcmp(argv[i], \"--debug\") == 0) {\n< // Handle debug mode\n< } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n---\n> exit(1);\n> }\n> for (int i = 1; i < argc; ++i) {\n> if (std::strcmp(argv[i], \"--debug\") == 0) {\n110c106\n< } else {\n---\n> } else {\n113,114c109,110" Debug: 05-18 23:48:33 Current state: true false true true Debug: 05-18 23:48:33 getResource: "gdlookup://localhost/?word=--- %3E if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3E search_string %3D argv[i + 1]; 100,101c99 %3C if (argc %3C 2) %7B %3C std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; --- %3E if (argc %3C 2) %7B 103,108c101,104 %3C exit(1); %3C %7D %3C for (int i %3D 1; i %3C argc; ++i) %7B %3C if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B %3C // Handle debug mode %3C %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B --- %3E exit(1); %3E %7D %3E for (int i %3D 1; i %3C argc; ++i) %7B %3E if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B 110c106 %3C %7D else %7B --- %3E %7D else %7B 113,114c109,110&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:48:33 scheme: "gdlookup" Debug: 05-18 23:48:33 host: "localhost" Debug: 05-18 23:48:33 clear current dictionaries: "--- > if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { > search_string = argv[i + 1]; 100,101c99 < if (argc < 2) { < std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; --- > if (argc < 2) { 103,108c101,104 < exit(1); < } < for (int i = 1; i < argc; ++i) { < if (std::strcmp(argv[i], \"--debug\") == 0) { < // Handle debug mode < } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { --- > exit(1); > } > for (int i = 1; i < argc; ++i) { > if (std::strcmp(argv[i], \"--debug\") == 0) { 110c106 < } else { --- > } else { 113,114c109,110" Debug: 05-18 23:48:33 some body finished Debug: 05-18 23:48:33 one not finished. Debug: 05-18 23:48:33 ====reading 2153 of (2153) bytes . Finished: 0 Debug: 05-18 23:48:33 ====reading 0 of (2153) bytes . Finished: 0 Debug: 05-18 23:48:33 ====reading 0 of (2153) bytes . Finished: 0 Warning: 05-18 23:48:33 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:48:57 translating from clipboard or selection Debug: 05-18 23:48:57 clipboard data: "88c88\n< }\n---\n> return {\"\", \"\"};\n94,96c94,95\n< if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n< search_string = argv[i + 1];\n< break;\n---\n> if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n> search_string = argv[i + 1];\n100,101c99\n< if (argc < 2) {\n< std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n---\n> if (argc < 2) {\n103,108c101,104\n< exit(1);\n< }\n< for (int i = 1; i < argc; ++i) {\n< if (std::strcmp(argv[i], \"--debug\") == 0) {\n< // Handle debug mode\n< } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n---\n> exit(1);\n> }\n> for (int i = 1; i < argc; ++i) {\n> if (std::strcmp(argv[i], \"--debug\") == 0) {\n110c106\n< } else {\n---\n> } else {\n113,114c109,110\n< break;\n< }\n---\n> break;\n> }\n116,117c112\n< std::cerr << \"Search string not provided.\" << std::endl;\n< exit(1);\n---\n> std::cerr << \"Search string not provided.\" << std::endl;\n119c114\n< return search_string;\n---\n> return search_string;\n247c242\n< std::vector substrings;\n---\n> std::vector substrings;\n251c246\n< while (!search_string.empty()) {\n---\n> while (!search_string.empty()) {\n253,254c248,249\n< while (itr.next()) {\n< results.emplace_back(itr.decoded_view(), itr.id());\n---\n> while (itr.next()) {\n> results.emplace_back(itr.decoded_view(), itr.id());\n256,257c251\n< log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n< }\n---\n> log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n260,261c254,255\n< for (const auto& entry : results) {\n< const std::string substring(entry.decoded_view);\n---\n> for (const auto& entry : results) {\n> const std::string substring(entry.decoded_view);\n263,269c257,263\n< derived_map[substring].push_back(search_string);\n< alternatives_map[search_string].insert(substring);\n< log_internal(\"Substring added: \" + substring);\n< if (!goldendict_mode) {\n< std::cout << substring << std::endl;\n< }\n< }\n---\n> derived_map[substring].push_back(search_string);\n> alternatives_map[search_string].insert(substring);\n> log_internal(\"Substring added: \" + substring);\n> if (!goldendict_mode) {\n> std::cout << substring << std::endl;\n> }\n> }\n273,274c267,268\n< const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n< log_internal(\"Removed character: \" + removed_char);\n---\n> const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n> log_internal(\"Removed character: \" + removed_char);\n276,277c270,271\n< std::cout << removed_char << std::endl;\n< }\n---\n> std::cout << removed_char << std::endl;\n> }\n279,282c273,276\n< std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n< log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n< break;\n< }\n---\n> std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n> log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n> break;\n> }\n284c278\n< log_internal(\"New search string: \" + search_string);\n---\n> log_internal(\"New search string: \" + search_string);\n286,287c280,281\n< std::cout << \"After removing one character: \" << search_string << std::endl;\n< raw_output += search_string + '\\n';\n---\n> std::cout << \"After removing one character: \" << search_string << std::endl;\n> raw_output += search_string + '\\n';\n289c283\n< results.clear();\n---\n> results.clear();\n291c285\n< search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n---\n> search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n293,295c287,288\n< if (debug_mode) {\n< print_debug_info(substrings, raw_output);\n< }\n---\n> if (debug_mode) {\n> print_debug_info(substrings, raw_output);\n297,299c290,291\n< wrap_html_output(substrings, alternatives_map, sentence);\n< exit(0);\n< }\n---\n> wrap_html_output(substrings, alternatives_map, sentence);\n> exit(0);\n301c293\n< return 0;\n---\n> return 0;\n" Debug: 05-18 23:48:57 Current state: true false true true Debug: 05-18 23:48:57 getResource: "gdlookup://localhost/?word=88c88 %3C %7D --- %3E return %7B%22%22, %22%22%7D; 94,96c94,95 %3C if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3C search_string %3D argv[i + 1]; %3C break; --- %3E if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3E search_string %3D argv[i + 1]; 100,101c99 %3C if (argc %3C 2) %7B %3C std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; --- %3E if (argc %3C 2) %7B 103,108c101,104 %3C exit(1); %3C %7D %3C for (int i %3D 1; i %3C argc; ++i) %7B %3C if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B %3C // Handle debug mode %3C %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B --- %3E exit(1); %3E %7D %3E for (int i %3D 1; i %3C argc; ++i) %7B %3E if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B 110c106 %3C %7D else %7B --- %3E %7D else %7B 113,114c109,110 %3C break; %3C %7D --- %3E break; %3E %7D 116,117c112 %3C std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; %3C exit(1); --- %3E std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; 119c114 %3C return search_string; --- %3E return search_string; 247c242 %3C std::vector%3Cstd::string%3E substrings; --- %3E std::vector%3Cstd::string%3E substrings; 251c246 %3C while (!search_string.empty()) %7B --- %3E while (!search_string.empty()) %7B 253,254c248,249 %3C while (itr.next()) %7B %3C results.emplace_back(itr.decoded_view(), itr.id()); --- %3E while (itr.next()) %7B %3E results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 %3C log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %3C %7D --- %3E log_internal(%22Found result: %22 + std::string(itr.decoded_view())); 260,261c254,255 %3C for (const auto%26 entry : results) %7B %3C const std::string substring(entry.decoded_view); --- %3E for (const auto%26 entry : results) %7B %3E const std::string substring(entry.decoded_view); 263,269c257,263 %3C derived_map[substring].push_back(search_string); %3C alternatives_map[search_string].insert(substring); %3C log_internal(%22Substring added: %22 + substring); %3C if (!goldendict_mode) %7B %3C std::cout %3C%3C substring %3C%3C std::endl; %3C %7D %3C %7D --- %3E derived_map[substring].push_back(search_string); %3E alternatives_map[search_string].insert(substring); %3E log_internal(%22Substring added: %22 + substring); %3E if (!goldendict_mode) %7B %3E std::cout %3C%3C substring %3C%3C std::endl; %3E %7D %3E %7D 273,274c267,268 %3C const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3C log_internal(%22Removed character: %22 + removed_char); --- %3E const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3E log_internal(%22Removed character: %22 + removed_char); 276,277c270,271 %3C std::cout %3C%3C removed_char %3C%3C std::endl; %3C %7D --- %3E std::cout %3C%3C removed_char %3C%3C std::endl; %3E %7D 279,282c273,276 %3C std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3C log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3C break; %3C %7D --- %3E std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3E log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3E break; %3E %7D 284c278 %3C log_internal(%22New search string: %22 + search_string); --- %3E log_internal(%22New search string: %22 + search_string); 286,287c280,281 %3C std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3C raw_output +%3D search_string + %27%5Cn%27; --- %3E std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3E raw_output +%3D search_string + %27%5Cn%27; 289c283 %3C results.clear(); --- %3E results.clear(); 291c285 %3C search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); --- %3E search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); 293,295c287,288 %3C if (debug_mode) %7B %3C print_debug_info(substrings, raw_output); %3C %7D --- %3E if (debug_mode) %7B %3E print_debug_info(substrings, raw_output); 297,299c290,291 %3C wrap_html_output(substrings, alternatives_map, sentence); %3C exit(0); %3C %7D --- %3E wrap_html_output(substrings, alternatives_map, sentence); %3E exit(0); 301c293 %3C return 0; --- %3E return 0;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:48:57 scheme: "gdlookup" Debug: 05-18 23:48:57 host: "localhost" Debug: 05-18 23:48:57 clear current dictionaries: "88c88 < } --- > return {\"\", \"\"}; 94,96c94,95 < if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { < search_string = argv[i + 1]; < break; --- > if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { > search_string = argv[i + 1]; 100,101c99 < if (argc < 2) { < std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; --- > if (argc < 2) { 103,108c101,104 < exit(1); < } < for (int i = 1; i < argc; ++i) { < if (std::strcmp(argv[i], \"--debug\") == 0) { < // Handle debug mode < } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { --- > exit(1); > } > for (int i = 1; i < argc; ++i) { > if (std::strcmp(argv[i], \"--debug\") == 0) { 110c106 < } else { --- > } else { 113,114c109,110 < break; < } --- > break; > } 116,117c112 < std::cerr << \"Search string not provided.\" << std::endl; < exit(1); --- > std::cerr << \"Search string not provided.\" << std::endl; 119c114 < return search_string; --- > return search_string; 247c242 < std::vector substrings; --- > std::vector substrings; 251c246 < while (!search_string.empty()) { --- > while (!search_string.empty()) { 253,254c248,249 < while (itr.next()) { < results.emplace_back(itr.decoded_view(), itr.id()); --- > while (itr.next()) { > results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 < log_internal(\"Found result: \" + std::string(itr.decoded_view())); < } --- > log_internal(\"Found result: \" + std::string(itr.decoded_view())); 260,261c254,255 < for (const auto& entry : results) { < const std::string substring(entry.decoded_view); --- > for (const auto& entry : results) { > const std::string substring(entry.decoded_view); 263,269c257,263 < derived_map[substring].push_back(search_string); < alternatives_map[search_string].insert(substring); < log_internal(\"Substring added: \" + substring); < if (!goldendict_mode) { < std::cout << substring << std::endl; < } < } --- > derived_map[substring].push_back(search_string); > alternatives_map[search_string].insert(substring); > log_internal(\"Substring added: \" + substring); > if (!goldendict_mode) { > std::cout << substring << std::endl; > } > } 273,274c267,268 < const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); < log_internal(\"Removed character: \" + removed_char); --- > const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); > log_internal(\"Removed character: \" + removed_char); 276,277c270,271 < std::cout << removed_char << std::endl; < } --- > std::cout << removed_char << std::endl; > } 279,282c273,276 < std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; < log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); < break; < } --- > std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; > log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); > break; > } 284c278 < log_internal(\"New search string: \" + search_string); --- > log_internal(\"New search string: \" + search_string); 286,287c280,281 < std::cout << \"After removing one character: \" << search_string << std::endl; < raw_output += search_string + '\\n'; --- > std::cout << \"After removing one character: \" << search_string << std::endl; > raw_output += search_string + '\\n'; 289c283 < results.clear(); --- > results.clear(); 291c285 < search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); --- > search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); 293,295c287,288 < if (debug_mode) { < print_debug_info(substrings, raw_output); < } --- > if (debug_mode) { > print_debug_info(substrings, raw_output); 297,299c290,291 < wrap_html_output(substrings, alternatives_map, sentence); < exit(0); < } --- > wrap_html_output(substrings, alternatives_map, sentence); > exit(0); 301c293 < return 0; --- > return 0;" Debug: 05-18 23:48:57 some body finished Debug: 05-18 23:48:57 one not finished. Debug: 05-18 23:48:57 ====reading 6216 of (6216) bytes . Finished: 0 Debug: 05-18 23:48:57 ====reading 0 of (6216) bytes . Finished: 0 Debug: 05-18 23:48:57 ====reading 0 of (6216) bytes . Finished: 0 Warning: 05-18 23:48:57 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:50:21 translating from clipboard or selection Debug: 05-18 23:50:21 clipboard data: "--- hakurei.cpp.orig\t2024-05-19 12:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 12:30:00.000000000 +0000\n@@ -17,7 +17,7 @@\n }\n i++;\n }\n-}\n+ return {\"\", \"\"};\n }\n \n inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n@@ -34,11 +34,11 @@\n \t search_string = argv[i + 1];\n \t break;\n \t}\n- }\n+ }\n } else {\n if (argc < 2) {\n \tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n \texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n@@ -49,7 +49,7 @@\n \t} else {\n \t search_string = argv[i];\n \t break;\n-\t}\n+ }\n }\n }\n }\n" Debug: 05-18 23:50:21 Current state: true true false true Debug: 05-18 23:50:21 getResource: "gdlookup://localhost/?word=--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ %7D i++; %7D -%7D + return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B @@ -34,11 +34,11 @@ search_string %3D argv[i + 1]; break; %7D - %7D + %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B @@ -49,7 +49,7 @@ %7D else %7B search_string %3D argv[i]; break; - %7D + %7D %7D %7D %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:50:21 scheme: "gdlookup" Debug: 05-18 23:50:21 host: "localhost" Debug: 05-18 23:50:21 clear current dictionaries: "--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ } i++; } -} + return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { @@ -34,11 +34,11 @@ search_string = argv[i + 1]; break; } - } + } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { @@ -49,7 +49,7 @@ } else { search_string = argv[i]; break; - } + } } } }" Debug: 05-18 23:50:21 some body finished Debug: 05-18 23:50:21 one not finished. Debug: 05-18 23:50:21 ====reading 2011 of (2011) bytes . Finished: 0 Debug: 05-18 23:50:21 ====reading 0 of (2011) bytes . Finished: 0 Debug: 05-18 23:50:21 ====reading 0 of (2011) bytes . Finished: 0 Warning: 05-18 23:50:21 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:50:37 translating from clipboard or selection Debug: 05-18 23:50:37 clipboard data: "88c88\n< }\n---\n> return {\"\", \"\"};\n94,96c94,95\n< if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n< search_string = argv[i + 1];\n< break;\n---\n> if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n> search_string = argv[i + 1];\n100,101c99\n< if (argc < 2) {\n< std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n---\n> if (argc < 2) {\n103,108c101,104\n< exit(1);\n< }\n< for (int i = 1; i < argc; ++i) {\n< if (std::strcmp(argv[i], \"--debug\") == 0) {\n< // Handle debug mode\n< } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n---\n> exit(1);\n> }\n> for (int i = 1; i < argc; ++i) {\n> if (std::strcmp(argv[i], \"--debug\") == 0) {\n110c106\n< } else {\n---\n> } else {\n113,114c109,110\n< break;\n< }\n---\n> break;\n> }\n116,117c112\n< std::cerr << \"Search string not provided.\" << std::endl;\n< exit(1);\n---\n> std::cerr << \"Search string not provided.\" << std::endl;\n119c114\n< return search_string;\n---\n> return search_string;\n247c242\n< std::vector substrings;\n---\n> std::vector substrings;\n251c246\n< while (!search_string.empty()) {\n---\n> while (!search_string.empty()) {\n253,254c248,249\n< while (itr.next()) {\n< results.emplace_back(itr.decoded_view(), itr.id());\n---\n> while (itr.next()) {\n> results.emplace_back(itr.decoded_view(), itr.id());\n256,257c251\n< log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n< }\n---\n> log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n260,261c254,255\n< for (const auto& entry : results) {\n< const std::string substring(entry.decoded_view);\n---\n> for (const auto& entry : results) {\n> const std::string substring(entry.decoded_view);\n263,269c257,263\n< derived_map[substring].push_back(search_string);\n< alternatives_map[search_string].insert(substring);\n< log_internal(\"Substring added: \" + substring);\n< if (!goldendict_mode) {\n< std::cout << substring << std::endl;\n< }\n< }\n---\n> derived_map[substring].push_back(search_string);\n> alternatives_map[search_string].insert(substring);\n> log_internal(\"Substring added: \" + substring);\n> if (!goldendict_mode) {\n> std::cout << substring << std::endl;\n> }\n> }\n273,274c267,268\n< const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n< log_internal(\"Removed character: \" + removed_char);\n---\n> const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n> log_internal(\"Removed character: \" + removed_char);\n276,277c270,271\n< std::cout << removed_char << std::endl;\n< }\n---\n> std::cout << removed_char << std::endl;\n> }\n279,282c273,276\n< std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n< log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n< break;\n< }\n---\n> std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n> log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n> break;\n> }\n284c278\n< log_internal(\"New search string: \" + search_string);\n---\n> log_internal(\"New search string: \" + search_string);\n286,287c280,281\n< std::cout << \"After removing one character: \" << search_string << std::endl;\n< raw_output += search_string + '\\n';\n---\n> std::cout << \"After removing one character: \" << search_string << std::endl;\n> raw_output += search_string + '\\n';\n289c283\n< results.clear();\n---\n> results.clear();\n291c285\n< search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n---\n> search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n293,295c287,288\n< if (debug_mode) {\n< print_debug_info(substrings, raw_output);\n< }\n---\n> if (debug_mode) {\n> print_debug_info(substrings, raw_output);\n297,299c290,291\n< wrap_html_output(substrings, alternatives_map, sentence);\n< exit(0);\n< }\n---\n> wrap_html_output(substrings, alternatives_map, sentence);\n> exit(0);\n301c293\n< return 0;\n---\n> return 0;\n" Debug: 05-18 23:50:37 Current state: true false false true Debug: 05-18 23:50:37 getResource: "gdlookup://localhost/?word=88c88 %3C %7D --- %3E return %7B%22%22, %22%22%7D; 94,96c94,95 %3C if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3C search_string %3D argv[i + 1]; %3C break; --- %3E if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3E search_string %3D argv[i + 1]; 100,101c99 %3C if (argc %3C 2) %7B %3C std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; --- %3E if (argc %3C 2) %7B 103,108c101,104 %3C exit(1); %3C %7D %3C for (int i %3D 1; i %3C argc; ++i) %7B %3C if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B %3C // Handle debug mode %3C %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B --- %3E exit(1); %3E %7D %3E for (int i %3D 1; i %3C argc; ++i) %7B %3E if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B 110c106 %3C %7D else %7B --- %3E %7D else %7B 113,114c109,110 %3C break; %3C %7D --- %3E break; %3E %7D 116,117c112 %3C std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; %3C exit(1); --- %3E std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; 119c114 %3C return search_string; --- %3E return search_string; 247c242 %3C std::vector%3Cstd::string%3E substrings; --- %3E std::vector%3Cstd::string%3E substrings; 251c246 %3C while (!search_string.empty()) %7B --- %3E while (!search_string.empty()) %7B 253,254c248,249 %3C while (itr.next()) %7B %3C results.emplace_back(itr.decoded_view(), itr.id()); --- %3E while (itr.next()) %7B %3E results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 %3C log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %3C %7D --- %3E log_internal(%22Found result: %22 + std::string(itr.decoded_view())); 260,261c254,255 %3C for (const auto%26 entry : results) %7B %3C const std::string substring(entry.decoded_view); --- %3E for (const auto%26 entry : results) %7B %3E const std::string substring(entry.decoded_view); 263,269c257,263 %3C derived_map[substring].push_back(search_string); %3C alternatives_map[search_string].insert(substring); %3C log_internal(%22Substring added: %22 + substring); %3C if (!goldendict_mode) %7B %3C std::cout %3C%3C substring %3C%3C std::endl; %3C %7D %3C %7D --- %3E derived_map[substring].push_back(search_string); %3E alternatives_map[search_string].insert(substring); %3E log_internal(%22Substring added: %22 + substring); %3E if (!goldendict_mode) %7B %3E std::cout %3C%3C substring %3C%3C std::endl; %3E %7D %3E %7D 273,274c267,268 %3C const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3C log_internal(%22Removed character: %22 + removed_char); --- %3E const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3E log_internal(%22Removed character: %22 + removed_char); 276,277c270,271 %3C std::cout %3C%3C removed_char %3C%3C std::endl; %3C %7D --- %3E std::cout %3C%3C removed_char %3C%3C std::endl; %3E %7D 279,282c273,276 %3C std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3C log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3C break; %3C %7D --- %3E std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3E log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3E break; %3E %7D 284c278 %3C log_internal(%22New search string: %22 + search_string); --- %3E log_internal(%22New search string: %22 + search_string); 286,287c280,281 %3C std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3C raw_output +%3D search_string + %27%5Cn%27; --- %3E std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3E raw_output +%3D search_string + %27%5Cn%27; 289c283 %3C results.clear(); --- %3E results.clear(); 291c285 %3C search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); --- %3E search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); 293,295c287,288 %3C if (debug_mode) %7B %3C print_debug_info(substrings, raw_output); %3C %7D --- %3E if (debug_mode) %7B %3E print_debug_info(substrings, raw_output); 297,299c290,291 %3C wrap_html_output(substrings, alternatives_map, sentence); %3C exit(0); %3C %7D --- %3E wrap_html_output(substrings, alternatives_map, sentence); %3E exit(0); 301c293 %3C return 0; --- %3E return 0;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:50:37 scheme: "gdlookup" Debug: 05-18 23:50:37 host: "localhost" Debug: 05-18 23:50:37 clear current dictionaries: "88c88 < } --- > return {\"\", \"\"}; 94,96c94,95 < if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { < search_string = argv[i + 1]; < break; --- > if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { > search_string = argv[i + 1]; 100,101c99 < if (argc < 2) { < std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; --- > if (argc < 2) { 103,108c101,104 < exit(1); < } < for (int i = 1; i < argc; ++i) { < if (std::strcmp(argv[i], \"--debug\") == 0) { < // Handle debug mode < } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { --- > exit(1); > } > for (int i = 1; i < argc; ++i) { > if (std::strcmp(argv[i], \"--debug\") == 0) { 110c106 < } else { --- > } else { 113,114c109,110 < break; < } --- > break; > } 116,117c112 < std::cerr << \"Search string not provided.\" << std::endl; < exit(1); --- > std::cerr << \"Search string not provided.\" << std::endl; 119c114 < return search_string; --- > return search_string; 247c242 < std::vector substrings; --- > std::vector substrings; 251c246 < while (!search_string.empty()) { --- > while (!search_string.empty()) { 253,254c248,249 < while (itr.next()) { < results.emplace_back(itr.decoded_view(), itr.id()); --- > while (itr.next()) { > results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 < log_internal(\"Found result: \" + std::string(itr.decoded_view())); < } --- > log_internal(\"Found result: \" + std::string(itr.decoded_view())); 260,261c254,255 < for (const auto& entry : results) { < const std::string substring(entry.decoded_view); --- > for (const auto& entry : results) { > const std::string substring(entry.decoded_view); 263,269c257,263 < derived_map[substring].push_back(search_string); < alternatives_map[search_string].insert(substring); < log_internal(\"Substring added: \" + substring); < if (!goldendict_mode) { < std::cout << substring << std::endl; < } < } --- > derived_map[substring].push_back(search_string); > alternatives_map[search_string].insert(substring); > log_internal(\"Substring added: \" + substring); > if (!goldendict_mode) { > std::cout << substring << std::endl; > } > } 273,274c267,268 < const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); < log_internal(\"Removed character: \" + removed_char); --- > const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); > log_internal(\"Removed character: \" + removed_char); 276,277c270,271 < std::cout << removed_char << std::endl; < } --- > std::cout << removed_char << std::endl; > } 279,282c273,276 < std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; < log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); < break; < } --- > std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; > log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); > break; > } 284c278 < log_internal(\"New search string: \" + search_string); --- > log_internal(\"New search string: \" + search_string); 286,287c280,281 < std::cout << \"After removing one character: \" << search_string << std::endl; < raw_output += search_string + '\\n'; --- > std::cout << \"After removing one character: \" << search_string << std::endl; > raw_output += search_string + '\\n'; 289c283 < results.clear(); --- > results.clear(); 291c285 < search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); --- > search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); 293,295c287,288 < if (debug_mode) { < print_debug_info(substrings, raw_output); < } --- > if (debug_mode) { > print_debug_info(substrings, raw_output); 297,299c290,291 < wrap_html_output(substrings, alternatives_map, sentence); < exit(0); < } --- > wrap_html_output(substrings, alternatives_map, sentence); > exit(0); 301c293 < return 0; --- > return 0;" Debug: 05-18 23:50:37 some body finished Debug: 05-18 23:50:37 one not finished. Debug: 05-18 23:50:37 ====reading 6216 of (6216) bytes . Finished: 0 Debug: 05-18 23:50:37 ====reading 0 of (6216) bytes . Finished: 0 Debug: 05-18 23:50:37 ====reading 0 of (6216) bytes . Finished: 0 Warning: 05-18 23:50:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:50:38 translating from clipboard or selection Debug: 05-18 23:50:38 clipboard data: "88c88\n< }\n---\n> return {\"\", \"\"};\n94,96c94,95\n< if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n< search_string = argv[i + 1];\n< break;\n---\n> if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) {\n> search_string = argv[i + 1];\n100,101c99\n< if (argc < 2) {\n< std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n---\n> if (argc < 2) {\n103,108c101,104\n< exit(1);\n< }\n< for (int i = 1; i < argc; ++i) {\n< if (std::strcmp(argv[i], \"--debug\") == 0) {\n< // Handle debug mode\n< } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) {\n---\n> exit(1);\n> }\n> for (int i = 1; i < argc; ++i) {\n> if (std::strcmp(argv[i], \"--debug\") == 0) {\n110c106\n< } else {\n---\n> } else {\n113,114c109,110\n< break;\n< }\n---\n> break;\n> }\n116,117c112\n< std::cerr << \"Search string not provided.\" << std::endl;\n< exit(1);\n---\n> std::cerr << \"Search string not provided.\" << std::endl;\n119c114\n< return search_string;\n---\n> return search_string;\n247c242\n< std::vector substrings;\n---\n> std::vector substrings;\n251c246\n< while (!search_string.empty()) {\n---\n> while (!search_string.empty()) {\n253,254c248,249\n< while (itr.next()) {\n< results.emplace_back(itr.decoded_view(), itr.id());\n---\n> while (itr.next()) {\n> results.emplace_back(itr.decoded_view(), itr.id());\n256,257c251\n< log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n< }\n---\n> log_internal(\"Found result: \" + std::string(itr.decoded_view()));\n260,261c254,255\n< for (const auto& entry : results) {\n< const std::string substring(entry.decoded_view);\n---\n> for (const auto& entry : results) {\n> const std::string substring(entry.decoded_view);\n263,269c257,263\n< derived_map[substring].push_back(search_string);\n< alternatives_map[search_string].insert(substring);\n< log_internal(\"Substring added: \" + substring);\n< if (!goldendict_mode) {\n< std::cout << substring << std::endl;\n< }\n< }\n---\n> derived_map[substring].push_back(search_string);\n> alternatives_map[search_string].insert(substring);\n> log_internal(\"Substring added: \" + substring);\n> if (!goldendict_mode) {\n> std::cout << substring << std::endl;\n> }\n> }\n273,274c267,268\n< const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n< log_internal(\"Removed character: \" + removed_char);\n---\n> const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string);\n> log_internal(\"Removed character: \" + removed_char);\n276,277c270,271\n< std::cout << removed_char << std::endl;\n< }\n---\n> std::cout << removed_char << std::endl;\n> }\n279,282c273,276\n< std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n< log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n< break;\n< }\n---\n> std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl;\n> log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\");\n> break;\n> }\n284c278\n< log_internal(\"New search string: \" + search_string);\n---\n> log_internal(\"New search string: \" + search_string);\n286,287c280,281\n< std::cout << \"After removing one character: \" << search_string << std::endl;\n< raw_output += search_string + '\\n';\n---\n> std::cout << \"After removing one character: \" << search_string << std::endl;\n> raw_output += search_string + '\\n';\n289c283\n< results.clear();\n---\n> results.clear();\n291c285\n< search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n---\n> search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n293,295c287,288\n< if (debug_mode) {\n< print_debug_info(substrings, raw_output);\n< }\n---\n> if (debug_mode) {\n> print_debug_info(substrings, raw_output);\n297,299c290,291\n< wrap_html_output(substrings, alternatives_map, sentence);\n< exit(0);\n< }\n---\n> wrap_html_output(substrings, alternatives_map, sentence);\n> exit(0);\n301c293\n< return 0;\n---\n> return 0;\n" Debug: 05-18 23:50:38 Current state: true false true true Debug: 05-18 23:50:38 getResource: "gdlookup://localhost/?word=88c88 %3C %7D --- %3E return %7B%22%22, %22%22%7D; 94,96c94,95 %3C if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3C search_string %3D argv[i + 1]; %3C break; --- %3E if (std::strcmp(argv[i], %22--sentence%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B %3E search_string %3D argv[i + 1]; 100,101c99 %3C if (argc %3C 2) %7B %3C std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; --- %3E if (argc %3C 2) %7B 103,108c101,104 %3C exit(1); %3C %7D %3C for (int i %3D 1; i %3C argc; ++i) %7B %3C if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B %3C // Handle debug mode %3C %7D else if (std::strcmp(argv[i], %22--dict%22) %3D%3D 0 %26%26 i + 1 %3C argc) %7B --- %3E exit(1); %3E %7D %3E for (int i %3D 1; i %3C argc; ++i) %7B %3E if (std::strcmp(argv[i], %22--debug%22) %3D%3D 0) %7B 110c106 %3C %7D else %7B --- %3E %7D else %7B 113,114c109,110 %3C break; %3C %7D --- %3E break; %3E %7D 116,117c112 %3C std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; %3C exit(1); --- %3E std::cerr %3C%3C %22Search string not provided.%22 %3C%3C std::endl; 119c114 %3C return search_string; --- %3E return search_string; 247c242 %3C std::vector%3Cstd::string%3E substrings; --- %3E std::vector%3Cstd::string%3E substrings; 251c246 %3C while (!search_string.empty()) %7B --- %3E while (!search_string.empty()) %7B 253,254c248,249 %3C while (itr.next()) %7B %3C results.emplace_back(itr.decoded_view(), itr.id()); --- %3E while (itr.next()) %7B %3E results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 %3C log_internal(%22Found result: %22 + std::string(itr.decoded_view())); %3C %7D --- %3E log_internal(%22Found result: %22 + std::string(itr.decoded_view())); 260,261c254,255 %3C for (const auto%26 entry : results) %7B %3C const std::string substring(entry.decoded_view); --- %3E for (const auto%26 entry : results) %7B %3E const std::string substring(entry.decoded_view); 263,269c257,263 %3C derived_map[substring].push_back(search_string); %3C alternatives_map[search_string].insert(substring); %3C log_internal(%22Substring added: %22 + substring); %3C if (!goldendict_mode) %7B %3C std::cout %3C%3C substring %3C%3C std::endl; %3C %7D %3C %7D --- %3E derived_map[substring].push_back(search_string); %3E alternatives_map[search_string].insert(substring); %3E log_internal(%22Substring added: %22 + substring); %3E if (!goldendict_mode) %7B %3E std::cout %3C%3C substring %3C%3C std::endl; %3E %7D %3E %7D 273,274c267,268 %3C const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3C log_internal(%22Removed character: %22 + removed_char); --- %3E const auto [removed_char, new_search_string] %3D remove_one_utf8_char(search_string); %3E log_internal(%22Removed character: %22 + removed_char); 276,277c270,271 %3C std::cout %3C%3C removed_char %3C%3C std::endl; %3C %7D --- %3E std::cout %3C%3C removed_char %3C%3C std::endl; %3E %7D 279,282c273,276 %3C std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3C log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3C break; %3C %7D --- %3E std::cerr %3C%3C %22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22 %3C%3C std::endl; %3E log_internal(%22Error: Search string did not change after removing a character. Exiting to prevent infinite loop.%22); %3E break; %3E %7D 284c278 %3C log_internal(%22New search string: %22 + search_string); --- %3E log_internal(%22New search string: %22 + search_string); 286,287c280,281 %3C std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3C raw_output +%3D search_string + %27%5Cn%27; --- %3E std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; %3E raw_output +%3D search_string + %27%5Cn%27; 289c283 %3C results.clear(); --- %3E results.clear(); 291c285 %3C search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); --- %3E search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); 293,295c287,288 %3C if (debug_mode) %7B %3C print_debug_info(substrings, raw_output); %3C %7D --- %3E if (debug_mode) %7B %3E print_debug_info(substrings, raw_output); 297,299c290,291 %3C wrap_html_output(substrings, alternatives_map, sentence); %3C exit(0); %3C %7D --- %3E wrap_html_output(substrings, alternatives_map, sentence); %3E exit(0); 301c293 %3C return 0; --- %3E return 0;&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:50:38 scheme: "gdlookup" Debug: 05-18 23:50:38 host: "localhost" Debug: 05-18 23:50:38 clear current dictionaries: "88c88 < } --- > return {\"\", \"\"}; 94,96c94,95 < if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { < search_string = argv[i + 1]; < break; --- > if (std::strcmp(argv[i], \"--sentence\") == 0 && i + 1 < argc) { > search_string = argv[i + 1]; 100,101c99 < if (argc < 2) { < std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; --- > if (argc < 2) { 103,108c101,104 < exit(1); < } < for (int i = 1; i < argc; ++i) { < if (std::strcmp(argv[i], \"--debug\") == 0) { < // Handle debug mode < } else if (std::strcmp(argv[i], \"--dict\") == 0 && i + 1 < argc) { --- > exit(1); > } > for (int i = 1; i < argc; ++i) { > if (std::strcmp(argv[i], \"--debug\") == 0) { 110c106 < } else { --- > } else { 113,114c109,110 < break; < } --- > break; > } 116,117c112 < std::cerr << \"Search string not provided.\" << std::endl; < exit(1); --- > std::cerr << \"Search string not provided.\" << std::endl; 119c114 < return search_string; --- > return search_string; 247c242 < std::vector substrings; --- > std::vector substrings; 251c246 < while (!search_string.empty()) { --- > while (!search_string.empty()) { 253,254c248,249 < while (itr.next()) { < results.emplace_back(itr.decoded_view(), itr.id()); --- > while (itr.next()) { > results.emplace_back(itr.decoded_view(), itr.id()); 256,257c251 < log_internal(\"Found result: \" + std::string(itr.decoded_view())); < } --- > log_internal(\"Found result: \" + std::string(itr.decoded_view())); 260,261c254,255 < for (const auto& entry : results) { < const std::string substring(entry.decoded_view); --- > for (const auto& entry : results) { > const std::string substring(entry.decoded_view); 263,269c257,263 < derived_map[substring].push_back(search_string); < alternatives_map[search_string].insert(substring); < log_internal(\"Substring added: \" + substring); < if (!goldendict_mode) { < std::cout << substring << std::endl; < } < } --- > derived_map[substring].push_back(search_string); > alternatives_map[search_string].insert(substring); > log_internal(\"Substring added: \" + substring); > if (!goldendict_mode) { > std::cout << substring << std::endl; > } > } 273,274c267,268 < const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); < log_internal(\"Removed character: \" + removed_char); --- > const auto [removed_char, new_search_string] = remove_one_utf8_char(search_string); > log_internal(\"Removed character: \" + removed_char); 276,277c270,271 < std::cout << removed_char << std::endl; < } --- > std::cout << removed_char << std::endl; > } 279,282c273,276 < std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; < log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); < break; < } --- > std::cerr << \"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\" << std::endl; > log_internal(\"Error: Search string did not change after removing a character. Exiting to prevent infinite loop.\"); > break; > } 284c278 < log_internal(\"New search string: \" + search_string); --- > log_internal(\"New search string: \" + search_string); 286,287c280,281 < std::cout << \"After removing one character: \" << search_string << std::endl; < raw_output += search_string + '\\n'; --- > std::cout << \"After removing one character: \" << search_string << std::endl; > raw_output += search_string + '\\n'; 289c283 < results.clear(); --- > results.clear(); 291c285 < search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); --- > search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); 293,295c287,288 < if (debug_mode) { < print_debug_info(substrings, raw_output); < } --- > if (debug_mode) { > print_debug_info(substrings, raw_output); 297,299c290,291 < wrap_html_output(substrings, alternatives_map, sentence); < exit(0); < } --- > wrap_html_output(substrings, alternatives_map, sentence); > exit(0); 301c293 < return 0; --- > return 0;" Debug: 05-18 23:50:38 some body finished Debug: 05-18 23:50:38 one not finished. Debug: 05-18 23:50:38 ====reading 6216 of (6216) bytes . Finished: 0 Debug: 05-18 23:50:38 ====reading 0 of (6216) bytes . Finished: 0 Debug: 05-18 23:50:38 ====reading 0 of (6216) bytes . Finished: 0 Warning: 05-18 23:50:38 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:51:47 translating from clipboard or selection Debug: 05-18 23:51:47 clipboard data: "--- hakurei.cpp.orig\t2024-05-19 12:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 12:30:00.000000000 +0000\n@@ -17,7 +17,7 @@\n }\n i++;\n }\n-}\n+ return {\"\", \"\"};\n }\n \n inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n@@ -34,11 +34,11 @@\n \t search_string = argv[i + 1];\n \t break;\n \t}\n- }\n+ }\n } else {\n if (argc < 2) {\n \tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n \texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n@@ -49,7 +49,7 @@\n \t} else {\n \t search_string = argv[i];\n \t break;\n-\t}\n+ }\n }\n }\n }\n@@ -134,6 +134,9 @@\n search_string = new_search_string;\n log_internal(\"New search string: \" + search_string);\n \n+ // Break if the search string is empty\n+ if (search_string.empty()) break;\n+\n // Print debug information if in debug mode\n if (debug_mode) {\n std::cout << \"After removing one character: \" << search_string << std::endl;\n@@ -141,6 +144,7 @@\n }\n \n results.clear();\n+\n // Remove leading whitespace\n search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\"));\n }\n@@ -149,6 +153,10 @@\n if (debug_mode) {\n print_debug_info(substrings, raw_output);\n }\n+\n+ // Log if the loop finished without issues\n+ log_internal(\"Finished processing search string\");\n+\n // Wrap the output in HTML format for GoldenDict if in GoldenDict mode\n if (goldendict_mode) {\n wrap_html_output(substrings, alternatives_map, sentence);\n" Debug: 05-18 23:51:47 Current state: true false true true Debug: 05-18 23:51:47 getResource: "gdlookup://localhost/?word=--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ %7D i++; %7D -%7D + return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B @@ -34,11 +34,11 @@ search_string %3D argv[i + 1]; break; %7D - %7D + %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B @@ -49,7 +49,7 @@ %7D else %7B search_string %3D argv[i]; break; - %7D + %7D %7D %7D %7D @@ -134,6 +134,9 @@ search_string %3D new_search_string; log_internal(%22New search string: %22 + search_string); + // Break if the search string is empty + if (search_string.empty()) break; + // Print debug information if in debug mode if (debug_mode) %7B std::cout %3C%3C %22After removing one character: %22 %3C%3C search_string %3C%3C std::endl; @@ -141,6 +144,7 @@ %7D results.clear(); + // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(%22 %5Ct%5Cn%5Cr%5Cf%5Cv%22)); %7D @@ -149,6 +153,10 @@ if (debug_mode) %7B print_debug_info(substrings, raw_output); %7D + + // Log if the loop finished without issues + log_internal(%22Finished processing search string%22); + // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) %7B wrap_html_output(substrings, alternatives_map, sentence);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:51:47 scheme: "gdlookup" Debug: 05-18 23:51:47 host: "localhost" Debug: 05-18 23:51:47 clear current dictionaries: "--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ } i++; } -} + return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { @@ -34,11 +34,11 @@ search_string = argv[i + 1]; break; } - } + } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { @@ -49,7 +49,7 @@ } else { search_string = argv[i]; break; - } + } } } } @@ -134,6 +134,9 @@ search_string = new_search_string; log_internal(\"New search string: \" + search_string); + // Break if the search string is empty + if (search_string.empty()) break; + // Print debug information if in debug mode if (debug_mode) { std::cout << \"After removing one character: \" << search_string << std::endl; @@ -141,6 +144,7 @@ } results.clear(); + // Remove leading whitespace search_string.erase(0, search_string.find_first_not_of(\" \\t\\n\\r\\f\\v\")); } @@ -149,6 +153,10 @@ if (debug_mode) { print_debug_info(substrings, raw_output); } + + // Log if the loop finished without issues + log_internal(\"Finished processing search string\"); + // Wrap the output in HTML format for GoldenDict if in GoldenDict mode if (goldendict_mode) { wrap_html_output(substrings, alternatives_map, sentence);" Debug: 05-18 23:51:47 some body finished Debug: 05-18 23:51:47 one not finished. Debug: 05-18 23:51:47 ====reading 2876 of (2876) bytes . Finished: 0 Debug: 05-18 23:51:47 ====reading 0 of (2876) bytes . Finished: 0 Debug: 05-18 23:51:47 ====reading 0 of (2876) bytes . Finished: 0 Warning: 05-18 23:51:47 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:51:50 translating from clipboard or selection Debug: 05-18 23:51:50 clipboard data: "--- hakurei.cpp.orig\t2024-05-19 12:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 12:30:00.000000000 +0000\n@@ -17,7 +17,7 @@\n }\n i++;\n }\n-}\n+ return {\"\", \"\"};\n }\n \n inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n@@ -34,11 +34,11 @@\n \t search_string = argv[i + 1];\n \t break;\n \t}\n- }\n+ }\n } else {\n if (argc < 2) {\n \tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n \texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n@@ -49,7 +49,7 @@\n \t} else {\n \t search_string = argv[i];\n \t break;\n-\t}\n+ }\n }\n }\n }\n" Debug: 05-18 23:51:50 Current state: true false true true Debug: 05-18 23:51:50 getResource: "gdlookup://localhost/?word=--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ %7D i++; %7D -%7D + return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B @@ -34,11 +34,11 @@ search_string %3D argv[i + 1]; break; %7D - %7D + %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B @@ -49,7 +49,7 @@ %7D else %7B search_string %3D argv[i]; break; - %7D + %7D %7D %7D %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:51:50 scheme: "gdlookup" Debug: 05-18 23:51:50 host: "localhost" Debug: 05-18 23:51:50 clear current dictionaries: "--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ } i++; } -} + return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { @@ -34,11 +34,11 @@ search_string = argv[i + 1]; break; } - } + } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { @@ -49,7 +49,7 @@ } else { search_string = argv[i]; break; - } + } } } }" Debug: 05-18 23:51:50 some body finished Debug: 05-18 23:51:50 one not finished. Debug: 05-18 23:51:50 ====reading 2011 of (2011) bytes . Finished: 0 Debug: 05-18 23:51:50 ====reading 0 of (2011) bytes . Finished: 0 Debug: 05-18 23:51:50 ====reading 0 of (2011) bytes . Finished: 0 Warning: 05-18 23:51:50 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:51:51 translating from clipboard or selection Debug: 05-18 23:51:51 clipboard data: "--- hakurei.cpp.orig\t2024-05-19 12:00:00.000000000 +0000\n+++ hakurei.cpp\t2024-05-19 12:30:00.000000000 +0000\n@@ -17,7 +17,7 @@\n }\n i++;\n }\n-}\n+ return {\"\", \"\"};\n }\n \n inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) {\n@@ -34,11 +34,11 @@\n \t search_string = argv[i + 1];\n \t break;\n \t}\n- }\n+ }\n } else {\n if (argc < 2) {\n \tstd::cerr << \"Usage: \" << argv[0] << \" \" << std::endl;\n \texit(1);\n }\n for (int i = 1; i < argc; ++i) {\n@@ -49,7 +49,7 @@\n \t} else {\n \t search_string = argv[i];\n \t break;\n-\t}\n+ }\n }\n }\n }\n" Debug: 05-18 23:51:51 Current state: true false true true Debug: 05-18 23:51:51 getResource: "gdlookup://localhost/?word=--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ %7D i++; %7D -%7D + return %7B%22%22, %22%22%7D; %7D inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) %7B @@ -34,11 +34,11 @@ search_string %3D argv[i + 1]; break; %7D - %7D + %7D %7D else %7B if (argc %3C 2) %7B std::cerr %3C%3C %22Usage: %22 %3C%3C argv[0] %3C%3C %22 %3Csearch_string%3E%22 %3C%3C std::endl; exit(1); %7D for (int i %3D 1; i %3C argc; ++i) %7B @@ -49,7 +49,7 @@ %7D else %7B search_string %3D argv[i]; break; - %7D + %7D %7D %7D %7D&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:51:51 scheme: "gdlookup" Debug: 05-18 23:51:51 host: "localhost" Debug: 05-18 23:51:51 clear current dictionaries: "--- hakurei.cpp.orig 2024-05-19 12:00:00.000000000 +0000 +++ hakurei.cpp 2024-05-19 12:30:00.000000000 +0000 @@ -17,7 +17,7 @@ } i++; } -} + return {\"\", \"\"}; } inline std::string get_input(const int argc, char* const argv[], const bool goldendict_mode) { @@ -34,11 +34,11 @@ search_string = argv[i + 1]; break; } - } + } } else { if (argc < 2) { std::cerr << \"Usage: \" << argv[0] << \" \" << std::endl; exit(1); } for (int i = 1; i < argc; ++i) { @@ -49,7 +49,7 @@ } else { search_string = argv[i]; break; - } + } } } }" Debug: 05-18 23:51:51 some body finished Debug: 05-18 23:51:51 one not finished. Debug: 05-18 23:51:51 ====reading 2011 of (2011) bytes . Finished: 0 Debug: 05-18 23:51:51 ====reading 0 of (2011) bytes . Finished: 0 Debug: 05-18 23:51:51 ====reading 0 of (2011) bytes . Finished: 0 Warning: 05-18 23:51:51 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:52:09 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:52:09 scheme: "gdlookup" Debug: 05-18 23:52:09 host: "localhost" Debug: 05-18 23:52:09 clear current dictionaries: "議" Debug: 05-18 23:52:09 some body finished Debug: 05-18 23:52:09 one not finished. Debug: 05-18 23:52:09 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 23:52:09 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:52:09 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 23:52:09 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:52:11 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:52:11 scheme: "gdlookup" Debug: 05-18 23:52:11 host: "localhost" Debug: 05-18 23:52:11 clear current dictionaries: "ゆっくり" Debug: 05-18 23:52:11 some body finished Debug: 05-18 23:52:11 one not finished. Debug: 05-18 23:52:11 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 23:52:11 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:52:11 ====reading 0 of (1415) bytes . Finished: 0 Warning: 05-18 23:52:11 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:52:14 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:52:14 scheme: "gdlookup" Debug: 05-18 23:52:14 host: "localhost" Debug: 05-18 23:52:14 clear current dictionaries: "転生したら剣でした" Debug: 05-18 23:52:14 some body finished Debug: 05-18 23:52:14 one not finished. Debug: 05-18 23:52:14 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 23:52:14 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:52:14 ====reading 0 of (1430) bytes . Finished: 0 Warning: 05-18 23:52:14 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:52:28 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:52:28 scheme: "gdlookup" Debug: 05-18 23:52:28 host: "localhost" Debug: 05-18 23:52:28 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:52:28 some body finished Debug: 05-18 23:52:28 one not finished. Debug: 05-18 23:52:28 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:52:28 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:52:28 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 23:52:28 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:55:00 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:55:00 scheme: "gdlookup" Debug: 05-18 23:55:00 host: "localhost" Debug: 05-18 23:55:00 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:55:00 some body finished Debug: 05-18 23:55:00 one not finished. Debug: 05-18 23:55:00 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:55:00 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:55:00 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 23:55:00 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:55:51 translating from clipboard or selection Debug: 05-18 23:55:51 clipboard data: "&& !sentence.empty()" Debug: 05-18 23:55:51 Current state: true true false true Debug: 05-18 23:55:51 getResource: "gdlookup://localhost/?word=%26%26 !sentence.empty()&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:55:51 scheme: "gdlookup" Debug: 05-18 23:55:51 host: "localhost" Debug: 05-18 23:55:51 clear current dictionaries: "&& !sentence.empty()" Debug: 05-18 23:55:51 some body finished Debug: 05-18 23:55:51 one not finished. Debug: 05-18 23:55:51 ====reading 1431 of (1431) bytes . Finished: 0 Debug: 05-18 23:55:51 ====reading 0 of (1431) bytes . Finished: 0 Debug: 05-18 23:55:51 ====reading 0 of (1431) bytes . Finished: 0 Warning: 05-18 23:55:51 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:55:52 translating from clipboard or selection Debug: 05-18 23:55:52 clipboard data: "&& !sentence.empty()" Debug: 05-18 23:55:52 Current state: true false false true Debug: 05-18 23:55:52 getResource: "gdlookup://localhost/?word=%26%26 !sentence.empty()&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:55:52 scheme: "gdlookup" Debug: 05-18 23:55:52 host: "localhost" Debug: 05-18 23:55:52 clear current dictionaries: "&& !sentence.empty()" Debug: 05-18 23:55:52 some body finished Debug: 05-18 23:55:52 one not finished. Debug: 05-18 23:55:52 ====reading 1431 of (1431) bytes . Finished: 0 Debug: 05-18 23:55:52 ====reading 0 of (1431) bytes . Finished: 0 Debug: 05-18 23:55:52 ====reading 0 of (1431) bytes . Finished: 0 Warning: 05-18 23:55:52 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:55:53 translating from clipboard or selection Debug: 05-18 23:55:53 clipboard data: "&& !sentence.empty()" Debug: 05-18 23:55:53 Current state: true false true true Debug: 05-18 23:55:53 getResource: "gdlookup://localhost/?word=%26%26 !sentence.empty()&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:55:53 scheme: "gdlookup" Debug: 05-18 23:55:53 host: "localhost" Debug: 05-18 23:55:53 clear current dictionaries: "&& !sentence.empty()" Debug: 05-18 23:55:53 some body finished Debug: 05-18 23:55:53 one not finished. Debug: 05-18 23:55:53 ====reading 1431 of (1431) bytes . Finished: 0 Debug: 05-18 23:55:53 ====reading 0 of (1431) bytes . Finished: 0 Debug: 05-18 23:55:53 ====reading 0 of (1431) bytes . Finished: 0 Warning: 05-18 23:55:53 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:13 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:13 scheme: "gdlookup" Debug: 05-18 23:56:13 host: "localhost" Debug: 05-18 23:56:13 clear current dictionaries: "議" Debug: 05-18 23:56:13 some body finished Debug: 05-18 23:56:13 one not finished. Debug: 05-18 23:56:13 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 23:56:13 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:56:13 ====reading 0 of (1406) bytes . Finished: 0 Warning: 05-18 23:56:13 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:14 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:14 scheme: "gdlookup" Debug: 05-18 23:56:14 host: "localhost" Debug: 05-18 23:56:14 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:56:14 some body finished Debug: 05-18 23:56:14 one not finished. Debug: 05-18 23:56:14 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:56:14 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:56:14 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 23:56:14 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:30 translating from clipboard or selection Debug: 05-18 23:56:30 clipboard data: "og_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:30 Current state: true true false true Debug: 05-18 23:56:30 getResource: "gdlookup://localhost/?word=og_internal(%22Search string overridden by sentence: %22 + search_string);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:30 scheme: "gdlookup" Debug: 05-18 23:56:30 host: "localhost" Debug: 05-18 23:56:30 clear current dictionaries: "og_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:30 some body finished Debug: 05-18 23:56:30 one not finished. Debug: 05-18 23:56:30 ====reading 1483 of (1483) bytes . Finished: 0 Debug: 05-18 23:56:30 ====reading 0 of (1483) bytes . Finished: 0 Debug: 05-18 23:56:30 ====reading 0 of (1483) bytes . Finished: 0 Warning: 05-18 23:56:30 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:32 translating from clipboard or selection Debug: 05-18 23:56:32 clipboard data: "search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:32 Current state: true false false true Debug: 05-18 23:56:32 getResource: "gdlookup://localhost/?word=search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:32 scheme: "gdlookup" Debug: 05-18 23:56:32 host: "localhost" Debug: 05-18 23:56:32 clear current dictionaries: "search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:32 some body finished Debug: 05-18 23:56:32 one not finished. Debug: 05-18 23:56:32 ====reading 1510 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:32 ====reading 0 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:32 ====reading 0 of (1510) bytes . Finished: 0 Warning: 05-18 23:56:32 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:33 translating from clipboard or selection Debug: 05-18 23:56:33 clipboard data: " search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:33 Current state: true false true true Debug: 05-18 23:56:33 getResource: "gdlookup://localhost/?word=search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:33 scheme: "gdlookup" Debug: 05-18 23:56:33 host: "localhost" Debug: 05-18 23:56:33 clear current dictionaries: "search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:33 some body finished Debug: 05-18 23:56:33 one not finished. Debug: 05-18 23:56:33 ====reading 1510 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:33 ====reading 0 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:33 ====reading 0 of (1510) bytes . Finished: 0 Warning: 05-18 23:56:33 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:34 translating from clipboard or selection Debug: 05-18 23:56:34 clipboard data: " search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:34 Current state: true false true true Debug: 05-18 23:56:34 getResource: "gdlookup://localhost/?word=search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:34 scheme: "gdlookup" Debug: 05-18 23:56:34 host: "localhost" Debug: 05-18 23:56:34 clear current dictionaries: "search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:34 some body finished Debug: 05-18 23:56:34 one not finished. Debug: 05-18 23:56:34 ====reading 1510 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:34 ====reading 0 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:34 ====reading 0 of (1510) bytes . Finished: 0 Warning: 05-18 23:56:34 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:35 translating from clipboard or selection Debug: 05-18 23:56:35 clipboard data: " search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:35 Current state: true false true true Debug: 05-18 23:56:35 getResource: "gdlookup://localhost/?word=search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:35 scheme: "gdlookup" Debug: 05-18 23:56:35 host: "localhost" Debug: 05-18 23:56:35 clear current dictionaries: "search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:35 some body finished Debug: 05-18 23:56:35 one not finished. Debug: 05-18 23:56:35 ====reading 1510 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:35 ====reading 0 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:35 ====reading 0 of (1510) bytes . Finished: 0 Warning: 05-18 23:56:35 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:56:37 translating from clipboard or selection Debug: 05-18 23:56:37 clipboard data: " search_string = sentence;\n log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:37 Current state: true false true true Debug: 05-18 23:56:37 getResource: "gdlookup://localhost/?word=search_string %3D sentence; log_internal(%22Search string overridden by sentence: %22 + search_string);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:56:37 scheme: "gdlookup" Debug: 05-18 23:56:37 host: "localhost" Debug: 05-18 23:56:37 clear current dictionaries: "search_string = sentence; log_internal(\"Search string overridden by sentence: \" + search_string);" Debug: 05-18 23:56:37 some body finished Debug: 05-18 23:56:37 one not finished. Debug: 05-18 23:56:37 ====reading 1510 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:37 ====reading 0 of (1510) bytes . Finished: 0 Debug: 05-18 23:56:37 ====reading 0 of (1510) bytes . Finished: 0 Warning: 05-18 23:56:37 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:57:07 translating from clipboard or selection Debug: 05-18 23:57:07 clipboard data: "get_input(argc, argv, goldendict_mode);" Debug: 05-18 23:57:07 Current state: true false true true Debug: 05-18 23:57:07 getResource: "gdlookup://localhost/?word=get_input(argc, argv, goldendict_mode);&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:07 scheme: "gdlookup" Debug: 05-18 23:57:07 host: "localhost" Debug: 05-18 23:57:07 clear current dictionaries: "get_input(argc, argv, goldendict_mode);" Debug: 05-18 23:57:07 some body finished Debug: 05-18 23:57:07 one not finished. Debug: 05-18 23:57:07 ====reading 1442 of (1442) bytes . Finished: 0 Debug: 05-18 23:57:07 ====reading 0 of (1442) bytes . Finished: 0 Debug: 05-18 23:57:07 ====reading 0 of (1442) bytes . Finished: 0 Warning: 05-18 23:57:07 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:57:08 translating from clipboard or selection Debug: 05-18 23:57:08 clipboard data: "get_input(argc, argv, goldendict_mode)" Debug: 05-18 23:57:08 Current state: true false true true Debug: 05-18 23:57:08 getResource: "gdlookup://localhost/?word=get_input(argc, argv, goldendict_mode)&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:08 scheme: "gdlookup" Debug: 05-18 23:57:08 host: "localhost" Debug: 05-18 23:57:08 clear current dictionaries: "get_input(argc, argv, goldendict_mode)" Debug: 05-18 23:57:08 some body finished Debug: 05-18 23:57:08 one not finished. Debug: 05-18 23:57:08 ====reading 1441 of (1441) bytes . Finished: 0 Debug: 05-18 23:57:08 ====reading 0 of (1441) bytes . Finished: 0 Debug: 05-18 23:57:08 ====reading 0 of (1441) bytes . Finished: 0 Warning: 05-18 23:57:08 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:57:09 translating from clipboard or selection Debug: 05-18 23:57:09 clipboard data: "get_input(argc, argv, goldendict_mode)" Debug: 05-18 23:57:09 Current state: true false true true Debug: 05-18 23:57:09 getResource: "gdlookup://localhost/?word=get_input(argc, argv, goldendict_mode)&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:09 scheme: "gdlookup" Debug: 05-18 23:57:09 host: "localhost" Debug: 05-18 23:57:09 clear current dictionaries: "get_input(argc, argv, goldendict_mode)" Debug: 05-18 23:57:09 some body finished Debug: 05-18 23:57:09 one not finished. Debug: 05-18 23:57:09 ====reading 1441 of (1441) bytes . Finished: 0 Debug: 05-18 23:57:09 ====reading 0 of (1441) bytes . Finished: 0 Debug: 05-18 23:57:09 ====reading 0 of (1441) bytes . Finished: 0 Warning: 05-18 23:57:09 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:57:32 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:32 scheme: "gdlookup" Debug: 05-18 23:57:32 host: "localhost" Debug: 05-18 23:57:32 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:57:32 some body finished Debug: 05-18 23:57:32 one not finished. Debug: 05-18 23:57:32 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:57:32 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:57:32 ====reading 0 of (1421) bytes . Finished: 0 Warning: 05-18 23:57:32 QProcess: Destroyed while process ("/tmp/Hakurei/hakurei") is still running. Debug: 05-18 23:57:32 some body finished Debug: 05-18 23:57:32 one finished. Debug: 05-18 23:57:32 erasing.. Debug: 05-18 23:57:32 erase done.. Debug: 05-18 23:57:32 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:32 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:57:32 ====reading 4009 of (5430) bytes . Finished: 1 Debug: 05-18 23:57:32 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:57:32 scheme: "gico" Debug: 05-18 23:57:32 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:32 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 23:57:39 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:39 scheme: "gdlookup" Debug: 05-18 23:57:39 host: "localhost" Debug: 05-18 23:57:39 clear current dictionaries: "ゆっくり" Debug: 05-18 23:57:39 some body finished Debug: 05-18 23:57:39 one not finished. Debug: 05-18 23:57:39 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 23:57:39 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:57:39 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:57:39 some body finished Debug: 05-18 23:57:39 one finished. Debug: 05-18 23:57:39 erasing.. Debug: 05-18 23:57:39 erase done.. Debug: 05-18 23:57:39 send dicts(finished): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:39 ====reading 3955 of (5370) bytes . Finished: 1 Debug: 05-18 23:57:39 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:57:39 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:57:39 scheme: "gico" Debug: 05-18 23:57:39 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:39 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b9663" true Debug: 05-18 23:57:39 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:39 scheme: "gdlookup" Debug: 05-18 23:57:39 host: "localhost" Debug: 05-18 23:57:39 clear current dictionaries: "転生したら剣でした" Debug: 05-18 23:57:39 some body finished Debug: 05-18 23:57:39 one not finished. Debug: 05-18 23:57:39 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 23:57:39 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:57:39 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:57:39 some body finished Debug: 05-18 23:57:39 one finished. Debug: 05-18 23:57:39 erasing.. Debug: 05-18 23:57:39 erase done.. Debug: 05-18 23:57:39 send dicts(finished): "groupId:1,word:転生したら剣でした,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:39 ====reading 5340 of (6770) bytes . Finished: 1 Debug: 05-18 23:57:39 receive dicts, current word: "転生したら剣でした" "転生したら剣でした" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:57:39 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:57:39 scheme: "gico" Debug: 05-18 23:57:39 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:39 article view loaded url: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22" true Debug: 05-18 23:57:40 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:40 scheme: "gdlookup" Debug: 05-18 23:57:40 host: "localhost" Debug: 05-18 23:57:40 clear current dictionaries: "ゆっくり" Debug: 05-18 23:57:40 some body finished Debug: 05-18 23:57:40 one not finished. Debug: 05-18 23:57:40 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 23:57:40 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:57:40 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:57:40 some body finished Debug: 05-18 23:57:40 one finished. Debug: 05-18 23:57:40 erasing.. Debug: 05-18 23:57:40 erase done.. Debug: 05-18 23:57:40 send dicts(finished): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:40 ====reading 3955 of (5370) bytes . Finished: 1 Debug: 05-18 23:57:40 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:57:40 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:57:40 scheme: "gico" Debug: 05-18 23:57:40 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:40 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b9663" true Debug: 05-18 23:57:40 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:40 scheme: "gdlookup" Debug: 05-18 23:57:40 host: "localhost" Debug: 05-18 23:57:40 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:57:40 some body finished Debug: 05-18 23:57:40 one not finished. Debug: 05-18 23:57:40 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:57:40 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:57:40 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:57:40 some body finished Debug: 05-18 23:57:40 one finished. Debug: 05-18 23:57:40 erasing.. Debug: 05-18 23:57:40 erase done.. Debug: 05-18 23:57:40 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:40 ====reading 4009 of (5430) bytes . Finished: 1 Debug: 05-18 23:57:40 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:57:40 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:57:40 scheme: "gico" Debug: 05-18 23:57:40 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:40 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 23:57:41 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:41 scheme: "gdlookup" Debug: 05-18 23:57:41 host: "localhost" Debug: 05-18 23:57:41 clear current dictionaries: "違和感" Debug: 05-18 23:57:41 some body finished Debug: 05-18 23:57:41 one not finished. Debug: 05-18 23:57:41 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 23:57:41 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:57:41 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:57:41 some body finished Debug: 05-18 23:57:41 one finished. Debug: 05-18 23:57:41 erasing.. Debug: 05-18 23:57:41 erase done.. Debug: 05-18 23:57:41 send dicts(finished): "groupId:1,word:違和感,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:41 receive dicts, current word: "違和感" "違和感" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:57:41 ====reading 2678 of (4090) bytes . Finished: 1 Debug: 05-18 23:57:41 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:57:41 scheme: "gico" Debug: 05-18 23:57:41 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:41 article view loaded url: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96631" true Debug: 05-18 23:57:41 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:57:41 scheme: "gdlookup" Debug: 05-18 23:57:41 host: "localhost" Debug: 05-18 23:57:41 clear current dictionaries: "転生したら剣でした" Debug: 05-18 23:57:41 some body finished Debug: 05-18 23:57:41 one not finished. Debug: 05-18 23:57:41 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 23:57:41 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:57:41 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:57:41 some body finished Debug: 05-18 23:57:41 one finished. Debug: 05-18 23:57:41 erasing.. Debug: 05-18 23:57:41 erase done.. Debug: 05-18 23:57:41 send dicts(finished): "groupId:1,word:転生したら剣でした,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:41 ====reading 5340 of (6770) bytes . Finished: 1 Debug: 05-18 23:57:41 receive dicts, current word: "転生したら剣でした" "転生したら剣でした" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:57:41 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:57:41 scheme: "gico" Debug: 05-18 23:57:41 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:57:41 article view loaded url: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22" true Debug: 05-18 23:58:01 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:01 scheme: "gdlookup" Debug: 05-18 23:58:01 host: "localhost" Debug: 05-18 23:58:01 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:58:01 some body finished Debug: 05-18 23:58:01 one not finished. Debug: 05-18 23:58:01 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:01 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:01 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:01 some body finished Debug: 05-18 23:58:01 one finished. Debug: 05-18 23:58:01 erasing.. Debug: 05-18 23:58:01 erase done.. Debug: 05-18 23:58:01 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:01 ====reading 4009 of (5430) bytes . Finished: 1 Debug: 05-18 23:58:01 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:01 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:01 scheme: "gico" Debug: 05-18 23:58:01 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:01 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 23:58:01 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:01 scheme: "gdlookup" Debug: 05-18 23:58:01 host: "localhost" Debug: 05-18 23:58:01 clear current dictionaries: "違和感" Debug: 05-18 23:58:01 some body finished Debug: 05-18 23:58:01 one not finished. Debug: 05-18 23:58:01 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:01 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:01 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:01 some body finished Debug: 05-18 23:58:01 one finished. Debug: 05-18 23:58:01 erasing.. Debug: 05-18 23:58:01 erase done.. Debug: 05-18 23:58:01 send dicts(finished): "groupId:1,word:違和感,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:01 receive dicts, current word: "違和感" "違和感" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:01 ====reading 2678 of (4090) bytes . Finished: 1 Debug: 05-18 23:58:01 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:01 scheme: "gico" Debug: 05-18 23:58:01 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:01 article view loaded url: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96631" true Debug: 05-18 23:58:02 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:02 scheme: "gdlookup" Debug: 05-18 23:58:02 host: "localhost" Debug: 05-18 23:58:02 clear current dictionaries: "議" Debug: 05-18 23:58:02 some body finished Debug: 05-18 23:58:02 one not finished. Debug: 05-18 23:58:02 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:02 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:02 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:02 some body finished Debug: 05-18 23:58:02 one finished. Debug: 05-18 23:58:02 erasing.. Debug: 05-18 23:58:02 erase done.. Debug: 05-18 23:58:02 send dicts(finished): "groupId:1,word:議,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:02 receive dicts, current word: "議" "議" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:02 ====reading 1329 of (2735) bytes . Finished: 1 Debug: 05-18 23:58:02 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:02 scheme: "gico" Debug: 05-18 23:58:02 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:02 article view loaded url: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a" true Debug: 05-18 23:58:02 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:02 scheme: "gdlookup" Debug: 05-18 23:58:02 host: "localhost" Debug: 05-18 23:58:02 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:58:02 some body finished Debug: 05-18 23:58:02 one not finished. Debug: 05-18 23:58:02 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:02 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:02 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:02 some body finished Debug: 05-18 23:58:02 one finished. Debug: 05-18 23:58:02 erasing.. Debug: 05-18 23:58:02 erase done.. Debug: 05-18 23:58:02 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:02 ====reading 4009 of (5430) bytes . Finished: 1 Debug: 05-18 23:58:02 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:02 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:02 scheme: "gico" Debug: 05-18 23:58:02 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:02 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 23:58:02 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:02 scheme: "gdlookup" Debug: 05-18 23:58:02 host: "localhost" Debug: 05-18 23:58:02 clear current dictionaries: "ゆっくり" Debug: 05-18 23:58:02 some body finished Debug: 05-18 23:58:02 one not finished. Debug: 05-18 23:58:02 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:02 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:02 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:02 some body finished Debug: 05-18 23:58:02 one finished. Debug: 05-18 23:58:02 erasing.. Debug: 05-18 23:58:02 erase done.. Debug: 05-18 23:58:02 send dicts(finished): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:02 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:02 ====reading 3955 of (5370) bytes . Finished: 1 Debug: 05-18 23:58:02 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:02 scheme: "gico" Debug: 05-18 23:58:02 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:02 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b9663" true Debug: 05-18 23:58:03 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:03 scheme: "gdlookup" Debug: 05-18 23:58:03 host: "localhost" Debug: 05-18 23:58:03 clear current dictionaries: "転生したら剣でした" Debug: 05-18 23:58:03 some body finished Debug: 05-18 23:58:03 one not finished. Debug: 05-18 23:58:03 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 23:58:03 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:58:03 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:58:03 some body finished Debug: 05-18 23:58:03 one finished. Debug: 05-18 23:58:03 erasing.. Debug: 05-18 23:58:03 erase done.. Debug: 05-18 23:58:03 send dicts(finished): "groupId:1,word:転生したら剣でした,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:03 ====reading 5340 of (6770) bytes . Finished: 1 Debug: 05-18 23:58:03 receive dicts, current word: "転生したら剣でした" "転生したら剣でした" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:03 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:03 scheme: "gico" Debug: 05-18 23:58:03 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:03 article view loaded url: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22" true Debug: 05-18 23:58:03 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:03 scheme: "gdlookup" Debug: 05-18 23:58:03 host: "localhost" Debug: 05-18 23:58:03 clear current dictionaries: "議" Debug: 05-18 23:58:03 some body finished Debug: 05-18 23:58:03 one not finished. Debug: 05-18 23:58:03 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:03 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:03 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:03 some body finished Debug: 05-18 23:58:03 one finished. Debug: 05-18 23:58:03 erasing.. Debug: 05-18 23:58:03 erase done.. Debug: 05-18 23:58:03 send dicts(finished): "groupId:1,word:議,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:03 receive dicts, current word: "議" "議" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:03 ====reading 1329 of (2735) bytes . Finished: 1 Debug: 05-18 23:58:03 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:03 scheme: "gico" Debug: 05-18 23:58:03 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:03 article view loaded url: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a" true Debug: 05-18 23:58:04 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:04 scheme: "gdlookup" Debug: 05-18 23:58:04 host: "localhost" Debug: 05-18 23:58:04 clear current dictionaries: "納得が行く" Debug: 05-18 23:58:04 some body finished Debug: 05-18 23:58:04 one not finished. Debug: 05-18 23:58:04 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 23:58:04 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 23:58:04 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 23:58:04 some body finished Debug: 05-18 23:58:04 one finished. Debug: 05-18 23:58:04 erasing.. Debug: 05-18 23:58:04 erase done.. Debug: 05-18 23:58:04 send dicts(finished): "groupId:1,word:納得が行く,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:04 receive dicts, current word: "納得が行く" "納得が行く" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:04 ====reading 3991 of (5409) bytes . Finished: 1 Debug: 05-18 23:58:04 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:04 scheme: "gico" Debug: 05-18 23:58:04 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:04 article view loaded url: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966" true Debug: 05-18 23:58:04 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:04 scheme: "gdlookup" Debug: 05-18 23:58:04 host: "localhost" Debug: 05-18 23:58:04 clear current dictionaries: "ゆっくり" Debug: 05-18 23:58:04 some body finished Debug: 05-18 23:58:04 one not finished. Debug: 05-18 23:58:04 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:04 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:04 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:04 some body finished Debug: 05-18 23:58:04 one finished. Debug: 05-18 23:58:04 erasing.. Debug: 05-18 23:58:04 erase done.. Debug: 05-18 23:58:04 send dicts(finished): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:04 ====reading 3955 of (5370) bytes . Finished: 1 Debug: 05-18 23:58:04 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:04 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:04 scheme: "gico" Debug: 05-18 23:58:04 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:04 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b9663" true Debug: 05-18 23:58:05 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:05 scheme: "gdlookup" Debug: 05-18 23:58:05 host: "localhost" Debug: 05-18 23:58:05 clear current dictionaries: "違和感" Debug: 05-18 23:58:05 some body finished Debug: 05-18 23:58:05 one not finished. Debug: 05-18 23:58:05 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:05 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:05 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:05 some body finished Debug: 05-18 23:58:05 one finished. Debug: 05-18 23:58:05 erasing.. Debug: 05-18 23:58:05 erase done.. Debug: 05-18 23:58:05 send dicts(finished): "groupId:1,word:違和感,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:05 ====reading 2678 of (4090) bytes . Finished: 1 Debug: 05-18 23:58:05 receive dicts, current word: "違和感" "違和感" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:05 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:05 scheme: "gico" Debug: 05-18 23:58:05 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:05 article view loaded url: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96631" true Debug: 05-18 23:58:05 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:05 scheme: "gdlookup" Debug: 05-18 23:58:05 host: "localhost" Debug: 05-18 23:58:05 clear current dictionaries: "転生したら剣でした" Debug: 05-18 23:58:05 some body finished Debug: 05-18 23:58:05 one not finished. Debug: 05-18 23:58:05 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-18 23:58:05 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:58:05 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-18 23:58:05 some body finished Debug: 05-18 23:58:05 one finished. Debug: 05-18 23:58:05 erasing.. Debug: 05-18 23:58:05 erase done.. Debug: 05-18 23:58:05 send dicts(finished): "groupId:1,word:転生したら剣でした,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:05 ====reading 5340 of (6770) bytes . Finished: 1 Debug: 05-18 23:58:05 receive dicts, current word: "転生したら剣でした" "転生したら剣でした" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:05 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:05 scheme: "gico" Debug: 05-18 23:58:05 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:05 article view loaded url: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22" true Debug: 05-18 23:58:05 getResource: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:05 scheme: "gdlookup" Debug: 05-18 23:58:05 host: "localhost" Debug: 05-18 23:58:05 clear current dictionaries: "違和感" Debug: 05-18 23:58:05 some body finished Debug: 05-18 23:58:05 one not finished. Debug: 05-18 23:58:05 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:05 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:05 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-18 23:58:05 some body finished Debug: 05-18 23:58:05 one finished. Debug: 05-18 23:58:05 erasing.. Debug: 05-18 23:58:05 erase done.. Debug: 05-18 23:58:05 send dicts(finished): "groupId:1,word:違和感,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:05 ====reading 2678 of (4090) bytes . Finished: 1 Debug: 05-18 23:58:05 receive dicts, current word: "違和感" "違和感" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:05 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:05 scheme: "gico" Debug: 05-18 23:58:05 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:05 article view loaded url: "gdlookup://localhost/?word=違和感&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96631" true Debug: 05-18 23:58:17 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:17 scheme: "gdlookup" Debug: 05-18 23:58:17 host: "localhost" Debug: 05-18 23:58:17 clear current dictionaries: "ゆっくり" Debug: 05-18 23:58:17 some body finished Debug: 05-18 23:58:17 one not finished. Debug: 05-18 23:58:17 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:17 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:17 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:17 some body finished Debug: 05-18 23:58:17 one finished. Debug: 05-18 23:58:17 erasing.. Debug: 05-18 23:58:17 erase done.. Debug: 05-18 23:58:17 send dicts(finished): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:17 ====reading 3955 of (5370) bytes . Finished: 1 Debug: 05-18 23:58:17 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:17 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:17 scheme: "gico" Debug: 05-18 23:58:17 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:17 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b9663" true Debug: 05-18 23:58:17 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:17 scheme: "gdlookup" Debug: 05-18 23:58:17 host: "localhost" Debug: 05-18 23:58:17 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:58:17 some body finished Debug: 05-18 23:58:17 one not finished. Debug: 05-18 23:58:17 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:17 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:17 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:58:18 some body finished Debug: 05-18 23:58:18 one finished. Debug: 05-18 23:58:18 erasing.. Debug: 05-18 23:58:18 erase done.. Debug: 05-18 23:58:18 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 ====reading 4009 of (5430) bytes . Finished: 1 Debug: 05-18 23:58:18 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:18 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:18 scheme: "gico" Debug: 05-18 23:58:18 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 23:58:18 getResource: "gdlookup://localhost/?word=意識&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:18 scheme: "gdlookup" Debug: 05-18 23:58:18 host: "localhost" Debug: 05-18 23:58:18 clear current dictionaries: "意識" Debug: 05-18 23:58:18 some body finished Debug: 05-18 23:58:18 one not finished. Debug: 05-18 23:58:18 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 23:58:18 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 23:58:18 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 23:58:18 some body finished Debug: 05-18 23:58:18 one finished. Debug: 05-18 23:58:18 erasing.. Debug: 05-18 23:58:18 erase done.. Debug: 05-18 23:58:18 send dicts(finished): "groupId:1,word:意識,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 ====reading 2600 of (4009) bytes . Finished: 1 Debug: 05-18 23:58:18 receive dicts, current word: "意識" "意識" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:18 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:18 scheme: "gico" Debug: 05-18 23:58:18 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 article view loaded url: "gdlookup://localhost/?word=意識&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313" true Debug: 05-18 23:58:18 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:18 scheme: "gdlookup" Debug: 05-18 23:58:18 host: "localhost" Debug: 05-18 23:58:18 clear current dictionaries: "議" Debug: 05-18 23:58:18 some body finished Debug: 05-18 23:58:18 one not finished. Debug: 05-18 23:58:18 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:18 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:18 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:58:18 some body finished Debug: 05-18 23:58:18 one finished. Debug: 05-18 23:58:18 erasing.. Debug: 05-18 23:58:18 erase done.. Debug: 05-18 23:58:18 send dicts(finished): "groupId:1,word:議,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 receive dicts, current word: "議" "議" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:18 ====reading 1329 of (2735) bytes . Finished: 1 Debug: 05-18 23:58:18 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:18 scheme: "gico" Debug: 05-18 23:58:18 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 article view loaded url: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a" true Debug: 05-18 23:58:18 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:58:18 scheme: "gdlookup" Debug: 05-18 23:58:18 host: "localhost" Debug: 05-18 23:58:18 clear current dictionaries: "ゆっくり" Debug: 05-18 23:58:18 some body finished Debug: 05-18 23:58:18 one not finished. Debug: 05-18 23:58:18 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:18 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:18 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-18 23:58:18 some body finished Debug: 05-18 23:58:18 one finished. Debug: 05-18 23:58:18 erasing.. Debug: 05-18 23:58:18 erase done.. Debug: 05-18 23:58:18 send dicts(finished): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:58:18 ====reading 3955 of (5370) bytes . Finished: 1 Debug: 05-18 23:58:18 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:58:18 scheme: "gico" Debug: 05-18 23:58:18 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:58:18 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b9663" true Debug: 05-18 23:59:24 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:59:24 scheme: "gdlookup" Debug: 05-18 23:59:24 host: "localhost" Debug: 05-18 23:59:24 clear current dictionaries: "地獄の苦しみ" Debug: 05-18 23:59:24 some body finished Debug: 05-18 23:59:24 one not finished. Debug: 05-18 23:59:24 ====reading 1421 of (1421) bytes . Finished: 0 Debug: 05-18 23:59:24 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:59:24 ====reading 0 of (1421) bytes . Finished: 0 Debug: 05-18 23:59:24 some body finished Debug: 05-18 23:59:24 one finished. Debug: 05-18 23:59:24 erasing.. Debug: 05-18 23:59:24 erase done.. Debug: 05-18 23:59:24 send dicts(finished): "groupId:1,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:24 ====reading 1292 of (2713) bytes . Finished: 1 Debug: 05-18 23:59:24 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:59:24 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:59:24 scheme: "gico" Debug: 05-18 23:59:24 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:24 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b96" true Debug: 05-18 23:59:25 getResource: "gdlookup://localhost/?word=意識&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:59:25 scheme: "gdlookup" Debug: 05-18 23:59:25 host: "localhost" Debug: 05-18 23:59:25 clear current dictionaries: "意識" Debug: 05-18 23:59:25 some body finished Debug: 05-18 23:59:25 one not finished. Debug: 05-18 23:59:25 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-18 23:59:25 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 23:59:25 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-18 23:59:25 some body finished Debug: 05-18 23:59:25 one finished. Debug: 05-18 23:59:25 erasing.. Debug: 05-18 23:59:25 erase done.. Debug: 05-18 23:59:25 send dicts(finished): "groupId:1,word:意識,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:25 receive dicts, current word: "意識" "意識" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:59:25 ====reading 1292 of (2701) bytes . Finished: 1 Debug: 05-18 23:59:25 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:59:25 scheme: "gico" Debug: 05-18 23:59:25 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:25 article view loaded url: "gdlookup://localhost/?word=意識&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313" true Debug: 05-18 23:59:25 getResource: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:59:25 scheme: "gdlookup" Debug: 05-18 23:59:25 host: "localhost" Debug: 05-18 23:59:25 clear current dictionaries: "議" Debug: 05-18 23:59:25 some body finished Debug: 05-18 23:59:25 one not finished. Debug: 05-18 23:59:25 ====reading 1406 of (1406) bytes . Finished: 0 Debug: 05-18 23:59:25 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:59:25 ====reading 0 of (1406) bytes . Finished: 0 Debug: 05-18 23:59:25 some body finished Debug: 05-18 23:59:25 one finished. Debug: 05-18 23:59:25 erasing.. Debug: 05-18 23:59:25 erase done.. Debug: 05-18 23:59:25 send dicts(finished): "groupId:1,word:議,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:25 receive dicts, current word: "議" "議" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:59:25 ====reading 1292 of (2698) bytes . Finished: 1 Debug: 05-18 23:59:25 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:59:25 scheme: "gico" Debug: 05-18 23:59:25 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:25 article view loaded url: "gdlookup://localhost/?word=議&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a" true Debug: 05-18 23:59:44 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-18 23:59:44 scheme: "gdlookup" Debug: 05-18 23:59:44 host: "localhost" Debug: 05-18 23:59:44 clear current dictionaries: "納得が行く" Debug: 05-18 23:59:44 some body finished Debug: 05-18 23:59:44 one not finished. Debug: 05-18 23:59:44 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-18 23:59:44 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 23:59:44 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-18 23:59:44 some body finished Debug: 05-18 23:59:44 one finished. Debug: 05-18 23:59:44 erasing.. Debug: 05-18 23:59:44 erase done.. Debug: 05-18 23:59:44 send dicts(finished): "groupId:1,word:納得が行く,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:44 ====reading 3991 of (5409) bytes . Finished: 1 Debug: 05-18 23:59:44 receive dicts, current word: "納得が行く" "納得が行く" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-18 23:59:44 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-18 23:59:44 scheme: "gico" Debug: 05-18 23:59:44 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-18 23:59:44 article view loaded url: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966" true Debug: 05-19 00:00:00 translating from clipboard or selection Debug: 05-19 00:00:00 clipboard data: "" Debug: 05-19 00:00:16 open link url: QUrl("bword:が行") Debug: 05-19 00:00:16 getResource: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:16 scheme: "gdlookup" Debug: 05-19 00:00:16 host: "localhost" Debug: 05-19 00:00:16 clear current dictionaries: "が行" Debug: 05-19 00:00:16 some body finished Debug: 05-19 00:00:16 one not finished. Debug: 05-19 00:00:16 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:16 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:16 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:16 some body finished Debug: 05-19 00:00:16 one finished. Debug: 05-19 00:00:16 erasing.. Debug: 05-19 00:00:16 erase done.. Debug: 05-19 00:00:16 send dicts(finished): "groupId:1,word:が行,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:16 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:16 receive dicts, current word: "が行" "が行" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:00:16 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:16 scheme: "gico" Debug: 05-19 00:00:16 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:16 article view loaded url: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:17 open link url: QUrl("bword:が行") Debug: 05-19 00:00:17 getResource: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:17 scheme: "gdlookup" Debug: 05-19 00:00:17 host: "localhost" Debug: 05-19 00:00:17 clear current dictionaries: "が行" Debug: 05-19 00:00:17 some body finished Debug: 05-19 00:00:17 one not finished. Debug: 05-19 00:00:17 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:17 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:17 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:17 some body finished Debug: 05-19 00:00:17 one finished. Debug: 05-19 00:00:17 erasing.. Debug: 05-19 00:00:17 erase done.. Debug: 05-19 00:00:17 send dicts(finished): "groupId:1,word:が行,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:17 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:17 receive dicts, current word: "が行" "が行" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:00:17 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:17 scheme: "gico" Debug: 05-19 00:00:17 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:17 article view loaded url: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Info: 05-19 00:00:20 libpng warning: iCCP: known incorrect sRGB profile Debug: 05-19 00:00:20 getResource: "gdlookup://localhost/?word=が行&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:20 scheme: "gdlookup" Debug: 05-19 00:00:20 host: "localhost" Debug: 05-19 00:00:20 clear current dictionaries: "が行" Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 ====reading 1472 of (1472) bytes . Finished: 0 Debug: 05-19 00:00:20 ====reading 0 of (1472) bytes . Finished: 0 Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 ====reading 0 of (1472) bytes . Finished: 0 Debug: 05-19 00:00:20 open link url: QUrl("bword:納得") Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:20 scheme: "gdlookup" Debug: 05-19 00:00:20 host: "localhost" Debug: 05-19 00:00:20 some body finished Debug: 05-19 00:00:20 one not finished. Debug: 05-19 00:00:20 ====reading 1409 of (1409) bytes . Finished: 0 Warning: 05-19 00:00:20 QProcess: Destroyed while process ("gd-tools") is still running. Debug: 05-19 00:00:20 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:21 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:21 some body finished Debug: 05-19 00:00:21 one finished. Debug: 05-19 00:00:21 erasing.. Debug: 05-19 00:00:21 erase done.. Debug: 05-19 00:00:21 send dicts(finished): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:21 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:21 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:21 scheme: "gico" Debug: 05-19 00:00:21 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:21 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:22 open link url: QUrl("bword:が行") Debug: 05-19 00:00:22 getResource: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:22 scheme: "gdlookup" Debug: 05-19 00:00:22 host: "localhost" Debug: 05-19 00:00:22 some body finished Debug: 05-19 00:00:22 one not finished. Debug: 05-19 00:00:22 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:22 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:22 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:22 some body finished Debug: 05-19 00:00:22 one finished. Debug: 05-19 00:00:22 erasing.. Debug: 05-19 00:00:22 erase done.. Debug: 05-19 00:00:22 send dicts(finished): "groupId:1,word:が行,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:22 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:22 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:22 scheme: "gico" Debug: 05-19 00:00:22 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:22 article view loaded url: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:24 open link url: QUrl("bword:納得") Debug: 05-19 00:00:24 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:24 scheme: "gdlookup" Debug: 05-19 00:00:24 host: "localhost" Debug: 05-19 00:00:24 some body finished Debug: 05-19 00:00:24 one not finished. Debug: 05-19 00:00:24 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:24 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:24 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:24 some body finished Debug: 05-19 00:00:24 one finished. Debug: 05-19 00:00:24 erasing.. Debug: 05-19 00:00:24 erase done.. Debug: 05-19 00:00:24 send dicts(finished): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:24 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:24 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:24 scheme: "gico" Debug: 05-19 00:00:24 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:25 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:34 open link url: QUrl("bword:納得") Debug: 05-19 00:00:34 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:34 scheme: "gdlookup" Debug: 05-19 00:00:34 host: "localhost" Debug: 05-19 00:00:34 some body finished Debug: 05-19 00:00:34 one not finished. Debug: 05-19 00:00:34 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:34 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:34 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:34 some body finished Debug: 05-19 00:00:34 one finished. Debug: 05-19 00:00:34 erasing.. Debug: 05-19 00:00:34 erase done.. Debug: 05-19 00:00:34 send dicts(finished): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:34 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:34 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:34 scheme: "gico" Debug: 05-19 00:00:34 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:34 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:35 open link url: QUrl("bword:納得") Debug: 05-19 00:00:35 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:35 scheme: "gdlookup" Debug: 05-19 00:00:35 host: "localhost" Debug: 05-19 00:00:35 some body finished Debug: 05-19 00:00:35 one not finished. Debug: 05-19 00:00:35 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:35 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:35 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:35 some body finished Debug: 05-19 00:00:35 one finished. Debug: 05-19 00:00:35 erasing.. Debug: 05-19 00:00:35 erase done.. Debug: 05-19 00:00:35 send dicts(finished): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:35 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:35 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:35 scheme: "gico" Debug: 05-19 00:00:35 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:35 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:36 open link url: QUrl("bword:納得が行く") Debug: 05-19 00:00:36 getResource: "gdlookup://localhost/?word=納得が行く&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:36 scheme: "gdlookup" Debug: 05-19 00:00:36 host: "localhost" Debug: 05-19 00:00:36 some body finished Debug: 05-19 00:00:36 one not finished. Debug: 05-19 00:00:36 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-19 00:00:36 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:00:36 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:00:36 some body finished Debug: 05-19 00:00:36 one finished. Debug: 05-19 00:00:36 erasing.. Debug: 05-19 00:00:36 erase done.. Debug: 05-19 00:00:36 send dicts(finished): "groupId:1,word:納得が行く,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:36 ====reading 3991 of (5409) bytes . Finished: 1 Debug: 05-19 00:00:36 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:36 scheme: "gico" Debug: 05-19 00:00:36 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:36 article view loaded url: "gdlookup://localhost/?word=納得が行く&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f" true Debug: 05-19 00:00:37 open link url: QUrl("bword:納得") Debug: 05-19 00:00:37 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:37 scheme: "gdlookup" Debug: 05-19 00:00:37 host: "localhost" Debug: 05-19 00:00:37 some body finished Debug: 05-19 00:00:37 one not finished. Debug: 05-19 00:00:37 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:37 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:37 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:37 some body finished Debug: 05-19 00:00:37 one finished. Debug: 05-19 00:00:37 erasing.. Debug: 05-19 00:00:37 erase done.. Debug: 05-19 00:00:37 send dicts(finished): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:37 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:37 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:37 scheme: "gico" Debug: 05-19 00:00:37 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:37 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:37 open link url: QUrl("bword:納得が行く") Debug: 05-19 00:00:37 getResource: "gdlookup://localhost/?word=納得が行く&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:37 scheme: "gdlookup" Debug: 05-19 00:00:37 host: "localhost" Debug: 05-19 00:00:37 some body finished Debug: 05-19 00:00:37 one not finished. Debug: 05-19 00:00:37 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-19 00:00:37 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:00:37 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:00:37 some body finished Debug: 05-19 00:00:37 one finished. Debug: 05-19 00:00:37 erasing.. Debug: 05-19 00:00:37 erase done.. Debug: 05-19 00:00:37 send dicts(finished): "groupId:1,word:納得が行く,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:37 ====reading 3991 of (5409) bytes . Finished: 1 Debug: 05-19 00:00:37 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:37 scheme: "gico" Debug: 05-19 00:00:37 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:37 article view loaded url: "gdlookup://localhost/?word=納得が行く&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f" true Debug: 05-19 00:00:38 open link url: QUrl("bword:納得") Debug: 05-19 00:00:38 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:00:38 scheme: "gdlookup" Debug: 05-19 00:00:38 host: "localhost" Debug: 05-19 00:00:38 some body finished Debug: 05-19 00:00:38 one not finished. Debug: 05-19 00:00:38 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:38 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:38 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:00:38 some body finished Debug: 05-19 00:00:38 one finished. Debug: 05-19 00:00:38 erasing.. Debug: 05-19 00:00:38 erase done.. Debug: 05-19 00:00:38 send dicts(finished): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:38 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:00:38 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:38 scheme: "gico" Debug: 05-19 00:00:38 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:38 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422" true Debug: 05-19 00:00:39 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:39 scheme: "gdlookup" Debug: 05-19 00:00:39 host: "localhost" Debug: 05-19 00:00:39 clear current dictionaries: "地獄の苦しみ" Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 ====reading 1484 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 some body finished Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one finished. Debug: 05-19 00:00:39 erasing.. Debug: 05-19 00:00:39 erase done.. Debug: 05-19 00:00:39 one not finished. Debug: 05-19 00:00:39 send dicts(updated): "groupId:3,word:地獄の苦しみ,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:39 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-19 00:00:39 ====reading 3094 of (4578) bytes . Finished: 0 Debug: 05-19 00:00:39 ====reading 0 of (4578) bytes . Finished: 0 Debug: 05-19 00:00:39 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-19 00:00:39 scheme: "gico" Debug: 05-19 00:00:39 host: "00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 send dicts(finished): "groupId:3,word:地獄の苦しみ,dictId:77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:40 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("77635cf22dadc58222f44f3c4f281c1f") Debug: 05-19 00:00:40 ====reading 2312 of (6890) bytes . Finished: 1 Debug: 05-19 00:00:40 getResource: "bres://77635cf22dadc58222f44f3c4f281c1f/thesaurus.css" Debug: 05-19 00:00:40 scheme: "bres" Debug: 05-19 00:00:40 host: "77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:40 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-19 00:00:40 scheme: "gico" Debug: 05-19 00:00:40 host: "00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:40 getResource: "gico://77635cf22dadc58222f44f3c4f281c1f/dicticon.png" Debug: 05-19 00:00:40 scheme: "gico" Debug: 05-19 00:00:40 host: "77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:40 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" true Debug: 05-19 00:00:40 getResource: "gdlookup://localhost/?word=議&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:40 scheme: "gdlookup" Debug: 05-19 00:00:40 host: "localhost" Debug: 05-19 00:00:40 clear current dictionaries: "議" Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 ====reading 1469 of (1469) bytes . Finished: 0 Debug: 05-19 00:00:40 ====reading 0 of (1469) bytes . Finished: 0 Debug: 05-19 00:00:40 offset = 28ad5d Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 ====reading 0 of (1469) bytes . Finished: 0 Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one finished. Debug: 05-19 00:00:40 erasing.. Debug: 05-19 00:00:40 erase done.. Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 send dicts(updated): "groupId:3,word:議,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:40 ====reading 2391 of (3860) bytes . Finished: 0 Debug: 05-19 00:00:40 receive dicts, current word: "議" "議" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-19 00:00:40 ====reading 0 of (3860) bytes . Finished: 0 Debug: 05-19 00:00:40 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-19 00:00:40 scheme: "gico" Debug: 05-19 00:00:40 host: "00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:40 some body finished Debug: 05-19 00:00:40 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 getResource: "gdlookup://localhost/?word=ゆっくり&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:41 scheme: "gdlookup" Debug: 05-19 00:00:41 host: "localhost" Debug: 05-19 00:00:41 clear current dictionaries: "ゆっくり" Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 ====reading 1478 of (1478) bytes . Finished: 0 Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 ====reading 0 of (1478) bytes . Finished: 0 Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 ====reading 0 of (1478) bytes . Finished: 0 Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:41 offset = d64a00 Debug: 05-19 00:00:41 some body finished Debug: 05-19 00:00:41 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 send dicts(updated): "groupId:3,word:ゆっくり,dictId:00824c93f503c5d1680483abdf367948,c63783324ee9b8fc3309849bd8302845,7363ba2e34cddead0f19a4a2ec51304e,968c3a374ef50d74e019560ae8f69488,646c2fbd2278d23caf8bc5b44599f5aa,41e48e169f3b09f5d08c9821aa0e88af,133436b45f37007263000dd395a5cb19,f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 ====reading 28068 of (29546) bytes . Finished: 0 Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 ====reading 0 of (29546) bytes . Finished: 0 Debug: 05-19 00:00:42 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:42 scheme: "gdlookup" Debug: 05-19 00:00:42 host: "localhost" Debug: 05-19 00:00:42 clear current dictionaries: "地獄の苦しみ" Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 ====reading 1484 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:42 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 getResource: "bres://c63783324ee9b8fc3309849bd8302845/REIKOKU.css" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "c63783324ee9b8fc3309849bd8302845" Debug: 05-19 00:00:42 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 send dicts(updated): "groupId:3,word:地獄の苦しみ,dictId:00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:42 ====reading 3094 of (4578) bytes . Finished: 0 Debug: 05-19 00:00:42 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("00824c93f503c5d1680483abdf367948") Debug: 05-19 00:00:42 ====reading 0 of (4578) bytes . Finished: 0 Debug: 05-19 00:00:42 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/kojien.css" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:42 getResource: "gico://c63783324ee9b8fc3309849bd8302845/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "c63783324ee9b8fc3309849bd8302845" Debug: 05-19 00:00:42 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/kojien.js" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:42 getResource: "bres://968c3a374ef50d74e019560ae8f69488/NHK日本語発音アクセント辞書.css" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:00:42 getResource: "bres://646c2fbd2278d23caf8bc5b44599f5aa/smk8.css" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "646c2fbd2278d23caf8bc5b44599f5aa" Debug: 05-19 00:00:42 getResource: "bres://646c2fbd2278d23caf8bc5b44599f5aa/Audio.png" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "646c2fbd2278d23caf8bc5b44599f5aa" Debug: 05-19 00:00:42 getResource: "bres://41e48e169f3b09f5d08c9821aa0e88af/daijirin2.css" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "41e48e169f3b09f5d08c9821aa0e88af" Debug: 05-19 00:00:42 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/nikkoku.css" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:42 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E02D.gif" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:42 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E030.gif" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:42 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E031.gif" Debug: 05-19 00:00:42 scheme: "bres" Debug: 05-19 00:00:42 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:42 getResource: "gico://7363ba2e34cddead0f19a4a2ec51304e/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:42 getResource: "gico://968c3a374ef50d74e019560ae8f69488/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:00:42 getResource: "gico://646c2fbd2278d23caf8bc5b44599f5aa/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "646c2fbd2278d23caf8bc5b44599f5aa" Debug: 05-19 00:00:42 getResource: "gico://41e48e169f3b09f5d08c9821aa0e88af/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "41e48e169f3b09f5d08c9821aa0e88af" Debug: 05-19 00:00:42 getResource: "gico://133436b45f37007263000dd395a5cb19/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "133436b45f37007263000dd395a5cb19" Debug: 05-19 00:00:42 getResource: "gico://f2f3fca4482e832d2b39e39931f1861e/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 send dicts(finished): "groupId:3,word:ゆっくり,dictId:f60affb79583cb692ba2bca6df57444d,71ac9bc6d781652a85341bcf5a7fd63c,c3bba9ed1957c4d6553f24a97adf0202,f26420c7eb1d59c1076d59ccf790a337,8431bdd6831e3f351ad8799dc6d42d73,d0e35c7d8c2b432d0a57cdf7941f912a,fd22dd8651fc9f5383ca576b5ed6a3cf,304a839a02ce8080037171de2de2d336,38386df88d70b0c53b53e9b70967bf8e,0c31f468bbb31b720212d9a43bb8e0e6,fb4e6f53358b387157bec73b6cbe4c8c,76920f4e8caf20bf370acb7fea5fc232,77635cf22dadc58222f44f3c4f281c1f,f6038dc4737356a34acc5a0c8a194f4a,8dda33ca157805525b1038e6fef3b56c,c05cc9bea6ab9ca5a7e4fd9bd485c294,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 send dicts(finished): "groupId:3,word:地獄の苦しみ,dictId:77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:42 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("77635cf22dadc58222f44f3c4f281c1f") Debug: 05-19 00:00:42 ====reading 2312 of (6890) bytes . Finished: 1 Debug: 05-19 00:00:42 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:42 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:42 scheme: "gdlookup" Debug: 05-19 00:00:42 host: "localhost" Debug: 05-19 00:00:42 clear current dictionaries: "地獄の苦しみ" Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 ====reading 1484 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:42 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 ====reading 0 of (1484) bytes . Finished: 0 Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one not finished. Debug: 05-19 00:00:42 some body finished Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 one finished. Debug: 05-19 00:00:42 erasing.. Debug: 05-19 00:00:42 erase done.. Debug: 05-19 00:00:42 send dicts(finished): "groupId:3,word:地獄の苦しみ,dictId:00824c93f503c5d1680483abdf367948,77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:42 ====reading 5406 of (6890) bytes . Finished: 1 Debug: 05-19 00:00:42 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("00824c93f503c5d1680483abdf367948", "77635cf22dadc58222f44f3c4f281c1f") Debug: 05-19 00:00:42 getResource: "gico://00824c93f503c5d1680483abdf367948/dicticon.png" Debug: 05-19 00:00:42 scheme: "gico" Debug: 05-19 00:00:42 host: "00824c93f503c5d1680483abdf367948" Debug: 05-19 00:00:43 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" true Debug: 05-19 00:00:46 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:46 scheme: "gdlookup" Debug: 05-19 00:00:46 host: "localhost" Debug: 05-19 00:00:46 clear current dictionaries: "地獄の苦しみ" Debug: 05-19 00:00:46 some body finished Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 one finished. Debug: 05-19 00:00:46 erasing.. Debug: 05-19 00:00:46 erase done.. Debug: 05-19 00:00:46 send dicts(finished): "groupId:3,word:地獄の苦しみ,dictId:77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:46 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("77635cf22dadc58222f44f3c4f281c1f") Debug: 05-19 00:00:46 In-place finish. Debug: 05-19 00:00:46 ====reading 3729 of (3729) bytes . Finished: 1 Debug: 05-19 00:00:46 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,9dfe38c28e4eb0d417245e761da52517" true Debug: 05-19 00:00:49 getResource: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" Debug: 05-19 00:00:49 scheme: "gdlookup" Debug: 05-19 00:00:49 host: "localhost" Debug: 05-19 00:00:49 clear current dictionaries: "地獄の苦しみ" Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 send dicts(updated): "groupId:3,word:地獄の苦しみ,dictId:77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:49 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("77635cf22dadc58222f44f3c4f281c1f") Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 ====reading 3672 of (3672) bytes . Finished: 0 Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 ====reading 0 of (3672) bytes . Finished: 0 Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one not finished. Debug: 05-19 00:00:49 ====reading 0 of (3672) bytes . Finished: 0 Debug: 05-19 00:00:49 some body finished Debug: 05-19 00:00:49 one finished. Debug: 05-19 00:00:49 erasing.. Debug: 05-19 00:00:49 erase done.. Debug: 05-19 00:00:49 send dicts(finished): "groupId:3,word:地獄の苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:49 ====reading 4076 of (7748) bytes . Finished: 1 Debug: 05-19 00:00:49 receive dicts, current word: "地獄の苦しみ" "地獄の苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:00:49 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:49 scheme: "gico" Debug: 05-19 00:00:49 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:49 article view loaded url: "gdlookup://localhost/?word=地獄の苦しみ&group=3&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" true Debug: 05-19 00:00:51 open link url: QUrl("bword:苦しみ") Debug: 05-19 00:00:51 getResource: "gdlookup://localhost/?word=苦しみ&group=3&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" Debug: 05-19 00:00:51 scheme: "gdlookup" Debug: 05-19 00:00:51 host: "localhost" Debug: 05-19 00:00:51 clear current dictionaries: "苦しみ" Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 ====reading 1475 of (1475) bytes . Finished: 0 Debug: 05-19 00:00:51 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-19 00:00:51 offset = 4f0886 Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:51 some body finished Debug: 05-19 00:00:51 one not finished. Debug: 05-19 00:00:53 some body finished Debug: 05-19 00:00:53 one not finished. Debug: 05-19 00:00:53 some body finished Debug: 05-19 00:00:53 one not finished. Debug: 05-19 00:00:53 some body finished Debug: 05-19 00:00:53 one finished. Debug: 05-19 00:00:53 erasing.. Debug: 05-19 00:00:53 erase done.. Debug: 05-19 00:00:53 one not finished. Debug: 05-19 00:00:53 send dicts(updated): "groupId:3,word:苦しみ,dictId:c63783324ee9b8fc3309849bd8302845" Debug: 05-19 00:00:53 receive dicts, current word: "苦しみ" "苦しみ" : QList("c63783324ee9b8fc3309849bd8302845") Debug: 05-19 00:00:53 ====reading 2369 of (3844) bytes . Finished: 0 Debug: 05-19 00:00:53 ====reading 0 of (3844) bytes . Finished: 0 Debug: 05-19 00:00:53 getResource: "bres://c63783324ee9b8fc3309849bd8302845/REIKOKU.css" Debug: 05-19 00:00:53 scheme: "bres" Debug: 05-19 00:00:53 host: "c63783324ee9b8fc3309849bd8302845" Debug: 05-19 00:00:53 getResource: "gico://c63783324ee9b8fc3309849bd8302845/dicticon.png" Debug: 05-19 00:00:53 scheme: "gico" Debug: 05-19 00:00:53 host: "c63783324ee9b8fc3309849bd8302845" Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one not finished. Debug: 05-19 00:00:54 send dicts(updated): "groupId:3,word:苦しみ,dictId:7363ba2e34cddead0f19a4a2ec51304e,968c3a374ef50d74e019560ae8f69488,41e48e169f3b09f5d08c9821aa0e88af,133436b45f37007263000dd395a5cb19,f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 receive dicts, current word: "苦しみ" "苦しみ" : QList("7363ba2e34cddead0f19a4a2ec51304e", "968c3a374ef50d74e019560ae8f69488", "41e48e169f3b09f5d08c9821aa0e88af", "133436b45f37007263000dd395a5cb19", "f2f3fca4482e832d2b39e39931f1861e") Debug: 05-19 00:00:54 ====reading 18377 of (22221) bytes . Finished: 0 Debug: 05-19 00:00:54 ====reading 0 of (22221) bytes . Finished: 0 Debug: 05-19 00:00:54 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/kojien.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:54 getResource: "gico://7363ba2e34cddead0f19a4a2ec51304e/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:54 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/kojien.js" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:54 getResource: "gico://968c3a374ef50d74e019560ae8f69488/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:00:54 getResource: "bres://968c3a374ef50d74e019560ae8f69488/NHK日本語発音アクセント辞書.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:00:54 getResource: "gico://41e48e169f3b09f5d08c9821aa0e88af/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "41e48e169f3b09f5d08c9821aa0e88af" Debug: 05-19 00:00:54 getResource: "bres://41e48e169f3b09f5d08c9821aa0e88af/daijirin2.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "41e48e169f3b09f5d08c9821aa0e88af" Debug: 05-19 00:00:54 getResource: "gico://133436b45f37007263000dd395a5cb19/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "133436b45f37007263000dd395a5cb19" Debug: 05-19 00:00:54 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/nikkoku.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E030.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E02F.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E035.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E032.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E031.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/1C9F.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "gico://f2f3fca4482e832d2b39e39931f1861e/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:00:54 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/くるしみ【苦しみ】.png" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:54 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/くるしみ【苦しみ】2.png" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:54 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/Ten Mincho Text Regular.otf" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:00:54 some body finished Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 one finished. Debug: 05-19 00:00:54 erasing.. Debug: 05-19 00:00:54 erase done.. Debug: 05-19 00:00:54 send dicts(finished): "groupId:3,word:苦しみ,dictId:71ac9bc6d781652a85341bcf5a7fd63c,c3bba9ed1957c4d6553f24a97adf0202,d0e35c7d8c2b432d0a57cdf7941f912a,fd22dd8651fc9f5383ca576b5ed6a3cf,304a839a02ce8080037171de2de2d336,0c31f468bbb31b720212d9a43bb8e0e6,ab6643336366d243d73d1ce4b7fd8b8d,727597d1015ede1f019990d436029401,77635cf22dadc58222f44f3c4f281c1f,f6038dc4737356a34acc5a0c8a194f4a,8dda33ca157805525b1038e6fef3b56c,43bc82454c7f9962132daee50f10e63b,c05cc9bea6ab9ca5a7e4fd9bd485c294,b1e3f422135b95f15c0225ae27692050,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:54 ====reading 43315 of (134264) bytes . Finished: 1 Debug: 05-19 00:00:54 receive dicts, current word: "苦しみ" "苦しみ" : QList("71ac9bc6d781652a85341bcf5a7fd63c", "c3bba9ed1957c4d6553f24a97adf0202", "d0e35c7d8c2b432d0a57cdf7941f912a", "fd22dd8651fc9f5383ca576b5ed6a3cf", "304a839a02ce8080037171de2de2d336", "0c31f468bbb31b720212d9a43bb8e0e6", "ab6643336366d243d73d1ce4b7fd8b8d", "727597d1015ede1f019990d436029401", "77635cf22dadc58222f44f3c4f281c1f", "f6038dc4737356a34acc5a0c8a194f4a", "8dda33ca157805525b1038e6fef3b56c", "43bc82454c7f9962132daee50f10e63b", "c05cc9bea6ab9ca5a7e4fd9bd485c294", "b1e3f422135b95f15c0225ae27692050", "9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:00:54 ====reading 22221 of (134264) bytes . Finished: 1 Debug: 05-19 00:00:54 getResource: "gico://71ac9bc6d781652a85341bcf5a7fd63c/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/pe.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/pixiv-logo.png" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/pe.js" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "gico://c3bba9ed1957c4d6553f24a97adf0202/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "c3bba9ed1957c4d6553f24a97adf0202" Debug: 05-19 00:00:54 getResource: "bres://c3bba9ed1957c4d6553f24a97adf0202/DAIJIRIN3.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "c3bba9ed1957c4d6553f24a97adf0202" Debug: 05-19 00:00:54 getResource: "gico://d0e35c7d8c2b432d0a57cdf7941f912a/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/nikkoku.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 ====reading 43315 of (134264) bytes . Finished: 1 Debug: 05-19 00:00:54 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E030.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 ====reading 3192 of (134264) bytes . Finished: 1 Debug: 05-19 00:00:54 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E02F.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E035.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 getResource: "gico://fd22dd8651fc9f5383ca576b5ed6a3cf/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "fd22dd8651fc9f5383ca576b5ed6a3cf" Debug: 05-19 00:00:54 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E032.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E031.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/1C9F.gif" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:00:54 getResource: "gico://304a839a02ce8080037171de2de2d336/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "304a839a02ce8080037171de2de2d336" Debug: 05-19 00:00:54 getResource: "bres://fd22dd8651fc9f5383ca576b5ed6a3cf/DJS.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "fd22dd8651fc9f5383ca576b5ed6a3cf" Debug: 05-19 00:00:54 getResource: "bres://304a839a02ce8080037171de2de2d336/MK3.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "304a839a02ce8080037171de2de2d336" Debug: 05-19 00:00:54 getResource: "bres://304a839a02ce8080037171de2de2d336/gaiji/参考1.svg" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "304a839a02ce8080037171de2de2d336" Debug: 05-19 00:00:54 getResource: "bres://0c31f468bbb31b720212d9a43bb8e0e6/gcy.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "0c31f468bbb31b720212d9a43bb8e0e6" Debug: 05-19 00:00:54 getResource: "bres://727597d1015ede1f019990d436029401/nhgkt.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "727597d1015ede1f019990d436029401" Debug: 05-19 00:00:54 getResource: "bres://727597d1015ede1f019990d436029401/1.png" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "727597d1015ede1f019990d436029401" Debug: 05-19 00:00:54 getResource: "gico://0c31f468bbb31b720212d9a43bb8e0e6/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "0c31f468bbb31b720212d9a43bb8e0e6" Debug: 05-19 00:00:54 getResource: "gico://ab6643336366d243d73d1ce4b7fd8b8d/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "ab6643336366d243d73d1ce4b7fd8b8d" Debug: 05-19 00:00:54 getResource: "gico://727597d1015ede1f019990d436029401/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "727597d1015ede1f019990d436029401" Debug: 05-19 00:00:54 getResource: "bres://77635cf22dadc58222f44f3c4f281c1f/thesaurus.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:54 getResource: "bres://f6038dc4737356a34acc5a0c8a194f4a/thsrs.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "f6038dc4737356a34acc5a0c8a194f4a" Debug: 05-19 00:00:54 getResource: "gico://77635cf22dadc58222f44f3c4f281c1f/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:00:54 getResource: "gico://f6038dc4737356a34acc5a0c8a194f4a/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "f6038dc4737356a34acc5a0c8a194f4a" Debug: 05-19 00:00:54 getResource: "bres://8dda33ca157805525b1038e6fef3b56c/ysx.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "8dda33ca157805525b1038e6fef3b56c" Debug: 05-19 00:00:54 getResource: "gico://8dda33ca157805525b1038e6fef3b56c/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "8dda33ca157805525b1038e6fef3b56c" Debug: 05-19 00:00:54 getResource: "gico://43bc82454c7f9962132daee50f10e63b/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "43bc82454c7f9962132daee50f10e63b" Debug: 05-19 00:00:54 getResource: "gico://c05cc9bea6ab9ca5a7e4fd9bd485c294/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:00:54 getResource: "bres://43bc82454c7f9962132daee50f10e63b/duiyiyu.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "43bc82454c7f9962132daee50f10e63b" Debug: 05-19 00:00:54 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/ktsn.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:00:54 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/ktsn.js" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:00:54 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.css" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:00:54 getResource: "gico://b1e3f422135b95f15c0225ae27692050/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:00:54 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:00:54 scheme: "gico" Debug: 05-19 00:00:54 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:00:54 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/logo.svg" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/fonts/A-OTF Ryumin Pr6N EB-KL.otf" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/fonts/UDDigiKyokashoNP-R.ttf" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/fonts/A-OTF Ryumin Pr6N H-KL.otf" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:54 getResource: "bres://71ac9bc6d781652a85341bcf5a7fd63c/fonts/A-OTF Gothic MB101 Pr6N M.otf" Debug: 05-19 00:00:54 scheme: "bres" Debug: 05-19 00:00:54 host: "71ac9bc6d781652a85341bcf5a7fd63c" Debug: 05-19 00:00:55 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/image/lig99.png" Debug: 05-19 00:00:55 scheme: "bres" Debug: 05-19 00:00:55 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:00:58 article view loaded url: "gdlookup://localhost/?word=苦しみ&group=3&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" true Info: 05-19 00:01:01 libpng warning: iCCP: known incorrect sRGB profile Info: 05-19 00:01:01 libpng warning: iCCP: cHRM chunk does not match sRGB Debug: 05-19 00:01:02 Epwing: can not found subbook directory,try to fix automatically, dir=> "eidai6" Debug: 05-19 00:01:02 Epwing: found "EIDAI6" Debug: 05-19 00:01:02 Epwing: can not found subbook directory,try to fix automatically, dir=> "hyogen" Debug: 05-19 00:01:02 Epwing: found "HYOGEN" Debug: 05-19 00:01:02 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-19 00:01:02 Epwing: found "RUIGIGO" Debug: 05-19 00:01:03 Epwing: can not found subbook directory,try to fix automatically, dir=> "ruigigo" Debug: 05-19 00:01:03 Epwing: found "RUIGIGO" Debug: 05-19 00:01:03 Epwing: can not found subbook directory,try to fix automatically, dir=> "ency" Debug: 05-19 00:01:03 Epwing: found "ENCY" Debug: 05-19 00:01:03 Epwing: can not found subbook directory,try to fix automatically, dir=> "snmkg99" Debug: 05-19 00:01:03 Epwing: found "Snmkg99" Debug: 05-19 00:01:03 Epwing: can not found subbook directory,try to fix automatically, dir=> "body" Debug: 05-19 00:01:03 Epwing: found "BODY" Debug: 05-19 00:01:03 Epwing: can not found subbook directory,try to fix automatically, dir=> "meikyojj" Debug: 05-19 00:01:03 Epwing: found "MEIKYOJJ" Info: 05-19 00:01:04 libpng warning: iCCP: known incorrect sRGB profile Info: 05-19 00:01:04 libpng warning: iCCP: known incorrect sRGB profile Debug: 05-19 00:01:05 "OrderAndProps" Debug: 05-19 00:01:05 "Groups" Debug: 05-19 00:01:16 Reloading all the tabs... Debug: 05-19 00:01:16 starting create the fts with thread: 11 Debug: 05-19 00:01:16 waiting for all the fts creation to finish. Debug: 05-19 00:01:16 finished/cancel all the fts creation Debug: 05-19 00:01:16 getResource: "gdlookup://localhost/?word=苦しみ&group=3&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" Debug: 05-19 00:01:16 scheme: "gdlookup" Debug: 05-19 00:01:16 host: "localhost" Debug: 05-19 00:01:16 clear current dictionaries: "苦しみ" Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 offset = 4f0886 Debug: 05-19 00:01:16 ====reading 1475 of (1475) bytes . Finished: 0 Debug: 05-19 00:01:16 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one not finished. Debug: 05-19 00:01:16 some body finished Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 one finished. Debug: 05-19 00:01:16 erasing.. Debug: 05-19 00:01:16 erase done.. Debug: 05-19 00:01:16 send dicts(finished): "groupId:3,word:苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517,c63783324ee9b8fc3309849bd8302845,7363ba2e34cddead0f19a4a2ec51304e,968c3a374ef50d74e019560ae8f69488,41e48e169f3b09f5d08c9821aa0e88af,133436b45f37007263000dd395a5cb19,f2f3fca4482e832d2b39e39931f1861e,71ac9bc6d781652a85341bcf5a7fd63c,c3bba9ed1957c4d6553f24a97adf0202,d0e35c7d8c2b432d0a57cdf7941f912a,fd22dd8651fc9f5383ca576b5ed6a3cf,304a839a02ce8080037171de2de2d336,0c31f468bbb31b720212d9a43bb8e0e6,ab6643336366d243d73d1ce4b7fd8b8d,727597d1015ede1f019990d436029401,77635cf22dadc58222f44f3c4f281c1f,f6038dc4737356a34acc5a0c8a194f4a,8dda33ca157805525b1038e6fef3b56c,43bc82454c7f9962132daee50f10e63b,c05cc9bea6ab9ca5a7e4fd9bd485c294,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:16 ====reading 64061 of (134264) bytes . Finished: 1 Debug: 05-19 00:01:16 receive dicts, current word: "苦しみ" "苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517", "c63783324ee9b8fc3309849bd8302845", "7363ba2e34cddead0f19a4a2ec51304e", "968c3a374ef50d74e019560ae8f69488", "41e48e169f3b09f5d08c9821aa0e88af", "133436b45f37007263000dd395a5cb19", "f2f3fca4482e832d2b39e39931f1861e", "71ac9bc6d781652a85341bcf5a7fd63c", "c3bba9ed1957c4d6553f24a97adf0202", "d0e35c7d8c2b432d0a57cdf7941f912a", "fd22dd8651fc9f5383ca576b5ed6a3cf", "304a839a02ce8080037171de2de2d336", "0c31f468bbb31b720212d9a43bb8e0e6", "ab6643336366d243d73d1ce4b7fd8b8d", "727597d1015ede1f019990d436029401", "77635cf22dadc58222f44f3c4f281c1f", "f6038dc4737356a34acc5a0c8a194f4a", "8dda33ca157805525b1038e6fef3b56c", "43bc82454c7f9962132daee50f10e63b", "c05cc9bea6ab9ca5a7e4fd9bd485c294", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:16 ====reading 65536 of (134264) bytes . Finished: 1 Debug: 05-19 00:01:16 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:16 scheme: "gico" Debug: 05-19 00:01:16 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:16 ====reading 3192 of (134264) bytes . Finished: 1 Debug: 05-19 00:01:16 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:16 scheme: "gico" Debug: 05-19 00:01:16 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:16 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/くるしみ【苦しみ】.png" Debug: 05-19 00:01:16 scheme: "bres" Debug: 05-19 00:01:16 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:16 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/くるしみ【苦しみ】2.png" Debug: 05-19 00:01:16 scheme: "bres" Debug: 05-19 00:01:16 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:16 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/image/lig99.png" Debug: 05-19 00:01:16 scheme: "bres" Debug: 05-19 00:01:16 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:01:16 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:16 scheme: "bres" Debug: 05-19 00:01:16 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:18 open link url: QUrl("bword:苦しみ") Debug: 05-19 00:01:18 getResource: "gdlookup://localhost/?word=苦しみ&group=3&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" Debug: 05-19 00:01:18 scheme: "gdlookup" Debug: 05-19 00:01:18 host: "localhost" Debug: 05-19 00:01:18 clear current dictionaries: "苦しみ" Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 ====reading 1475 of (1475) bytes . Finished: 0 Debug: 05-19 00:01:18 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-19 00:01:18 offset = 4f0886 Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 ====reading 0 of (1475) bytes . Finished: 0 Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one not finished. Debug: 05-19 00:01:18 some body finished Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 one finished. Debug: 05-19 00:01:18 erasing.. Debug: 05-19 00:01:18 erase done.. Debug: 05-19 00:01:18 send dicts(finished): "groupId:3,word:苦しみ,dictId:9dfe38c28e4eb0d417245e761da52517,c63783324ee9b8fc3309849bd8302845,7363ba2e34cddead0f19a4a2ec51304e,968c3a374ef50d74e019560ae8f69488,41e48e169f3b09f5d08c9821aa0e88af,133436b45f37007263000dd395a5cb19,f2f3fca4482e832d2b39e39931f1861e,71ac9bc6d781652a85341bcf5a7fd63c,c3bba9ed1957c4d6553f24a97adf0202,d0e35c7d8c2b432d0a57cdf7941f912a,fd22dd8651fc9f5383ca576b5ed6a3cf,304a839a02ce8080037171de2de2d336,0c31f468bbb31b720212d9a43bb8e0e6,ab6643336366d243d73d1ce4b7fd8b8d,727597d1015ede1f019990d436029401,77635cf22dadc58222f44f3c4f281c1f,f6038dc4737356a34acc5a0c8a194f4a,8dda33ca157805525b1038e6fef3b56c,43bc82454c7f9962132daee50f10e63b,c05cc9bea6ab9ca5a7e4fd9bd485c294,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:18 ====reading 64061 of (134264) bytes . Finished: 1 Debug: 05-19 00:01:18 receive dicts, current word: "苦しみ" "苦しみ" : QList("9dfe38c28e4eb0d417245e761da52517", "c63783324ee9b8fc3309849bd8302845", "7363ba2e34cddead0f19a4a2ec51304e", "968c3a374ef50d74e019560ae8f69488", "41e48e169f3b09f5d08c9821aa0e88af", "133436b45f37007263000dd395a5cb19", "f2f3fca4482e832d2b39e39931f1861e", "71ac9bc6d781652a85341bcf5a7fd63c", "c3bba9ed1957c4d6553f24a97adf0202", "d0e35c7d8c2b432d0a57cdf7941f912a", "fd22dd8651fc9f5383ca576b5ed6a3cf", "304a839a02ce8080037171de2de2d336", "0c31f468bbb31b720212d9a43bb8e0e6", "ab6643336366d243d73d1ce4b7fd8b8d", "727597d1015ede1f019990d436029401", "77635cf22dadc58222f44f3c4f281c1f", "f6038dc4737356a34acc5a0c8a194f4a", "8dda33ca157805525b1038e6fef3b56c", "43bc82454c7f9962132daee50f10e63b", "c05cc9bea6ab9ca5a7e4fd9bd485c294", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:18 ====reading 65536 of (134264) bytes . Finished: 1 Debug: 05-19 00:01:18 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:18 scheme: "gico" Debug: 05-19 00:01:18 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:18 ====reading 3192 of (134264) bytes . Finished: 1 Debug: 05-19 00:01:18 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:18 scheme: "gico" Debug: 05-19 00:01:18 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:18 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/くるしみ【苦しみ】.png" Debug: 05-19 00:01:18 scheme: "bres" Debug: 05-19 00:01:18 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:18 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/くるしみ【苦しみ】2.png" Debug: 05-19 00:01:18 scheme: "bres" Debug: 05-19 00:01:18 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:18 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/image/lig99.png" Debug: 05-19 00:01:18 scheme: "bres" Debug: 05-19 00:01:18 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:01:18 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:18 scheme: "bres" Debug: 05-19 00:01:18 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:20 open link url: QUrl("bword:苦し") Debug: 05-19 00:01:20 getResource: "gdlookup://localhost/?word=苦し&group=3&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" Debug: 05-19 00:01:20 scheme: "gdlookup" Debug: 05-19 00:01:20 host: "localhost" Debug: 05-19 00:01:20 clear current dictionaries: "苦し" Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 ====reading 1472 of (1472) bytes . Finished: 0 Debug: 05-19 00:01:20 ====reading 0 of (1472) bytes . Finished: 0 Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 ====reading 0 of (1472) bytes . Finished: 0 Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 send dicts(updated): "groupId:3,word:苦し,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:20 receive dicts, current word: "苦し" "苦し" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:20 ====reading 3952 of (5424) bytes . Finished: 0 Debug: 05-19 00:01:20 ====reading 0 of (5424) bytes . Finished: 0 Debug: 05-19 00:01:20 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:20 scheme: "gico" Debug: 05-19 00:01:20 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 send dicts(updated): "groupId:3,word:苦し,dictId:41e48e169f3b09f5d08c9821aa0e88af" Debug: 05-19 00:01:20 receive dicts, current word: "苦し" "苦し" : QList("41e48e169f3b09f5d08c9821aa0e88af") Debug: 05-19 00:01:20 ====reading 2417 of (7841) bytes . Finished: 0 Debug: 05-19 00:01:20 ====reading 0 of (7841) bytes . Finished: 0 Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 send dicts(updated): "groupId:3,word:苦し,dictId:f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:01:20 receive dicts, current word: "苦し" "苦し" : QList("f2f3fca4482e832d2b39e39931f1861e") Debug: 05-19 00:01:20 ====reading 2057 of (9898) bytes . Finished: 0 Debug: 05-19 00:01:20 ====reading 0 of (9898) bytes . Finished: 0 Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one not finished. Debug: 05-19 00:01:20 send dicts(updated): "groupId:3,word:苦し,dictId:f60affb79583cb692ba2bca6df57444d,c3bba9ed1957c4d6553f24a97adf0202,d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:20 receive dicts, current word: "苦し" "苦し" : QList("f60affb79583cb692ba2bca6df57444d", "c3bba9ed1957c4d6553f24a97adf0202", "d0e35c7d8c2b432d0a57cdf7941f912a") Debug: 05-19 00:01:20 ====reading 5818 of (15716) bytes . Finished: 0 Debug: 05-19 00:01:20 ====reading 0 of (15716) bytes . Finished: 0 Debug: 05-19 00:01:20 getResource: "gico://f60affb79583cb692ba2bca6df57444d/dicticon.png" Debug: 05-19 00:01:20 scheme: "gico" Debug: 05-19 00:01:20 host: "f60affb79583cb692ba2bca6df57444d" Debug: 05-19 00:01:20 some body finished Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 one finished. Debug: 05-19 00:01:20 erasing.. Debug: 05-19 00:01:20 erase done.. Debug: 05-19 00:01:20 send dicts(finished): "groupId:3,word:苦し,dictId:68ea7837dab9dc82d592a7762c4e8092" Debug: 05-19 00:01:20 receive dicts, current word: "苦し" "苦し" : QList("68ea7837dab9dc82d592a7762c4e8092") Debug: 05-19 00:01:20 ====reading 6426 of (22142) bytes . Finished: 1 Debug: 05-19 00:01:20 getResource: "bres://68ea7837dab9dc82d592a7762c4e8092/kogo.css" Debug: 05-19 00:01:20 scheme: "bres" Debug: 05-19 00:01:20 host: "68ea7837dab9dc82d592a7762c4e8092" Debug: 05-19 00:01:20 getResource: "gico://68ea7837dab9dc82d592a7762c4e8092/dicticon.png" Debug: 05-19 00:01:20 scheme: "gico" Debug: 05-19 00:01:20 host: "68ea7837dab9dc82d592a7762c4e8092" Debug: 05-19 00:01:20 article view loaded url: "gdlookup://localhost/?word=苦し&group=3&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" true Debug: 05-19 00:01:23 open link url: QUrl("bword:地獄") Debug: 05-19 00:01:23 getResource: "gdlookup://localhost/?word=地獄&group=3&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7" Debug: 05-19 00:01:23 scheme: "gdlookup" Debug: 05-19 00:01:23 host: "localhost" Debug: 05-19 00:01:23 clear current dictionaries: "地獄" Debug: 05-19 00:01:23 offset = d5a1c0 Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 ====reading 1472 of (1472) bytes . Finished: 0 Debug: 05-19 00:01:23 ====reading 0 of (1472) bytes . Finished: 0 Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 ====reading 0 of (1472) bytes . Finished: 0 Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one finished. Debug: 05-19 00:01:23 erasing.. Debug: 05-19 00:01:23 erase done.. Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 send dicts(updated): "groupId:3,word:地獄,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:23 receive dicts, current word: "地獄" "地獄" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:23 ====reading 3952 of (5424) bytes . Finished: 0 Debug: 05-19 00:01:23 ====reading 0 of (5424) bytes . Finished: 0 Debug: 05-19 00:01:23 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:23 scheme: "gico" Debug: 05-19 00:01:23 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one finished. Debug: 05-19 00:01:23 erasing.. Debug: 05-19 00:01:23 erase done.. Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 send dicts(updated): "groupId:3,word:地獄,dictId:c63783324ee9b8fc3309849bd8302845" Debug: 05-19 00:01:23 receive dicts, current word: "地獄" "地獄" : QList("c63783324ee9b8fc3309849bd8302845") Debug: 05-19 00:01:23 ====reading 3231 of (8655) bytes . Finished: 0 Debug: 05-19 00:01:23 ====reading 0 of (8655) bytes . Finished: 0 Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:23 some body finished Debug: 05-19 00:01:23 one not finished. Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 send dicts(updated): "groupId:3,word:地獄,dictId:7363ba2e34cddead0f19a4a2ec51304e,968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:01:24 receive dicts, current word: "地獄" "地獄" : QList("7363ba2e34cddead0f19a4a2ec51304e", "968c3a374ef50d74e019560ae8f69488") Debug: 05-19 00:01:24 ====reading 9024 of (17679) bytes . Finished: 0 Debug: 05-19 00:01:24 ====reading 0 of (17679) bytes . Finished: 0 Debug: 05-19 00:01:24 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/kojien.js" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:24 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/じ‐ごく【地獄】.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:24 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/じ‐ごく【地獄】2.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:24 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/じごく【地獄】.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:24 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/img/じごく【地獄】2.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 getResource: "bres://7363ba2e34cddead0f19a4a2ec51304e/SourceHanSerifCN.otf" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "7363ba2e34cddead0f19a4a2ec51304e" Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one not finished. Debug: 05-19 00:01:24 send dicts(updated): "groupId:3,word:地獄,dictId:646c2fbd2278d23caf8bc5b44599f5aa,41e48e169f3b09f5d08c9821aa0e88af,133436b45f37007263000dd395a5cb19,f2f3fca4482e832d2b39e39931f1861e,f60affb79583cb692ba2bca6df57444d" Debug: 05-19 00:01:24 receive dicts, current word: "地獄" "地獄" : QList("646c2fbd2278d23caf8bc5b44599f5aa", "41e48e169f3b09f5d08c9821aa0e88af", "133436b45f37007263000dd395a5cb19", "f2f3fca4482e832d2b39e39931f1861e", "f60affb79583cb692ba2bca6df57444d") Debug: 05-19 00:01:24 ====reading 42121 of (59800) bytes . Finished: 0 Debug: 05-19 00:01:24 ====reading 0 of (59800) bytes . Finished: 0 Debug: 05-19 00:01:24 getResource: "bres://646c2fbd2278d23caf8bc5b44599f5aa/smk8.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "646c2fbd2278d23caf8bc5b44599f5aa" Debug: 05-19 00:01:24 getResource: "gico://646c2fbd2278d23caf8bc5b44599f5aa/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "646c2fbd2278d23caf8bc5b44599f5aa" Debug: 05-19 00:01:24 some body finished Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 one finished. Debug: 05-19 00:01:24 erasing.. Debug: 05-19 00:01:24 erase done.. Debug: 05-19 00:01:24 send dicts(finished): "groupId:3,word:地獄,dictId:71ac9bc6d781652a85341bcf5a7fd63c,5672141bb28e74f28e750058bfca0956,c3bba9ed1957c4d6553f24a97adf0202,f26420c7eb1d59c1076d59ccf790a337,8431bdd6831e3f351ad8799dc6d42d73,d0e35c7d8c2b432d0a57cdf7941f912a,fd22dd8651fc9f5383ca576b5ed6a3cf,304a839a02ce8080037171de2de2d336,38386df88d70b0c53b53e9b70967bf8e,0c31f468bbb31b720212d9a43bb8e0e6,fb4e6f53358b387157bec73b6cbe4c8c,36a7df6c1b1d19a4e7df65b79fa98a67,0dc93d9e25edee78f80b6c12013b4d9a,0a5c32cda34c580f09fd0b5fc015e1b3,cb8bfcfc5c40f1be931fb77ea3d87a35,888d7bb796756084542d33d9c6e0685f,97295be38a11d07b041a97b8144cb152,68ea7837dab9dc82d592a7762c4e8092,23e549f189b1238b16b9c6a2fc2860f0,76920f4e8caf20bf370acb7fea5fc232,439501f369c57bb5d3f0933b088cb23f,69012e49a9b1bb44848ace9b2ec951d0,77635cf22dadc58222f44f3c4f281c1f,f6038dc4737356a34acc5a0c8a194f4a,8dda33ca157805525b1038e6fef3b56c,43bc82454c7f9962132daee50f10e63b,c05cc9bea6ab9ca5a7e4fd9bd485c294,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:24 ====reading 16384 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 receive dicts, current word: "地獄" "地獄" : QList("71ac9bc6d781652a85341bcf5a7fd63c", "5672141bb28e74f28e750058bfca0956", "c3bba9ed1957c4d6553f24a97adf0202", "f26420c7eb1d59c1076d59ccf790a337", "8431bdd6831e3f351ad8799dc6d42d73", "d0e35c7d8c2b432d0a57cdf7941f912a", "fd22dd8651fc9f5383ca576b5ed6a3cf", "304a839a02ce8080037171de2de2d336", "38386df88d70b0c53b53e9b70967bf8e", "0c31f468bbb31b720212d9a43bb8e0e6", "fb4e6f53358b387157bec73b6cbe4c8c", "36a7df6c1b1d19a4e7df65b79fa98a67", "0dc93d9e25edee78f80b6c12013b4d9a", "0a5c32cda34c580f09fd0b5fc015e1b3", "cb8bfcfc5c40f1be931fb77ea3d87a35", "888d7bb796756084542d33d9c6e0685f", "97295be38a11d07b041a97b8144cb152", "68ea7837dab9dc82d592a7762c4e8092", "23e549f189b1238b16b9c6a2fc2860f0", "76920f4e8caf20bf370acb7fea5fc232", "439501f369c57bb5d3f0933b088cb23f", "69012e49a9b1bb44848ace9b2ec951d0", "77635cf22dadc58222f44f3c4f281c1f", "f6038dc4737356a34acc5a0c8a194f4a", "8dda33ca157805525b1038e6fef3b56c", "43bc82454c7f9962132daee50f10e63b", "c05cc9bea6ab9ca5a7e4fd9bd485c294", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:24 ====reading 49152 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 ====reading 16384 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 getResource: "bres://646c2fbd2278d23caf8bc5b44599f5aa/Audio.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "646c2fbd2278d23caf8bc5b44599f5aa" Debug: 05-19 00:01:24 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E2EB.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:01:24 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E2E9.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:01:24 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E2E7.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:01:24 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/1701.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:01:24 ====reading 49152 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 ====reading 16384 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 getResource: "bres://f2f3fca4482e832d2b39e39931f1861e/gaiji/E256.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "f2f3fca4482e832d2b39e39931f1861e" Debug: 05-19 00:01:24 ====reading 49152 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 ====reading 16384 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 getResource: "gico://5672141bb28e74f28e750058bfca0956/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "5672141bb28e74f28e750058bfca0956" Debug: 05-19 00:01:24 getResource: "bres://5672141bb28e74f28e750058bfca0956/nipponica.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "5672141bb28e74f28e750058bfca0956" Debug: 05-19 00:01:24 getResource: "gico://f26420c7eb1d59c1076d59ccf790a337/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "f26420c7eb1d59c1076d59ccf790a337" Debug: 05-19 00:01:24 getResource: "bres://f26420c7eb1d59c1076d59ccf790a337/SANKOKU7.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "f26420c7eb1d59c1076d59ccf790a337" Debug: 05-19 00:01:24 getResource: "gico://8431bdd6831e3f351ad8799dc6d42d73/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "8431bdd6831e3f351ad8799dc6d42d73" Debug: 05-19 00:01:24 ====reading 19207 of (291999) bytes . Finished: 1 Debug: 05-19 00:01:24 getResource: "bres://8431bdd6831e3f351ad8799dc6d42d73/sinmei.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "8431bdd6831e3f351ad8799dc6d42d73" Debug: 05-19 00:01:24 getResource: "bres://8431bdd6831e3f351ad8799dc6d42d73/Audio.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "8431bdd6831e3f351ad8799dc6d42d73" Debug: 05-19 00:01:24 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E2EB.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:24 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E2E9.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:24 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E2E7.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:24 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/1701.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:24 getResource: "gico://38386df88d70b0c53b53e9b70967bf8e/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "38386df88d70b0c53b53e9b70967bf8e" Debug: 05-19 00:01:24 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E256.gif" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:24 getResource: "bres://304a839a02ce8080037171de2de2d336/MK3.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "304a839a02ce8080037171de2de2d336" Debug: 05-19 00:01:24 getResource: "bres://304a839a02ce8080037171de2de2d336/gaiji/対義語.svg" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "304a839a02ce8080037171de2de2d336" Debug: 05-19 00:01:24 getResource: "bres://38386df88d70b0c53b53e9b70967bf8e/iwakoku.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "38386df88d70b0c53b53e9b70967bf8e" Debug: 05-19 00:01:24 getResource: "bres://0c31f468bbb31b720212d9a43bb8e0e6/yajirusi2.svg" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "0c31f468bbb31b720212d9a43bb8e0e6" Debug: 05-19 00:01:24 getResource: "bres://fb4e6f53358b387157bec73b6cbe4c8c/OBS.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "fb4e6f53358b387157bec73b6cbe4c8c" Debug: 05-19 00:01:24 getResource: "bres://36a7df6c1b1d19a4e7df65b79fa98a67/Kanjikai2.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "36a7df6c1b1d19a4e7df65b79fa98a67" Debug: 05-19 00:01:24 getResource: "bres://0dc93d9e25edee78f80b6c12013b4d9a/DHHCD02407.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "0dc93d9e25edee78f80b6c12013b4d9a" Debug: 05-19 00:01:24 getResource: "bres://0a5c32cda34c580f09fd0b5fc015e1b3/kanjigen5.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "0a5c32cda34c580f09fd0b5fc015e1b3" Debug: 05-19 00:01:24 getResource: "bres://cb8bfcfc5c40f1be931fb77ea3d87a35/JITSU.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "cb8bfcfc5c40f1be931fb77ea3d87a35" Debug: 05-19 00:01:24 getResource: "bres://888d7bb796756084542d33d9c6e0685f/NKGORIN2.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "888d7bb796756084542d33d9c6e0685f" Debug: 05-19 00:01:24 getResource: "bres://888d7bb796756084542d33d9c6e0685f/img/B134.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "888d7bb796756084542d33d9c6e0685f" Debug: 05-19 00:01:24 getResource: "bres://888d7bb796756084542d33d9c6e0685f/img/B133.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "888d7bb796756084542d33d9c6e0685f" Debug: 05-19 00:01:24 getResource: "gico://fb4e6f53358b387157bec73b6cbe4c8c/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "fb4e6f53358b387157bec73b6cbe4c8c" Debug: 05-19 00:01:24 getResource: "gico://36a7df6c1b1d19a4e7df65b79fa98a67/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "36a7df6c1b1d19a4e7df65b79fa98a67" Debug: 05-19 00:01:24 getResource: "gico://0dc93d9e25edee78f80b6c12013b4d9a/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "0dc93d9e25edee78f80b6c12013b4d9a" Debug: 05-19 00:01:24 getResource: "gico://0a5c32cda34c580f09fd0b5fc015e1b3/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "0a5c32cda34c580f09fd0b5fc015e1b3" Debug: 05-19 00:01:24 getResource: "gico://cb8bfcfc5c40f1be931fb77ea3d87a35/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "cb8bfcfc5c40f1be931fb77ea3d87a35" Debug: 05-19 00:01:24 getResource: "gico://888d7bb796756084542d33d9c6e0685f/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "888d7bb796756084542d33d9c6e0685f" Debug: 05-19 00:01:24 getResource: "gico://97295be38a11d07b041a97b8144cb152/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "97295be38a11d07b041a97b8144cb152" Debug: 05-19 00:01:24 getResource: "gico://23e549f189b1238b16b9c6a2fc2860f0/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "23e549f189b1238b16b9c6a2fc2860f0" Debug: 05-19 00:01:24 getResource: "bres://97295be38a11d07b041a97b8144cb152/SHINJIGEN.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "97295be38a11d07b041a97b8144cb152" Debug: 05-19 00:01:24 getResource: "bres://23e549f189b1238b16b9c6a2fc2860f0/kogodai.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "23e549f189b1238b16b9c6a2fc2860f0" Debug: 05-19 00:01:24 getResource: "gico://76920f4e8caf20bf370acb7fea5fc232/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "76920f4e8caf20bf370acb7fea5fc232" Debug: 05-19 00:01:24 getResource: "bres://76920f4e8caf20bf370acb7fea5fc232/iwakoku.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "76920f4e8caf20bf370acb7fea5fc232" Debug: 05-19 00:01:24 getResource: "bres://76920f4e8caf20bf370acb7fea5fc232/b326.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "76920f4e8caf20bf370acb7fea5fc232" Debug: 05-19 00:01:24 getResource: "bres://76920f4e8caf20bf370acb7fea5fc232/b327.png" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "76920f4e8caf20bf370acb7fea5fc232" Debug: 05-19 00:01:24 getResource: "gico://439501f369c57bb5d3f0933b088cb23f/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "439501f369c57bb5d3f0933b088cb23f" Debug: 05-19 00:01:24 getResource: "gico://69012e49a9b1bb44848ace9b2ec951d0/dicticon.png" Debug: 05-19 00:01:24 scheme: "gico" Debug: 05-19 00:01:24 host: "69012e49a9b1bb44848ace9b2ec951d0" Debug: 05-19 00:01:24 getResource: "bres://439501f369c57bb5d3f0933b088cb23f/common.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "439501f369c57bb5d3f0933b088cb23f" Debug: 05-19 00:01:24 getResource: "bres://439501f369c57bb5d3f0933b088cb23f/kankenkj2.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "439501f369c57bb5d3f0933b088cb23f" Debug: 05-19 00:01:24 getResource: "bres://69012e49a9b1bb44848ace9b2ec951d0/JMnedict.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "69012e49a9b1bb44848ace9b2ec951d0" Debug: 05-19 00:01:24 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/ktsn.css" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:01:24 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:24 scheme: "bres" Debug: 05-19 00:01:24 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:25 getResource: "bres://c3bba9ed1957c4d6553f24a97adf0202/DAIJIRIN3.css" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "c3bba9ed1957c4d6553f24a97adf0202" Debug: 05-19 00:01:25 getResource: "gico://c3bba9ed1957c4d6553f24a97adf0202/dicticon.png" Debug: 05-19 00:01:25 scheme: "gico" Debug: 05-19 00:01:25 host: "c3bba9ed1957c4d6553f24a97adf0202" Debug: 05-19 00:01:25 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/nikkoku.css" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:25 getResource: "gico://d0e35c7d8c2b432d0a57cdf7941f912a/dicticon.png" Debug: 05-19 00:01:25 scheme: "gico" Debug: 05-19 00:01:25 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:25 getResource: "bres://fd22dd8651fc9f5383ca576b5ed6a3cf/DJS.css" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "fd22dd8651fc9f5383ca576b5ed6a3cf" Debug: 05-19 00:01:25 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E030.gif" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:25 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E02F.gif" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:25 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E032.gif" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:25 getResource: "gico://fd22dd8651fc9f5383ca576b5ed6a3cf/dicticon.png" Debug: 05-19 00:01:25 scheme: "gico" Debug: 05-19 00:01:25 host: "fd22dd8651fc9f5383ca576b5ed6a3cf" Debug: 05-19 00:01:25 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E035.gif" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:25 getResource: "bres://d0e35c7d8c2b432d0a57cdf7941f912a/gaiji/E031.gif" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "d0e35c7d8c2b432d0a57cdf7941f912a" Debug: 05-19 00:01:25 getResource: "bres://0c31f468bbb31b720212d9a43bb8e0e6/gcy.css" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "0c31f468bbb31b720212d9a43bb8e0e6" Debug: 05-19 00:01:25 getResource: "gico://304a839a02ce8080037171de2de2d336/dicticon.png" Debug: 05-19 00:01:25 scheme: "gico" Debug: 05-19 00:01:25 host: "304a839a02ce8080037171de2de2d336" Debug: 05-19 00:01:25 getResource: "gico://0c31f468bbb31b720212d9a43bb8e0e6/dicticon.png" Debug: 05-19 00:01:25 scheme: "gico" Debug: 05-19 00:01:25 host: "0c31f468bbb31b720212d9a43bb8e0e6" Debug: 05-19 00:01:25 getResource: "bres://97295be38a11d07b041a97b8144cb152/SourceHanSerifJP-Regular.otf" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "97295be38a11d07b041a97b8144cb152" Debug: 05-19 00:01:25 getResource: "bres://97295be38a11d07b041a97b8144cb152/SourceHanSansJP-Regular.otf" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "97295be38a11d07b041a97b8144cb152" Debug: 05-19 00:01:25 getResource: "bres://cb8bfcfc5c40f1be931fb77ea3d87a35/ヒラギノ明朝 ProN.ttc" Debug: 05-19 00:01:25 scheme: "bres" Debug: 05-19 00:01:25 host: "cb8bfcfc5c40f1be931fb77ea3d87a35" Debug: 05-19 00:01:26 getResource: "bres://68ea7837dab9dc82d592a7762c4e8092/kogo.css" Debug: 05-19 00:01:26 scheme: "bres" Debug: 05-19 00:01:26 host: "68ea7837dab9dc82d592a7762c4e8092" Debug: 05-19 00:01:26 getResource: "gico://68ea7837dab9dc82d592a7762c4e8092/dicticon.png" Debug: 05-19 00:01:26 scheme: "gico" Debug: 05-19 00:01:26 host: "68ea7837dab9dc82d592a7762c4e8092" Debug: 05-19 00:01:26 getResource: "bres://97295be38a11d07b041a97b8144cb152/SHINJIMinchoW3.otf" Debug: 05-19 00:01:26 scheme: "bres" Debug: 05-19 00:01:26 host: "97295be38a11d07b041a97b8144cb152" Debug: 05-19 00:01:26 getResource: "bres://77635cf22dadc58222f44f3c4f281c1f/thesaurus.css" Debug: 05-19 00:01:26 scheme: "bres" Debug: 05-19 00:01:26 host: "77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:01:26 getResource: "gico://77635cf22dadc58222f44f3c4f281c1f/dicticon.png" Debug: 05-19 00:01:26 scheme: "gico" Debug: 05-19 00:01:26 host: "77635cf22dadc58222f44f3c4f281c1f" Debug: 05-19 00:01:26 getResource: "bres://23e549f189b1238b16b9c6a2fc2860f0/KogoGaiji.ttf" Debug: 05-19 00:01:26 scheme: "bres" Debug: 05-19 00:01:26 host: "23e549f189b1238b16b9c6a2fc2860f0" Debug: 05-19 00:01:26 getResource: "bres://f6038dc4737356a34acc5a0c8a194f4a/thsrs.css" Debug: 05-19 00:01:26 scheme: "bres" Debug: 05-19 00:01:26 host: "f6038dc4737356a34acc5a0c8a194f4a" Debug: 05-19 00:01:26 getResource: "gico://f6038dc4737356a34acc5a0c8a194f4a/dicticon.png" Debug: 05-19 00:01:26 scheme: "gico" Debug: 05-19 00:01:26 host: "f6038dc4737356a34acc5a0c8a194f4a" Debug: 05-19 00:01:26 getResource: "bres://8dda33ca157805525b1038e6fef3b56c/ysx.css" Debug: 05-19 00:01:26 scheme: "bres" Debug: 05-19 00:01:26 host: "8dda33ca157805525b1038e6fef3b56c" Debug: 05-19 00:01:26 getResource: "gico://8dda33ca157805525b1038e6fef3b56c/dicticon.png" Debug: 05-19 00:01:26 scheme: "gico" Debug: 05-19 00:01:26 host: "8dda33ca157805525b1038e6fef3b56c" Debug: 05-19 00:01:27 getResource: "bres://43bc82454c7f9962132daee50f10e63b/duiyiyu.css" Debug: 05-19 00:01:27 scheme: "bres" Debug: 05-19 00:01:27 host: "43bc82454c7f9962132daee50f10e63b" Debug: 05-19 00:01:27 getResource: "gico://43bc82454c7f9962132daee50f10e63b/dicticon.png" Debug: 05-19 00:01:27 scheme: "gico" Debug: 05-19 00:01:27 host: "43bc82454c7f9962132daee50f10e63b" Debug: 05-19 00:01:27 getResource: "gico://c05cc9bea6ab9ca5a7e4fd9bd485c294/dicticon.png" Debug: 05-19 00:01:27 scheme: "gico" Debug: 05-19 00:01:27 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:01:27 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/ktsn.js" Debug: 05-19 00:01:27 scheme: "bres" Debug: 05-19 00:01:27 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:01:27 getResource: "bres://c05cc9bea6ab9ca5a7e4fd9bd485c294/image/lig99.png" Debug: 05-19 00:01:27 scheme: "bres" Debug: 05-19 00:01:27 host: "c05cc9bea6ab9ca5a7e4fd9bd485c294" Debug: 05-19 00:01:27 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.css" Debug: 05-19 00:01:27 scheme: "bres" Debug: 05-19 00:01:27 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:27 getResource: "gico://b1e3f422135b95f15c0225ae27692050/dicticon.png" Debug: 05-19 00:01:27 scheme: "gico" Debug: 05-19 00:01:27 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:27 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:27 scheme: "bres" Debug: 05-19 00:01:27 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:27 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:27 scheme: "bres" Debug: 05-19 00:01:27 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:28 getResource: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:28 scheme: "gdlookup" Debug: 05-19 00:01:28 host: "localhost" Debug: 05-19 00:01:28 clear current dictionaries: "地獄" Debug: 05-19 00:01:28 some body finished Debug: 05-19 00:01:28 one not finished. Debug: 05-19 00:01:28 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:28 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:28 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:28 some body finished Debug: 05-19 00:01:28 one finished. Debug: 05-19 00:01:28 erasing.. Debug: 05-19 00:01:28 erase done.. Debug: 05-19 00:01:28 send dicts(finished): "groupId:1,word:地獄,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:28 ====reading 4009 of (5418) bytes . Finished: 1 Debug: 05-19 00:01:28 receive dicts, current word: "地獄" "地獄" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:28 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:28 scheme: "gico" Debug: 05-19 00:01:28 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:29 article view loaded url: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313" true Debug: 05-19 00:01:31 getResource: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:31 scheme: "gdlookup" Debug: 05-19 00:01:31 host: "localhost" Debug: 05-19 00:01:31 clear current dictionaries: "地獄" Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 send dicts(updated): "groupId:1,word:地獄,dictId:968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:01:31 receive dicts, current word: "地獄" "地獄" : QList("968c3a374ef50d74e019560ae8f69488") Debug: 05-19 00:01:31 ====reading 2958 of (4367) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (4367) bytes . Finished: 0 Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 send dicts(finished): "groupId:1,word:地獄,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:31 receive dicts, current word: "地獄" "地獄" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:31 ====reading 4076 of (8443) bytes . Finished: 1 Debug: 05-19 00:01:31 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:31 scheme: "gico" Debug: 05-19 00:01:31 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:31 article view loaded url: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c" true Debug: 05-19 00:01:31 getResource: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:31 scheme: "gdlookup" Debug: 05-19 00:01:31 host: "localhost" Debug: 05-19 00:01:31 clear current dictionaries: "地獄" Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 send dicts(updated): "groupId:1,word:地獄,dictId:968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:01:31 receive dicts, current word: "地獄" "地獄" : QList("968c3a374ef50d74e019560ae8f69488") Debug: 05-19 00:01:31 ====reading 2958 of (4367) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (4367) bytes . Finished: 0 Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 send dicts(finished): "groupId:1,word:地獄,dictId:ec855a5ed10fb99483666514453d9bac,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:31 receive dicts, current word: "地獄" "地獄" : QList("ec855a5ed10fb99483666514453d9bac", "9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:31 ====reading 6277 of (10644) bytes . Finished: 1 Debug: 05-19 00:01:31 getResource: "bres://ec855a5ed10fb99483666514453d9bac/jm_pt.css" Debug: 05-19 00:01:31 scheme: "bres" Debug: 05-19 00:01:31 host: "ec855a5ed10fb99483666514453d9bac" Debug: 05-19 00:01:31 getResource: "gico://ec855a5ed10fb99483666514453d9bac/dicticon.png" Debug: 05-19 00:01:31 scheme: "gico" Debug: 05-19 00:01:31 host: "ec855a5ed10fb99483666514453d9bac" Debug: 05-19 00:01:31 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:31 scheme: "gico" Debug: 05-19 00:01:31 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:31 article view loaded url: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,b1e3f422135b95f15c0225ae27692050,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170e" true Debug: 05-19 00:01:31 getResource: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:31 scheme: "gdlookup" Debug: 05-19 00:01:31 host: "localhost" Debug: 05-19 00:01:31 clear current dictionaries: "地獄" Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 send dicts(updated): "groupId:1,word:地獄,dictId:968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:31 receive dicts, current word: "地獄" "地獄" : QList("968c3a374ef50d74e019560ae8f69488", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:31 ====reading 9124 of (10533) bytes . Finished: 0 Debug: 05-19 00:01:31 ====reading 0 of (10533) bytes . Finished: 0 Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one not finished. Debug: 05-19 00:01:31 some body finished Debug: 05-19 00:01:31 one finished. Debug: 05-19 00:01:31 erasing.. Debug: 05-19 00:01:31 erase done.. Debug: 05-19 00:01:31 send dicts(finished): "groupId:1,word:地獄,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:31 receive dicts, current word: "地獄" "地獄" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:31 ====reading 4076 of (14609) bytes . Finished: 1 Debug: 05-19 00:01:31 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:31 scheme: "bres" Debug: 05-19 00:01:31 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:31 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:31 scheme: "gico" Debug: 05-19 00:01:31 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:31 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:31 scheme: "bres" Debug: 05-19 00:01:31 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:31 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:31 scheme: "bres" Debug: 05-19 00:01:31 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:31 article view loaded url: "gdlookup://localhost/?word=地獄&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8" true Debug: 05-19 00:01:35 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:35 scheme: "gdlookup" Debug: 05-19 00:01:35 host: "localhost" Debug: 05-19 00:01:35 clear current dictionaries: "納得が行く" Debug: 05-19 00:01:35 some body finished Debug: 05-19 00:01:35 one not finished. Debug: 05-19 00:01:35 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:35 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:35 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:35 some body finished Debug: 05-19 00:01:35 one finished. Debug: 05-19 00:01:35 erasing.. Debug: 05-19 00:01:35 erase done.. Debug: 05-19 00:01:35 one not finished. Debug: 05-19 00:01:35 some body finished Debug: 05-19 00:01:35 one not finished. Debug: 05-19 00:01:35 some body finished Debug: 05-19 00:01:35 one not finished. Debug: 05-19 00:01:35 some body finished Debug: 05-19 00:01:35 one finished. Debug: 05-19 00:01:35 erasing.. Debug: 05-19 00:01:35 erase done.. Debug: 05-19 00:01:35 one finished. Debug: 05-19 00:01:35 erasing.. Debug: 05-19 00:01:35 erase done.. Debug: 05-19 00:01:35 one finished. Debug: 05-19 00:01:35 erasing.. Debug: 05-19 00:01:35 erase done.. Debug: 05-19 00:01:35 send dicts(finished): "groupId:1,word:納得が行く,dictId:ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050,9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:35 receive dicts, current word: "納得が行く" "納得が行く" : QList("ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050", "9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:35 ====reading 8550 of (9968) bytes . Finished: 1 Debug: 05-19 00:01:35 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:35 scheme: "bres" Debug: 05-19 00:01:35 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:35 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:35 scheme: "gico" Debug: 05-19 00:01:35 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:35 article view loaded url: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcb" true Debug: 05-19 00:01:40 "OrderAndProps" Debug: 05-19 00:01:40 "Groups" Debug: 05-19 00:01:46 Reloading all the tabs... Debug: 05-19 00:01:46 starting create the fts with thread: 11 Debug: 05-19 00:01:46 waiting for all the fts creation to finish. Debug: 05-19 00:01:46 finished/cancel all the fts creation Debug: 05-19 00:01:46 getResource: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:46 scheme: "gdlookup" Debug: 05-19 00:01:46 host: "localhost" Debug: 05-19 00:01:46 clear current dictionaries: "納得が行く" Debug: 05-19 00:01:46 some body finished Debug: 05-19 00:01:46 one not finished. Debug: 05-19 00:01:46 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:46 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:46 some body finished Debug: 05-19 00:01:46 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:46 one not finished. Debug: 05-19 00:01:46 some body finished Debug: 05-19 00:01:46 one not finished. Debug: 05-19 00:01:46 some body finished Debug: 05-19 00:01:46 one not finished. Debug: 05-19 00:01:46 some body finished Debug: 05-19 00:01:46 one finished. Debug: 05-19 00:01:46 erasing.. Debug: 05-19 00:01:46 erase done.. Debug: 05-19 00:01:46 one finished. Debug: 05-19 00:01:46 erasing.. Debug: 05-19 00:01:46 erase done.. Debug: 05-19 00:01:46 one finished. Debug: 05-19 00:01:46 erasing.. Debug: 05-19 00:01:46 erase done.. Debug: 05-19 00:01:46 one finished. Debug: 05-19 00:01:46 erasing.. Debug: 05-19 00:01:46 erase done.. Debug: 05-19 00:01:46 send dicts(finished): "groupId:1,word:納得が行く,dictId:9dfe38c28e4eb0d417245e761da52517,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:46 ====reading 8550 of (9968) bytes . Finished: 1 Debug: 05-19 00:01:46 receive dicts, current word: "納得が行く" "納得が行く" : QList("9dfe38c28e4eb0d417245e761da52517", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:46 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:46 scheme: "gico" Debug: 05-19 00:01:46 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:46 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:46 scheme: "bres" Debug: 05-19 00:01:46 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:46 article view loaded url: "gdlookup://localhost/?word=納得が行く&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcb" true Debug: 05-19 00:01:48 open link url: QUrl("bword:納得が行く") Debug: 05-19 00:01:48 getResource: "gdlookup://localhost/?word=納得が行く&group=1&scrollto=gdfrom-&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:48 scheme: "gdlookup" Debug: 05-19 00:01:48 host: "localhost" Debug: 05-19 00:01:48 clear current dictionaries: "納得が行く" Debug: 05-19 00:01:48 some body finished Debug: 05-19 00:01:48 one not finished. Debug: 05-19 00:01:48 ====reading 1418 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:48 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:48 ====reading 0 of (1418) bytes . Finished: 0 Debug: 05-19 00:01:48 some body finished Debug: 05-19 00:01:48 one not finished. Debug: 05-19 00:01:48 some body finished Debug: 05-19 00:01:48 one not finished. Debug: 05-19 00:01:48 some body finished Debug: 05-19 00:01:48 one not finished. Debug: 05-19 00:01:48 some body finished Debug: 05-19 00:01:48 one finished. Debug: 05-19 00:01:48 erasing.. Debug: 05-19 00:01:48 erase done.. Debug: 05-19 00:01:48 one finished. Debug: 05-19 00:01:48 erasing.. Debug: 05-19 00:01:48 erase done.. Debug: 05-19 00:01:48 one finished. Debug: 05-19 00:01:48 erasing.. Debug: 05-19 00:01:48 erase done.. Debug: 05-19 00:01:48 one finished. Debug: 05-19 00:01:48 erasing.. Debug: 05-19 00:01:48 erase done.. Debug: 05-19 00:01:48 send dicts(finished): "groupId:1,word:納得が行く,dictId:9dfe38c28e4eb0d417245e761da52517,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:48 receive dicts, current word: "納得が行く" "納得が行く" : QList("9dfe38c28e4eb0d417245e761da52517", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:48 ====reading 8550 of (9968) bytes . Finished: 1 Debug: 05-19 00:01:48 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:48 scheme: "gico" Debug: 05-19 00:01:48 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:48 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:48 scheme: "bres" Debug: 05-19 00:01:48 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:48 article view loaded url: "gdlookup://localhost/?word=納得が行く&group=1&scrollto=gdfrom-&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea" true Debug: 05-19 00:01:49 open link url: QUrl("bword:が行") Debug: 05-19 00:01:49 getResource: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:49 scheme: "gdlookup" Debug: 05-19 00:01:49 host: "localhost" Debug: 05-19 00:01:49 clear current dictionaries: "が行" Debug: 05-19 00:01:49 some body finished Debug: 05-19 00:01:49 one not finished. Debug: 05-19 00:01:49 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:49 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:49 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:49 some body finished Debug: 05-19 00:01:49 one not finished. Debug: 05-19 00:01:49 some body finished Debug: 05-19 00:01:49 one not finished. Debug: 05-19 00:01:49 some body finished Debug: 05-19 00:01:49 one not finished. Debug: 05-19 00:01:49 some body finished Debug: 05-19 00:01:49 one finished. Debug: 05-19 00:01:49 erasing.. Debug: 05-19 00:01:49 erase done.. Debug: 05-19 00:01:49 one finished. Debug: 05-19 00:01:49 erasing.. Debug: 05-19 00:01:49 erase done.. Debug: 05-19 00:01:49 one finished. Debug: 05-19 00:01:49 erasing.. Debug: 05-19 00:01:49 erase done.. Debug: 05-19 00:01:49 one finished. Debug: 05-19 00:01:49 erasing.. Debug: 05-19 00:01:49 erase done.. Debug: 05-19 00:01:49 send dicts(finished): "groupId:1,word:が行,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:49 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:01:49 receive dicts, current word: "が行" "が行" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:49 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:49 scheme: "gico" Debug: 05-19 00:01:49 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:49 article view loaded url: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fff" true Debug: 05-19 00:01:50 open link url: QUrl("bword:納得") Debug: 05-19 00:01:50 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:50 scheme: "gdlookup" Debug: 05-19 00:01:50 host: "localhost" Debug: 05-19 00:01:50 clear current dictionaries: "納得" Debug: 05-19 00:01:50 some body finished Debug: 05-19 00:01:50 one not finished. Debug: 05-19 00:01:50 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:50 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:50 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:50 some body finished Debug: 05-19 00:01:50 one not finished. Debug: 05-19 00:01:50 some body finished Debug: 05-19 00:01:50 one not finished. Debug: 05-19 00:01:50 some body finished Debug: 05-19 00:01:50 one finished. Debug: 05-19 00:01:50 erasing.. Debug: 05-19 00:01:50 erase done.. Debug: 05-19 00:01:50 one not finished. Debug: 05-19 00:01:50 send dicts(updated): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:50 ====reading 3934 of (5343) bytes . Finished: 0 Debug: 05-19 00:01:50 receive dicts, current word: "納得" "納得" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:50 ====reading 0 of (5343) bytes . Finished: 0 Debug: 05-19 00:01:50 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:50 scheme: "gico" Debug: 05-19 00:01:50 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:50 some body finished Debug: 05-19 00:01:50 one finished. Debug: 05-19 00:01:50 erasing.. Debug: 05-19 00:01:50 erase done.. Debug: 05-19 00:01:50 one finished. Debug: 05-19 00:01:50 erasing.. Debug: 05-19 00:01:50 erase done.. Debug: 05-19 00:01:50 one finished. Debug: 05-19 00:01:50 erasing.. Debug: 05-19 00:01:50 erase done.. Debug: 05-19 00:01:50 send dicts(finished): "groupId:1,word:納得,dictId:968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:50 receive dicts, current word: "納得" "納得" : QList("968c3a374ef50d74e019560ae8f69488", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:50 ====reading 10360 of (15703) bytes . Finished: 1 Debug: 05-19 00:01:50 getResource: "bres://968c3a374ef50d74e019560ae8f69488/NHK日本語発音アクセント辞書.css" Debug: 05-19 00:01:50 scheme: "bres" Debug: 05-19 00:01:50 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:01:50 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:50 scheme: "gico" Debug: 05-19 00:01:50 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:50 getResource: "gico://968c3a374ef50d74e019560ae8f69488/dicticon.png" Debug: 05-19 00:01:50 scheme: "gico" Debug: 05-19 00:01:50 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:01:50 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:50 scheme: "bres" Debug: 05-19 00:01:50 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:50 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:50 scheme: "bres" Debug: 05-19 00:01:50 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:50 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:50 scheme: "bres" Debug: 05-19 00:01:50 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:50 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fff" true Debug: 05-19 00:01:53 open link url: QUrl("bword:が行") Debug: 05-19 00:01:53 getResource: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:53 scheme: "gdlookup" Debug: 05-19 00:01:53 host: "localhost" Debug: 05-19 00:01:53 clear current dictionaries: "が行" Debug: 05-19 00:01:53 some body finished Debug: 05-19 00:01:53 one not finished. Debug: 05-19 00:01:53 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:53 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:53 some body finished Debug: 05-19 00:01:53 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:53 one not finished. Debug: 05-19 00:01:53 some body finished Debug: 05-19 00:01:53 one not finished. Debug: 05-19 00:01:53 some body finished Debug: 05-19 00:01:53 one not finished. Debug: 05-19 00:01:53 some body finished Debug: 05-19 00:01:53 one finished. Debug: 05-19 00:01:53 erasing.. Debug: 05-19 00:01:53 erase done.. Debug: 05-19 00:01:53 one finished. Debug: 05-19 00:01:53 erasing.. Debug: 05-19 00:01:53 erase done.. Debug: 05-19 00:01:53 one finished. Debug: 05-19 00:01:53 erasing.. Debug: 05-19 00:01:53 erase done.. Debug: 05-19 00:01:53 one finished. Debug: 05-19 00:01:53 erasing.. Debug: 05-19 00:01:53 erase done.. Debug: 05-19 00:01:53 send dicts(finished): "groupId:1,word:が行,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:53 ====reading 3991 of (5400) bytes . Finished: 1 Debug: 05-19 00:01:53 receive dicts, current word: "が行" "が行" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:53 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:53 scheme: "gico" Debug: 05-19 00:01:53 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:53 article view loaded url: "gdlookup://localhost/?word=が行&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fff" true Debug: 05-19 00:01:54 open link url: QUrl("bword:納得") Debug: 05-19 00:01:54 getResource: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:54 scheme: "gdlookup" Debug: 05-19 00:01:54 host: "localhost" Debug: 05-19 00:01:54 clear current dictionaries: "納得" Debug: 05-19 00:01:54 some body finished Debug: 05-19 00:01:54 one not finished. Debug: 05-19 00:01:54 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:54 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:54 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:54 some body finished Debug: 05-19 00:01:54 one not finished. Debug: 05-19 00:01:54 some body finished Debug: 05-19 00:01:54 one not finished. Debug: 05-19 00:01:54 some body finished Debug: 05-19 00:01:54 one not finished. Debug: 05-19 00:01:54 some body finished Debug: 05-19 00:01:54 one finished. Debug: 05-19 00:01:54 erasing.. Debug: 05-19 00:01:54 erase done.. Debug: 05-19 00:01:54 one finished. Debug: 05-19 00:01:54 erasing.. Debug: 05-19 00:01:54 erase done.. Debug: 05-19 00:01:54 one finished. Debug: 05-19 00:01:54 erasing.. Debug: 05-19 00:01:54 erase done.. Debug: 05-19 00:01:54 one finished. Debug: 05-19 00:01:54 erasing.. Debug: 05-19 00:01:54 erase done.. Debug: 05-19 00:01:54 send dicts(finished): "groupId:1,word:納得,dictId:9dfe38c28e4eb0d417245e761da52517,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:54 receive dicts, current word: "納得" "納得" : QList("9dfe38c28e4eb0d417245e761da52517", "968c3a374ef50d74e019560ae8f69488", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:54 ====reading 14294 of (15703) bytes . Finished: 1 Debug: 05-19 00:01:54 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:54 scheme: "gico" Debug: 05-19 00:01:54 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:54 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:54 scheme: "bres" Debug: 05-19 00:01:54 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:54 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:54 scheme: "bres" Debug: 05-19 00:01:54 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:54 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:54 scheme: "bres" Debug: 05-19 00:01:54 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:54 article view loaded url: "gdlookup://localhost/?word=納得&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fff" true Debug: 05-19 00:01:56 getResource: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:56 scheme: "gdlookup" Debug: 05-19 00:01:56 host: "localhost" Debug: 05-19 00:01:56 clear current dictionaries: "ゆっくり" Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 ====reading 1415 of (1415) bytes . Finished: 0 Debug: 05-19 00:01:56 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-19 00:01:56 ====reading 0 of (1415) bytes . Finished: 0 Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 send dicts(updated): "groupId:1,word:ゆっくり,dictId:9dfe38c28e4eb0d417245e761da52517,968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:01:56 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("9dfe38c28e4eb0d417245e761da52517", "968c3a374ef50d74e019560ae8f69488") Debug: 05-19 00:01:56 ====reading 6975 of (8390) bytes . Finished: 0 Debug: 05-19 00:01:56 ====reading 0 of (8390) bytes . Finished: 0 Debug: 05-19 00:01:56 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:56 scheme: "gico" Debug: 05-19 00:01:56 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 send dicts(finished): "groupId:1,word:ゆっくり,dictId:ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 receive dicts, current word: "ゆっくり" "ゆっくり" : QList("ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:56 ====reading 12849 of (21239) bytes . Finished: 1 Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:56 scheme: "gico" Debug: 05-19 00:01:56 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:56 scheme: "bres" Debug: 05-19 00:01:56 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:56 article view loaded url: "gdlookup://localhost/?word=ゆっくり&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbf" true Debug: 05-19 00:01:56 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:56 scheme: "gdlookup" Debug: 05-19 00:01:56 host: "localhost" Debug: 05-19 00:01:56 clear current dictionaries: "転生したら剣でした" Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-19 00:01:56 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-19 00:01:56 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one not finished. Debug: 05-19 00:01:56 some body finished Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 one finished. Debug: 05-19 00:01:56 erasing.. Debug: 05-19 00:01:56 erase done.. Debug: 05-19 00:01:56 send dicts(finished): "groupId:1,word:転生したら剣でした,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:56 receive dicts, current word: "転生したら剣でした" "転生したら剣でした" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:56 ====reading 5340 of (6770) bytes . Finished: 1 Debug: 05-19 00:01:56 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:56 scheme: "gico" Debug: 05-19 00:01:56 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:56 article view loaded url: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf" true Debug: 05-19 00:01:57 open link url: QUrl("bword:転生") Debug: 05-19 00:01:57 getResource: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:57 scheme: "gdlookup" Debug: 05-19 00:01:57 host: "localhost" Debug: 05-19 00:01:57 clear current dictionaries: "転生" Debug: 05-19 00:01:57 some body finished Debug: 05-19 00:01:57 one not finished. Debug: 05-19 00:01:57 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:57 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:57 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:57 some body finished Debug: 05-19 00:01:57 one not finished. Debug: 05-19 00:01:57 some body finished Debug: 05-19 00:01:57 one not finished. Debug: 05-19 00:01:57 some body finished Debug: 05-19 00:01:57 one finished. Debug: 05-19 00:01:57 erasing.. Debug: 05-19 00:01:57 erase done.. Debug: 05-19 00:01:57 one finished. Debug: 05-19 00:01:57 erasing.. Debug: 05-19 00:01:57 erase done.. Debug: 05-19 00:01:57 one not finished. Debug: 05-19 00:01:57 send dicts(updated): "groupId:1,word:転生,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:57 receive dicts, current word: "転生" "転生" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:57 ====reading 5283 of (6692) bytes . Finished: 0 Debug: 05-19 00:01:57 ====reading 0 of (6692) bytes . Finished: 0 Debug: 05-19 00:01:57 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:57 scheme: "gico" Debug: 05-19 00:01:57 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:58 some body finished Debug: 05-19 00:01:58 one finished. Debug: 05-19 00:01:58 erasing.. Debug: 05-19 00:01:58 erase done.. Debug: 05-19 00:01:58 one finished. Debug: 05-19 00:01:58 erasing.. Debug: 05-19 00:01:58 erase done.. Debug: 05-19 00:01:58 send dicts(finished): "groupId:1,word:転生,dictId:ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:58 receive dicts, current word: "転生" "転生" : QList("ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:58 ====reading 7296 of (13988) bytes . Finished: 1 Debug: 05-19 00:01:58 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:58 scheme: "bres" Debug: 05-19 00:01:58 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:58 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:58 scheme: "gico" Debug: 05-19 00:01:58 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:58 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:58 scheme: "bres" Debug: 05-19 00:01:58 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:58 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:58 scheme: "bres" Debug: 05-19 00:01:58 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:58 article view loaded url: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cf" true Debug: 05-19 00:01:58 open link url: QUrl("bword:したら") Debug: 05-19 00:01:58 getResource: "gdlookup://localhost/?word=したら&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:58 scheme: "gdlookup" Debug: 05-19 00:01:58 host: "localhost" Debug: 05-19 00:01:58 clear current dictionaries: "したら" Debug: 05-19 00:01:58 some body finished Debug: 05-19 00:01:58 one not finished. Debug: 05-19 00:01:58 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-19 00:01:58 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-19 00:01:58 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-19 00:01:58 some body finished Debug: 05-19 00:01:58 one not finished. Debug: 05-19 00:01:58 some body finished Debug: 05-19 00:01:58 one not finished. Debug: 05-19 00:01:58 some body finished Debug: 05-19 00:01:58 one not finished. Debug: 05-19 00:01:58 some body finished Debug: 05-19 00:01:58 one finished. Debug: 05-19 00:01:58 erasing.. Debug: 05-19 00:01:58 erase done.. Debug: 05-19 00:01:58 one finished. Debug: 05-19 00:01:58 erasing.. Debug: 05-19 00:01:58 erase done.. Debug: 05-19 00:01:58 one finished. Debug: 05-19 00:01:58 erasing.. Debug: 05-19 00:01:58 erase done.. Debug: 05-19 00:01:58 one finished. Debug: 05-19 00:01:58 erasing.. Debug: 05-19 00:01:58 erase done.. Debug: 05-19 00:01:58 send dicts(finished): "groupId:1,word:したら,dictId:9dfe38c28e4eb0d417245e761da52517,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:58 receive dicts, current word: "したら" "したら" : QList("9dfe38c28e4eb0d417245e761da52517", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:01:58 ====reading 7529 of (8941) bytes . Finished: 1 Debug: 05-19 00:01:58 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:58 scheme: "gico" Debug: 05-19 00:01:58 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:58 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:01:58 scheme: "bres" Debug: 05-19 00:01:58 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:01:58 article view loaded url: "gdlookup://localhost/?word=したら&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259ff" true Debug: 05-19 00:01:59 open link url: QUrl("bword:でし") Debug: 05-19 00:01:59 getResource: "gdlookup://localhost/?word=でし&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:01:59 scheme: "gdlookup" Debug: 05-19 00:01:59 host: "localhost" Debug: 05-19 00:01:59 clear current dictionaries: "でし" Debug: 05-19 00:01:59 some body finished Debug: 05-19 00:01:59 one not finished. Debug: 05-19 00:01:59 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:59 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:59 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:01:59 some body finished Debug: 05-19 00:01:59 one not finished. Debug: 05-19 00:01:59 some body finished Debug: 05-19 00:01:59 one finished. Debug: 05-19 00:01:59 erasing.. Debug: 05-19 00:01:59 erase done.. Debug: 05-19 00:01:59 one not finished. Debug: 05-19 00:01:59 send dicts(updated): "groupId:1,word:でし,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:01:59 receive dicts, current word: "でし" "でし" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:01:59 ====reading 5283 of (6692) bytes . Finished: 0 Debug: 05-19 00:01:59 ====reading 0 of (6692) bytes . Finished: 0 Debug: 05-19 00:01:59 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:01:59 scheme: "gico" Debug: 05-19 00:01:59 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:04 some body finished Debug: 05-19 00:02:04 one finished. Debug: 05-19 00:02:04 erasing.. Debug: 05-19 00:02:04 erase done.. Debug: 05-19 00:02:04 one not finished. Debug: 05-19 00:02:04 send dicts(updated): "groupId:1,word:でし,dictId:968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:02:04 receive dicts, current word: "でし" "でし" : QList("968c3a374ef50d74e019560ae8f69488") Debug: 05-19 00:02:04 ====reading 2954 of (9646) bytes . Finished: 0 Debug: 05-19 00:02:04 ====reading 0 of (9646) bytes . Finished: 0 Debug: 05-19 00:02:04 some body finished Debug: 05-19 00:02:04 one finished. Debug: 05-19 00:02:04 erasing.. Debug: 05-19 00:02:04 erase done.. Debug: 05-19 00:02:04 one finished. Debug: 05-19 00:02:04 erasing.. Debug: 05-19 00:02:04 erase done.. Debug: 05-19 00:02:04 send dicts(finished): "groupId:1,word:でし,dictId:ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:04 receive dicts, current word: "でし" "でし" : QList("ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:02:04 ====reading 5558 of (15204) bytes . Finished: 1 Debug: 05-19 00:02:07 getResource: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:02:07 scheme: "gdlookup" Debug: 05-19 00:02:07 host: "localhost" Debug: 05-19 00:02:07 clear current dictionaries: "転生したら剣でした" Debug: 05-19 00:02:07 some body finished Debug: 05-19 00:02:07 one not finished. Debug: 05-19 00:02:07 ====reading 1430 of (1430) bytes . Finished: 0 Debug: 05-19 00:02:07 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-19 00:02:07 ====reading 0 of (1430) bytes . Finished: 0 Debug: 05-19 00:02:07 some body finished Debug: 05-19 00:02:07 one not finished. Debug: 05-19 00:02:07 some body finished Debug: 05-19 00:02:07 one not finished. Debug: 05-19 00:02:07 some body finished Debug: 05-19 00:02:07 one not finished. Debug: 05-19 00:02:07 some body finished Debug: 05-19 00:02:07 one finished. Debug: 05-19 00:02:07 erasing.. Debug: 05-19 00:02:07 erase done.. Debug: 05-19 00:02:07 one finished. Debug: 05-19 00:02:07 erasing.. Debug: 05-19 00:02:07 erase done.. Debug: 05-19 00:02:07 one finished. Debug: 05-19 00:02:07 erasing.. Debug: 05-19 00:02:07 erase done.. Debug: 05-19 00:02:07 one finished. Debug: 05-19 00:02:07 erasing.. Debug: 05-19 00:02:07 erase done.. Debug: 05-19 00:02:07 send dicts(finished): "groupId:1,word:転生したら剣でした,dictId:9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:07 receive dicts, current word: "転生したら剣でした" "転生したら剣でした" : QList("9dfe38c28e4eb0d417245e761da52517") Debug: 05-19 00:02:07 ====reading 5340 of (6770) bytes . Finished: 1 Debug: 05-19 00:02:07 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:02:07 scheme: "gico" Debug: 05-19 00:02:07 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:07 article view loaded url: "gdlookup://localhost/?word=転生したら剣でした&group=1&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf" true Debug: 05-19 00:02:08 open link url: QUrl("bword:転生") Debug: 05-19 00:02:08 getResource: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:02:08 scheme: "gdlookup" Debug: 05-19 00:02:08 host: "localhost" Debug: 05-19 00:02:08 clear current dictionaries: "転生" Debug: 05-19 00:02:08 some body finished Debug: 05-19 00:02:08 one not finished. Debug: 05-19 00:02:08 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:08 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:08 some body finished Debug: 05-19 00:02:08 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:08 one not finished. Debug: 05-19 00:02:08 some body finished Debug: 05-19 00:02:08 one not finished. Debug: 05-19 00:02:08 some body finished Debug: 05-19 00:02:08 one not finished. Debug: 05-19 00:02:08 some body finished Debug: 05-19 00:02:08 one finished. Debug: 05-19 00:02:08 erasing.. Debug: 05-19 00:02:08 erase done.. Debug: 05-19 00:02:08 one finished. Debug: 05-19 00:02:08 erasing.. Debug: 05-19 00:02:08 erase done.. Debug: 05-19 00:02:08 one finished. Debug: 05-19 00:02:08 erasing.. Debug: 05-19 00:02:08 erase done.. Debug: 05-19 00:02:08 one finished. Debug: 05-19 00:02:08 erasing.. Debug: 05-19 00:02:08 erase done.. Debug: 05-19 00:02:08 send dicts(finished): "groupId:1,word:転生,dictId:9dfe38c28e4eb0d417245e761da52517,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:08 receive dicts, current word: "転生" "転生" : QList("9dfe38c28e4eb0d417245e761da52517", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:02:08 ====reading 12579 of (13988) bytes . Finished: 1 Debug: 05-19 00:02:08 getResource: "bres://ec855a5ed10fb99483666514453d9bac/jm_pt.css" Debug: 05-19 00:02:08 scheme: "bres" Debug: 05-19 00:02:08 host: "ec855a5ed10fb99483666514453d9bac" Debug: 05-19 00:02:08 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:02:08 scheme: "gico" Debug: 05-19 00:02:08 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:08 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.css" Debug: 05-19 00:02:08 scheme: "bres" Debug: 05-19 00:02:08 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:08 getResource: "gico://ec855a5ed10fb99483666514453d9bac/dicticon.png" Debug: 05-19 00:02:08 scheme: "gico" Debug: 05-19 00:02:08 host: "ec855a5ed10fb99483666514453d9bac" Debug: 05-19 00:02:08 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:08 scheme: "bres" Debug: 05-19 00:02:08 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:08 getResource: "gico://b1e3f422135b95f15c0225ae27692050/dicticon.png" Debug: 05-19 00:02:08 scheme: "gico" Debug: 05-19 00:02:08 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:09 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:09 scheme: "bres" Debug: 05-19 00:02:09 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:09 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:09 scheme: "bres" Debug: 05-19 00:02:09 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:09 article view loaded url: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cf" true Debug: 05-19 00:02:10 open link url: QUrl("bword:したら") Debug: 05-19 00:02:10 getResource: "gdlookup://localhost/?word=したら&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:02:10 scheme: "gdlookup" Debug: 05-19 00:02:10 host: "localhost" Debug: 05-19 00:02:10 clear current dictionaries: "したら" Debug: 05-19 00:02:10 some body finished Debug: 05-19 00:02:10 one not finished. Debug: 05-19 00:02:10 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-19 00:02:10 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-19 00:02:10 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-19 00:02:10 some body finished Debug: 05-19 00:02:10 one not finished. Debug: 05-19 00:02:10 some body finished Debug: 05-19 00:02:10 one not finished. Debug: 05-19 00:02:10 some body finished Debug: 05-19 00:02:10 one not finished. Debug: 05-19 00:02:10 some body finished Debug: 05-19 00:02:10 one finished. Debug: 05-19 00:02:10 erasing.. Debug: 05-19 00:02:10 erase done.. Debug: 05-19 00:02:10 one finished. Debug: 05-19 00:02:10 erasing.. Debug: 05-19 00:02:10 erase done.. Debug: 05-19 00:02:10 one finished. Debug: 05-19 00:02:10 erasing.. Debug: 05-19 00:02:10 erase done.. Debug: 05-19 00:02:10 one finished. Debug: 05-19 00:02:10 erasing.. Debug: 05-19 00:02:10 erase done.. Debug: 05-19 00:02:10 send dicts(finished): "groupId:1,word:したら,dictId:9dfe38c28e4eb0d417245e761da52517,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:10 receive dicts, current word: "したら" "したら" : QList("9dfe38c28e4eb0d417245e761da52517", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:02:10 ====reading 7529 of (8941) bytes . Finished: 1 Debug: 05-19 00:02:10 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:02:10 scheme: "gico" Debug: 05-19 00:02:10 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:10 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:10 scheme: "bres" Debug: 05-19 00:02:10 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:10 article view loaded url: "gdlookup://localhost/?word=したら&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259ff" true Debug: 05-19 00:02:12 open link url: QUrl("bword:転生") Debug: 05-19 00:02:12 getResource: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:02:12 scheme: "gdlookup" Debug: 05-19 00:02:12 host: "localhost" Debug: 05-19 00:02:12 clear current dictionaries: "転生" Debug: 05-19 00:02:12 some body finished Debug: 05-19 00:02:12 one not finished. Debug: 05-19 00:02:12 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:12 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:12 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:12 some body finished Debug: 05-19 00:02:12 one not finished. Debug: 05-19 00:02:12 some body finished Debug: 05-19 00:02:12 one not finished. Debug: 05-19 00:02:12 some body finished Debug: 05-19 00:02:12 one not finished. Debug: 05-19 00:02:12 some body finished Debug: 05-19 00:02:12 one finished. Debug: 05-19 00:02:12 erasing.. Debug: 05-19 00:02:12 erase done.. Debug: 05-19 00:02:12 one finished. Debug: 05-19 00:02:12 erasing.. Debug: 05-19 00:02:12 erase done.. Debug: 05-19 00:02:12 one finished. Debug: 05-19 00:02:12 erasing.. Debug: 05-19 00:02:12 erase done.. Debug: 05-19 00:02:12 one finished. Debug: 05-19 00:02:12 erasing.. Debug: 05-19 00:02:12 erase done.. Debug: 05-19 00:02:12 send dicts(finished): "groupId:1,word:転生,dictId:9dfe38c28e4eb0d417245e761da52517,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:12 ====reading 12579 of (13988) bytes . Finished: 1 Debug: 05-19 00:02:12 receive dicts, current word: "転生" "転生" : QList("9dfe38c28e4eb0d417245e761da52517", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:02:12 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:02:12 scheme: "gico" Debug: 05-19 00:02:12 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:12 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:12 scheme: "bres" Debug: 05-19 00:02:12 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:12 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:12 scheme: "bres" Debug: 05-19 00:02:12 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:12 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:12 scheme: "bres" Debug: 05-19 00:02:12 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:12 article view loaded url: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fff" true Debug: 05-19 00:02:14 open link url: QUrl("bword:でし") Debug: 05-19 00:02:14 getResource: "gdlookup://localhost/?word=でし&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:02:14 scheme: "gdlookup" Debug: 05-19 00:02:14 host: "localhost" Debug: 05-19 00:02:14 clear current dictionaries: "でし" Debug: 05-19 00:02:14 some body finished Debug: 05-19 00:02:14 one not finished. Debug: 05-19 00:02:14 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:14 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:14 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:14 some body finished Debug: 05-19 00:02:14 one not finished. Debug: 05-19 00:02:14 some body finished Debug: 05-19 00:02:14 one not finished. Debug: 05-19 00:02:14 some body finished Debug: 05-19 00:02:14 one not finished. Debug: 05-19 00:02:14 some body finished Debug: 05-19 00:02:14 one finished. Debug: 05-19 00:02:14 erasing.. Debug: 05-19 00:02:14 erase done.. Debug: 05-19 00:02:14 one finished. Debug: 05-19 00:02:14 erasing.. Debug: 05-19 00:02:14 erase done.. Debug: 05-19 00:02:14 one finished. Debug: 05-19 00:02:14 erasing.. Debug: 05-19 00:02:14 erase done.. Debug: 05-19 00:02:14 one finished. Debug: 05-19 00:02:14 erasing.. Debug: 05-19 00:02:14 erase done.. Debug: 05-19 00:02:14 send dicts(finished): "groupId:1,word:でし,dictId:9dfe38c28e4eb0d417245e761da52517,968c3a374ef50d74e019560ae8f69488,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:14 ====reading 13795 of (15204) bytes . Finished: 1 Debug: 05-19 00:02:14 receive dicts, current word: "でし" "でし" : QList("9dfe38c28e4eb0d417245e761da52517", "968c3a374ef50d74e019560ae8f69488", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:02:14 getResource: "bres://968c3a374ef50d74e019560ae8f69488/NHK日本語発音アクセント辞書.css" Debug: 05-19 00:02:14 scheme: "bres" Debug: 05-19 00:02:14 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:02:14 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:02:14 scheme: "gico" Debug: 05-19 00:02:14 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:14 getResource: "gico://968c3a374ef50d74e019560ae8f69488/dicticon.png" Debug: 05-19 00:02:14 scheme: "gico" Debug: 05-19 00:02:14 host: "968c3a374ef50d74e019560ae8f69488" Debug: 05-19 00:02:14 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:14 scheme: "bres" Debug: 05-19 00:02:14 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:14 article view loaded url: "gdlookup://localhost/?word=でし&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fff" true Debug: 05-19 00:02:16 open link url: QUrl("bword:転生") Debug: 05-19 00:02:16 getResource: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:02:16 scheme: "gdlookup" Debug: 05-19 00:02:16 host: "localhost" Debug: 05-19 00:02:16 clear current dictionaries: "転生" Debug: 05-19 00:02:16 some body finished Debug: 05-19 00:02:16 one not finished. Debug: 05-19 00:02:16 ====reading 1409 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:16 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:16 some body finished Debug: 05-19 00:02:16 ====reading 0 of (1409) bytes . Finished: 0 Debug: 05-19 00:02:16 one not finished. Debug: 05-19 00:02:16 some body finished Debug: 05-19 00:02:16 one not finished. Debug: 05-19 00:02:16 some body finished Debug: 05-19 00:02:16 one not finished. Debug: 05-19 00:02:16 some body finished Debug: 05-19 00:02:16 one finished. Debug: 05-19 00:02:16 erasing.. Debug: 05-19 00:02:16 erase done.. Debug: 05-19 00:02:16 one finished. Debug: 05-19 00:02:16 erasing.. Debug: 05-19 00:02:16 erase done.. Debug: 05-19 00:02:16 one finished. Debug: 05-19 00:02:16 erasing.. Debug: 05-19 00:02:16 erase done.. Debug: 05-19 00:02:16 one finished. Debug: 05-19 00:02:16 erasing.. Debug: 05-19 00:02:16 erase done.. Debug: 05-19 00:02:16 send dicts(finished): "groupId:1,word:転生,dictId:9dfe38c28e4eb0d417245e761da52517,ec855a5ed10fb99483666514453d9bac,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:16 receive dicts, current word: "転生" "転生" : QList("9dfe38c28e4eb0d417245e761da52517", "ec855a5ed10fb99483666514453d9bac", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:02:16 ====reading 12579 of (13988) bytes . Finished: 1 Debug: 05-19 00:02:16 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:02:16 scheme: "gico" Debug: 05-19 00:02:16 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:16 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:16 scheme: "bres" Debug: 05-19 00:02:16 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:16 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:16 scheme: "bres" Debug: 05-19 00:02:16 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:16 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:16 scheme: "bres" Debug: 05-19 00:02:16 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:16 article view loaded url: "gdlookup://localhost/?word=転生&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fff" true Debug: 05-19 00:02:43 open link url: QUrl("bword:したら") Debug: 05-19 00:02:43 getResource: "gdlookup://localhost/?word=したら&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259fffdd76764f7431170eeb89a0f9,27ea5cfecf6d68fdf7dcbfd8df6f06f7,156e4c2d5407db4c7dc6af55617b6d87,23bf0ce06d2b68a076557b4c34cf1a74" Debug: 05-19 00:02:43 scheme: "gdlookup" Debug: 05-19 00:02:43 host: "localhost" Debug: 05-19 00:02:43 clear current dictionaries: "したら" Debug: 05-19 00:02:43 some body finished Debug: 05-19 00:02:43 one not finished. Debug: 05-19 00:02:43 ====reading 1412 of (1412) bytes . Finished: 0 Debug: 05-19 00:02:43 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-19 00:02:43 ====reading 0 of (1412) bytes . Finished: 0 Debug: 05-19 00:02:43 some body finished Debug: 05-19 00:02:43 one not finished. Debug: 05-19 00:02:43 some body finished Debug: 05-19 00:02:43 one not finished. Debug: 05-19 00:02:43 some body finished Debug: 05-19 00:02:43 one not finished. Debug: 05-19 00:02:43 some body finished Debug: 05-19 00:02:43 one finished. Debug: 05-19 00:02:43 erasing.. Debug: 05-19 00:02:43 erase done.. Debug: 05-19 00:02:43 one finished. Debug: 05-19 00:02:43 erasing.. Debug: 05-19 00:02:43 erase done.. Debug: 05-19 00:02:43 one finished. Debug: 05-19 00:02:43 erasing.. Debug: 05-19 00:02:43 erase done.. Debug: 05-19 00:02:43 one finished. Debug: 05-19 00:02:43 erasing.. Debug: 05-19 00:02:43 erase done.. Debug: 05-19 00:02:43 send dicts(finished): "groupId:1,word:したら,dictId:9dfe38c28e4eb0d417245e761da52517,b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:43 receive dicts, current word: "したら" "したら" : QList("9dfe38c28e4eb0d417245e761da52517", "b1e3f422135b95f15c0225ae27692050") Debug: 05-19 00:02:43 ====reading 7529 of (8941) bytes . Finished: 1 Debug: 05-19 00:02:43 getResource: "gico://9dfe38c28e4eb0d417245e761da52517/dicticon.png" Debug: 05-19 00:02:43 scheme: "gico" Debug: 05-19 00:02:43 host: "9dfe38c28e4eb0d417245e761da52517" Debug: 05-19 00:02:43 getResource: "bres://b1e3f422135b95f15c0225ae27692050/fj.js" Debug: 05-19 00:02:43 scheme: "bres" Debug: 05-19 00:02:43 host: "b1e3f422135b95f15c0225ae27692050" Debug: 05-19 00:02:43 article view loaded url: "gdlookup://localhost/?word=したら&group=1&scrollto=gdfrom-9dfe38c28e4eb0d417245e761da52517&muted=00824c93f503c5d1680483abdf367948,6dac50cdfb3265d22b966313a1d228b7,5a560bd16b0c6cbd714faf0c388ae098,90259ff" true