Repository.mk | 1 l10ntools/Executable_genlang.mk | 52 -- l10ntools/inc/gConv.hxx | 71 -- l10ntools/inc/gConvPo.hxx | 71 -- l10ntools/inc/gConvProp.hxx | 34 - l10ntools/inc/gConvSrc.hxx | 75 --- l10ntools/inc/gConvTree.hxx | 65 -- l10ntools/inc/gConvUi.hxx | 39 - l10ntools/inc/gConvUlf.hxx | 44 - l10ntools/inc/gConvXcs.hxx | 46 - l10ntools/inc/gConvXcu.hxx | 57 -- l10ntools/inc/gConvXhp.hxx | 69 -- l10ntools/inc/gConvXml.hxx | 39 - l10ntools/inc/gConvXrm.hxx | 50 -- l10ntools/inc/gL10nMem.hxx | 139 ----- l10ntools/source/gConv.cxx | 272 ----------- l10ntools/source/gConvPo.cxx | 269 ----------- l10ntools/source/gConvProp.cxx | 31 - l10ntools/source/gConvSrc.cxx | 330 ------------- l10ntools/source/gConvTree.cxx | 200 -------- l10ntools/source/gConvUi.cxx | 40 - l10ntools/source/gConvUlf.cxx | 76 --- l10ntools/source/gConvXcs.cxx | 128 ----- l10ntools/source/gConvXcu.cxx | 181 ------- l10ntools/source/gConvXhp.cxx | 391 ---------------- l10ntools/source/gConvXml.cxx | 40 - l10ntools/source/gConvXrm.cxx | 135 ----- l10ntools/source/gDiff.sh | 20 l10ntools/source/gL10nMem.cxx | 969 ---------------------------------------- l10ntools/source/gLang.cxx | 418 ----------------- l10ntools/source/gLexPo.l | 125 ----- l10ntools/source/gLexSrc.l | 351 -------------- l10ntools/source/gLexTree.l | 127 ----- l10ntools/source/gLexUi.l | 90 --- l10ntools/source/gLexUlf.l | 107 ---- l10ntools/source/gLexXcs.l | 76 --- l10ntools/source/gLexXcu.l | 127 ----- l10ntools/source/gLexXhp.l | 157 ------ l10ntools/source/gLexXml.l | 90 --- l10ntools/source/gLexXrm.l | 97 ---- l10ntools/source/gRun.sh | 500 -------------------- l10ntools/source/gTest.sh | 6 solenv/clang-format/blacklist | 27 - 43 files changed, 6232 deletions(-)
New commits: commit bcbb3c4f5b23acd4fe73c7d8b080d20c49d664f8 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Feb 7 20:56:29 2018 +0100 Remove dead Executable_genlang ...originally introduce with 999c68f12f1d95b16a97294949a0e6ba6d3ba259 "genLang project (awareness)", but apparently never took off. Change-Id: I6f61271a75d96750dea63de596b7745c2f589b83 Reviewed-on: https://gerrit.libreoffice.org/49389 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/Repository.mk b/Repository.mk index 17dab1319038..2f34509f4f4c 100644 --- a/Repository.mk +++ b/Repository.mk @@ -34,7 +34,6 @@ $(eval $(call gb_Helper_register_executables,NONE, \ genconv_dict \ gendict \ genindex_data \ - genlang \ helpex \ idxdict \ langsupport \ diff --git a/l10ntools/Executable_genlang.mk b/l10ntools/Executable_genlang.mk deleted file mode 100644 index 0299493abb57..000000000000 --- a/l10ntools/Executable_genlang.mk +++ /dev/null @@ -1,52 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_Executable_Executable,genlang)) - -$(eval $(call gb_Executable_set_include,genlang,\ - -I$(SRCDIR)/l10ntools/inc \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_Executable_use_externals,genlang,\ - boost_headers \ -)) - - -$(eval $(call gb_Executable_add_scanners,genlang,\ - l10ntools/source/gLexPo \ - l10ntools/source/gLexUi \ - l10ntools/source/gLexSrc \ - l10ntools/source/gLexXcu \ - l10ntools/source/gLexXcs \ - l10ntools/source/gLexXrm \ - l10ntools/source/gLexXml \ - l10ntools/source/gLexXhp \ - l10ntools/source/gLexUlf \ - l10ntools/source/gLexTree \ -)) - -$(eval $(call gb_Executable_add_exception_objects,genlang,\ - l10ntools/source/gLang \ - l10ntools/source/gL10nMem \ - l10ntools/source/gConvProp \ - l10ntools/source/gConv \ - l10ntools/source/gConvPo \ - l10ntools/source/gConvSrc \ - l10ntools/source/gConvUi \ - l10ntools/source/gConvXrm \ - l10ntools/source/gConvXml \ - l10ntools/source/gConvXhp \ - l10ntools/source/gConvXcs \ - l10ntools/source/gConvXcu \ - l10ntools/source/gConvUlf \ - l10ntools/source/gConvTree \ -)) - -# vim:set noet sw=4 ts=4: diff --git a/l10ntools/inc/gConv.hxx b/l10ntools/inc/gConv.hxx deleted file mode 100644 index a32291272278..000000000000 --- a/l10ntools/inc/gConv.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCON_HXX -#define GCON_HXX -#include <iostream> -#include <fstream> - -class convert_gen -{ - public: - static convert_gen *mcImpl; - - convert_gen(l10nMem& cMemory); - virtual ~convert_gen(); - - // Create instance - static convert_gen& createInstance(l10nMem& cMemory, - const string& sSourceDir, - const string& sTargetDir, - const string& sSourceFile); - - // do extract/merge - bool execute(const bool bMerge); - - // all converters MUST implement this function - virtual void doExecute() = 0; - - // utility functions for converters - void lexRead(char *sBuf, size_t *result, size_t nMax_size); - static void lexStrncpy(char* s1, const char * s2, int n); - string& copySource(char const *yyText, bool bDoClear = true); - - protected: - // generic variables - bool mbMergeMode; - bool mbLoadMode; - string msSourcePath; - string msTargetPath; - string msSourceFile; - l10nMem& mcMemory; - string msCollector; - int miLineNo; - string msSourceBuffer, msCopyText; - int miSourceReadIndex; - - bool prepareFile(); - - // utility functions for converters - void writeSourceFile(const string& line); - static bool createDir(const string& sDir, const string& sFile); -private: - ofstream mcOutputFile; - static bool checkAccess(string& sFile); -}; -#endif diff --git a/l10ntools/inc/gConvPo.hxx b/l10ntools/inc/gConvPo.hxx deleted file mode 100644 index ebf1ee3f29ea..000000000000 --- a/l10ntools/inc/gConvPo.hxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONPO_HXX -#define GCONPO_HXX -#include "gConv.hxx" - - - -extern int polex(void); - - - -class convert_po : public convert_gen -{ - public: - bool mbExpectId; - bool mbExpectStr; - - - convert_po(l10nMem& crMemory); - ~convert_po() override {}; - - void startLook (); - void setValue (char *syyText, int iLineCnt); - void setFuzzy (); - void setKey (char *syyText); - void setMsgId (); - void setMsgStr (); - void handleNL (); - - // Used to save .pot files - void startSave(const string& sName, - const string& sTargetDir, - const string& sFile); - void save(const string& sFileName, - const string& sKey, - const string& sENUStext, - const string& sText, - const string& sComment, - const string& sResource, - const string& sGroup, - bool bFuzzy); - void endSave(); - - private: - string msId; - string msStr; - string msKey; - bool mbFuzzy; - filebuf mfOutBuffer; - - void doExecute() override; - string genKeyId(const string& text); -}; -#endif diff --git a/l10ntools/inc/gConvProp.hxx b/l10ntools/inc/gConvProp.hxx deleted file mode 100644 index d65531ec5d2a..000000000000 --- a/l10ntools/inc/gConvProp.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONPROP_HXX -#define GCONPROP_HXX -#include "gConv.hxx" - - - -class convert_prop : public convert_gen -{ - public: - convert_prop(l10nMem& crMemory) : convert_gen(crMemory) {}; - ~convert_prop() override {}; - - private: - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gConvSrc.hxx b/l10ntools/inc/gConvSrc.hxx deleted file mode 100644 index 0710f134d69a..000000000000 --- a/l10ntools/inc/gConvSrc.hxx +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONSRCHXX -#define GCONSRCHXX -#include "gConv.hxx" - - -extern int srclex(void); - - - -class convert_src : public convert_gen -{ - public: -// bool mbExpectValue; - - convert_src(l10nMem& crMemory); - ~convert_src() override {}; - - void setValue(string& syyText); - bool setLang(string& syyText); - void setName(string& syyText, bool revertLevel); - void setCmd(string& syyText); - void startBlock(); - void stopBlock(); - void defMacro(); - void endMacro(); - -// void setId (char *syyText, bool bIde); -// void setText (char *syyText); -// void setList (char *syyText); -// void setListItem (char const *syyText, bool bIsStart); -// void setNL (char *syyText, bool bMacro); - - private: - vector<string> mcStack; - int miLevel; - bool mbMacroActive; - void doExecute() override; -#if 0 - string msValue; - string msName; - string msTextName; - string msCmd; - string msGroup; - bool mbEnUs; - bool mbExpectName; - bool mbAutoPush; - bool mbValuePresent; - bool mbInList; - bool mbInListItem; - int miListCount; - - static void trim(string& sText); - void buildKey(string& sKey); - void insertLanguagePart(string& sKey, string& sTextType); -#endif -}; -#endif diff --git a/l10ntools/inc/gConvTree.hxx b/l10ntools/inc/gConvTree.hxx deleted file mode 100644 index bd9adb38d65e..000000000000 --- a/l10ntools/inc/gConvTree.hxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONTREE_HXX -#define GCONTREE_HXX -#include "gConv.hxx" - - -extern int treelex(void); - - -class convert_tree : public convert_gen -{ - public: - typedef enum { - STATE_TAG_NONE, - STATE_TAG_HELPSEC, - STATE_TAG_NODE, - STATE_TAG_TOPIC, - STATE_TAG_VALUE - } STATE_TAG; - typedef enum { - STATE_VAL_NONE, - STATE_VAL_APPL, - STATE_VAL_ID, - STATE_VAL_TITLE - } STATE_VAL; - - convert_tree(l10nMem& crMemory); - ~convert_tree() override; - - void setString(char *yytext); - void setState(char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNewStateVAL, char *sModule); - void setValue(char *yytext); - void writeSourceFile(string& sText, int inx); - string& copySourceSpecial(char *yytext, int iType); - - private: - string msLine; - string msModule; - string msId; - string msAppl; - ofstream *mcOutputFiles; - STATE_TAG meStateTag; - STATE_VAL meStateVal; - int miCntLanguages; - - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gConvUi.hxx b/l10ntools/inc/gConvUi.hxx deleted file mode 100644 index be4a443e136e..000000000000 --- a/l10ntools/inc/gConvUi.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONUIHXX -#define GCONUIHXX -#include "gConv.hxx" - - - -extern int uilex(void); - - - -class convert_ui : public convert_gen -{ - public: - convert_ui(l10nMem& crMemory); - ~convert_ui() override {}; - - - private: - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gConvUlf.hxx b/l10ntools/inc/gConvUlf.hxx deleted file mode 100644 index 85902e4bba0f..000000000000 --- a/l10ntools/inc/gConvUlf.hxx +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONULF_HXX -#define GCONULF_HXX -#include "gConv.hxx" - - - -extern int ulflex(void); - - -class convert_ulf : public convert_gen -{ - public: - convert_ulf(l10nMem& crMemory) : convert_gen(crMemory) {}; - ~convert_ulf() override {}; - - void setKey(char *syyText); - void setText(char *syyText, bool bIsEnUs); - void setValue(char *syyText); - - private: - string msKey; - - void doExecute() override; - void handleLines(); -}; -#endif diff --git a/l10ntools/inc/gConvXcs.hxx b/l10ntools/inc/gConvXcs.hxx deleted file mode 100644 index 407ff61a375e..000000000000 --- a/l10ntools/inc/gConvXcs.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONXCS_HXX -#define GCONXCS_HXX -#include "gConv.hxx" - - - -extern int xcslex(void); - - - -class convert_xcs : public convert_gen -{ - public: - convert_xcs(l10nMem& crMemory); - ~convert_xcs() override {}; - - void setKey(char *syyText); - void unsetKey(char *syyText); - void startCollectData(char *syyText); - void stopCollectData(char *syyText); - - private: - string msKey; - bool mbCollectingData; - - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gConvXcu.hxx b/l10ntools/inc/gConvXcu.hxx deleted file mode 100644 index 1bdde9fc30e8..000000000000 --- a/l10ntools/inc/gConvXcu.hxx +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONXCU_HXX -#define GCONXCU_HXX -#include "gConv.hxx" - - - -extern int xculex(void); - - - -class xcu_stack_entry; - - - -class convert_xcu : public convert_gen -{ - public: - bool mbNoCollectingData; - - convert_xcu(l10nMem& crMemory); - ~convert_xcu() override {}; - - void pushKey(char *syyText); - void popKey(char *syyText); - - void startCollectData(char *syyText); - void stopCollectData(char *syyText); - void copySpecial(char *syyText); - void copyNL(char *syyText); - void addLevel(); - - private: - vector<string> mcStack; - int miLevel; - bool mbNoTranslate; - - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gConvXhp.hxx b/l10ntools/inc/gConvXhp.hxx deleted file mode 100644 index 480280acd8af..000000000000 --- a/l10ntools/inc/gConvXhp.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONXHP_HXX -#define GCONXHP_HXX -#include "gConv.hxx" - - - -extern int xhplex(void); - - - -class convert_xhp : public convert_gen -{ - public: - convert_xhp(l10nMem& crMemory); - ~convert_xhp() override; - - void setString(char *yytext); - void openTag(char *yytext); - void closeTag(char *yytext); - void closeTagNOvalue(char *yytext); - void setId(char *yytext); - void setLang(char *yytext); - void setRef(char *yytext); - void openTransTag(char *yytext); - void closeTransTag(char *yytext); - void stopTransTag(char *yytext); - void startComment(char *yytext); - void stopComment(char *yytext); - void handleSpecial(char *yytext); - void handleDataEnd(char *yytext); - void duplicate(char *yytext); - string& copySourceSpecial(char *yytext, int iType); - void writeSourceFile(string& sText, int inx); - - private: - typedef enum { - VALUE_NOT_USED, - VALUE_IS_TAG, - VALUE_IS_TAG_TRANS, - VALUE_IS_VALUE, - VALUE_IS_VALUE_TAG - } STATE; - STATE meExpectValue, mePushValue; - string msKey, msPushCollect; - string msLine; - string *msLangText; - ofstream *mcOutputFiles; - int miCntLanguages; - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gConvXml.hxx b/l10ntools/inc/gConvXml.hxx deleted file mode 100644 index 5e8f74d5518a..000000000000 --- a/l10ntools/inc/gConvXml.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONVXMLHXX -#define GCONVXMLHXX -#include "gConv.hxx" - - - -extern int xmllex(void); - - - -class convert_xml : public convert_gen -{ - public: - convert_xml(l10nMem& crMemory); - ~convert_xml() override {}; - - - private: - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gConvXrm.hxx b/l10ntools/inc/gConvXrm.hxx deleted file mode 100644 index 8aa808814547..000000000000 --- a/l10ntools/inc/gConvXrm.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GCONXRM_HXX -#define GCONXRM_HXX -#include "gConv.hxx" - - - -extern int xrmlex(void); - - - -class convert_xrm : public convert_gen -{ - public: - bool mbNoCollectingData; - convert_xrm(l10nMem& crMemory); - ~convert_xrm() override {}; - - void setId(char *yytext); - void setLang(char *yytext); - void setTag(char *yytext); - void startCollectData(char *yytext); - void stopCollectData(char *yytext); - - private: - string msKey; - bool mbIsTag; - bool mbIsLang; - string msTag; - - void doExecute() override; -}; -#endif diff --git a/l10ntools/inc/gL10nMem.hxx b/l10ntools/inc/gL10nMem.hxx deleted file mode 100644 index c657c8225b2c..000000000000 --- a/l10ntools/inc/gL10nMem.hxx +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef GL10NMEM_HXX -#define GL10NMEM_HXX - -class l10nMem_enus_entry; -class l10nMem_file_entry; -class l10nMem_lang_list_entry; -class l10nMem -{ - public: - l10nMem(); - ~l10nMem(); - - typedef enum { - ENTRY_DELETED, - ENTRY_ADDED, - ENTRY_CHANGED, - ENTRY_NORMAL - } ENTRY_STATE; - - static int showError (const string& sText, int iLineNo = 0); - static void showWarning(const string& sText, int iLineNo = 0); - static void showDebug (const string& sText, int iLineNo = 0); - static void showVerbose(const string& sText, int iLineNo = 0); - static void keyToLower (string& sKey); - - void setModuleName(const string& sModuleName); - const string& getModuleName(void); - void setLanguage(const string& sLanguage, - bool bCreate); - void setConvert(bool bConvert, - bool bStrict); - void setVerbose(const bool doVerbose); - void setDebug(const bool doDebug); - - void loadEntryKey(int iLineNo, - const string& sSourceFile, - const string& sKey, - const string& sOrgText, - const string& sText, - const string& sComment, - const string& sResource, - const string& sGroup, - bool bIsFuzzy); - void setSourceKey(int iLineNo, - const string& sFilename, - const string& sKey, - const string& sText, - const string& sComment, - const string& sResource, - const string& sGroup, - bool bMustExist); - - void saveTemplates(const string& sTargetDir, - bool bForce); - void saveLanguages(l10nMem& cMem, - const string& sTargetDir, - bool bForce); - void dumpMem(const string& sTargetDir); - int prepareMerge(); - bool getMergeLang(string& sLang, - string& sText); - void showNOconvert(); - bool isError(); - void convertToInetString(string& sText); - void convertFromInetString(string& sText); - - private: - bool mbVerbose; - bool mbDebug; - bool mbInError; - string msModuleName; - int miCurFileInx; - int miCurLangInx; - int miCurENUSinx; - bool mbConvertMode; - bool mbStrictMode; - vector<l10nMem_enus_entry> mcENUSlist; - vector<l10nMem_file_entry> mcFileList; - vector<l10nMem_lang_list_entry> mcLangList; - - void formatAndShowText(const string& sType, int iLineNo, const string& sText); - bool needWrite(const string sFileName, bool bForce); - bool convFilterWarning(const string& sSourceFile, - const string& sKey, - const string& sMsgId); - void convEntryKey(int iLineNo, - const string& sSourceFile, - const string& sKey, - const string& sMsgId, - const string& sMsgStr, - bool bIsFuzzy); - void loadENUSkey(int iLineNo, - const string& sSourceFile, - const string& sKey, - const string& sMsgId, - const string& sComment, - const string& sResource, - const string& sGroup); - void loadLangKey(int iLineNo, - const string& sSourceFile, - const string& sKey, - const string& sMsgId, - const string& sMsgStr, - bool bFuzzy); - void reorganize(bool bConvert); - bool locateKey(int iLineNo, - const string& sSourceFile, - const string& sKey, - const string& sMsgId, - bool bThrow); - void addKey(int iLineNo, - const string& sSourceFile, - const string& sKey, - const string& sMsgId, - const string& sComment, - const string& sResource, - const string& sGroup, - l10nMem::ENTRY_STATE eStat); - bool findFileName(const string& sSourceFile); -}; -#endif diff --git a/l10ntools/source/gConv.cxx b/l10ntools/source/gConv.cxx deleted file mode 100644 index 41870a225bc5..000000000000 --- a/l10ntools/source/gConv.cxx +++ /dev/null @@ -1,272 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConv.hxx" -#include "gConvPo.hxx" -#include "gConvProp.hxx" -#include "gConvSrc.hxx" -#include "gConvUi.hxx" -#include "gConvTree.hxx" -#include "gConvUlf.hxx" -#include "gConvXcs.hxx" -#include "gConvXcu.hxx" -#include "gConvXhp.hxx" -#include "gConvXml.hxx" -#include "gConvXrm.hxx" -#ifdef _WIN32 -#include <io.h> -#include <direct.h> -#define OS_ACCESS(x,y) _access(x,y) -#define OS_MKDIR(x) _mkdir(x) -#else -#include <unistd.h> -#include <sys/stat.h> -#include <sys/types.h> -#define OS_ACCESS(x,y) access(x,y) -#define OS_MKDIR(x) mkdir(x,0777) -#endif - - - -convert_gen * convert_gen::mcImpl; - - - -convert_gen::convert_gen(l10nMem& cMemory) - : mcMemory(cMemory) -{ - mcImpl = this; -} -convert_gen::~convert_gen() -{ -} - - -convert_gen& convert_gen::createInstance(l10nMem& cMemory, - const string& sSourceDir, - const string& sTargetDir, - const string& sSourceFile) -{ - // did the user give a .xxx with the source file ? - int nInx = sSourceFile.rfind("."); - if (nInx == (int)string::npos) - throw l10nMem::showError("source file: "+sSourceFile+" missing extension"); - - // find correct conversion class and create correct object - string sExtension = sSourceFile.substr(nInx+1); - convert_gen *x; - if (sExtension == "hrc") x = new convert_src(cMemory); - else if (sExtension == "src") x = new convert_src(cMemory); - else if (sExtension == "po") x = new convert_po(cMemory); - else if (sExtension == "pot") x = new convert_po(cMemory); - else if (sExtension == "tree") x = new convert_tree(cMemory); - else if (sExtension == "ulf") x = new convert_ulf(cMemory); - else if (sExtension == "ui") x = new convert_ui(cMemory); - else if (sExtension == "xcu") x = new convert_xcu(cMemory); - else if (sExtension == "xhp") x = new convert_xhp(cMemory); - else if (sExtension == "xrm") x = new convert_xrm(cMemory); - else if (sExtension == "xml") x = new convert_xml(cMemory); - else if (sExtension == "properties") x = new convert_prop(cMemory); - else throw l10nMem::showError("unknown extension on source file: "+sSourceFile); - - // and set environment - x->msSourceFile = sSourceFile; - x->msTargetPath = sTargetDir; - x->msSourcePath = sSourceDir + sSourceFile; - return *x; -} - - - -bool convert_gen::execute(const bool bMerge) -{ - mbMergeMode = bMerge; - - // and load file - if (!prepareFile()) - return false; - - // and execute conversion - doExecute(); - - return true; -} - - - -bool convert_gen::checkAccess(string& sFile) -{ - return (OS_ACCESS(sFile.c_str(), 0) == 0); -} - - - -bool convert_gen::createDir(const string& sDir, const string& sFile) -{ - string sNewDir(sDir); - int newPos, oldPos; - - for (oldPos = 0;; oldPos = newPos +1) { - newPos = sFile.find_first_of("/\\", oldPos); - if (newPos == (int)string::npos) - break; - - sNewDir += sFile.substr(oldPos, newPos-oldPos) + "/"; - - if (!checkAccess(sNewDir)) { - OS_MKDIR(sNewDir.c_str()); - } - } - return true; -} - - - -bool convert_gen::prepareFile() -{ - ifstream inputFile(msSourcePath.c_str(), ios::binary); - - - if (!inputFile.is_open()) { - if (mbLoadMode) { - l10nMem::showWarning("Cannot open file (" + msSourcePath + ")"); - return false; - } - else - throw l10nMem::showError("Cannot open file (" + msSourcePath + ") for reading"); - } - - // get length of file: - miSourceReadIndex = 0; - inputFile.seekg (0, ios::end); - msSourceBuffer.resize((unsigned int)inputFile.tellg()); - inputFile.seekg (0, ios::beg); - - // get size, prepare string and read whole file - inputFile.read(const_cast<char *>(msSourceBuffer.c_str()), msSourceBuffer.size()); - if ((unsigned int)inputFile.gcount() != msSourceBuffer.size()) - throw l10nMem::showError("cannot read whole file"); - inputFile.close(); - - if (mbMergeMode && !mbLoadMode) { - // close previous file - if (mcOutputFile.is_open()) - mcOutputFile.close(); - - // open output file - mcOutputFile.open((msTargetPath+msSourceFile).c_str(), ios::binary); - if (mcOutputFile.is_open()) - return true; - - if (createDir(msTargetPath, msSourceFile)) { - mcOutputFile.open((msTargetPath+msSourceFile).c_str(), ios::binary); - if (mcOutputFile.is_open()) - return true; - } - throw l10nMem::showError("Cannot open file (" + msTargetPath+msSourceFile + ") for writing"); - } - return true; -} - - - - -void convert_gen::lexRead(char *sBuf, size_t *result, size_t nMax_size) -{ - // did we hit eof - if (miSourceReadIndex == -1) - *result = 0; - else { - // assume we can copy all that are left. - *result = msSourceBuffer.size() - miSourceReadIndex; - - // space enough for the whole line ? - if (*result <= nMax_size) { - msSourceBuffer.copy(sBuf, *result, miSourceReadIndex); - l10nMem::showDebug(sBuf); - miSourceReadIndex = -1; - } - else { - msSourceBuffer.copy(sBuf, nMax_size, miSourceReadIndex); - l10nMem::showDebug(sBuf); - *result = nMax_size; - miSourceReadIndex += nMax_size; - } - } -} - - - -void convert_gen::lexStrncpy(char *s1, const char *s2, int n) -{ - register int i; - for (i = 0; i < n; ++i) - s1[i] = s2[i]; -} - - - -void convert_gen::writeSourceFile(const string& line) -{ - if (!line.size()) - return; - - if (mcOutputFile.is_open()) - mcOutputFile.write(line.c_str(), line.size()); -} - - - -string& convert_gen::copySource(char const *yyText, bool bDoClear) -{ - int nL; - - - if (!yyText) { - msCopyText.clear(); - return msCopyText; - } - msCopyText = yyText; - - // write text for merge - if (mbMergeMode) - writeSourceFile(msCopyText); - - if (bDoClear) - msCollector.clear(); - else - msCollector += msCopyText; - - // remove any CR - for (nL = 0; nL < (int)msCopyText.size(); ++nL) { - if (msCopyText[nL] == '\r') { - msCopyText.erase(nL, 1); - --nL; - continue; - } - if (msCopyText[nL] == '\n') - ++miLineNo; - } - - return msCopyText; -} diff --git a/l10ntools/source/gConvPo.cxx b/l10ntools/source/gConvPo.cxx deleted file mode 100644 index 2f36797f0346..000000000000 --- a/l10ntools/source/gConvPo.cxx +++ /dev/null @@ -1,269 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - - * This file incorporates work covered by the following license notice: - - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 - */ -#include <iomanip> -#include <ctime> -#include <string> -#include <vector> -using namespace std; - -#include <rtl/crc.h> - -#include "gL10nMem.hxx" -#include "gConvPo.hxx" -#include <iostream> -#include <fstream> -#include <cstdlib> - - - -convert_po::convert_po(l10nMem& crMemory) - : convert_gen(crMemory), - mbExpectId(false), - mbExpectStr(false), - mbFuzzy(false) -{ - // Po files are handled special - mbLoadMode = true; -} - - - -void convert_po::startLook() -{ - string sFileName, sNewKey; - int i; - - - if (!msKey.size() || !msId.size()) - return; - - // split key into filename and real key - i = msKey.find("#"); - sFileName = msKey.substr(0, i); - sNewKey = msKey.substr(i+1); - - // load in db - if (msId.size()) - mcMemory.loadEntryKey(miLineNo, sFileName, sNewKey, msId, msStr, "", "", "", mbFuzzy); - - // and prepare for new entry - msKey.clear(); - msId.clear(); - msStr.clear(); -} - - - -void convert_po::setValue(char *syyText, int iLineCnt) -{ - if (mbExpectId) - msId = syyText; - if (mbExpectStr) - msStr = syyText; - mbExpectId = - mbExpectStr = false; - miLineNo += iLineCnt; -} - - - -void convert_po::setFuzzy() -{ - mbFuzzy = true; -} - - - -void convert_po::setKey(char *syyText) -{ - int i; - - - // Activate "look for msg" mode. - startLook(); - - // skip "#:" and any blanks - for (syyText += 2; *syyText == ' ' || *syyText == '\t'; ++syyText) - - msKey = syyText; - - // remove trailing blanks - for (i = msKey.size() -1; msKey[i] == '\r' || msKey[i] == ' ' || msKey[i] == '\t'; --i) - - msKey.erase(i+1); -} - - - -void convert_po::setMsgId() -{ - mbExpectId = true; -} - - - -void convert_po::setMsgStr() -{ - mbExpectStr = true; -} - - - -void convert_po::handleNL() -{ - ++miLineNo; -} - - - -void convert_po::doExecute() -{ - if (mbMergeMode) - throw l10nMem::showError("Merge not implemented"); - - polex(); - startLook(); -} - - - -void convert_po::startSave(const string& sName, - const string& sTargetDir, - const string& sFile) -{ - string sFilePath; - string ext = sTargetDir.substr(sTargetDir.length() - 5, sTargetDir.length()); - - sFilePath = (ext == ".pot/") ? sTargetDir.substr(0, sTargetDir.length() - 1) : sTargetDir + sFile; - - // create directories as needed - createDir(string(""), sFilePath); - mfOutBuffer.open(sFilePath.c_str(), ios::out | ios::binary); - - if (!mfOutBuffer.is_open()) - throw l10nMem::showError("Cannot open " + sFilePath + " for writing"); - - l10nMem::showDebug("writing file (" + sFilePath + ")"); - - ostream outFile(&mfOutBuffer); - - // Set header - auto t = std::time(nullptr); - auto tm = *std::localtime(&t); - outFile << "#. extracted from " << sName << endl - << "msgid \"\"" << endl - << "msgstr \"\"" << endl - << "\"Project-Id-Version: PACKAGE VERSION\\n\"" << endl - << "\"Report-Msgid-Bugs-To: " - "https://bugs.libreoffice.org/enter_bug.cgi?" - "product=LibreOffice&bug_status=UNCONFIRMED" - "&component=UI\\n\"" << endl - << "\"POT-Creation-Date: " - << std::put_time(&tm, "%Y-%m-%d %H:%M%z") << "\\n\"" << endl - << "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"" << endl - << "\"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n\"" << endl - << "\"Language-Team: LANGUAGE <l...@li.org>\\n\"" << endl - << "\"MIME-Version: 1.0\\n\"" << endl - << "\"Content-Type: text/plain; charset=UTF-8\\n\"" << endl - << "\"Content-Transfer-Encoding: 8bit\\n\"" << endl - << "\"X-Generator: LibreOffice\\n\"" << endl - << "\"X-Accelerator-Marker: ~\\n\"" << endl; -} - - - -void convert_po::save(const string& sFileName, - const string& sKey, - const string& sENUStext, - const string& sText, - const string& sComment, - const string& sResource, - const string& sGroup, - bool bFuzzy) -{ - string sName; - ostream outFile(&mfOutBuffer); - int newPos, oldPos; - - // isolate filename - newPos = sFileName.find_last_of("/\\", sFileName.length()); - sName = sFileName.substr(newPos + 1, sFileName.length()); - - outFile << endl << "#. " << genKeyId(sName + sKey + sGroup + sResource + sENUStext) << endl; - if (sComment.length()) - outFile << "#. " << sComment << endl; - outFile << "#: " << sName << endl - << "msgctxt \"\"" << endl - << "\"" << sName << "\\n\"" << endl - << "\"" << sKey << "\\n\"" << endl; - if (sGroup.length()) - outFile << "\"" << sGroup << "\\n\"" << endl; - outFile << "\"" << sResource << ".text\"" << endl; - if (bFuzzy) - outFile << "#, fuzzy" << endl; - outFile << "msgid \""; - newPos = oldPos = 0; - while ((newPos = sENUStext.find("\\n", oldPos)) > 0) { - newPos += 2; - outFile << "\"" << endl - << "\"" << sENUStext.substr(oldPos, newPos - oldPos); - oldPos = newPos; - } - if (oldPos) - outFile << "\"" << endl << "\""; - outFile << sENUStext.substr(oldPos) << "\"" << endl - << "msgstr \"" << sText << "\"" << endl; -} - - - -void convert_po::endSave() -{ - mfOutBuffer.close(); -} - - - -string convert_po::genKeyId(const string& text) -{ - string newText(text); - int i; - - for (i = 0; (i = newText.find("\\\\", 0)) != (int)string::npos;) { - newText.erase(i, 1); - } - for (i = 0; (i = newText.find("\\\"", 0)) != (int)string::npos;) { - newText.erase(i, 1); - } - for (i = 0; (i = newText.find("\\n", 0)) != (int)string::npos;) { - newText.erase(i, 1); - newText[i] = 0x0A; - } - sal_uInt32 const nCRC = rtl_crc32(0, newText.c_str(), newText.length()); - string key; - - // Use simple ASCII characters, exclude I, l, 1 and O, 0 to avoid confusing IDs - static const char sSymbols[] = - "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789"; - for (short nKeyInd = 0; nKeyInd < 5; ++nKeyInd) { - key += sSymbols[(nCRC & 63) % strlen(sSymbols)]; - nCRC >>= 6; - } - return key; -} diff --git a/l10ntools/source/gConvProp.cxx b/l10ntools/source/gConvProp.cxx deleted file mode 100644 index 45829f40b226..000000000000 --- a/l10ntools/source/gConvProp.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvProp.hxx" - - - -void convert_prop::doExecute() -{ -// throw l10nMem::showError(string("convert_prop::execute not implemented")); -} diff --git a/l10ntools/source/gConvSrc.cxx b/l10ntools/source/gConvSrc.cxx deleted file mode 100644 index d7b57d69d07b..000000000000 --- a/l10ntools/source/gConvSrc.cxx +++ /dev/null @@ -1,330 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -#include <iostream> -#include <fstream> -#include <cstdlib> -#include <sstream> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvSrc.hxx" - - -convert_src::convert_src(l10nMem& crMemory) - : convert_gen(crMemory), - miLevel(0), - mbMacroActive(false) -#if 0 - mbExpectValue(false), - mbEnUs(false), - mbExpectName(false), - mbAutoPush(false), - mbValuePresent(false), - mbInList(false), - mbInListItem(false) -#endif -{ -} - - - -void convert_src::doExecute() -{ - srclex(); -} - - - -void convert_src::setValue(string& syyText) -{ - int stackSize = mcStack.size(); - string cleanValue = syyText.substr(1, syyText.size() - 1); - { - cout << "test value\n"; - for (int i = 0; i < stackSize; i++) - cout << i << ") " << mcStack[i] << "\n"; - } - string subid = (stackSize > 3) ? mcStack[stackSize - 1] : ""; - string stringid = mcStack[stackSize - 2]; - l10nMem::keyToLower(stringid); - - mcMemory.setSourceKey(miLineNo, msSourceFile, mcStack[1], cleanValue, "", stringid, subid, false); -} - - - -bool convert_src::setLang(string& syyText) -{ - if (syyText == "en-US") - return true; - else if (syyText != "x-comment") - l10nMem::showError(syyText + " non legal language"); - return false; -} - - - -void convert_src::setName(string& syyText, bool revertLevel) -{ - if (revertLevel) - mcStack.pop_back(); - mcStack.push_back(syyText); -} - - - -void convert_src::setCmd(string& syyText) -{ - mcStack.push_back(syyText); -} - - - -void convert_src::startBlock() -{ - unsigned int cnt = 2 * ++miLevel; - - while (cnt > mcStack.size()) - mcStack.push_back(""); -} - - - -void convert_src::stopBlock() -{ - if (miLevel > 0) - miLevel--; - - // check for correct node/prop relations - if (mcStack.size()) { - if (miLevel) { - mcStack.pop_back(); - mcStack.pop_back(); - } - else - mcStack.clear(); - } -} - - - -void convert_src::defMacro() -{ - if (!miLevel) - miLevel++; - mbMacroActive = true; -} - - - -void convert_src::endMacro() -{ - if (mbMacroActive) { - mbMacroActive = false; - miLevel = 0; - mcStack.clear(); - } -} - - -#if 0 -void convert_src::setId(char *syyText, bool bId) -{ - copySource(syyText); - if (bId || !mcStack.back().size()) - mbExpectName = mbAutoPush = true; -} -#endif - - - -#if 0 -void convert_src::setText(char *syyText) -{ - msTextName = copySource(syyText); - mbExpectValue = true; - mbEnUs = false; - trim(msTextName); -} -#endif - - - -#if 0 -void convert_src::setList(char *syyText) -{ - msCmd = copySource(syyText); - miListCount = 0; - mbInList = true; - trim(msCmd); - l10nMem::keyToLower(msCmd); -} -#endif - - - -#if 0 -void convert_src::setNL(char *syyText, bool bMacro) -{ - int nL; - string sKey; - - copySource(syyText); - - if (msTextName.size() && mbValuePresent && mbEnUs) { - // locate key and extract it - buildKey(sKey); - - for (nL = -1;;) { - nL = msValue.find("\\\"", nL + 1); - if (nL == (int)string::npos) - break; - msValue.erase(nL, 1); - } - for (nL = -1;;) { - nL = msValue.find("\\\\", nL + 1); - if (nL == (int)string::npos) - break; - msValue.erase(nL, 1); - } - - //FIX sKey += "." + msCmd + "." + msTextName; - if (msValue.size() && msValue != "-") { - mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, msValue, "", msCmd, msGroup, mbMergeMode); - if (mbMergeMode) - insertLanguagePart(sKey, msTextName); - } - msGroup.clear(); - } - - if (!bMacro && mbExpectMacro) { - while ((int)mcStack.size() > miMacroLevel) - mcStack.pop_back(); - mbEnUs = - mbExpectMacro = false; - } - - mbValuePresent = - mbExpectName = - mbAutoPush = false; - msValue.clear(); - msTextName.clear(); -} -#endif - - - -#if 0 -void convert_src::setListItem(char const *syyText, bool bIsStart) -{ - copySource(syyText); - - if (bIsStart) { - if (!miListCount) { - mcStack.pop_back(); - msName = "dummy"; - mcStack.push_back(msName); - } - msTextName = "item"; - mbExpectValue = - mbExpectName = - mbInListItem = true; - msName.clear(); - } - else - { - if (mbInListItem) { - stringstream ssBuf; - string myKey; - - ++miListCount; - mcStack.pop_back(); - if (mbExpectName) { - ssBuf << miListCount; - msName = "item" + ssBuf.str(); - } - mcStack.push_back(msName); - mbInListItem = - mbExpectName = false; - - // check key or add seq. - buildKey(myKey); - } - } -} -#endif - - - -#if 0 -void convert_src::trim(string& sText) -{ - int nL; - - - while (sText[0] == ' ' || sText[0] == '\t') - sText.erase(0,1); - for (nL = sText.size(); sText[nL-1] == ' ' || sText[nL-1] == '\t'; --nL) - ; - if (nL != (int)sText.size()) - sText.erase(nL); -} -#endif - - - -#if 0 -void convert_src::buildKey(string& sKey) -{ - int nL; - - - sKey.clear(); - for (nL = 0; nL < (int)mcStack.size(); ++nL) - if (mcStack[nL].size()) - sKey += (sKey.size() ? "." : "") + mcStack[nL]; - - // FIX jan - sKey = mcStack[0]; -} -#endif - - - -#if 0 -void convert_src::insertLanguagePart(string& sKey, string& sTextType) -{ - string sLang, sText, sTagText; - - - // just to please compiler - sKey = sKey; - - // prepare to read all languages - mcMemory.prepareMerge(); - for (; mcMemory.getMergeLang(sLang, sText);) { - // Prepare tag start and end - sTagText = sTextType + "[ " + sLang + " ] = \"" + sText + "\" ;" + - (mbExpectMacro ? "\\" : "") + "\n"; - writeSourceFile(sTagText); - } -} -#endif diff --git a/l10ntools/source/gConvTree.cxx b/l10ntools/source/gConvTree.cxx deleted file mode 100644 index 5605e1e6a25a..000000000000 --- a/l10ntools/source/gConvTree.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvTree.hxx" - - -convert_tree::convert_tree(l10nMem& crMemory) - : convert_gen(crMemory), - mcOutputFiles(nullptr), - meStateTag(STATE_TAG_NONE), - meStateVal(STATE_VAL_NONE), - miCntLanguages(0) - -{ - // tree files are written through a local routine - mbLoadMode = true; -} - - - -convert_tree::~convert_tree() -{ - if (mcOutputFiles) { - for (int i = 0; i < miCntLanguages; ++i) - mcOutputFiles[i].close(); - delete[] mcOutputFiles; - } -} - - - -void convert_tree::doExecute() -{ - string sLang; - string sFile, sFile2; - - if (mbMergeMode) - throw l10nMem::showError("Merge not implemented"); - - // prepare list with languages - if (mbMergeMode) { - miCntLanguages = mcMemory.prepareMerge(); - mcOutputFiles = new ofstream[miCntLanguages]; - - for (int i = 0; mcMemory.getMergeLang(sLang, sFile); ++i) { - sFile2 = sLang + "/" + msSourceFile; - sFile = msTargetPath + sFile2; - mcOutputFiles[i].open(sFile.c_str(), ios::binary); - if (!mcOutputFiles[i].is_open()) { - if (!createDir(msTargetPath, sFile2)) - throw l10nMem::showError("Cannot create missing directories (" + sFile + ") for writing"); - - mcOutputFiles[i].open(sFile.c_str(), ios::binary); - if (!mcOutputFiles[i].is_open()) - throw l10nMem::showError("Cannot open file (" + sFile + ") for writing"); - } - } - } - - // run analyzer - treelex(); - - // dump last line - copySourceSpecial(nullptr,3); -} - - - -void convert_tree::setString(char *yytext) -{ - switch (meStateVal) { - case STATE_VAL_NONE: - copySourceSpecial(yytext, 0); - break; - - case STATE_VAL_APPL: - msAppl = copySourceSpecial(yytext, 0); - break; - - case STATE_VAL_ID: - msId = copySourceSpecial(yytext, 0); - msId.erase(msId.size()-1); - break; - - case STATE_VAL_TITLE: - string sText = copySourceSpecial(yytext, 1); - sText.erase(sText.size()-1); - mcMemory.setSourceKey(miLineNo, msSourceFile, msId, sText, "", "help_section", "", mbMergeMode); - break; - } - meStateVal = STATE_VAL_NONE; -} - - - -void convert_tree::setState(char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNewStateVAL, char *sModule) -{ - copySourceSpecial(yytext, 0); - msCollector.clear(); - meStateTag = eNewStateTag; - meStateVal = eNewStateVAL; - if (sModule) - msModule = sModule; -} - - - -void convert_tree::setValue(char *yytext) -{ - mcMemory.setSourceKey(miLineNo, msSourceFile, msId, msCollector, "", msModule, "", mbMergeMode); - copySourceSpecial(yytext, 2); - - meStateTag = STATE_TAG_NONE; - meStateVal = STATE_VAL_NONE; -} - - - -string& convert_tree::copySourceSpecial(char *yytext, int iType) -{ - string& sText = copySource(yytext, false); - string sLang, sTemp; - int i; - - // Handling depends on iType - switch (iType) { - case 0: // Used for tokens that are to be copied 1-1, - if (mbMergeMode) { - msLine += yytext; - if (*yytext == '\n') { - for (i = 0; i < miCntLanguages; ++i) - writeSourceFile(msLine, i); - msLine.clear(); - } - } - break; - - case 1: // Used for title token, are to replaced with languages - if (mbMergeMode) { - mcMemory.prepareMerge(); - for (i = 0; i < miCntLanguages; ++i) { - writeSourceFile(msLine, i); - mcMemory.getMergeLang(sLang, sTemp); - writeSourceFile(sTemp,i); - } - msLine.clear(); - } - break; - - case 2: // Used for token at end of value, language text are to be inserted and then token written - if (mbMergeMode) { - mcMemory.prepareMerge(); - for (i = 0; i < miCntLanguages; ++i) { - writeSourceFile(msLine, i); - mcMemory.getMergeLang(sLang, sTemp); - writeSourceFile(sTemp,i); - string sYY(yytext); - writeSourceFile(sYY, i); - } - msLine.clear(); - } - break; - - case 3: // Used for EOF - if (mbMergeMode) { - for (i = 0; i < miCntLanguages; ++i) - writeSourceFile(msLine, i); - } - break; - } - return sText; -} - - - -void convert_tree::writeSourceFile(string& sText, int inx) -{ - if (sText.size() && mcOutputFiles[inx].is_open()) - mcOutputFiles[inx].write(sText.c_str(), sText.size()); -} diff --git a/l10ntools/source/gConvUi.cxx b/l10ntools/source/gConvUi.cxx deleted file mode 100644 index 3a6bd687791d..000000000000 --- a/l10ntools/source/gConvUi.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - - - -#include "gL10nMem.hxx" -#include "gConvUi.hxx" - - - -convert_ui::convert_ui(l10nMem& crMemory) - : convert_gen(crMemory) -{ -} - - - -void convert_ui::doExecute() -{ - uilex(); -} diff --git a/l10ntools/source/gConvUlf.cxx b/l10ntools/source/gConvUlf.cxx deleted file mode 100644 index ee53cf9c8e63..000000000000 --- a/l10ntools/source/gConvUlf.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvUlf.hxx" - - - -void convert_ulf::doExecute() -{ - ulflex(); -} - - - -void convert_ulf::setKey(char *syyText) -{ - string sText = copySource(syyText); - - // locate key (is any) - msKey = sText.substr(1,sText.size()-2); -} - - - -void convert_ulf::setText(char *syyText, bool bIsEnUs) -{ - string sText = copySource(syyText); - - - if (!bIsEnUs && sText != "x-comment =") - l10nMem::showError(sText + " is not en-US"); -} - - - -void convert_ulf::setValue(char *syyText) -{ - string sLang, sText = copySource(syyText); - int nL; - - sText.erase(0,1); - nL = sText.rfind("\""); - sText.erase(nL); - - mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "LngText", "", mbMergeMode); - - if (mbMergeMode) { - // prepare to read all languages - mcMemory.prepareMerge(); - for (; mcMemory.getMergeLang(sLang, sText);) { - // Prepare tag - sText = "\n" + sLang + " = \"" + sText + "\""; - writeSourceFile(sText); - } - } -} diff --git a/l10ntools/source/gConvXcs.cxx b/l10ntools/source/gConvXcs.cxx deleted file mode 100644 index f82c35416479..000000000000 --- a/l10ntools/source/gConvXcs.cxx +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvXcs.hxx" - - - -convert_xcs::convert_xcs(l10nMem& crMemory) - : convert_gen(crMemory), - mbCollectingData(false) -{ -} - - - -void convert_xcs::doExecute() -{ - if (mbMergeMode) - throw l10nMem::showError("Merge not implemented"); - - // currently no .xcs files generate en-US translation, so stop trying - xcslex(); -} - - - -void convert_xcs::setKey(char *syyText) -{ - int nL; - string sHead, sText = copySource(syyText); - - // is it to be translated - if (sText.find("oor:localized=") == string::npos) - return; - - // locate key (is any) - nL = sText.find("oor:name=\""); - if (nL == (int)string::npos) - return; - sHead = sText.substr(nL+10); - nL = sHead.find("\""); - msKey = sHead.substr(0,nL); -} - - - -void convert_xcs::unsetKey(char *syyText) -{ - copySource(syyText); -} - - - -void convert_xcs::startCollectData(char *syyText) -{ - copySource(syyText); - if (!msKey.size()) - return; -} - - - -void convert_xcs::stopCollectData(char *syyText) -{ - string sHead, sKey, sLang, sText, sCollectedText = copySource(syyText, false); - int nL; - - - // get type of tag - msCollector += sCollectedText; - nL = msCollector.find("<p"); - if (nL != (int)string::npos) - sHead = msCollector.substr(nL+1, 1); - else { - nL = msCollector.find("<h"); - sHead = msCollector.substr(nL+1, 2); - } - - // locate key and extract it - nL = msCollector.find("id=") +4; - sKey = msCollector.substr(nL, msCollector.find("\"", nL+1) - nL); - nL = msCollector.find("xml:lang=\"") + 10; - sLang = msCollector.substr(nL, msCollector.find("\"", nL+1) - nL); - nL = msCollector.find(">") +1; - sText = msCollector.substr(nL, msCollector.find("\"", nL+1) - nL); - msCollector.clear(); - - if (mbMergeMode) { -#if 0 - // get all languages (includes en-US) - vector<l10nMem_entry *>& cExtraLangauges = mcMemory.getLanguagesForKey(sKey); - string sNewLine; - nL = cExtraLangauges.size(); - - for (int i = 0; i < nL; ++i) { - sNewLine = "\n<" + sHead + " id=\"" + sKey + "\"" + " xml:lang=\"" + - cExtraLangauges[i]->msLanguage + "\">" + - cExtraLangauges[i]->msText + - "</" + sHead + ">"; - - writeSourceFile(sNewLine); - } -#endif - } - - mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, sText, "", "", "", mbMergeMode); - mbCollectingData = false; -} diff --git a/l10ntools/source/gConvXcu.cxx b/l10ntools/source/gConvXcu.cxx deleted file mode 100644 index cae480bb77e2..000000000000 --- a/l10ntools/source/gConvXcu.cxx +++ /dev/null @@ -1,181 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - - - -#include "gL10nMem.hxx" -#include "gConvXcu.hxx" - - - -convert_xcu::convert_xcu(l10nMem& crMemory) - : convert_gen(crMemory), - mbNoCollectingData(true), - miLevel(0), - mbNoTranslate(false) -{ -} - - - -void convert_xcu::doExecute() -{ - xculex(); -} - - - -void convert_xcu::pushKey(char *syyText) -{ - string sKey, sTag = copySource(syyText); - - // find key in tag - int nL = sTag.find("oor:name=\""); - if (nL != (int)string::npos) { - // find end of key - nL += 10; - int nE = sTag.find("\"", nL); - if (nE != (int)string::npos) - sKey = sTag.substr(nL, nE - nL); - } - mcStack.push_back(sKey); -} - - - -void convert_xcu::popKey(char *syyText) -{ - copySource(syyText); - - // check for correct node/prop relations - if (mcStack.size()) - mcStack.pop_back(); - - mbNoTranslate = false; -} - - - -void convert_xcu::startCollectData(char *syyText) -{ - int nL; - string sTag = copySource(syyText); - - if (mbNoTranslate) - return; - - // locate object name - nL = sTag.find("xml:lang=\""); - if (nL != (int)string::npos) { - // test language - nL += 10; - if (sTag.substr(nL,5) == "en-US") - mbNoCollectingData = false; - else if (sTag.substr(nL,14) == "x-no-translate") - mbNoTranslate = true; - else { - string sErr = sTag.substr(nL,5) + " is not en-US"; - l10nMem::showError(sErr); - } - } -} - - - -void convert_xcu::stopCollectData(char *syyText) -{ - int nL; - string useKey, useText = msCollector; - - copySource(syyText); - - // time to do something ? - if (mbNoCollectingData || mbNoTranslate) - return; - - // remove any newline - for (nL = 0;;) { - nL = useText.find("\n"); - if (nL == (int)string::npos) - break; - useText.erase(nL,1); - } - - mbNoCollectingData = true; - - if (useText.size()) { - // locate key and extract it - int max = (int)mcStack.size() - 1; - for (nL = 0; nL < max; ++nL) { - useKey += mcStack[nL]; - if (nL < max -1) - useKey += "."; - } - mcMemory.setSourceKey(miLineNo, msSourceFile, useKey, useText, "", "value", mcStack[nL], mbMergeMode); - } - - if (mbMergeMode) { - string sLang, sText, sNewLine; - - // prepare to read all languages - mcMemory.prepareMerge(); - for (; mcMemory.getMergeLang(sLang, sText);) { - sNewLine = "\n<value xml:lang=\"" + sLang + "\">" + sText + "</value>"; - mcMemory.convertToInetString(sNewLine); - writeSourceFile(sNewLine); - } - } -} - - - -void convert_xcu::copySpecial(char *syyText) -{ - int nx = msCollector.size(); - string sText = copySource(syyText, mbNoCollectingData); - - if (!mbNoCollectingData) { - msCollector.erase(nx); - mcMemory.convertFromInetString(sText); - msCollector += sText; - } -} - - - -void convert_xcu::copyNL(char *syyText) -{ - int nX = msCollector.size(); - string sText = copySource(syyText, mbNoCollectingData); - - if (!mbNoCollectingData) { - msCollector.erase(nX); - msCollector += ' '; - } -} - - - -void convert_xcu::addLevel() -{ - ++miLevel; -} diff --git a/l10ntools/source/gConvXhp.cxx b/l10ntools/source/gConvXhp.cxx deleted file mode 100644 index 6f7cdb7f2a20..000000000000 --- a/l10ntools/source/gConvXhp.cxx +++ /dev/null @@ -1,391 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvXhp.hxx" - - - -convert_xhp::convert_xhp(l10nMem& crMemory) - : convert_gen(crMemory), - meExpectValue(VALUE_NOT_USED), - msLangText(nullptr), - mcOutputFiles(nullptr), - miCntLanguages(0) -{ - // xhp files are written through a local routine - mbLoadMode = true; -} - - - -convert_xhp::~convert_xhp() -{ - if (mcOutputFiles) { - for (int i = 0; i < miCntLanguages; ++i) - mcOutputFiles[i].close(); - delete[] mcOutputFiles; - } - if (msLangText) - delete[] msLangText; -} - - - -void convert_xhp::doExecute() -{ - string sLang; - string sFile, sFile2; - - // prepare list with languages - miCntLanguages = mcMemory.prepareMerge(); - if (mbMergeMode) { - mcOutputFiles = new ofstream[miCntLanguages]; - msLangText = new string[miCntLanguages]; - - for (int i = 0; mcMemory.getMergeLang(sLang, sFile); ++i) { - sFile2 = sLang + "/text/" + mcMemory.getModuleName().substr(5) + "/" + msSourceFile; - sFile = msTargetPath + sFile2; - mcOutputFiles[i].open(sFile.c_str(), ios::binary); - if (!mcOutputFiles[i].is_open()) { - if (!createDir(msTargetPath, sFile2)) - throw l10nMem::showError("Cannot create missing directories (" + sFile + ") for writing"); - - mcOutputFiles[i].open(sFile.c_str(), ios::binary); - if (!mcOutputFiles[i].is_open()) - throw l10nMem::showError("Cannot open file (" + sFile + ") for writing"); - } - msLangText[i] = "xml-lang=\"" + sLang + "\""; - } - } - - // run analyzer - xhplex(); - - // dump last line - copySourceSpecial(nullptr,3); -} - - - -void convert_xhp::setString(char *yytext) -{ - copySourceSpecial(yytext, 0); -} - - - -void convert_xhp::openTag(char *yytext) -{ - if (meExpectValue == VALUE_IS_VALUE) { - meExpectValue = VALUE_IS_VALUE_TAG; - //FIX msCollector += "\\"; - } - copySourceSpecial(yytext, 0); -} - - - -void convert_xhp::closeTag(char *yytext) -{ - STATE newState = meExpectValue; - - switch (meExpectValue) { - case VALUE_IS_VALUE_TAG: - newState = VALUE_IS_VALUE; - //FIX msCollector += "\\"; - break; - - case VALUE_IS_TAG_TRANS: - if (msKey.size()) - newState = VALUE_IS_VALUE; - break; - - case VALUE_IS_TAG: - msKey.clear(); - newState = VALUE_NOT_USED; - break; - - case VALUE_NOT_USED: - case VALUE_IS_VALUE: - break; - } - copySourceSpecial(yytext, 0); - meExpectValue = newState; -} - - - -void convert_xhp::closeTagNOvalue(char *yytext) -{ - copySourceSpecial(yytext, 0); - if (meExpectValue == VALUE_IS_VALUE_TAG) - meExpectValue = VALUE_IS_VALUE; - else - meExpectValue = VALUE_NOT_USED; -} - - - -void convert_xhp::setId(char *yytext) -{ - int nL, nE; - string& sText = copySourceSpecial(yytext, 0); - - - nL = sText.find("\""); - nE = sText.find("\"", nL+1); - if (nL == (int)string::npos || nE == (int)string::npos) - return; - - switch (meExpectValue) { - case VALUE_IS_TAG: - case VALUE_IS_TAG_TRANS: - msKey = sText.substr(nL+1, nE - nL -1) + msKey; - break; - - case VALUE_IS_VALUE_TAG: - case VALUE_NOT_USED: - case VALUE_IS_VALUE: - break; - } -} - - - -void convert_xhp::setLang(char *yytext) -{ - int nL, nE; - string sLang; - string& sText = copySourceSpecial(yytext, 1); - - - nL = sText.find("\""); - nE = sText.find("\"", nL+1); - if (nL == (int)string::npos || nE == (int)string::npos) - return; - - switch (meExpectValue) { - case VALUE_IS_TAG: - sLang = sText.substr(nL+1, nE - nL -1); - if (sLang == "en-US") - meExpectValue = VALUE_IS_TAG_TRANS; - else - l10nMem::showError(sLang + " is no en-US language"); - break; - - case VALUE_IS_VALUE_TAG: - msCollector.erase(msCollector.size() - sText.size() -1); - break; - - case VALUE_NOT_USED: - case VALUE_IS_TAG_TRANS: - case VALUE_IS_VALUE: - break; - } -} - - - -void convert_xhp::setRef(char *yytext) -{ - int nL, nE; - string& sText = copySourceSpecial(yytext, 0); - - - nL = sText.find("\""); - nE = sText.find("\"", nL+1); - if (nL == (int)string::npos || nE == (int)string::npos) - return; - - switch (meExpectValue) { - case VALUE_IS_TAG: - case VALUE_IS_TAG_TRANS: - msKey += "." + sText.substr(nL+1, nE - nL -1); - break; - - case VALUE_IS_VALUE_TAG: - case VALUE_NOT_USED: - case VALUE_IS_VALUE: - break; - } -} - - - -void convert_xhp::openTransTag(char *yytext) -{ - copySourceSpecial(yytext, 0); - msKey.clear(); - meExpectValue = VALUE_IS_TAG; -} - - - -void convert_xhp::closeTransTag(char *yytext) -{ - int iType = 0; - - - if (meExpectValue == VALUE_IS_VALUE || meExpectValue == VALUE_IS_VALUE_TAG) { - if (msCollector.size() && msCollector != "-") { - string newString(msCollector); - if (newString[newString.length() - 1] == ' ') - newString = newString.substr(0, newString.length() - 1); - mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, newString, "", "help", "", mbMergeMode); - } - msKey.clear(); - iType = 2; - } - meExpectValue = VALUE_NOT_USED; - copySourceSpecial(yytext, iType); -} - - - -void convert_xhp::stopTransTag(char *yytext) -{ - copySourceSpecial(yytext, 0); - meExpectValue = VALUE_NOT_USED; -} - - - -void convert_xhp::startComment(char *yytext) -{ - mePushValue = meExpectValue; - msPushCollect = msCollector; - meExpectValue = VALUE_NOT_USED; - copySourceSpecial(yytext, 0); -} - - - -void convert_xhp::stopComment(char *yytext) -{ - copySourceSpecial(yytext, 0); - meExpectValue = mePushValue; - msCollector = msPushCollect; -} - - - -void convert_xhp::handleSpecial(char *yytext) -{ - if (meExpectValue != VALUE_IS_VALUE || meExpectValue != VALUE_IS_VALUE_TAG) { - string sText(yytext); - mcMemory.convertFromInetString(sText); - msCollector += sText; - } - else - copySourceSpecial(yytext, 0); -} - - - -void convert_xhp::handleDataEnd(char *yytext) -{ - int nX = msCollector.size(); - copySourceSpecial(yytext, 0); - - if (meExpectValue == VALUE_IS_VALUE || meExpectValue == VALUE_IS_VALUE_TAG) - msCollector.erase(nX); -} - - - -void convert_xhp::duplicate(char *yytext) -{ - copySourceSpecial(yytext, 0); - - if (meExpectValue == VALUE_IS_VALUE || meExpectValue == VALUE_IS_VALUE_TAG) - msCollector += msCollector[msCollector.size()-1]; -} - - - -string& convert_xhp::copySourceSpecial(char *yytext, int iType) -{ - bool doingValue = (meExpectValue == VALUE_IS_VALUE || meExpectValue == VALUE_IS_VALUE_TAG); - string& sText = copySource(yytext, !doingValue); - string sLang; - int i; - - - // Do NOT write data while collecting a value (will be replaced by language text) - if (doingValue) - return sText; - - // Handling depends o - switch (iType) { - case 0: // Used for tokens that are to be copied 1-1, - if (mbMergeMode) { - msLine += yytext; - if (*yytext == '\n') { - for (i = 0; i < miCntLanguages; ++i) - writeSourceFile(msLine, i); - msLine.clear(); - } - } - break; - - case 1: // Used for language token, are to replaced with languages - if (mbMergeMode) { - for (i = 0; i < miCntLanguages; ++i) { - writeSourceFile(msLine, i); - writeSourceFile(msLangText[i], i); - } - msLine.clear(); - } - break; - - case 2: // Used for token at end of value, language text are to be inserted and then token written - if (mbMergeMode) { - mcMemory.prepareMerge(); - for (i = 0; i < miCntLanguages; ++i) { - writeSourceFile(msLine, i); - mcMemory.getMergeLang(sLang, sText); - writeSourceFile(sText,i); - string sYY(yytext); - writeSourceFile(sYY, i); - } - msLine.clear(); - } - break; - - case 3: // Used for EOF - if (mbMergeMode) { - for (i = 0; i < miCntLanguages; ++i) - writeSourceFile(msLine, i); - } - break; - } - return sText; -} - - - -void convert_xhp::writeSourceFile(string& sText, int inx) -{ - if (sText.size() && mcOutputFiles[inx].is_open()) - mcOutputFiles[inx].write(sText.c_str(), sText.size()); -} diff --git a/l10ntools/source/gConvXml.cxx b/l10ntools/source/gConvXml.cxx deleted file mode 100644 index ed307d6d3b5a..000000000000 --- a/l10ntools/source/gConvXml.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - - - -#include "gL10nMem.hxx" -#include "gConvXml.hxx" - - - -convert_xml::convert_xml(l10nMem& crMemory) - : convert_gen(crMemory) -{ -} - - - -void convert_xml::doExecute() -{ - xmllex(); -} diff --git a/l10ntools/source/gConvXrm.cxx b/l10ntools/source/gConvXrm.cxx deleted file mode 100644 index a42a90c10dad..000000000000 --- a/l10ntools/source/gConvXrm.cxx +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvXrm.hxx" - - - -convert_xrm::convert_xrm(l10nMem& crMemory) - : convert_gen(crMemory), - mbNoCollectingData(true), - mbIsTag(false), - mbIsLang(false) -{ -} - - - -void convert_xrm::doExecute() -{ - xrmlex(); - - // write last part of file. - if (mbMergeMode) - writeSourceFile(msCollector); -} - - - -void convert_xrm::setId(char *yytext) -{ - string& sText = copySource(yytext, mbNoCollectingData); - - if (mbIsTag) { - int nL = sText.find("\""); - int nE = sText.find("\"", nL+1); - if (nL == (int)string::npos || nE == (int)string::npos) - return; - - msKey = sText.substr(nL+1, nE - nL -1); - } -} - - - -void convert_xrm::setLang(char *yytext) -{ - string& sText = copySource(yytext, mbNoCollectingData); - - if (mbIsTag) { - int nL = sText.find("\""); - int nE = sText.find("\"", nL+1); - if (nL == (int)string::npos || nE == (int)string::npos) - return; - - string sLang = sText.substr(nL+1, nE - nL -1); - if (sLang == "en-US") - mbIsLang = true; - else - l10nMem::showError(sLang + " is no en-US language"); - } -} - - - -void convert_xrm::setTag(char *yytext) -{ - msTag = copySource(yytext); - - msKey.clear(); - mbIsLang = false; - mbIsTag = true; -} - - - -void convert_xrm::startCollectData(char *yytext) -{ - copySource(yytext, mbNoCollectingData); - - if (mbIsTag && mbIsLang && msKey.size()) - mbNoCollectingData = false; - - mbIsTag = mbIsLang = false; -} - - - -void convert_xrm::stopCollectData(char *yytext) -{ - string sTagText, sTagEnd, sLang, sText = msCollector; - - copySource(yytext); - if (!mbNoCollectingData) { - mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "readmeitem", "", mbMergeMode); - mbNoCollectingData = true; - if (mbMergeMode) { - sTagEnd = "</" + msTag.substr(1,msTag.size()-2) + ">\n"; - msTag += "id=\"" + msKey + "\" xml:lang=\""; - - // prepare to read all languages - mcMemory.prepareMerge(); - for (; mcMemory.getMergeLang(sLang, sText);) { - // replace \" with " - for (int i = 0; (i = sText.find("\\\"", i)) != (int)string::npos;) - sText.erase(i,1); - - // Prepare tag start and end - sTagText = msTag + sLang + "\">" + sText + sTagEnd; - writeSourceFile(sTagText); - } - } - msKey.clear(); - } - mbIsTag = false; -} diff --git a/l10ntools/source/gDiff.sh b/l10ntools/source/gDiff.sh deleted file mode 100755 index 767ca0784a27..000000000000 --- a/l10ntools/source/gDiff.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -cd workdir/pot -find . > /tmp/jix1 -cd ../jan -find . > /tmp/jix2 - -echo ">>>>> FILELIST DIFF >>>" -diff /tmp/jix1 /tmp/jix2 - -for i in `find . -name \*.pot` -do - CMD=$(diff ../pot/$i $i | sed '/^6c6$/,/^16c16$/d') - if [ "$CMD" != "" ] - then - echo ">>>>>>>> " $i - echo "$CMD" - fi -done - diff --git a/l10ntools/source/gL10nMem.cxx b/l10ntools/source/gL10nMem.cxx deleted file mode 100644 index 3a8647f2eb18..000000000000 --- a/l10ntools/source/gL10nMem.cxx +++ /dev/null @@ -1,969 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#include <string> -#include <vector> -#include <iostream> -#include <fstream> -#include <sstream> -#include <rtl/character.hxx> -using namespace std; - -#include "gL10nMem.hxx" -#include "gConvPo.hxx" - - - -l10nMem *myMem; - - -class l10nMem_lang_list_entry -{ - public: - explicit l10nMem_lang_list_entry(const string& sName) - : msName(sName), - mbChanged(false) - {} - - ~l10nMem_lang_list_entry() {}; - - string msName; // language Name - bool mbChanged; // used for "convert", true if language is modified -}; - - -class l10nMem_file_entry -{ - public: - l10nMem_file_entry(const string& sFileName, int iStart) - : msFileName(sFileName), - miStart(iStart), - miEnd(iStart) - { - // Store fileName without relative path - int i = msFileName.rfind("/"); - if (i == (int)string::npos) - msPureName = msFileName; - else - msPureName = msFileName.substr(i + 1); - } - ~l10nMem_file_entry() {}; - - string msFileName; // file Name with relative path - string msPureName; // just filename - int miStart; // start index of entries in mcMasterEntries (l10Mem_db::mcENUS) - int miEnd; // last index of entries in mcMasterEntries (l10Mem_db::mcENUS) -}; - - - -class l10nMem_lang_entry -{ - public: - l10nMem_lang_entry(const string& sMsgStr, bool bFuzzy) - : msMsgStr(sMsgStr), - mbFuzzy(bFuzzy) - {} - ~l10nMem_lang_entry() {}; - - string msMsgStr; // translated text from po file - bool mbFuzzy; // fuzzy flag -}; - - - -class l10nMem_enus_entry -{ - public: - l10nMem_enus_entry(const string& sKey, - const string& sMsgId, - const string& sComment, - const string& sResource, - const string& sGroup, - int iLineNo, - int iFileInx, - int iLangSize, - l10nMem::ENTRY_STATE eState) - : msMsgId(sMsgId), - msComment(sComment), - msResource(sResource), - msGroup(sGroup), - meState(eState), - miFileInx(iFileInx), - miLineNo(iLineNo) - { - int i; - - // add dummy language entries - for (i = 0; i < iLangSize; ++i) - mcLangText.push_back(l10nMem_lang_entry("", false)); - - // convert key to upper case - msKey = sKey; - //FIX l10nMem::keyToUpper(msKey); - } - - ~l10nMem_enus_entry() {}; - - string msKey; // key in po file and source file - string msMsgId; // en-US text from source file - string msComment; // Comment (to be used in msgcstr) - string msResource; // Resource Id (to be used in msgcstr) - string msGroup; // Group Id (to be used in msgcstr) - l10nMem::ENTRY_STATE meState; // status information - int miFileInx; // index of file name - int miLineNo; // line number - vector<l10nMem_lang_entry> mcLangText; // language texts (index is languageId) -}; - - - -l10nMem::l10nMem() - : mbVerbose(false), - mbDebug(false), - mbInError(false), - miCurFileInx(0), - miCurLangInx(0), - miCurENUSinx(0), - mbConvertMode(false), - mbStrictMode(false) -{ - myMem = this; - msModuleName = "default"; - mcFileList.push_back(l10nMem_file_entry("-genLang-", 0)); - mcLangList.push_back(l10nMem_lang_list_entry("-genLang-")); - mcENUSlist.push_back(l10nMem_enus_entry("-genLang-", "-genLang-", "", "", "", 0, 0, 0, l10nMem::ENTRY_DELETED)); -} - - - -l10nMem::~l10nMem() -{ -} - - - -int l10nMem::showError(const string& sText, int iLineNo) -{ - myMem->mbInError = true; - myMem->formatAndShowText("ERROR", iLineNo, sText); - return 1; -} - - - -void l10nMem::showWarning(const string& sText, int iLineNo) -{ - myMem->formatAndShowText("WARNING", iLineNo, sText); -} - - - -void l10nMem::showDebug(const string& sText, int iLineNo) -{ - if (myMem->mbDebug) - myMem->formatAndShowText("DEBUG", iLineNo, sText); -} - - - -void l10nMem::showVerbose(const string& sText, int iLineNo) -{ - if (myMem->mbVerbose) - myMem->formatAndShowText("INFO", iLineNo, sText); -} - - - -bool l10nMem::isError() -{ - return myMem->mbInError; -} - - - -void l10nMem::setModuleName(const string& sModuleName) -{ - msModuleName = sModuleName; -} - - - -const string& l10nMem::getModuleName() -{ - return msModuleName; -} - - - -void l10nMem::setLanguage(const string& sLanguage, - bool bCreate) -{ - int i, iSize; - - // regular load or convert of old po files - miCurFileInx = 0; - - // With no languages selected only en-US is generated - if (!sLanguage.size()) { - miCurLangInx = 0; - return; - } - - // en-US is loaded as master and cannot be loaded again - if (sLanguage == "en-US") - throw l10nMem::showError("en-US is loaded automatically"); - - // check if language is already loaded - iSize = mcLangList.size(); - for (miCurLangInx = 0; miCurLangInx < iSize && mcLangList[miCurLangInx].msName != sLanguage; ++miCurLangInx); - if (miCurLangInx < iSize) { - if (bCreate) - throw showError("loading " + sLanguage + " twice"); - return; - } - - // language does not exist in db - if (!bCreate) - throw showError("language " + sLanguage + " not loaded"); - - // create language - mcLangList.push_back(l10nMem_lang_list_entry(sLanguage)); - - // add language to all ENUS entries - iSize = mcENUSlist.size(); - for (i = 0; i < iSize; ++i) - mcENUSlist[i].mcLangText.push_back(l10nMem_lang_entry("", false)); -} - - - -void l10nMem::setConvert(bool bConvert, - bool bStrict) -{ - // regular load or convert of old po files - mbConvertMode = bConvert; - mbStrictMode = bStrict; -} - - - ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits