diff options
author | Andras Timar <atimar@suse.com> | 2012-11-27 21:11:18 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-11-28 21:22:47 +0100 |
commit | 78234602ceb6aaaff9996240b388be12fcff968f (patch) | |
tree | ab163b8dda42463167c1477638ce9d85bfb15e7f /librelogo | |
parent | 5c34ee433b9f1191d14d64214a923b321e667a4c (diff) |
LibreLogo integration (extension -> normal code)
While efforts have been made to make LibreLogo work with Python 3.3,
there are still a few bugs, for example large Logo programs do not run
correctly and Translate button does not work. Bugfixing is in progress.
Change-Id: I4227ff86084f51047861897189d2317322296139
Diffstat (limited to 'librelogo')
-rw-r--r-- | librelogo/Configuration_librelogo.mk | 20 | ||||
-rw-r--r-- | librelogo/CustomTarget_librelogo.mk | 43 | ||||
-rw-r--r-- | librelogo/Extension_librelogo.mk | 46 | ||||
-rw-r--r-- | librelogo/Module_librelogo.mk | 4 | ||||
-rw-r--r-- | librelogo/Zip_librelogo.mk | 49 | ||||
-rw-r--r-- | librelogo/source/LibreLogo/LibreLogo.py | 267 | ||||
-rw-r--r-- | librelogo/source/LibreLogoDummy.py | 24 | ||||
-rw-r--r-- | librelogo/source/META-INF/manifest.xml | 9 | ||||
-rw-r--r-- | librelogo/source/README | 43 | ||||
-rw-r--r-- | librelogo/source/description-en-US.txt | 1 | ||||
-rw-r--r-- | librelogo/source/description.xml | 20 | ||||
-rw-r--r-- | librelogo/source/help/en-US/LibreLogo.xhp | 397 | ||||
-rw-r--r-- | librelogo/source/help/en-US/help.tree | 18 | ||||
-rw-r--r-- | librelogo/source/pythonpath/librelogodummy_path.py | 13 | ||||
-rw-r--r-- | librelogo/source/registry/data/org/openoffice/Office/Addons.xcu | 286 | ||||
-rw-r--r-- | librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu | 28 | ||||
-rw-r--r-- | librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu | 28 |
17 files changed, 233 insertions, 1063 deletions
diff --git a/librelogo/Configuration_librelogo.mk b/librelogo/Configuration_librelogo.mk deleted file mode 100644 index cf2e6f45271d..000000000000 --- a/librelogo/Configuration_librelogo.mk +++ /dev/null @@ -1,20 +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_Configuration_Configuration,librelogo,nodeliver)) - -$(eval $(call gb_Configuration_use_configuration,librelogo,registry)) - -$(eval $(call gb_Configuration_add_localized_datas,librelogo,librelogo/source/registry/data,\ - org/openoffice/Office/Addons.xcu \ - org/openoffice/Office/UI/StartModuleWindowState.xcu \ - org/openoffice/Office/UI/WriterWindowState.xcu \ -)) - -# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/librelogo/CustomTarget_librelogo.mk b/librelogo/CustomTarget_librelogo.mk new file mode 100644 index 000000000000..903ca8ab5081 --- /dev/null +++ b/librelogo/CustomTarget_librelogo.mk @@ -0,0 +1,43 @@ +# -*- 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_CustomTarget_CustomTarget,librelogo/locproperties)) + +librelogo_DIR := $(call gb_CustomTarget_get_workdir,librelogo/locproperties) + +ifneq ($(strip $(gb_WITH_LANG)),) +librelogo_LANGS := $(subst -,_,$(filter-out qtz,$(filter-out en-US,$(gb_WITH_LANG)))) +librelogo_LOCPROPERTIES := $(foreach lang,$(librelogo_LANGS),$(librelogo_DIR)/LibreLogo_$(lang).properties) +else +librelogo_LOCPROPERTIES := +endif + +librelogo_PROPMERGETARGET := $(call gb_Executable_get_target_for_build,propex) +librelogo_PROPMERGECOMMAND := $(gb_Helper_set_ld_path) $(librelogo_PROPMERGETARGET) + +$(call gb_CustomTarget_get_target,librelogo/locproperties) : $(librelogo_LOCPROPERTIES) + +$(librelogo_DIR)/LibreLogo_%.properties : \ + $(SRCDIR)/librelogo/source/pythonpath/LibreLogo_en_US.properties \ + | $(librelogo_DIR)/.dir + $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRP,1) + $(call gb_Helper_abbreviate_dirs, \ + LANG=$(subst _,-,$(subst $(librelogo_DIR)/LibreLogo_,,$(subst .properties,,$@))) && \ + MERGEINPUT=`$(gb_MKTEMP)` && \ + echo $(gb_POLOCATION)/$${LANG}/librelogo/source/pythonpath.po > $${MERGEINPUT} && \ + $(librelogo_PROPMERGECOMMAND) \ + -p librelogo \ + -i $< \ + -o $@ \ + -m $${MERGEINPUT} \ + -l $${LANG} && \ + rm -rf $${MERGEINPUT} \ + ) + +# vim:set shiftwidth=4 tabstop=4 noexpandtab: diff --git a/librelogo/Extension_librelogo.mk b/librelogo/Extension_librelogo.mk deleted file mode 100644 index 8f525c3d449b..000000000000 --- a/librelogo/Extension_librelogo.mk +++ /dev/null @@ -1,46 +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_Extension_Extension,librelogo,librelogo/source)) - -$(eval $(call gb_Extension_add_files,librelogo,icons,\ - $(SRCDIR)/librelogo/source/icons/lc_arrowshapes.circular-arrow.png \ - $(SRCDIR)/librelogo/source/icons/lc_arrowshapes.circular-leftarrow.png \ - $(SRCDIR)/librelogo/source/icons/lc_arrowshapes.down-arrow.png \ - $(SRCDIR)/librelogo/source/icons/lc_arrowshapes.up-arrow.png \ - $(SRCDIR)/librelogo/source/icons/lc_basicstop.png \ - $(SRCDIR)/librelogo/source/icons/lc_editglossary.png \ - $(SRCDIR)/librelogo/source/icons/lc_navigationbarleft.png \ - $(SRCDIR)/librelogo/source/icons/lc_newdoc.png \ - $(SRCDIR)/librelogo/source/icons/lc_runbasic.png \ - $(SRCDIR)/librelogo/source/icons/sc_arrowshapes.circular-arrow.png \ - $(SRCDIR)/librelogo/source/icons/sc_arrowshapes.circular-leftarrow.png \ - $(SRCDIR)/librelogo/source/icons/sc_arrowshapes.down-arrow.png \ - $(SRCDIR)/librelogo/source/icons/sc_arrowshapes.up-arrow.png \ - $(SRCDIR)/librelogo/source/icons/sc_basicstop.png \ - $(SRCDIR)/librelogo/source/icons/sc_editglossary.png \ - $(SRCDIR)/librelogo/source/icons/sc_navigationbarleft.png \ - $(SRCDIR)/librelogo/source/icons/sc_newdoc.png \ - $(SRCDIR)/librelogo/source/icons/sc_runbasic.png \ -)) - -$(eval $(call gb_Extension_add_file,librelogo,LibreLogoDummy.py,$(SRCDIR)/librelogo/source/LibreLogoDummy.py)) -$(eval $(call gb_Extension_add_file,librelogo,pythonpath/librelogodummy_path.py,$(SRCDIR)/librelogo/source/pythonpath/librelogodummy_path.py)) -$(eval $(call gb_Extension_add_file,librelogo,LibreLogo/LibreLogo.py,$(SRCDIR)/librelogo/source/LibreLogo/LibreLogo.py)) -$(eval $(call gb_Extension_add_file,librelogo,Addons.xcu,$(call gb_XcuFile_for_extension,librelogo/source/registry/data/org/openoffice/Office/Addons.xcu))) -$(eval $(call gb_Extension_add_file,librelogo,Office/UI/StartModuleWindowState.xcu,$(call gb_XcuFile_for_extension,librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu))) -$(eval $(call gb_Extension_add_file,librelogo,Office/UI/WriterWindowState.xcu,$(call gb_XcuFile_for_extension,librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu))) - -$(eval $(call gb_Extension_localize_properties,librelogo,pythonpath/LibreLogo_en_US.properties,$(SRCDIR)/librelogo/source/pythonpath/LibreLogo_en_US.properties)) - -$(eval $(call gb_Extension_add_helpfile,librelogo,$(SRCDIR)/librelogo/source/help/en-US,org.openoffice.comp.pyuno.LibreLogo/LibreLogo.xhp,LibreLogo.xhp)) - -$(eval $(call gb_Extension_add_helptreefile,librelogo,$(SRCDIR)/librelogo/source/help/en-US,help.tree,help.tree,org.openoffice.comp.pyuno.LibreLogo)) - -# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/librelogo/Module_librelogo.mk b/librelogo/Module_librelogo.mk index 6db9719138a0..caa4cf96efb0 100644 --- a/librelogo/Module_librelogo.mk +++ b/librelogo/Module_librelogo.mk @@ -13,8 +13,8 @@ ifneq ($(DISABLE_SCRIPTING),TRUE) ifneq ($(DISABLE_PYTHON),TRUE) $(eval $(call gb_Module_add_targets,librelogo,\ - Configuration_librelogo \ - Extension_librelogo \ + CustomTarget_librelogo \ + Zip_librelogo \ )) endif diff --git a/librelogo/Zip_librelogo.mk b/librelogo/Zip_librelogo.mk new file mode 100644 index 000000000000..617d0fd2ef8d --- /dev/null +++ b/librelogo/Zip_librelogo.mk @@ -0,0 +1,49 @@ +# -*- 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_Zip_Zip,LibreLogo,$(WORKDIR)/Zip/LibreLogo)) + +$(eval $(call gb_Zip_add_file,LibreLogo,python/LibreLogo/LibreLogo.py,\ + $(SRCDIR)/librelogo/source/LibreLogo/LibreLogo.py \ +)) + +$(eval $(call gb_Zip_add_file,LibreLogo,python/LibreLogo/LibreLogo_en_US.properties,\ + $(SRCDIR)/librelogo/source/pythonpath/LibreLogo_en_US.properties \ +)) + +librelogo_LANGS := $(subst -,_,$(filter-out qtz,$(filter-out en-US,$(gb_WITH_LANG)))) + +$(eval $(foreach lang,$(librelogo_LANGS),\ + $(call gb_Zip_add_file,LibreLogo,python/LibreLogo/LibreLogo_$(lang).properties,\ + $(call gb_CustomTarget_get_workdir,librelogo/locproperties)/LibreLogo_$(lang).properties))) + +$(eval $(foreach icon,\ + lc_arrowshapes.circular-arrow.png \ + lc_arrowshapes.circular-leftarrow.png \ + lc_arrowshapes.down-arrow.png \ + lc_arrowshapes.up-arrow.png \ + lc_basicstop.png \ + lc_editglossary.png \ + lc_navigationbarleft.png \ + lc_newdoc.png \ + lc_runbasic.png \ + sc_arrowshapes.circular-arrow.png \ + sc_arrowshapes.circular-leftarrow.png \ + sc_arrowshapes.down-arrow.png \ + sc_arrowshapes.up-arrow.png \ + sc_basicstop.png \ + sc_editglossary.png \ + sc_navigationbarleft.png \ + sc_newdoc.png \ + sc_runbasic.png, \ + $(call gb_Zip_add_file,LibreLogo,python/LibreLogo/icons/$(icon),\ + $(SRCDIR)/librelogo/source/icons/$(icon) \ +))) + +# vim:set shiftwidth=4 softtabstop=4 expandtab: diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py index db697bd7a022..4fe0c92c8c14 100644 --- a/librelogo/source/LibreLogo/LibreLogo.py +++ b/librelogo/source/LibreLogo/LibreLogo.py @@ -7,12 +7,23 @@ # 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/. # +from __future__ import unicode_literals import sys, os, uno, unohelper import re, random, traceback, itertools import threading, time as __time__ -ctx = uno.getComponentContext() -__lngpath__ = re.sub("[\w_.]*$", "", ctx.ServiceManager.createInstanceWithContext("org.openoffice.LibreLogo.LibreLogoDummy", ctx).get_path()) # instead of PackageInformationProvider, see #115393# +try: + unicode +except: + unicode, long = str, int # support python 3 + +urebootstrap = os.environ["URE_BOOTSTRAP"] +if "vnd.sun.star.pathname" in urebootstrap: + __lngpath__ = re.sub("^vnd.sun.star.pathname:(.*)program(/|\\)fundamental([.]ini|rc)$", "\\1", urebootstrap) +else: + __lngpath__ = unohelper.fileUrlToSystemPath(re.sub("program/(fundamental.ini|fundamentalrc)$", "", urebootstrap)) +__lngpath__ = __lngpath__ + "share/Scripts/python/LibreLogo/".replace("/", os.sep) +print (__lngpath__) __translang__ = "cz|de|dk|en_US|es|fr|hu|it|nl|no|pl|pt|ru|se|sl" # FIXME supported languages for language guessing, expand this list, according to the localizations __lng__ = {} __docs__ = {} @@ -125,7 +136,7 @@ def __l12n__(lng): return __lng__[lng] except: try: - __lng__[lng] = dict([[i.split("=")[0].strip(), i.split("=")[1].strip().decode("unicode-escape")] for i in open(__lngpath__ + "LibreLogo_" + lng + ".properties", 'r').readlines() if "=" in i]) + __lng__[lng] = dict([[i.decode("unicode-escape").split("=")[0].strip(), i.decode("unicode-escape").split("=")[1].strip()] for i in open(__lngpath__ + "LibreLogo_" + lng + ".properties", 'rb').readlines() if b"=" in i]) return __lng__[lng] except: return None @@ -208,7 +219,7 @@ def Input(s): # dispose the dialog controlContainer.dispose() return inputtext - except Exception, e: + except Exception as e: __trace__() def __string__(s, decimal = None): # convert decimal sign, localized BOOL and SET @@ -257,10 +268,10 @@ def Random(r): return list(r)[int(random.random() * len(r))] def to_ascii(s): - return s.encode("unicode-escape").replace("\u", "__u__").replace(r"\x", "__x__") + return s.encode("unicode-escape").decode("utf-8").replace("\\u", "__u__").replace(r"\x", "__x__") def to_unicode(s): - return s.replace("__x__", r"\x").replace("__u__", "\u").decode("unicode-escape") + return bytes(s.replace("__x__", r"\x").replace("__u__", "\\u"), "ascii").decode("unicode-escape") def __trace__(): if 'PYUNO_LOGLEVEL' in os.environ: @@ -281,7 +292,7 @@ def __translate__(arg = None): # detect language text = _.doc.getText().getString() # remove comments and strings - text = re.sub(r"[ ]*;[^\n]*", "", re.sub(ur"['„“‘«»「][^\n'”“‘’«»」]*['”“‘’«»」]", "", re.sub(r"^[ \t]*[;#][^\n]*", "", text))) + text = re.sub(r"[ ]*;[^\n]*", "", re.sub(r"['„“‘«»「][^\n'”“‘’«»」]*['”“‘’«»」]", "", re.sub(r"^[ \t]*[;#][^\n]*", "", text))) text = " ".join(set(re.findall("(?u)\w+", text)) - set(re.findall("(?u)\w*\d+\w*", text))).lower() # only words ctx = uno.getComponentContext() guess = ctx.ServiceManager.createInstanceWithContext("com.sun.star.linguistic2.LanguageGuessing", ctx) @@ -309,15 +320,15 @@ def __translate__(arg = None): in2 = __l12n__(_.lng)['IN'].split("|")[0].upper() if in1[0] == '-' and in2[0] != '-': # "for x y-in" -> "for x in y" exception += ['IN'] - text = re.sub(ur"(?ui)\b((?:%s) +:?\w+) +([^\n]+)(?:%s) +(?=[[] |[[]\n)" % (lang['FOR'], in1), "\\1 %s \\2 " % in2, text) - text = re.sub(ur"(?ui)(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % in1, "%s \\1" % in2, text) + text = re.sub(r"(?ui)\b((?:%s) +:?\w+) +([^\n]+)(?:%s) +(?=[[] |[[]\n)" % (lang['FOR'], in1), "\\1 %s \\2 " % in2, text) + text = re.sub(r"(?ui)(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % in1, "%s \\1" % in2, text) elif in1[0] != '-' and in2[0] == '-': # "for x in y" -> "for x y-in" exception += ['IN'] - text = re.sub(ur"(?ui)(?<=\n)((?:%s)\b +:?\w+) +(?:%s) +([^\n]+?) +(?=[[] |[[]\n)" % (lang['FOR'], in1), "\\1 \\2%s " % in2, text) - text = re.sub(ur"(?ui)(?<!:)\b(?:%s) +(:?\b\w+|[[][^[\n]*])\b" % in1, "\\1%s" % in2, text) + text = re.sub(r"(?ui)(?<=\n)((?:%s)\b +:?\w+) +(?:%s) +([^\n]+?) +(?=[[] |[[]\n)" % (lang['FOR'], in1), "\\1 \\2%s " % in2, text) + text = re.sub(r"(?ui)(?<!:)\b(?:%s) +(:?\b\w+|[[][^[\n]*])\b" % in1, "\\1%s" % in2, text) for i in set(lang) - set(exception): - text = re.sub(ur'(?ui)(?<!:)\b(%s)\b' % lang[i], __l12n__(_.lng)[i].split("|")[0].upper(), text) - text = re.sub(ur"(?<=\d)[%s](?=\d)" % lang['DECIMAL'], __l12n__(_.lng)['DECIMAL'], text) + text = re.sub(r'(?ui)(?<!:)\b(%s)\b' % lang[i], __l12n__(_.lng)[i].split("|")[0].upper(), text) + text = re.sub(r"(?<=\d)[%s](?=\d)" % lang['DECIMAL'], __l12n__(_.lng)['DECIMAL'], text) # decode strings quoted = u"(?ui)(?<=%s)(%%s)(?=%s)" % (__l12n__(_.lng)['LEFTSTRING'][0], __l12n__(_.lng)['RIGHTSTRING'][0]) @@ -548,7 +559,7 @@ def run(arg=None, arg2 = -1): if arg2 == -1: arg2 = _.doc.getText().getString() if len(arg2) > 20000: - if MessageBox(_.doc.CurrentController.Frame.ContainerWindow, __l12n__(_.lng)['ERR_NOTAPROGRAM'], __l12n__(_.lng)['LIBRELOGO'], "querybox", __YES_NO_CANCEL__) <> 2: + if MessageBox(_.doc.CurrentController.Frame.ContainerWindow, __l12n__(_.lng)['ERR_NOTAPROGRAM'], __l12n__(_.lng)['LIBRELOGO'], "querybox", __YES_NO_CANCEL__) != 2: with __lock__: __thread__ = None return None @@ -718,7 +729,7 @@ def __draw__(d): def __zoom__(): z = _.doc.CurrentController.getViewSettings().ZoomValue - if z <> _.zoomvalue: + if z != _.zoomvalue: _.zoomvalue = z return True return False @@ -742,7 +753,7 @@ def __go__(shapename, n, dot = False, preciseAngle = -1): dx = n * sin((pi/180)*(max(turtle.RotateAngle, preciseAngle)/100)) dy = n * cos((pi/180)*(max(turtle.RotateAngle, preciseAngle)/100)) turtle.setPosition(__Point__(pos.X + dx / __MM10_TO_TWIP__, pos.Y + dy / __MM10_TO_TWIP__)) - if (_.pencolor <> _.oldlc or _.pensize <> _.oldlw or _.linestyle <> _.oldls or _.linejoint <> _.oldlj): + if (_.pencolor != _.oldlc or _.pensize != _.oldlw or _.linestyle != _.oldls or _.linejoint != _.oldlj): __removeshape__(__ACTUAL__) shape = None else: @@ -851,7 +862,7 @@ def point(): _.pen, _.linestyle = oldpen, oldstyle def __boxshape__(shapetype, l): - if type(l) <> type([]): # default for circle and square + if type(l) != type([]): # default for circle and square l = [l, l] turtle = __getshape__(__TURTLE__) shape = __draw__(shapetype + "Shape") @@ -1144,111 +1155,111 @@ def __loadlang__(lang, a): repcount = a['REPCOUNT'].split('|')[0] loopi = itertools.count() loop = lambda r: "%(i)s = 1\n%(orig)s%(j)s = %(i)s\n%(i)s += 1\n" % \ - { "i": repcount + str(loopi.next()), "j": repcount, "orig": re.sub( ur"(?ui)(?<!:)\b%s\b" % repcount, repcount + str(loopi.next()-1), r.group(0)) } + { "i": repcount + str(loopi.next()), "j": repcount, "orig": re.sub( r"(?ui)(?<!:)\b%s\b" % repcount, repcount + str(loopi.next()-1), r.group(0)) } __comp__[lang] = [ - [ur"(?<!:)\b(?:%s) [[]" % a['GROUP'], "\n__groupstart__()\nfor __groupindex__ in range(2):\n[\nif __groupindex__ == 1:\n[\n__groupend__()\nbreak\n]\n"], - [ur"(?<!:)\b(?:%s)\b" % a['GROUP'], "\n__removeshape__(__ACTUAL__)\n"], - [ur"(\n| )][ \n]*\[(\n| )", "\n]\nelse:\n[\n"], # if/else block - [ur"(?<!\n)\[(?= |\n)", ":\n[\n"], # start block - [ur"( ]|\n]$)", "\n]\n"], # finish block - [ur"(?<!:)\b(?:%s)\b" % a['FOR'], "\nfor"], - [ur"(?<!:)\b(?:%s)\b" % a['REPEAT'], "\n__repeat__"], - [ur"(?<!:)\b(?:%s)\b" % a['BREAK'], "\nbreak"], - [ur"(?<!:)\b(?:%s)\b" % a['CONTINUE'], "\ncontinue"], - [ur"(?<!:)\b(?:%s)\b" % a['REPCOUNT'], repcount], - [ur"(?<!:)\b(?:%s)\b" % a['IF'], "\nif"], - [ur"(?<!:)\b(?:%s)\b" % a['WHILE'], "\nwhile"], - [ur"(?<!:)\b(?:%s)\b" % a['OUTPUT'], "\nreturn"], - [ur"\n(if|while|return) [^\n]*", lambda r: re.sub("(?<![=!<>])=(?!=)", "==", r.group(0))], # = -> ==, XXX x = y = 1? - [ur"(?<=\n)(for\b :?\w+) ([^\n]+)(?<=\w|]|}|\))(?=-|:)(?:%s)\b" % a['IN'], "\\1 in \\2"], # "for x y-in" -> "for x in y" - [ur"(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % a['IN'], "in \\1"], # "x y-in" -> "x in y" - [ur"(?<!:)\b(?:%s)\b" % a['IN'], "in"], - [ur"(?<!:)\b(?:%s)\b[ \t]+(:?\w+)\b(?! in\b)" % a['FOR'], "\nfor \\1 in"], - [ur"(?<=\n)__repeat__ :\n", "while True:\n"], # infinite loop - [ur"(?<=\n)(for|while) (?!__groupindex__)[^\n]*:\n\[\n", loop], # loop variables for repcount (not groupindex loop) - [ur"(?<=\n)__repeat__([^\n]*\w[^\n]*):(?=\n)", "for %s in range(1, 1+int(\\1)):" % repcount], # repeat block - [ur"(?<=\d)[%s](?=\d)" % a['DECIMAL'], "."], # decimal sign - [ur"(?<!/)/(?!/)", "*1.0/"], # fix division: /1 -> /1.0, but not with // - [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['HOUR'], "\\1*30"], # 12h = 12*30° - [ur"(?<=\d)(%s)" % a['DEG'], ""], # 1° -> 1 - [ur"(?<!:)\b(?:__def__)[ \t]+(\w+)\b[ \t]*([:]?\w[^\n]*)", "\ndef \\1(\\2):\n["], - [ur"(?<!:)\b(?:__def__)\s+(\w+)", "\ndef \\1():\n["], - [ur"(?<!:)\b(?:%s)\b" % a['END'], "\n]"], - [ur"(?<!:)\b(?:%s)\b" % a['GLOBAL'], "global"], - [ur"(?<!:)\b(?:%s)\b" % a['TRUE'], "True"], - [ur"(?<!:)\b(?:%s)\b" % a['FALSE'], "False"], - [ur"(?<!:)\b(?:%s)\b" % a['NOT'], "not"], - [ur"(?<!:)\b(?:%s)\b" % a['AND'], "and"], - [ur"(?<!:)\b(?:%s)\b" % a['OR'], "or"], - [ur"(?<!:)\b(?:%s)\b" % a['INT'], "__int__"], - [ur"(?<!:)\b(?:%s)\b" % a['FLOAT'], "__float__"], - [ur"(?<!:)\b(?:%s)\b" % a['STR'], "__string__"], - [ur"(?<!:)\b(?:%s)\b" % a['COUNT'], "len"], - [ur"(?<!:)\b(?:%s)\b" % a['ROUND'], "round"], - [ur"(?<!:)\b(?:%s)\b" % a['ABS'], "abs"], - [ur"(?<!:)\b(?:%s)\b" % a['SIN'], "sin"], - [ur"(?<!:)\b(?:%s)\b" % a['COS'], "cos"], - [ur"(?<!:)\b(?:%s)\b" % a['PI'], "pi"], - [ur"(?<!:)\b(?:%s)\b" % a['SQRT'], "sqrt"], - [ur"(?<!:)\b(?:%s)\b" % a['MIN'], "min"], - [ur"(?<!:)\b(?:%s)\b" % a['MAX'], "max"], - [ur"(?<!:)\b(?:%s)\b" % a['STOP'], "\nreturn None"], - [ur"(?<!:)\b(?:%s)\b" % a['CLEARSCREEN'], "\n__cs__()"], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENCOLOR'], "\n)pencolor("], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENSTYLE'], "\n)penstyle("], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENJOINT'], "\n)penjoint("], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FILLCOLOR'], "\n)fillcolor("], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FILLSTYLE'], "\n)fillstyle("], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTCOLOR'], "\n)fontcolor("], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTFAMILY'], "\nglobal _\n_.fontfamily="], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTHEIGHT'], "\nglobal _\n_.fontheight="], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTWEIGHT'], "\nglobal _\n_.fontweight="], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['FONTSTYLE'], "\nglobal _\n_.fontstyle="], - [ur"(?<!:)\b(?:%s)(\s+|$)" % a['PENWIDTH'], "\n)pensize("], - [ur"(?<!:)\b(?:%s)\b" % a['PENDOWN'], "\nglobal _\n__pen__(1)"], - [ur"(?<!:)\b(?:%s)\b" % a['PENUP'], "\nglobal _\n__pen__(0)"], - [ur"(?<!:)\b(?:%s)\b" % a['HIDETURTLE'], "\nhideturtle()"], - [ur"(?<!:)\b(?:%s)\b" % a['SHOWTURTLE'], "\nshowturtle()"], - [ur"(?<!:)\b(?:%s)\b\[" % a['POSITION'], "position()["], - [ur"(?<!:)\b(?:%s)\b(?!\()" % a['POSITION'], "\n)position("], - [ur"(?<!:)\b(?:%s)\b" % a['HEADING'], "\n)heading("], - [ur"(?<!:)\b(?:%s)\b" % a['PAGESIZE'], "pagesize()"], - [ur"(?<!:)\b(?:%s)\b" % a['POINT'], "\npoint()"], - [ur"(?<!:)\b(?:%s)\b" % (a['ELLIPSE'] + "|" + a['CIRCLE']), "\n)ellipse("], - [ur"(?<!:)\b(?:%s)\b" % (a['RECTANGLE'] + "|" + a['SQUARE']), "\n)rectangle("], - [ur"(?<!:)\b(?:%s)\b" % a['CLOSE'], "\n__fillit__(False)"], - [ur"(?<!:)\b(?:%s)\b" % a['FILL'], "\n__fillit__()"], - [ur"(?<!:)\b(?:%s)\b" % a['LABEL'], "\n)label("], - [ur"(?<!:)\b(?:%s)\b" % a['TEXT'], "\n)text(__getshape__(__ACTUAL__),"], - [ur"(text\([ \t]*\"[^\"\n\)]*)", "\\1\"\n"], - [ur"(?<!:)\b(?:%s)\b" % a['HOME'], "\nturtlehome()"], - [ur"(?<!:)\b(?:%s)\b" % a['SLEEP'], "\n)sleep("], - [ur"(?<!:)\b(?:%s)\b" % a['FORWARD'], "\n)forward("], - [ur"(?<!:)\b(?:%s)\b" % a['BACKWARD'], "\n)backward("], - [ur"(?<!:)\b(?:%s)\b" % a['TURNRIGHT'], "\n)turnright("], - [ur"(?<!:)\b(?:%s)\b" % a['RANDOM'], "Random"], - [ur"(?<!:)\b(?:%s)\b(?= \d)" % 'Random', "random.random()*"], - [ur"(?<!:)\b(?:%s)\b" % a['SET'], "set"], - [ur"(?<!:)\b(?:%s)\b" % a['RANGE'], "range"], - [ur"(?<!:)\b(?:%s)\b" % a['LIST'], "list"], - [ur"(?<!:)\b(?:%s)\b" % a['TUPLE'], "tuple"], - [ur"(?<!:)\b(?:%s)\b" % a['SORTED'], "sorted"], - [ur"(?<!:)\b(?:%s)\b ?\(" % a['RESEARCH'], "re.search('(?u)'+"], - [ur"(?<!:)\b(?:%s)\b ?\(" % a['RESUB'], "re.sub('(?u)'+"], - [ur"(?<!:)\b(?:%s)\b ?\(" % a['REFINDALL'], "re.findall('(?u)'+"], - [ur"(?<!:)\b(?:%s)\b" % a['ANY'], "u'any'"], - [ur"(?<!:)\b(?:%s) (\w+|[[][^\]]*])\b" % a['INPUT'], " Input(\\1)"], - [ur"(?<!:)\b(?:%s)\b" % a['PRINT'], "\n)Print("], - [ur"(?<!:)\b(?:%s)\b" % a['TURNLEFT'], "\n)turnleft("], - [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['PT'], "\\1"], - [ur"\b([0-9]+([,.][0-9]+)?)(%s)(?!\w)" % a['INCH'], "\\1*72"], - [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['MM'], "\\1*%s" % __MM_TO_PT__], - [ur"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['CM'], "\\1*%s*10" % __MM_TO_PT__], - [ur"\b(__(?:int|float|string)__len|round|abs|sin|cos|sqrt|set|list|tuple|sorted)\b ((?:\w|\d+([,.]\d+)?|[-+*/]| )+)\)" , "\\1(\\2))" ], # fix parsing: (1 + sqrt x) -> (1 + sqrt(x)) - [ur"(?<=[-*/=+,]) ?\n\)(\w+)\(", "\\1()"], # read attributes, eg. x = fillcolor - [ur"(?<=return) ?\n\)(\w+)\(", "\\1()"], # return + user function - [ur"(?<=(?:Print|label)\() ?\n\)(\w+)\(", "\\1()\n"] # Print/label + user function + [r"(?<!:)\b(?:%s) [[]" % a['GROUP'], "\n__groupstart__()\nfor __groupindex__ in range(2):\n[\nif __groupindex__ == 1:\n[\n__groupend__()\nbreak\n]\n"], + [r"(?<!:)\b(?:%s)\b" % a['GROUP'], "\n__removeshape__(__ACTUAL__)\n"], + [r"(\n| )][ \n]*\[(\n| )", "\n]\nelse:\n[\n"], # if/else block + [r"(?<!\n)\[(?= |\n)", ":\n[\n"], # start block + [r"( ]|\n]$)", "\n]\n"], # finish block + [r"(?<!:)\b(?:%s)\b" % a['FOR'], "\nfor"], + [r"(?<!:)\b(?:%s)\b" % a['REPEAT'], "\n__repeat__"], + [r"(?<!:)\b(?:%s)\b" % a['BREAK'], "\nbreak"], + [r"(?<!:)\b(?:%s)\b" % a['CONTINUE'], "\ncontinue"], + [r"(?<!:)\b(?:%s)\b" % a['REPCOUNT'], repcount], + [r"(?<!:)\b(?:%s)\b" % a['IF'], "\nif"], + [r"(?<!:)\b(?:%s)\b" % a['WHILE'], "\nwhile"], + [r"(?<!:)\b(?:%s)\b" % a['OUTPUT'], "\nreturn"], + [r"\n(if|while|return) [^\n]*", lambda r: re.sub("(?<![=!<>])=(?!=)", "==", r.group(0))], # = -> ==, XXX x = y = 1? + [r"(?<=\n)(for\b :?\w+) ([^\n]+)(?<=\w|]|}|\))(?=-|:)(?:%s)\b" % a['IN'], "\\1 in \\2"], # "for x y-in" -> "for x in y" + [r"(:?\b\w+|[[][^[\n]*])\b(?:%s)\b" % a['IN'], "in \\1"], # "x y-in" -> "x in y" + [r"(?<!:)\b(?:%s)\b" % a['IN'], "in"], + [r"(?<!:)\b(?:%s)\b[ \t]+(:?\w+)\b(?! in\b)" % a['FOR'], "\nfor \\1 in"], + [r"(?<=\n)__repeat__ :\n", "while True:\n"], # infinite loop + [r"(?<=\n)(for|while) (?!__groupindex__)[^\n]*:\n\[\n", loop], # loop variables for repcount (not groupindex loop) + [r"(?<=\n)__repeat__([^\n]*\w[^\n]*):(?=\n)", "for %s in range(1, 1+int(\\1)):" % repcount], # repeat block + [r"(?<=\d)[%s](?=\d)" % a['DECIMAL'], "."], # decimal sign + [r"(?<!/)/(?!/)", "*1.0/"], # fix division: /1 -> /1.0, but not with // + [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['HOUR'], "\\1*30"], # 12h = 12*30° + [r"(?<=\d)(%s)" % a['DEG'], ""], # 1° -> 1 + [r"(?<!:)\b(?:__def__)[ \t]+(\w+)\b[ \t]*([:]?\w[^\n]*)", "\ndef \\1(\\2):\n["], + [r"(?<!:)\b(?:__def__)\s+(\w+)", "\ndef \\1():\n["], + [r"(?<!:)\b(?:%s)\b" % a['END'], "\n]"], + [r"(?<!:)\b(?:%s)\b" % a['GLOBAL'], "global"], + [r"(?<!:)\b(?:%s)\b" % a['TRUE'], "True"], + [r"(?<!:)\b(?:%s)\b" % a['FALSE'], "False"], + [r"(?<!:)\b(?:%s)\b" % a['NOT'], "not"], + [r"(?<!:)\b(?:%s)\b" % a['AND'], "and"], + [r"(?<!:)\b(?:%s)\b" % a['OR'], "or"], + [r"(?<!:)\b(?:%s)\b" % a['INT'], "__int__"], + [r"(?<!:)\b(?:%s)\b" % a['FLOAT'], "__float__"], + [r"(?<!:)\b(?:%s)\b" % a['STR'], "__string__"], + [r"(?<!:)\b(?:%s)\b" % a['COUNT'], "len"], + [r"(?<!:)\b(?:%s)\b" % a['ROUND'], "round"], + [r"(?<!:)\b(?:%s)\b" % a['ABS'], "abs"], + [r"(?<!:)\b(?:%s)\b" % a['SIN'], "sin"], + [r"(?<!:)\b(?:%s)\b" % a['COS'], "cos"], + [r"(?<!:)\b(?:%s)\b" % a['PI'], "pi"], + [r"(?<!:)\b(?:%s)\b" % a['SQRT'], "sqrt"], + [r"(?<!:)\b(?:%s)\b" % a['MIN'], "min"], + [r"(?<!:)\b(?:%s)\b" % a['MAX'], "max"], + [r"(?<!:)\b(?:%s)\b" % a['STOP'], "\nreturn None"], + [r"(?<!:)\b(?:%s)\b" % a['CLEARSCREEN'], "\n__cs__()"], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['PENCOLOR'], "\n)pencolor("], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['PENSTYLE'], "\n)penstyle("], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['PENJOINT'], "\n)penjoint("], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['FILLCOLOR'], "\n)fillcolor("], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['FILLSTYLE'], "\n)fillstyle("], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['FONTCOLOR'], "\n)fontcolor("], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['FONTFAMILY'], "\nglobal _\n_.fontfamily="], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['FONTHEIGHT'], "\nglobal _\n_.fontheight="], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['FONTWEIGHT'], "\nglobal _\n_.fontweight="], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['FONTSTYLE'], "\nglobal _\n_.fontstyle="], + [r"(?<!:)\b(?:%s)(\s+|$)" % a['PENWIDTH'], "\n)pensize("], + [r"(?<!:)\b(?:%s)\b" % a['PENDOWN'], "\nglobal _\n__pen__(1)"], + [r"(?<!:)\b(?:%s)\b" % a['PENUP'], "\nglobal _\n__pen__(0)"], + [r"(?<!:)\b(?:%s)\b" % a['HIDETURTLE'], "\nhideturtle()"], + [r"(?<!:)\b(?:%s)\b" % a['SHOWTURTLE'], "\nshowturtle()"], + [r"(?<!:)\b(?:%s)\b\[" % a['POSITION'], "position()["], + [r"(?<!:)\b(?:%s)\b(?!\()" % a['POSITION'], "\n)position("], + [r"(?<!:)\b(?:%s)\b" % a['HEADING'], "\n)heading("], + [r"(?<!:)\b(?:%s)\b" % a['PAGESIZE'], "pagesize()"], + [r"(?<!:)\b(?:%s)\b" % a['POINT'], "\npoint()"], + [r"(?<!:)\b(?:%s)\b" % (a['ELLIPSE'] + "|" + a['CIRCLE']), "\n)ellipse("], + [r"(?<!:)\b(?:%s)\b" % (a['RECTANGLE'] + "|" + a['SQUARE']), "\n)rectangle("], + [r"(?<!:)\b(?:%s)\b" % a['CLOSE'], "\n__fillit__(False)"], + [r"(?<!:)\b(?:%s)\b" % a['FILL'], "\n__fillit__()"], + [r"(?<!:)\b(?:%s)\b" % a['LABEL'], "\n)label("], + [r"(?<!:)\b(?:%s)\b" % a['TEXT'], "\n)text(__getshape__(__ACTUAL__),"], + [r"(text\([ \t]*\"[^\"\n\)]*)", "\\1\"\n"], + [r"(?<!:)\b(?:%s)\b" % a['HOME'], "\nturtlehome()"], + [r"(?<!:)\b(?:%s)\b" % a['SLEEP'], "\n)sleep("], + [r"(?<!:)\b(?:%s)\b" % a['FORWARD'], "\n)forward("], + [r"(?<!:)\b(?:%s)\b" % a['BACKWARD'], "\n)backward("], + [r"(?<!:)\b(?:%s)\b" % a['TURNRIGHT'], "\n)turnright("], + [r"(?<!:)\b(?:%s)\b" % a['RANDOM'], "Random"], + [r"(?<!:)\b(?:%s)\b(?= \d)" % 'Random', "random.random()*"], + [r"(?<!:)\b(?:%s)\b" % a['SET'], "set"], + [r"(?<!:)\b(?:%s)\b" % a['RANGE'], "range"], + [r"(?<!:)\b(?:%s)\b" % a['LIST'], "list"], + [r"(?<!:)\b(?:%s)\b" % a['TUPLE'], "tuple"], + [r"(?<!:)\b(?:%s)\b" % a['SORTED'], "sorted"], + [r"(?<!:)\b(?:%s)\b ?\(" % a['RESEARCH'], "re.search('(?u)'+"], + [r"(?<!:)\b(?:%s)\b ?\(" % a['RESUB'], "re.sub('(?u)'+"], + [r"(?<!:)\b(?:%s)\b ?\(" % a['REFINDALL'], "re.findall('(?u)'+"], + [r"(?<!:)\b(?:%s)\b" % a['ANY'], "u'any'"], + [r"(?<!:)\b(?:%s) (\w+|[[][^\]]*])\b" % a['INPUT'], " Input(\\1)"], + [r"(?<!:)\b(?:%s)\b" % a['PRINT'], "\n)Print("], + [r"(?<!:)\b(?:%s)\b" % a['TURNLEFT'], "\n)turnleft("], + [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['PT'], "\\1"], + [r"\b([0-9]+([,.][0-9]+)?)(%s)(?!\w)" % a['INCH'], "\\1*72"], + [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['MM'], "\\1*%s" % __MM_TO_PT__], + [r"\b([0-9]+([,.][0-9]+)?)(%s)\b" % a['CM'], "\\1*%s*10" % __MM_TO_PT__], + [r"\b(__(?:int|float|string)__len|round|abs|sin|cos|sqrt|set|list|tuple|sorted)\b ((?:\w|\d+([,.]\d+)?|[-+*/]| )+)\)" , "\\1(\\2))" ], # fix parsing: (1 + sqrt x) -> (1 + sqrt(x)) + [r"(?<=[-*/=+,]) ?\n\)(\w+)\(", "\\1()"], # read attributes, eg. x = fillcolor + [r"(?<=return) ?\n\)(\w+)\(", "\\1()"], # return + user function + [r"(?<=(?:Print|label)\() ?\n\)(\w+)\(", "\\1()\n"] # Print/label + user function ] def __concatenation__(r): # keep line positions with extra line breaks @@ -1278,7 +1289,7 @@ def __compil__(s): rmsp = re.compile(r"[ ]*([=+*/]|==|<=|>=|<>|!=|-[ ]+)[ ]*") chsp = re.compile(r"[ \t]+") chch = re.compile(r"(?u)(?<!\w):(?=\w)") - parenfix = re.compile(ur"(?ui)(\([^\(\[\]\)]+)]\)") + parenfix = re.compile(r"(?ui)(\([^\(\[\]\)]+)]\)") # remove CR characters and split lines s = re.sub(r'[ \t\r]*(?=\n)', '', s) @@ -1307,11 +1318,11 @@ def __compil__(s): s = re.sub(r"[ ]*;[^\n]*", "", s) # n-dash and m-dash as minus signs - s = re.sub(ur"(?u)[–—]", "-", s) + s = re.sub(r"(?u)[–—]", "-", s) # replace procedure names - s = re.sub(ur"(?i)^[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "__def__ ", s) - s = re.sub(ur"(?i)\n[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "\n__def__ ", s) + s = re.sub(r"(?i)^[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "__def__ ", s) + s = re.sub(r"(?i)\n[ ]*(%s)[ ]+" % __l12n__(_.lng)['TO'], "\n__def__ ", s) subnames = re.findall(u"(?iu)(?<=__def__ )\w+", s) globs = "" functions = ["range", "__int__", "__float__", "Random", "Input", "__string__", "len", "round", "abs", "sin", "cos", "sqrt", "set", "list", "tuple", "re.sub", "re.search", "re.findall", "sorted", "min", "max"] @@ -1319,7 +1330,7 @@ def __compil__(s): if len(subnames) > 0: globs = "global %s" % ", ".join(subnames) # search user functions (function calls with two or more arguments need explicite Python parentheses) - functions += [ re.findall("(?u)\w+",i[0])[0] for i in re.findall(ur"""(?iu)(?<=__def__ )([^\n]*)\n # beginning of a procedure + functions += [ re.findall("(?u)\w+",i[0])[0] for i in re.findall(r"""(?iu)(?<=__def__ )([^\n]*)\n # beginning of a procedure (?:[^\n]*(?<!\b(%(END)s))\n)* # 0 or more lines (not END) [^\n]*\b(?:%(OUTPUT)s)\b[^\n]*\n # line with OUTPUT (functions = procedures with OUTPUT) (?:[^\n]*(?<!\b(?:%(END)s))\n)* # 0 or more lines (not END) @@ -1327,7 +1338,7 @@ def __compil__(s): # add line breaks before procedure calls procedures = set(subnames) - set(functions) if len(procedures) > 0: - s = re.sub(ur"(?<!__def__)(?<![-+=*/])(?<!%s)(?:^|[ \t]+)(" % ")(?<!".join(functions) + "|".join(procedures) + ")", r"\n\1", s) + s = re.sub(r"(?<!__def__)(?<![-+=*/])(?<!%s)(?:^|[ \t]+)(" % ")(?<!".join(functions) + "|".join(procedures) + ")", r"\n\1", s) # compile native Logo for i in __comp__[_.lng]: @@ -1336,7 +1347,7 @@ def __compil__(s): indent = 0 result = "" func = re.compile("(?iu)(def (\w+))(\(.*\):)") - expr = ur"""(?iu)(?<!def[ ])(?<![:\w])%(name)s(?!\w)(?!\()(?![ ]\() + expr = r"""(?iu)(?<!def[ ])(?<![:\w])%(name)s(?!\w)(?!\()(?![ ]\() ( ([ ]+\[*([-+]|\([ ]?)*((%(functions)s)\b[ ]*\(*)* (?:[0-9]+([,.][0-9]+)?|:?\w+(?:[.]\w+[\(]?[\)]?)?]*|\[])]*[\)]* @@ -1377,7 +1388,7 @@ def __compil__(s): if j in i: if names[j][0] == 0: if not j in functions: - i = re.sub(ur"(?iu)(?<!def )(?<![_\w])\b%s\b(?!\w)" %j, j+'()', i) + i = re.sub(r"(?iu)(?<!def )(?<![_\w])\b%s\b(?!\w)" %j, j+'()', i) else: r = names[j][1].search(i) if r: diff --git a/librelogo/source/LibreLogoDummy.py b/librelogo/source/LibreLogoDummy.py deleted file mode 100644 index fc3ef12ad950..000000000000 --- a/librelogo/source/LibreLogoDummy.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- 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/. -# -# dummy UNO component to get the path of the localizations -import uno, unohelper, os, sys -from com.sun.star.lang import XMain -class LibreLogoDummyComponent(XMain, unohelper.Base): - def __init__( self, ctx ): - self.ctx = ctx - - def get_path(self): - import librelogodummy_path - return librelogodummy_path.get_path() - -g_ImplementationHelper = unohelper.ImplementationHelper() -g_ImplementationHelper.addImplementation( \ - LibreLogoDummyComponent,"org.openoffice.comp.pyuno.LibreLogoDummy",("org.openoffice.LibreLogo.LibreLogoDummy",),) - -# vim: set noet sw=4 ts=4: diff --git a/librelogo/source/META-INF/manifest.xml b/librelogo/source/META-INF/manifest.xml deleted file mode 100644 index a10be2952af5..000000000000 --- a/librelogo/source/META-INF/manifest.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<manifest:manifest> - <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Python" manifest:full-path="LibreLogoDummy.py"/> - <manifest:file-entry manifest:media-type="application/vnd.sun.star.framework-script" manifest:full-path="LibreLogo"/> - <manifest:file-entry manifest:full-path="Office/UI/StartModuleWindowState.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/> - <manifest:file-entry manifest:full-path="Office/UI/WriterWindowState.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/> - <manifest:file-entry manifest:full-path="Addons.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/> - <manifest:file-entry manifest:media-type="application/vnd.sun.star.help" manifest:full-path="help"/> -</manifest:manifest>
\ No newline at end of file diff --git a/librelogo/source/README b/librelogo/source/README deleted file mode 100644 index ffe5ea0a1611..000000000000 --- a/librelogo/source/README +++ /dev/null @@ -1,43 +0,0 @@ -LibreOffice Logo 0.2 RC2 - -License: GNU LGPL & GPL, MPL - -Home page: http://www.numbertext.org/logo - -(c) László Németh (nemeth at numbertextdotorg) - -FSF.hu Foundation, http://www.fsf.hu - -Icons copyright: OpenOffice.org/LibreOffice - -Introduction -============ - -LibreLogo is a Logo-like programming language with interactive vectorgraphics for education and DTP - -- presentation: http://www.numbertext.org/logo/librelogo.pdf -- basic Logo syntax for back compability with educational Logo systems -- interactive vectorgraphics in LibreOffice Writer -- native commands (easily translatable) -- Python data structures (list, tuple, set, dictionary) and other Python features - -Usage -===== - -See Logo in LibreOffice Help and http://www.numbertext.org/logo for documentation. - -Translation -=========== - -create your_language_id.lng in LibreOffice/ based on en.lng. - -Compilation: - -python make.py - -Development -=========== - -LibreLogo uses the PyUNO scripting framework, so Addons.xcu URLs depend from the -full name of the package. Modify them according to the package name with the -version number. diff --git a/librelogo/source/description-en-US.txt b/librelogo/source/description-en-US.txt deleted file mode 100644 index 6e9566518da8..000000000000 --- a/librelogo/source/description-en-US.txt +++ /dev/null @@ -1 +0,0 @@ -Programming language and environment for education, graphic design and desktop publishing. Usage: View→Toolbars→Logo toolbar in Writer. See Logo in LibreOffice Help. diff --git a/librelogo/source/description.xml b/librelogo/source/description.xml deleted file mode 100644 index 6711d7806ccb..000000000000 --- a/librelogo/source/description.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<description xmlns="http://openoffice.org/extensions/description/2006" - xmlns:d="http://openoffice.org/extensions/description/2006" - xmlns:xlink="http://www.w3.org/1999/xlink"> - <identifier value="org.openoffice.comp.pyuno.LibreLogo" /> - <display-name> - <name lang="en-US">LibreLogo</name> - </display-name> - <version value="0.2rc2" /> - <publisher> - <name lang="en-US" xlink:href="http://www.numbertext.org/logo">László Németh</name> - <name lang="hu" xlink:href="http://www.numbertext.org/logo">Németh László</name> - </publisher> - <extension-description> - <src lang="en-US" xlink:href="description-en-US.txt" /> - </extension-description> - <dependencies> - <OpenOffice.org-minimal-version value="3.2" d:name="OpenOffice.org 3.2" /> - </dependencies> -</description> diff --git a/librelogo/source/help/en-US/LibreLogo.xhp b/librelogo/source/help/en-US/LibreLogo.xhp deleted file mode 100644 index 33dc2cc14d16..000000000000 --- a/librelogo/source/help/en-US/LibreLogo.xhp +++ /dev/null @@ -1,397 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<helpdocument version="1.0"> - -<!-- - * 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/. - * ---> - -<meta> -<topic id="LibreLogo" indexer="include" status="PUBLISH"> -<title id="title" xml-lang="en-US">LibreLogo</title> -<filename>/org.openoffice.comp.pyuno.LibreLogo/LibreLogo.xhp</filename> -</topic> -</meta> -<body> - -<bookmark xml-lang="en-US" branch="index" id="bm1"> -<bookmark_value>LibreLogo</bookmark_value> -<bookmark_value>Logo</bookmark_value> -<bookmark_value>Turtle graphics</bookmark_value> -</bookmark> -<bookmark xml-lang="en-US" branch="hid/.HelpId:addon_LibreLogo.OfficeToolBar" id="bm2" localize="false"/> -<paragraph role="heading" level="1" xml-lang="en-US" id="hd_170">LibreLogo</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_180">LibreLogo is a simple, native, Logo-like programming environment with turtle vector graphics for teaching of computing (programming and word processing), DTP and graphic design. See http://www.numbertext.org/logo/librelogo.pdf.</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_220">LibreLogo toolbar</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_230">The LibreLogo toolbar (View » Toolbars » Logo) contains turtle moving, program run and stop, home and clear screen and syntax highlighting/translating icons and an input bar (command line).</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_240">Turtle moving icons</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_250">They are equivalents of the Logo commands “FORWARD 10”, “BACK 10”, “LEFT 15”, “RIGHT 15”. Clicking on one of the icons will also focus the turtle shape scrolling the page to its position.</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_280">Program run and start</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_290">Click on the icon “run” to execute the text of the Writer document as a LibreLogo program.</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_300">Click on the icon “stop” to stop the program execution.</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_310">Home</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_320">Click on the icon “home” to reset the position and settings of the turtle.</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_330">Clear screen</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_340">Click on the icon “clear screen” to remove the drawing objects of the document.</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_350">Command line</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_360">Hit Enter in the command line to execute its content. To stop the program use the icon “stop”.</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_370">Hold down the Enter to repeat the command line, for example, on the following command sequence:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_380"> FORWARD 200 LEFT 89<br/></paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_390">To reset the command line click triple in it or press Ctrl-A to select the previous commands, and type the new commands.</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_400">Syntax highlighting/Translating</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_410">It expands and upper case Logo commands in the Writer document. Change the language of the document (Tools » Options » Language Settings » Languages » Western) and click on this icon to translate the Logo program to the selected language.</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_420">Program editing</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_430">LibreLogo drawings and programs use the same Writer document. The LibreLogo canvas is on the first page of the Writer document. You can insert a page break before the LibreLogo programs and set the zoom/font size for a comfortable two page layout for LibreLogo programming: left (first) page is the canvas, right (second) page is for the LibreLogo programs.</paragraph> -<paragraph role="heading" level="1" xml-lang="en-US" id="hd_440">LibreLogo programming language</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_450">LibreLogo is a native, easily localisable, Logo-like programming language. It is back-compatible with the older Logo systems in the case of the simple Logo programs used in education, eg.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_460"> TO triangle :size<br/> REPEAT 3 [<br/>   FORWARD :size<br/>   LEFT 120<br/> ]<br/> END<br/> <br/> triangle 10 triangle 100 triangle 200<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_470">Differences from the Logo programming language</paragraph> -<list type="unordered"> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_480">List members are comma separated: POSITION [0, 0]</paragraph> - </listitem> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_490">Program blocks and lists are different</paragraph> - </listitem> - <listitem> - <list type="unordered"> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_500">Program blocks need space or new line at parenthesization: REPEAT 10 [ forward 10 left 36 ]</paragraph> - </listitem> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_510">Lists need close parenthesization: POSITION [0, 0], and not POSITION [ 0, 0 ]</paragraph> - </listitem> - </list> - </listitem> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_520">1-line function declarations have not supported yet (TO and END need new lines).</paragraph> - </listitem> -</list> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_530">Other features of LibreLogo</paragraph> -<list type="unordered"> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_540">The colon is optional before the variable names.</paragraph> - <paragraph role="code" xml-lang="en-US" id="par_550"> TO triangle size<br/>   REPEAT 3 [ FORWARD size LEFT 120 ]<br/> END<br/></paragraph> - </listitem> - <listitem> - <paragraph role="paragraph" xml-lang="en-US" id="par_560">String notation supports also orthographical and Python syntax.</paragraph> - <paragraph role="code" xml-lang="en-US" id="par_570"> PRINT "word ; original Logo syntax<br/> PRINT “Arbitrary text.” ; orthography, Writer<br/> PRINT 'Arbitrary text.' ; Python syntax<br/></paragraph> - </listitem> - <listitem> - <paragraph role="paragraph" xml-lang="en-US" id="par_580">Python list and string handling</paragraph> - <paragraph role="code" xml-lang="en-US" id="par_590"> PRINT “text”[2] ; print “x”<br/> PRINT “text”[1:3] ; print “ex”<br/></paragraph> - </listitem> - <listitem> - <paragraph role="paragraph" xml-lang="en-US" id="par_600">Python-like FOR loop</paragraph> - </listitem> - <listitem> - <paragraph role="paragraph" xml-lang="en-US" id="par_610">Python-like variable declaration:</paragraph> - <paragraph role="code" xml-lang="en-US" id="par_620"> x = 15<br/> PRINT x<br/></paragraph> - </listitem> - <listitem> - <paragraph role="paragraph" xml-lang="en-US" id="par_630">There are no extra query functions:</paragraph> - <paragraph role="code" xml-lang="en-US" id="par_640"> PRINT FILLCOLOR<br/> p = POSITION<br/> PRINT p<br/> REPEAT 10 [ POSITION ANY POSITION p ]<br/></paragraph> - </listitem> - <listitem> - <paragraph role="paragraph" xml-lang="en-US" id="par_650">Alternative parenthesization in function calls</paragraph> - <paragraph role="code" xml-lang="en-US" id="par_660"> TO star size color<br/> FILLCOLOR color<br/> REPEAT 5 [ LEFT 72 FORWARD size RIGHT 144 FORWARD size ]<br/> FILL<br/> END<br/> <br/> star 100 “red”<br/> star (100, “green”)<br/> star(100, “blue”)<br/></paragraph> - </listitem> -</list> -<paragraph role="heading" level="1" xml-lang="en-US" id="hd_670">LibreLogo commands</paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_680">Basic syntax</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_690">Case sensitivity</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_700">Commands, color constants are case insensitive:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_710"> PRINT “Hello, World!”<br/> print “Hello, World, again!”<br/></paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_720">Variable names are case sensitive:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_730"> a = 5<br/> A = 7<br/> PRINT a<br/> PRINT A<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_740">Program lines</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_750">Lines of a LibreLogo program are paragraphs in the LibreOffice Writer document. A program line can contain multiple commands:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_760"> PRINT “Hello, World!” PRINT “LibreLogo”<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_770">Comments</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_780">Lines or line parts are comments from a semicolon to the end of the line (paragraph):</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_790"> ; some comments<br/> PRINT 5 * 5 ; some comments<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_800">Break program lines to multiple paragraphs</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_810">It’s possible to break a program line for more paragraphs using the character tilde at the end of the line:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_820"> PRINT “This is a very long ” + ~<br/>       “warning message”<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_830">Turtle moving</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_840">FORWARD (fd)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_850"> FORWARD 10 ; move forward 10pt (1pt = 1/72 inch)<br/> FORWARD 10pt ; see above<br/> FORWARD 0.5in ; move forward 0.5 inch (1 inch = 2.54 cm)<br/> FORWARD 1" ; see above<br/> FD 1mm<br/> FD 1cm<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_860">BACK (bk)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_870"> BACK 10 ; move back 10pt<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_880">LEFT (lt)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_890"> LEFT 90 ; turn counterclockwise 90 degrees<br/> LEFT 90° ; see above<br/> LT 3h ; see above (clock position)<br/> LT any ; turn to a random position<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_900">RIGHT (rt)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_910"> RIGHT 90 ; turn clockwise 90 degrees<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_920">PENUP (pu)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_930"> PENUP ; turtle will move without drawing<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_940">PENDOWN (pd)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_950"> PENDOWN ; turtle will move with drawing<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_960">POSITION (pos)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_970"> POSITION [0, 0] ; turn and move to the top-left corner<br/> POSITION PAGESIZE ; turn and move to the bottom-right corner<br/> POSITION [PAGESIZE[0], 0] ; turn and move to the top-right corner<br/> POSITION ANY ; turn and move to a random position<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_980">HEADING (seth)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_990"> HEADING 0 ; turn north<br/> HEADING 12h ; see above<br/> HEADING ANY ; turn to a random position<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1000">Other turtle commands</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1010">HIDETURTLE (ht)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1020"> HIDETURTLE ; hide turtle (until the showturtle command)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1030">SHOWTURTLE (st)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1040"> SHOWTURTLE ; show turtle<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1050">HOME</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1060"> HOME ; reset initial turtle settings and position<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1070">CLEARSCREEN (cs)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1080"> CLEARSCREEN ; remove drawing objects of the document<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1090">FILL and CLOSE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1100"> FILL ; close and fill the actual line shape<br/> CLOSE ; close the actual line shape<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1110">Pen settings</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1120">PENSIZE (ps)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1130"> PENSIZE 100 ; line width is 100 points<br/> PENSIZE ANY ; equivalent of PENSIZE RANDOM 10<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1140">PENCOLOR/PENCOLOUR (pc)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1150"> PENCOLOR “red” ; set red pen color (by color name, see color constants)<br/> PENCOLOR [255, 255, 0] ; set yellow color (RGB list)<br/> PENCOLOR 0xffff00 ; set yellow color (hexa code)<br/> PENCOLOR 0 ; set black color (0x000000)<br/> PENCOLOR ANY ; random color<br/> PENCOLOR [5] ; set red color (by color identifier, see color constants)<br/> PENCOLOR “invisible” ; invisible pen color for shapes without visible outline<br/> PENCOLOR “~red” ; set random red color<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1160">PENJOINT/LINEJOINT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1170"> PENJOINT “rounded” ; rounded line joint (default)<br/> PENJOINT “miter” ; sharp line joint<br/> PENJOINT “bevel” ; bevel line joint<br/> PENJOINT “none” ; without line joint<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1180">PENSTYLE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1190"> PENSTYLE “solid” ; solid line (default)<br/> PENSTYLE “dotted” ; dotted line<br/> PENSTYLE “dashed” ; dashed line<br/> <br/> ; custom dot–dash pattern specified by a list with the following arguments:<br/> ; – number of the neighbouring dots<br/> ; – length of a dot<br/> ; – number of the neighbouring dashes<br/> ; – length of a dash<br/> ; – distance of the dots/dashes<br/> ; – type (optional):<br/> ;   0 = dots are rectangles (default)<br/> ;   2 = dots are squares (lengths and distances are relative to the pensize)<br/> <br/> PENSTYLE [3, 1mm, 2, 4mm, 2mm, 2] ; ...––...––...––<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1200">Fill settings</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1210">FILLCOLOR/FILLCOLOUR (fc)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1220"> FILLCOLOR “blue” ; fill with blue color, see also PENCOLOR<br/> FILLCOLOR “invisible” CIRCLE 10 ; unfilled circle<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1230">FILLSTYLE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1240"> FILLSTYLE 0 ; fill without hatches (default)<br/> FILLSTYLE 1 ; black single hatches (horizontal)<br/> FILLSTYLE 2 ; black single hatches (45 degrees)<br/> FILLSTYLE 3 ; black single hatches (-45 degrees)<br/> FILLSTYLE 4 ; black single hatches (vertical)<br/> FILLSTYLE 5 ; red crossed hatches (45 degrees)<br/> FILLSTYLE 6 ; red crossed hatches (0 degrees)<br/> FILLSTYLE 7 ; blue crossed hatches (45 degrees)<br/> FILLSTYLE 8 ; blue crossed hatches (0 degrees)<br/> FILLSTYLE 9 ; blue triple crossed<br/> FILLSTYLE 10 ; black wide single hatches (45 degrees)<br/> <br/> ; custom hatches specified by a list with the following arguments:<br/> ; – style (1 = single, 2 = double, 3 = triple hatching)<br/> ; – color<br/> ; – distance<br/> ; – degree<br/> <br/> FILLSTYLE [2, “green”, 3pt, 15°] ; green crossed hatches (15 degrees)<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1250">Drawing objects</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1260">CIRCLE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1270"> CIRCLE 100 ; draw a circle shape (diameter = 100pt)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1280">ELLIPSE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1290"> ELLIPSE [50, 100] ; draw an ellipse with 50 and 100 diameters<br/> ELLIPSE [50, 100, 2h, 12h] ; draw an elliptical sector (from 2h clock position to 12h)<br/> ELLIPSE [50, 100, 2h, 12h, 2]  ; draw an elliptical segment<br/> ELLIPSE [50, 100, 2h, 12h, 3]  ; draw an elliptical arc<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1300">SQUARE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1310"> SQUARE 100 ; draw a square shape (size = 100pt)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1320">RECTANGLE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1330"> RECTANGLE [50, 100] ; draw a rectange shape (50×100pt)<br/> RECTANGLE [50, 100, 50] ; draw a rectangle <br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1340">POINT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1350"> POINT ; draw a point with size and color of the pen<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1360">LABEL</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1370"> LABEL “text” ; print text in the turte position<br/> LABEL 'text' ; see above<br/> LABEL "text ; see above (only for single words)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1380">TEXT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1390"> CIRCLE 10 TEXT “text” ; set text of the actual drawing object<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1400">Font settings</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1410">FONTCOLOR/FONTCOLOUR</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1420"> FONTCOLOR “green” ; set font color<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1430">FONTFAMILY</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1440"> FONTFAMILY “Linux Libertine G” ; set font (family)<br/> FONTFAMILY “Linux Libertine G:smcp=1” ; set also font feature (small caps)<br/> FONTFAMILY “Linux Libertine G:smcp=1&onum=1” ; small caps + old figures<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1450">FONTSIZE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1460"> FONTSIZE 12 ; set 12pt<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1470">FONTWEIGHT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1480"> FONTWEIGHT “bold” ; set bold font<br/> FONTWEIGHT “normal” ; set normal weight<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1490">FONTSTYLE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1500"> FONTSTYLE “italic” ; set italic variant<br/> FONTSTYLE “normal” ; set normal variant<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1510">PICTURE (pic)</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1520">PICTURE is for </paragraph> -<list type="unordered"> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_1530">shape grouping;</paragraph> - </listitem> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_1540">starting new line shapes;</paragraph> - </listitem> - <listitem> - <paragraph role="listitem" xml-lang="en-US" id="par_1550">keeping the consistency of positions and line shapes at the left border.</paragraph> - </listitem> -</list> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1560">Shape grouping</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1570"> ; PICTURE [ LibreLogo_commands ]<br/> PICTURE [ FORWARD 100 CIRCLE 100 ] ; tree-like grouped shape<br/></paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1580">See also “Group” in LibreOffice Writer Help.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1590"> TO tree location<br/>   PENUP POSITION location HEADING 0 PENDOWN<br/>   PICTURE [ FORWARD 100 CIRCLE 100 ] ; tree-like grouped shape<br/> END<br/> <br/> PICTURE [ tree [30, 50] tree [100, 50] ] ; grouped shapes in a grouped shape<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1600">Starting new line shapes</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1610"> PICTURE ; start a new line shape<br/> FORWARD 10 PICTURE FORWARD 10 ; two line shapes<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1620">Consistency at the left border</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1630">Use picture to keep the consistency of positions and line shapes at the left border of Writer:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1640"> PICTURE [ CIRCLE 20 POSITION [-100, 100] CIRCLE 20 ]<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1650">Loops</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1660">REPEAT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1670"> ; REPEAT number [ commands ]<br/> <br/> REPEAT 10 [ FORWARD 10 LEFT 45 CIRCLE 10 ] ; repeat 10 times<br/></paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1680"> ; number is optional<br/> <br/> REPEAT [ POSITION ANY ] ; endless loop<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1690">REPCOUNT</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1700">Loop variable (also in the FOR and WHILE loops).</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1710"> REPEAT 100 [ FORWARD REPCOUNT LEFT 90 ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1720">FOR IN</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1730">Loop for the list elements:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1740"> FOR i IN [1, 5, 7, 9, 11] [<br/>   FORWARD i<br/>   LEFT 90<br/> ]<br/></paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1750">Loop for the characters of a character sequence:</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1760"> FOR i IN “text” [<br/>   LABEL i<br/>   FORWARD 10<br/> ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1770">WHILE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1780"> WHILE TRUE [ POSITION ANY ] ; endless loop<br/> WHILE REPCOUNT <= 10 [ FORWARD 50 LEFT 36 ] ; as REPEAT 10 [ ... ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1790">BREAK</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1800">Stop the loop.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1810"> REPEAT [ ; endless loop<br/>   POSITION ANY<br/>   IF REPCOUNT = 100 [ BREAK ]  ; equivalent of the REPEAT 100 [ ... ]<br/> ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1820">CONTINUE</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1830">Jump into the next iteration of the loop.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1840"> REPEAT 100 [<br/>   POSITION ANY<br/>   IF REPCOUNT % 2 <> 0 [ CONTINUE ]<br/>   CIRCLE 10 ; draw circles on every 2nd positions<br/> ]<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1850">Conditions</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1860">IF</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1870"> ; IF condition [ true block ]<br/> ; IF condition [ true block ] [ false block ]<br/> <br/> IF a < 10 [ PRINT “Small” ]<br/> IF a < 10 [ PRINT “Small” ] [ PRINT “Big” ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1880">AND, OR, NOT</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1890">Logical operators.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1900"> IF a < 10 AND NOT a < 5 [ PRINT “5, 6, 7, 8 or 9” ]<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_1910">Subroutines</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1920">TO, END</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1930">New word (or procedure).</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1940"> TO triangle<br/>   REPEAT [ FORWARD 100 RIGHT 120 ] FILL<br/> END<br/> <br/> REPEAT 10 [ triangle PENUP POSITION ANY PENDOWN ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1950">OUTPUT</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1960">Return value of the function.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_1970"> TO randomletter<br/>   OUTPUT RANDOM “qwertzuiopasdfghjklyxcvbnm”<br/> END<br/> <br/> PRINT randomletter + randomletter + randomletter ; print 3-letter random character sequence<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_1980">STOP</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_1990">Return from the procedure.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2000"> TO example number<br/>   IF number < 0 [ STOP ]<br/>   PRINT SQRT number ; print square root<br/> ]<br/> <br/> example 100<br/> example -1 ; without output and error<br/> example 25<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2010">Default variables</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2020">ANY</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2030">Default random value of colors, etc.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2040"> PENCOLOR ANY ; random pen color<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2050">TRUE</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2060">Logical value.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2070"> WHILE TRUE [ POSITION ANY ] ; endless loop<br/> PRINT TRUE ; print true<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2080">FALSE</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2090">Logical value.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2100"> WHILE NOT FALSE [ POSITION ANY ] ; endless loop<br/> PRINT FALSE ; print false<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2110">PAGESIZE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2120"> PRINT PAGESIZE ; print list of the page sizes in points, eg. [595.30, 841.89]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2130">PI/π</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2140"> PRINT PI ; print 3.14159265359<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2150">Input/Output</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2160">PRINT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2170"> PRINT “text” ; print “text” in a dialog box<br/> PRINT 5 + 10 ; print 15<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2180">INPUT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2190"> PRINT INPUT “Input value?” ; ask and print a string by a query dialog box<br/> PRINT FLOAT (INPUT “First number?”) + FLOAT (INPUT “Second number?”) ; simple calculator<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2200">SLEEP</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2210"> SLEEP 1000 ; wait for 1000 ms (1 sec)<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2220">GLOBAL</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2230">Set global variables used in procedures.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2240"> GLOBAL about<br/> about = “LibreLogo”<br/> <br/> TO example<br/>   PRINT about<br/>   GLOBAL about ; when we want to add a new value<br/>   about = “new value for the global variable”<br/> END<br/> <br/> example<br/> PRINT about<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2250">Functions</paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2260">RANDOM</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2270"> PRINT RANDOM 100 ; random float number (0 <= x < 100)<br/> PRINT RANDOM “text” ; random letter of the “text”<br/> PRINT RANDOM [1, 2] ; random list element (1 or 2)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2280">INT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2290"> PRINT INT 3.8 ; print 3 (integer part of 3.8)<br/> PRINT INT RANDOM 100 ; random integer number (0 <= x < 100)<br/> PRINT INT “7” ; convert the string parameter to integer<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2300">FLOAT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2310"> ; convert the string parameter to float number<br/> PRINT 2 * FLOAT “5.5” ; print 11.0<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2320">STR</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2330"> ; convert the number parameter to string<br/> PRINT “Result: ” + STR 5 ; print “Result: 5”<br/> PRINT 10 * STR 5 ; print 5555555555<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2340">SQRT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2350"> PRINT SQRT 100 ; print 10, square root of 100<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2360">SIN</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2370"> PRINT SIN 90 * PI/180 ; print 1.0 (sinus of 90° in radians)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2380">COS</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2390"> PRINT COS 0 * PI/180 ; print 1.0 (sinus of 0° in radians)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2400">ROUND</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2410"> PRINT ROUND 3.8 ; print 4 (rounding 3.8)<br/> PRINT ROUND RANDOM 100 ; random integer number (0 <= x <= 100)<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2420">ABS</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2430"> PRINT ABS -10 ; print 10, absolute value of -10<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2440">COUNT</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2450"> PRINT COUNT “text” ; print 4, character count of “text”<br/> PRINT COUNT [1, 2, 3] ; print 3, size of the list<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2460">SET</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2470"> ; Convert list to Python set<br/> PRINT SET [4, 5, 6, 6] ; print {4, 5, 6}<br/> PRINT SET [4, 5, 6, 6] | SET [4, 1, 9] ; print {1, 4, 5, 6, 9}, union<br/> PRINT SET [4, 5, 6, 6] & SET [4, 1, 9] ; print {4}, intersection<br/> PRINT SET ([4, 5, 6, 6]) - SET [4, 1, 9] ; print {5, 6}, difference<br/> PRINT SET [4, 5, 6, 6] ^ SET [4, 1, 9] ; print {1, 5, 6, 9}, symmetric difference  <br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2480">RANGE</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2490"> ; Python-like list generation<br/> PRINT RANGE 10 ; print [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]<br/> PRINT RANGE 3 10 ; print [3, 4, 5, 6, 7, 8, 9]<br/> PRINT RANGE 3 10 3 ; print [3, 6, 9]<br/> <br/> FOR i in RANGE 10 50 10 [ ; loop for [10, 20, 30, 40]<br/>   FORWARD i<br/>   LEFT 90<br/> ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2500">LIST</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2510"> ; remove the repeating elements of a list using set and list conversion<br/> PRINT LIST (SET [1, 3, 5, 5, 2, 1]) ; print [1, 3, 5, 2]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2520">TUPLE</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2530">Conversion to Python tuple (non-modifiable list)</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2540"> PRINT TUPLE [4, 5]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2550">SORTED</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2560">It returns with a sorted list.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2570"> PRINT SORTED [5, 1, 3, 4] ; print [1, 3, 4, 5]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2580">SUB</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2590">Substitue character sequences using regex (regular expression) patterns.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2600"> PRINT SUB (“t”, “T”, “text”) ; print “Text”, replacing “t” with “T”<br/> PRINT SUB (“(.)”, “\\1\\1”, “text”) ; print “tteexxtt”, doubling every characters<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2610">SEARCH</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2620">Search character sequences patterns using regex patterns.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2630"> IF SEARCH (“\w”, word) [ PRINT “Letter in the word.” ]<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2640">FINDALL</paragraph> -<paragraph role="paragraph" xml-lang="en-US" id="par_2650">Find all character sequences in the input string matching the given regex pattern.</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2660"> PRINT FINDALL(“\w+”, “Dogs, cats.”) ; print [“Dogs”, “cats”], the list of the words.<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2670">MIN</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2680"> PRINT MIN [1, 2, 3] ; print 1, the lowest element of the list<br/></paragraph> -<paragraph role="heading" level="3" xml-lang="en-US" id="hd_2690">MAX</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2700"> PRINT MAX [1, 2, 3] ; print 3, the greatest element of the list<br/></paragraph> -<paragraph role="heading" level="2" xml-lang="en-US" id="hd_2710">Color constants</paragraph> -<paragraph role="code" xml-lang="en-US" id="par_2720"> PENCOLOR “SILVER” ; set by name<br/> PENCOLOR [1] ; set by identifiers<br/> PENCOLOR “~SILVER” ; random silver color<br/> <br/></paragraph> -<table><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2740">Identifier</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2750">Name</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2770">0</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2780">BLACK</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2800">1</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2810">SILVER</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2830">2</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2840">GRAY/GREY</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2860">3</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2870">WHITE</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2890">4</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2900">MAROON</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2920">5</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2930">RED</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2950">6</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2960">PURPLE</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2980">7</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_2990">FUCHSIA/MAGENTA</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3010">8</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3020">GREEN</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3040">9</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3050">LIME</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3070">10</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3080">OLIVE</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3100">11</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3110">YELLOW</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3130">12</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3140">NAVY</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3160">13</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3170">BLUE</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3190">14</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3200">TEAL</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3220">15</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3230">AQUA</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3250">16</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3260">PINK</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3280">17</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3290">TOMATO</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3310">18</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3320">ORANGE</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3340">19</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3350">GOLD</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3370">20</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3380">VIOLET</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3400">21</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3410">SKYBLUE</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3430">22</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3440">CHOCOLATE</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3460">23</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3470">BROWN</paragraph></tablecell> -</tablerow><tablerow> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3490">24</paragraph></tablecell> -<tablecell><paragraph role="tablecontent" xml-lang="en-US" id="par_3500">INVISIBLE</paragraph></tablecell> -</tablerow></table> -</body></helpdocument> diff --git a/librelogo/source/help/en-US/help.tree b/librelogo/source/help/en-US/help.tree deleted file mode 100644 index 10d79ef2958a..000000000000 --- a/librelogo/source/help/en-US/help.tree +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - * 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/. - * ---> - -<tree_view> -<help_section application="swriter" id="02" title="LibreLogo"> - <node id="0225" title="LibreLogo"> - <topic id="help/org.openoffice.comp.pyuno.LibreLogo/LibreLogo.xhp">LibreLogo</topic> - </node> -</help_section> -</tree_view> diff --git a/librelogo/source/pythonpath/librelogodummy_path.py b/librelogo/source/pythonpath/librelogodummy_path.py deleted file mode 100644 index 3ab8495ecc1f..000000000000 --- a/librelogo/source/pythonpath/librelogodummy_path.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- 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/. -# -import uno, re, sys, os, traceback -def get_path(): - return os.path.join(os.path.dirname(sys.modules[__name__].__file__), __name__ + ".py") - -# vim: set noet sw=4 ts=4: diff --git a/librelogo/source/registry/data/org/openoffice/Office/Addons.xcu b/librelogo/source/registry/data/org/openoffice/Office/Addons.xcu deleted file mode 100644 index 3f608d7302a1..000000000000 --- a/librelogo/source/registry/data/org/openoffice/Office/Addons.xcu +++ /dev/null @@ -1,286 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> - -<!-- - * 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/. - * ---> - -<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office"> - <node oor:name="AddonUI"> - <node oor:name="OfficeToolBar"> - <node oor:name="LibreLogo.OfficeToolBar" oor:op="replace"> - <node oor:name="m01" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$goforward?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Forward</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m02" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$gobackward?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Back</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m03" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$left?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Left</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m04" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$right?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Right</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m05" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$run?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Start (the program in the Writer document)</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m06" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$stop?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Stop</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m07" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$home?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Home</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m08" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$clearscreen?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Clear screen</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - <node oor:name="m09" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$commandline?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Logo command line (press F1 here for help)</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="ControlType" oor:type="xs:string"> - <value>Editfield</value> - </prop> - <prop oor:name="Width" oor:type="xs:long"> - <value>300</value> - </prop> - </node> - <node oor:name="m10" oor:op="replace"> - <prop oor:name="Context" oor:type="xs:string"> - <value>com.sun.star.text.TextDocument</value> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$__translate__?language=Python&location=user:uno_packages</value> - </prop> - <prop oor:name="Title" oor:type="xs:string"> - <value xml:lang="en-US">Uppercase commands, also translate them to the language of the document</value> - </prop> - <prop oor:name="Target" oor:type="xs:string"> - <value>_self</value> - </prop> - </node> - </node> - </node> - <node oor:name="Images"> - <node oor:name="logo-forward" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$goforward?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_arrowshapes.up-arrow.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_arrowshapes.up-arrow.png</value> - </prop> - </node> - </node> - <node oor:name="logo-backward" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$gobackward?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_arrowshapes.down-arrow.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_arrowshapes.down-arrow.png</value> - </prop> - </node> - </node> - <node oor:name="logo-left" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$left?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_arrowshapes.circular-leftarrow.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_arrowshapes.circular-leftarrow.png</value> - </prop> - </node> - </node> - <node oor:name="logo-right" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$right?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_arrowshapes.circular-arrow.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_arrowshapes.circular-arrow.png</value> - </prop> - </node> - </node> - <node oor:name="logo-run" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$run?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_runbasic.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_runbasic.png</value> - </prop> - </node> - </node> - <node oor:name="logo-stop" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$stop?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_basicstop.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_basicstop.png</value> - </prop> - </node> - </node> - <node oor:name="logo-home" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$home?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_navigationbarleft.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_navigationbarleft.png</value> - </prop> - </node> - </node> - <node oor:name="logo-clearscreen" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$clearscreen?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_newdoc.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_newdoc.png</value> - </prop> - </node> - </node> - <node oor:name="logo-translate" oor:op="replace"> - <prop oor:name="URL" oor:type="xs:string"> - <value>vnd.sun.star.script:librelogo.oxt|LibreLogo|LibreLogo.py$__translate__?language=Python&location=user:uno_packages</value> - </prop> - <node oor:name="UserDefinedImages"> - <prop oor:name="ImageSmallURL"> - <value>%origin%/icons/sc_editglossary.png</value> - </prop> - <prop oor:name="ImageBigURL"> - <value>%origin%/icons/lc_editglossary.png</value> - </prop> - </node> - </node> - - </node> - - </node> -</oor:component-data> diff --git a/librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu b/librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu deleted file mode 100644 index 96e63938d634..000000000000 --- a/librelogo/source/registry/data/org/openoffice/Office/UI/StartModuleWindowState.xcu +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - * 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/. - * ---> - -<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="StartModuleWindowState" oor:package="org.openoffice.Office.UI"> - <node oor:name="UIElements"> - <node oor:name="States"> - <node oor:name="private:resource/toolbar/addon_LibreLogo.OfficeToolBar" oor:op="replace"> - <prop oor:name="UIName" oor:type="xs:string"> - <value xml:lang="en-US">Logo</value> - </prop> - <prop oor:name="Visible" oor:type="xs:boolean"> - <value>false</value> - </prop> - <prop oor:name="Locked" oor:type="xs:boolean"> - <value>false</value> - </prop> - </node> - </node> - </node> -</oor:component-data> diff --git a/librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu b/librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu deleted file mode 100644 index 8d87c561d0c2..000000000000 --- a/librelogo/source/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<!-- - * 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/. - * ---> - -<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="WriterWindowState" oor:package="org.openoffice.Office.UI"> - <node oor:name="UIElements"> - <node oor:name="States"> - <node oor:name="private:resource/toolbar/addon_LibreLogo.OfficeToolBar" oor:op="replace"> - <prop oor:name="UIName" oor:type="xs:string"> - <value xml:lang="en-US">Logo</value> - </prop> - <prop oor:name="Visible" oor:type="xs:boolean"> - <value>false</value> - </prop> - <prop oor:name="Locked" oor:type="xs:boolean"> - <value>false</value> - </prop> - </node> - </node> - </node> -</oor:component-data> |