xforth.leo 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- Created by Leo: http://leoeditor.com/leo_toc.html -->
  3. <leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1" >
  4. <leo_header file_format="2"/>
  5. <globals/>
  6. <preferences/>
  7. <find_panel_settings/>
  8. <vnodes>
  9. <v t="caminhante.20200313155940.1"><vh>@settings</vh>
  10. <v t="caminhante.20200313155940.3"><vh>@data abbreviations</vh></v>
  11. <v t="caminhante.20200313155940.4"><vh>@outline-data tree-abbreviations</vh></v>
  12. <v t="caminhante.20200618180759.1"><vh>@command terminal-here @key=Alt-T</vh></v>
  13. <v t="caminhante.20200619162742.1"><vh>@command open-url-here @key=Ctrl-U</vh></v>
  14. <v t="caminhante.20200313155940.99"><vh>nodeActions</vh>
  15. <v t="caminhante.20200604232050.1"><vh>@cmd *</vh></v>
  16. <v t="caminhante.20200619161501.1"><vh>@download *</vh></v>
  17. <v t="caminhante.20200619155412.1"><vh>@duck *</vh></v>
  18. <v t="caminhante.20211214151759.1"><vh>@files Makefile</vh></v>
  19. <v t="caminhante.20200927204806.1"><vh>@gcc|@gcc .* [X]</vh></v>
  20. <v t="caminhante.20200808174417.1"><vh>@js|@js .* [X]</vh></v>
  21. <v t="knoppix.20200918114306.1"><vh>@kml *</vh></v>
  22. <v t="knoppix.20200918115239.1"><vh>@kmlfolder *</vh></v>
  23. <v t="knoppix.20200918115703.1"><vh>@latlon *</vh></v>
  24. <v t="knoppix.20200918120617.1"><vh>@latlonh *</vh></v>
  25. <v t="caminhante.20200912185313.1"><vh>@lua|@lua .* [X]</vh></v>
  26. <v t="caminhante.20210430163831.1"><vh>@mkdir *</vh></v>
  27. <v t="caminhante.20210430170244.1"><vh>@mv file://*</vh></v>
  28. <v t="caminhante.20200619213937.1"><vh>@node|@node .* [X]</vh></v>
  29. <v t="caminhante.20210608171556.1"><vh>@odt *</vh></v>
  30. <v t="caminhante.20210905232208.1"><vh>@rm *</vh></v>
  31. <v t="caminhante.20210430164404.1"><vh>@rmdir /*/</vh></v>
  32. <v t="caminhante.20200618203115.1"><vh>@run|@run .* [X]</vh></v>
  33. <v t="caminhante.20200619154823.1"><vh>@web *</vh></v>
  34. </v>
  35. </v>
  36. <v t="caminhante.20211214150936.2"><vh>XForth</vh>
  37. <v t="caminhante.20211214151142.1"><vh>@path .</vh>
  38. <v t="caminhante.20211215232241.3"><vh>.gitmodules</vh></v>
  39. <v t="caminhante.20211214151146.9"><vh>/.git/</vh></v>
  40. <v t="caminhante.20211215232241.2"><vh>/meta/</vh></v>
  41. <v t="caminhante.20211216004210.1"><vh>/XForth</vh>
  42. <v t="caminhante.20211214153326.1"><vh>Arithmetic tests</vh>
  43. <v t="caminhante.20211214153355.1"><vh>*LT*</vh></v>
  44. <v t="caminhante.20211214153401.1"><vh>*GT*</vh></v>
  45. <v t="caminhante.20211214153407.1"><vh>*LE*</vh></v>
  46. <v t="caminhante.20211214153411.1"><vh>*GE*</vh></v>
  47. <v t="caminhante.20211214153418.1"><vh>*EQU0*</vh></v>
  48. <v t="caminhante.20211214153424.1"><vh>*DIF0*</vh></v>
  49. <v t="caminhante.20211214153429.1"><vh>*LT0*</vh></v>
  50. <v t="caminhante.20211214153434.1"><vh>*GT0*</vh></v>
  51. <v t="caminhante.20211214153439.1"><vh>*LE0*</vh></v>
  52. <v t="caminhante.20211214153444.1"><vh>*GE0*</vh></v>
  53. <v t="caminhante.20211214153451.1"><vh>*AND4*</vh></v>
  54. <v t="caminhante.20211214153456.1"><vh>*OR4*</vh></v>
  55. <v t="caminhante.20211214153500.1"><vh>*NOT4*</vh></v>
  56. <v t="caminhante.20211214153505.1"><vh>*NEG4*</vh></v>
  57. </v>
  58. <v t="caminhante.20211214153126.1"><vh>Basic arithmetic</vh>
  59. <v t="caminhante.20211214153135.1"><vh>*INCR1*</vh></v>
  60. <v t="caminhante.20211214153142.1"><vh>*DECR1*</vh></v>
  61. <v t="caminhante.20211214153150.1"><vh>*INCR4*</vh></v>
  62. <v t="caminhante.20211214153208.1"><vh>*DECR4*</vh></v>
  63. <v t="caminhante.20211214153214.1"><vh>*ADDIT*</vh></v>
  64. <v t="caminhante.20211214153220.1"><vh>*SUBIT*</vh></v>
  65. <v t="caminhante.20211214153229.1"><vh>*MULIT*</vh></v>
  66. <v t="caminhante.20211214153247.1"><vh>*DIVMOD*</vh></v>
  67. </v>
  68. <v t="caminhante.20211214153530.1"><vh>Memory operations</vh>
  69. <v t="caminhante.20211216004240.1"><vh>*POKE4*</vh></v>
  70. <v t="caminhante.20211216004245.1"><vh>*PEEK4*</vh></v>
  71. <v t="caminhante.20211216004250.1"><vh>*POKE4ADD*</vh></v>
  72. <v t="caminhante.20211216004256.1"><vh>*POKE4SUB*</vh></v>
  73. <v t="caminhante.20211216004300.1"><vh>*POKE1*</vh></v>
  74. <v t="caminhante.20211216004304.1"><vh>*PEEK1*</vh></v>
  75. <v t="caminhante.20211216004309.1"><vh>*COPY1*</vh></v>
  76. <v t="caminhante.20211216004314.1"><vh>*COPY4*</vh></v>
  77. <v t="caminhante.20211216004321.1"><vh>*MOVE1*</vh></v>
  78. </v>
  79. </v>
  80. <v t="caminhante.20211214151146.7"><vh>@clean Makefile</vh></v>
  81. <v t="caminhante.20211215234432.1"><vh>@edit .gitignore</vh></v>
  82. <v t="caminhante.20211215232259.1"><vh>@edit forth-compiler.meta</vh></v>
  83. <v t="caminhante.20211216001625.1"><vh>@edit ithread.inc</vh></v>
  84. <v t="caminhante.20211214151146.8"><vh>@edit LICENSE</vh></v>
  85. <v t="caminhante.20211215234815.2"><vh>@edit test.asm</vh></v>
  86. <v t="caminhante.20211215234815.1"><vh>@edit test.fth</vh></v>
  87. <v t="caminhante.20211216003644.1"><vh>@edit xforth.asm</vh></v>
  88. <v t="caminhante.20211214151146.6"><vh>@file primitives.asm</vh></v>
  89. <v t="caminhante.20211216002840.1"><vh>@file xforth.fth</vh></v>
  90. <v t="caminhante.20211215233815.3"><vh>forth-compiler</vh></v>
  91. <v t="caminhante.20211215232839.1"><vh>proc32.inc</vh></v>
  92. <v t="caminhante.20211216001602.3"><vh>structs.inc</vh></v>
  93. <v t="caminhante.20211216001602.2"><vh>structs_v.inc</vh></v>
  94. <v t="caminhante.20211216001602.1"><vh>symbols.inc</vh></v>
  95. <v t="caminhante.20211214151146.1"><vh>xforth.leo</vh></v>
  96. </v>
  97. </v>
  98. </vnodes>
  99. <tnodes>
  100. <t tx="caminhante.20200313155940.1"></t>
  101. <t tx="caminhante.20200313155940.3">@tabwidth -2
  102. </t>
  103. <t tx="caminhante.20200313155940.4"></t>
  104. <t tx="caminhante.20200313155940.99">@language python
  105. </t>
  106. <t tx="caminhante.20200604232050.1">import subprocess
  107. def execute (cmd):
  108. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  109. if c.isChanged(): c.save()
  110. path = c.getNodePath(c.p)
  111. g.os.chdir(path)
  112. command = ''.join(c.p.h.split('@cmd ')[1:])
  113. command = "cat &lt;&lt;'EOFEOFEOFEOFEOFEOF' | bash\n"+command+'\nEOFEOFEOFEOFEOFEOF'
  114. g.es(c.p.h)
  115. c.p.b += execute(command)
  116. c.save()
  117. </t>
  118. <t tx="caminhante.20200618180759.1">@language python
  119. import subprocess
  120. def execute (cmd):
  121. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  122. if c.isChanged(): c.save()
  123. path = c.getNodePath(c.p)
  124. execute('x-terminal-emulator --working-directory="'+path+'"')
  125. </t>
  126. <t tx="caminhante.20200618203115.1">@language python
  127. import subprocess
  128. def execute (cmd):
  129. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  130. path = c.getNodePath(c.p)
  131. g.os.chdir(path)
  132. w = c.frame.body.wrapper
  133. s1,s2 = w.getSelectionRange()
  134. if s1 == s2:
  135. code = c.p.b
  136. else:
  137. linebr = c.p.b.find('\n',s2)
  138. if linebr == -1: linebr = len(c.p.b)
  139. code = c.p.b[s1:s2]
  140. g.es(c.p.h)
  141. command = "cat &lt;&lt;'EOFEOFEOFEOFEOFEOF' | bash\n"+code+'\nEOFEOFEOFEOFEOFEOF'
  142. cpc = c.p.copy()
  143. novoNo = cpc.insertAsLastChild()
  144. novoNo.h = c.p.h
  145. novoNo.b = execute(command)
  146. c.redraw()
  147. c.save()
  148. w.setSelectionRange(s1,s2)
  149. </t>
  150. <t tx="caminhante.20200619154823.1">import subprocess
  151. def execute (cmd):
  152. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  153. if c.isChanged(): c.save()
  154. url = ''.join(c.p.h.split('@web ')[1:])
  155. command = 'lynx -image_links -dump "'+url+'"'
  156. g.es(c.p.h)
  157. c.p.b = execute(command)
  158. c.save()
  159. </t>
  160. <t tx="caminhante.20200619155412.1">import subprocess
  161. import urllib.parse
  162. def execute (cmd):
  163. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  164. if c.isChanged(): c.save()
  165. search = ''.join(c.p.h.split('@duck ')[1:])
  166. searchenc = urllib.parse.quote(search)
  167. command = 'lynx -dump "https://duckduckgo.com/html/?q='+searchenc+'&amp;t=seamonkey"'
  168. g.es(c.p.h)
  169. c.p.b = execute(command)
  170. c.save()
  171. </t>
  172. <t tx="caminhante.20200619161501.1">import subprocess
  173. def execute (cmd):
  174. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  175. if c.isChanged(): c.save()
  176. path = c.getNodePath(c.p)
  177. g.os.chdir(path)
  178. url = ''.join(c.p.h.split('@download ')[1:])
  179. command = 'wget --no-config --continue --no-verbose --adjust-extension --tries=3 --content-on-error "'+url+'"'
  180. g.es(c.p.h)
  181. c.p.b += execute(command)
  182. c.save()
  183. </t>
  184. <t tx="caminhante.20200619162742.1">@language python
  185. w = c.frame.body.wrapper
  186. b = c.p.b
  187. i,j = w.getSelectionRange()
  188. selecao = b[i:j]
  189. cpc = c.p.copy()
  190. novoNo = cpc.insertAsLastChild()
  191. c.setHeadString(novoNo, '@web '+selecao)
  192. c.selectPosition(novoNo)
  193. c.redraw()
  194. </t>
  195. <t tx="caminhante.20200619213937.1">import subprocess
  196. import re
  197. def execute (cmd):
  198. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  199. path = c.getNodePath(c.p)
  200. g.os.chdir(path)
  201. code = re.sub(r'^#|\n+#', '\n///', g.getScript(c,c.p))
  202. g.es(c.p.h)
  203. command = "cat &lt;&lt;'EOFEOFEOFEOFEOFEOF' | node\n"+code+'\nEOFEOFEOFEOFEOFEOF'
  204. c.p.b += '\n' + execute(command)
  205. </t>
  206. <t tx="caminhante.20200808174417.1">import subprocess
  207. import re
  208. def execute (cmd):
  209. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  210. path = c.getNodePath(c.p)
  211. g.os.chdir(path)
  212. code = re.sub(r'^#|\n+#', '\n///', g.getScript(c,c.p))
  213. g.es(c.p.h)
  214. command = "cat &lt;&lt;'EOFEOFEOFEOFEOFEOF' | js\n"+code+'\nEOFEOFEOFEOFEOFEOF'
  215. c.p.b += '\n' + execute(command)
  216. </t>
  217. <t tx="caminhante.20200912185313.1">import subprocess
  218. import re
  219. def execute (cmd):
  220. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  221. path = c.getNodePath(c.p)
  222. g.os.chdir(path)
  223. code = re.sub(r'^#|\n+#', '\n---', g.getScript(c,c.p))
  224. g.es(c.p.h)
  225. command = "cat &lt;&lt;'EOFEOFEOFEOFEOFEOF' | lua\n"+code+'\nEOFEOFEOFEOFEOFEOF'
  226. c.p.b += '\n' + execute(command)
  227. </t>
  228. <t tx="caminhante.20200927204806.1">import subprocess
  229. import re
  230. def execute (cmd):
  231. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  232. path = c.getNodePath(c.p)
  233. g.os.chdir(path)
  234. code = re.sub(r'^#@|\n+#@', '\n///', g.getScript(c,c.p))
  235. args = ''.join(c.p.h.split('@gcc ')[1:])
  236. g.es(c.p.h)
  237. command = "cat &lt;&lt;'EOFEOFEOFEOFEOFEOF' | gcc -Wall -Werror -std=gnu11 -x c - -o t &amp;&amp; ./t "+args+"\n"+code+'\nEOFEOFEOFEOFEOFEOF'
  238. c.p.b += '\n' + execute(command)
  239. </t>
  240. <t tx="caminhante.20210430163831.1">import subprocess
  241. def execute (cmd):
  242. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  243. path = c.getNodePath(c.p)
  244. g.os.chdir(path)
  245. path = ''.join(c.p.h.split('@mkdir ')[1:])
  246. cmd = 'mkdir -p "' + path + '"'
  247. g.es(c.p.h)
  248. execute(cmd)
  249. c.p.h = '/'+path+'/'
  250. c.p.b = '@path ' + path</t>
  251. <t tx="caminhante.20210430164404.1">import subprocess
  252. import shutil
  253. def execute (cmd):
  254. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  255. ps = c.p.parents()
  256. for par in ps:
  257. break
  258. path = c.getNodePath(par)
  259. g.os.chdir(path)
  260. path = ''.join(c.p.h.split('@rmdir /')[1:]).split('/')[0]
  261. shutil.rmtree(path)</t>
  262. <t tx="caminhante.20210430170244.1">import subprocess
  263. def execute (cmd):
  264. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  265. path = c.getNodePath(c.p)
  266. g.os.chdir(path)
  267. path = ''.join(c.p.h.split('@mv file://')[1:])
  268. cmd = 'mv -v "' + path + '" ./'
  269. g.es(c.p.h)
  270. g.es(execute(cmd))</t>
  271. <t tx="caminhante.20210608171556.1">import subprocess
  272. import re
  273. def execute (cmd):
  274. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  275. def writeFile (_file,_content):
  276. f = open(_file, "w")
  277. f.write(_content)
  278. f.close()
  279. path = c.getNodePath(c.p)
  280. g.os.chdir(path)
  281. docName = ''.join(c.p.h.split('@odt ')[1:])
  282. docPath = './.odt/'+docName+'/'
  283. manifest_xml = """&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  284. &lt;manifest:manifest
  285. xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.2"
  286. xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"&gt;
  287. &lt;manifest:file-entry manifest:full-path="/" manifest:version="1.2" manifest:media-type="application/vnd.oasis.opendocument.text"/&gt;
  288. &lt;manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/&gt;
  289. &lt;manifest:file-entry manifest:full-path="meta.xml" manifest:media-type="text/xml"/&gt;
  290. &lt;manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/&gt;
  291. &lt;manifest:file-entry manifest:full-path="styles.xml" manifest:media-type="text/xml"/&gt;
  292. &lt;/manifest:manifest&gt;
  293. """
  294. mimetype = "application/vnd.oasis.opendocument.text"
  295. content_xml = (
  296. """&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  297. &lt;office:document-content
  298. xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  299. xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
  300. xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
  301. xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
  302. xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
  303. xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
  304. xmlns:xlink="http://www.w3.org/1999/xlink"
  305. xmlns:dc="http://purl.org/dc/elements/1.1/"
  306. xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
  307. xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
  308. xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
  309. xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
  310. xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
  311. xmlns:math="http://www.w3.org/1998/Math/MathML"
  312. xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
  313. xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
  314. xmlns:ooo="http://openoffice.org/2004/office"
  315. xmlns:ooow="http://openoffice.org/2004/writer"
  316. xmlns:oooc="http://openoffice.org/2004/calc"
  317. xmlns:dom="http://www.w3.org/2001/xml-events"
  318. xmlns:xforms="http://www.w3.org/2002/xforms"
  319. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  320. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  321. xmlns:rpt="http://openoffice.org/2005/report"
  322. xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2"
  323. xmlns:xhtml="http://www.w3.org/1999/xhtml"
  324. xmlns:grddl="http://www.w3.org/2003/g/data-view#"
  325. xmlns:officeooo="http://openoffice.org/2009/office"
  326. xmlns:tableooo="http://openoffice.org/2009/table"
  327. xmlns:drawooo="http://openoffice.org/2010/draw"
  328. xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
  329. xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
  330. xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0"
  331. xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
  332. xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2"&gt;
  333. &lt;office:body&gt;
  334. &lt;office:text&gt;
  335. """,
  336. re.sub(r'^#@[^\n]+|\n+#@[^\n]+', '', g.getScript(c,c.p)),
  337. """
  338. &lt;/office:text&gt;
  339. &lt;/office:body&gt;
  340. &lt;/office:document-content&gt;
  341. """
  342. )
  343. manifest_rdf = """&lt;?xml version="1.0" encoding="utf-8"?&gt;
  344. &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt;
  345. &lt;rdf:Description rdf:about="styles.xml"&gt;
  346. &lt;rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/&gt;
  347. &lt;/rdf:Description&gt;
  348. &lt;rdf:Description rdf:about=""&gt;
  349. &lt;ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/&gt;
  350. &lt;/rdf:Description&gt;
  351. &lt;rdf:Description rdf:about="content.xml"&gt;
  352. &lt;rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/&gt;
  353. &lt;/rdf:Description&gt;
  354. &lt;rdf:Description rdf:about=""&gt;
  355. &lt;ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/&gt;
  356. &lt;/rdf:Description&gt;
  357. &lt;rdf:Description rdf:about=""&gt;
  358. &lt;rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/&gt;
  359. &lt;/rdf:Description&gt;
  360. &lt;/rdf:RDF&gt;
  361. """
  362. meta_xml = f"""&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  363. &lt;office:document-meta
  364. xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  365. xmlns:xlink="http://www.w3.org/1999/xlink"
  366. xmlns:dc="http://purl.org/dc/elements/1.1/"
  367. xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
  368. xmlns:ooo="http://openoffice.org/2004/office"
  369. xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.2"&gt;
  370. &lt;office:meta&gt;
  371. &lt;meta:generator&gt;LeoEditor/6.4$Linux_x64&lt;/meta:generator&gt;
  372. &lt;dc:title&gt;{docName}&lt;/dc:title&gt;
  373. &lt;/office:meta&gt;
  374. &lt;/office:document-meta&gt;
  375. """
  376. generate_odt = f"""cp -f styles.xml '{docPath}/styles.xml'; cd '{docPath}'; zip -q9ru doc.odt META-INF manifest.rdf meta.xml content.xml styles.xml mimetype"""
  377. generate_pdf = f"""libreoffice --headless --convert-to pdf '{docPath}/doc.odt' &amp;&amp; mv 'doc.pdf' '{docName}.pdf'"""
  378. execute('mkdir -p "'+docPath+'/META-INF/"')
  379. writeFile(docPath+'/META-INF/manifest.xml', manifest_xml)
  380. writeFile(docPath+'/mimetype', mimetype)
  381. writeFile(docPath+'/content.xml',''.join(content_xml))
  382. writeFile(docPath+'/manifest.rdf', manifest_rdf)
  383. writeFile(docPath+'/meta.xml', meta_xml)
  384. # writeFile(docPath+'/styles.xml', styles_xml)
  385. execute(generate_odt)
  386. g.es(execute(generate_pdf))
  387. </t>
  388. <t tx="caminhante.20210905232208.1">import subprocess
  389. def execute (cmd):
  390. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  391. path = c.getNodePath(c.p)
  392. g.os.chdir(path)
  393. filename = ''.join(c.p.h.split('@rm ')[1:])
  394. cmd = 'rm -vf "' + filename + '"'
  395. g.es(c.p.h)
  396. g.es(execute(cmd))
  397. </t>
  398. <t tx="caminhante.20211214150936.2"></t>
  399. <t tx="caminhante.20211214151142.1">@tabwidth -2</t>
  400. <t tx="caminhante.20211214151146.1"></t>
  401. <t tx="caminhante.20211214151146.7">@tabwidth 4
  402. CFLAGS := -std=gnu99 -Wall -Werror -Wno-unused-function -Wfatal-errors -D_GNU_SOURCE -flto -Os
  403. all: forth-compiler xforth
  404. %: %.asm $(wildcard *.inc)
  405. `which fasm` "$&lt;"
  406. %.asm: %.fth forth-compiler
  407. ./forth-compiler "$&lt;" "$@"
  408. forth-compiler: forth-compiler.c
  409. %.c: %.meta
  410. ./meta/meta "$&lt;" "$@"
  411. clean:
  412. rm xforth *.c
  413. </t>
  414. <t tx="caminhante.20211214151146.9">@path .git</t>
  415. <t tx="caminhante.20211214151759.1">import subprocess
  416. def execute (cmd):
  417. return subprocess.run(cmd,shell=True,universal_newlines=True,stderr=subprocess.STDOUT,stdout=subprocess.PIPE).stdout
  418. if c.isChanged(): c.save()
  419. path = c.getNodePath(c.p)
  420. g.os.chdir(path)
  421. g.es(execute('make'))</t>
  422. <t tx="caminhante.20211214153126.1"></t>
  423. <t tx="caminhante.20211214153135.1">INCR1: dd _enter_native
  424. inc dword [esp]
  425. jmp _next_routine
  426. </t>
  427. <t tx="caminhante.20211214153142.1">DECR1: dd _enter_native
  428. dec dword [esp]
  429. jmp _next_routine
  430. </t>
  431. <t tx="caminhante.20211214153150.1">INCR4: dd _enter_native
  432. add dword [esp], 4
  433. jmp _next_routine
  434. </t>
  435. <t tx="caminhante.20211214153208.1">DECR4: dd _enter_native
  436. sub dword [esp], 4
  437. jmp _next_routine
  438. </t>
  439. <t tx="caminhante.20211214153214.1">ADDIT: dd _enter_native
  440. pop eax
  441. add dword [esp], eax
  442. jmp _next_routine
  443. </t>
  444. <t tx="caminhante.20211214153220.1">SUBIT: dd _enter_native
  445. pop eax
  446. sub dword [esp], eax
  447. jmp _next_routine
  448. </t>
  449. <t tx="caminhante.20211214153229.1">MULIT: dd _enter_native
  450. pop eax
  451. pop ebx
  452. imul ebx, eax
  453. push eax
  454. jmp _next_routine
  455. </t>
  456. <t tx="caminhante.20211214153247.1">DIVMOD: dd _enter_native
  457. xor edx, edx
  458. pop ebx
  459. pop eax
  460. idiv ebx
  461. push edx
  462. push eax
  463. jmp _next_routine
  464. </t>
  465. <t tx="caminhante.20211214153326.1"></t>
  466. <t tx="caminhante.20211214153355.1">LT: dd _enter_native
  467. pop eax
  468. cmp eax, [esp]
  469. setl al
  470. movzx eax, al
  471. mov [esp], eax
  472. jmp _next_routine
  473. </t>
  474. <t tx="caminhante.20211214153401.1">GT: dd _enter_native
  475. pop eax
  476. cmp eax, [esp]
  477. setg al
  478. movzx eax, al
  479. mov [esp], eax
  480. jmp _next_routine
  481. </t>
  482. <t tx="caminhante.20211214153407.1">LE: dd _enter_native
  483. pop eax
  484. cmp eax, [esp]
  485. setle al
  486. movzx eax, al
  487. mov [esp], eax
  488. jmp _next_routine
  489. </t>
  490. <t tx="caminhante.20211214153411.1">GE: dd _enter_native
  491. pop eax
  492. cmp eax, [esp]
  493. setge al
  494. movzx eax, al
  495. mov [esp], eax
  496. jmp _next_routine
  497. </t>
  498. <t tx="caminhante.20211214153418.1">EQU0: dd _enter_native
  499. cmp dword [esp], 0
  500. setz al
  501. movzx eax, al
  502. mov [esp], eax
  503. jmp _next_routine
  504. </t>
  505. <t tx="caminhante.20211214153424.1">DIF0: dd _enter_native
  506. cmp dword [esp], 0
  507. setnz al
  508. movzx eax, al
  509. mov [esp], eax
  510. jmp _next_routine
  511. </t>
  512. <t tx="caminhante.20211214153429.1">LT0: dd _enter_native
  513. cmp dword [esp], 0
  514. setl al
  515. movzx eax, al
  516. mov [esp], eax
  517. jmp _next_routine
  518. </t>
  519. <t tx="caminhante.20211214153434.1">GT0: dd _enter_native
  520. cmp dword [esp], 0
  521. setg al
  522. movzx eax, al
  523. mov [esp], eax
  524. jmp _next_routine
  525. </t>
  526. <t tx="caminhante.20211214153439.1">LE0: dd _enter_native
  527. cmp dword [esp], 0
  528. setle al
  529. movzx eax, al
  530. mov [esp], eax
  531. jmp _next_routine
  532. </t>
  533. <t tx="caminhante.20211214153444.1">GE0: dd _enter_native
  534. cmp dword [esp], 0
  535. setge al
  536. movzx eax, al
  537. mov [esp], eax
  538. jmp _next_routine
  539. </t>
  540. <t tx="caminhante.20211214153451.1">AND4: dd _enter_native
  541. pop eax
  542. and [esp], eax
  543. jmp _next_routine
  544. </t>
  545. <t tx="caminhante.20211214153456.1">OR4: dd _enter_native
  546. pop eax
  547. or [esp], eax
  548. jmp _next_routine
  549. </t>
  550. <t tx="caminhante.20211214153500.1">NOT4: dd _enter_native
  551. not dword [esp]
  552. jmp _next_routine
  553. </t>
  554. <t tx="caminhante.20211214153505.1">NEG4: dd _enter_native
  555. neg dword [esp]
  556. jmp _next_routine
  557. </t>
  558. <t tx="caminhante.20211214153530.1"></t>
  559. <t tx="caminhante.20211215232241.2">@path meta</t>
  560. <t tx="caminhante.20211215232241.3"></t>
  561. <t tx="caminhante.20211215232839.1"></t>
  562. <t tx="caminhante.20211215233815.3"></t>
  563. <t tx="caminhante.20211216001602.1"></t>
  564. <t tx="caminhante.20211216001602.2"></t>
  565. <t tx="caminhante.20211216001602.3"></t>
  566. <t tx="caminhante.20211216004210.1"></t>
  567. <t tx="caminhante.20211216004240.1">POKE4: dd _enter_native
  568. pop ebx
  569. pop eax
  570. mov [ebx], eax
  571. jmp _next_routine
  572. </t>
  573. <t tx="caminhante.20211216004245.1">PEEK4: dd _enter_native
  574. pop ebx
  575. mov eax, [ebx]
  576. push eax
  577. jmp _next_routine
  578. </t>
  579. <t tx="caminhante.20211216004250.1">POKE4ADD: dd _enter_native
  580. pop ebx
  581. pop eax
  582. add [ebx], eax
  583. jmp _next_routine
  584. </t>
  585. <t tx="caminhante.20211216004256.1">POKE4SUB: dd _enter_native
  586. pop ebx
  587. pop eax
  588. sub [ebx], eax
  589. jmp _next_routine
  590. </t>
  591. <t tx="caminhante.20211216004300.1">POKE1: dd _enter_native
  592. pop ebx
  593. pop eax
  594. mov [ebx], al
  595. jmp _next_routine
  596. </t>
  597. <t tx="caminhante.20211216004304.1">PEEK1: dd _enter_native
  598. pop ebx
  599. xor eax, eax
  600. mov al, [ebx]
  601. push eax
  602. jmp _next_routine
  603. </t>
  604. <t tx="caminhante.20211216004309.1">COPY1: dd _enter_native
  605. mov ebx, [esp+4]
  606. mov edx, [esp]
  607. mov al, [ebx]
  608. mov [edx], al
  609. inc dword [esp]
  610. inc dword [esp+4]
  611. jmp _next_routine
  612. </t>
  613. <t tx="caminhante.20211216004314.1">COPY4: dd _enter_native
  614. mov ebx, [esp+4]
  615. mov edx, [esp]
  616. mov eax, [ebx]
  617. mov [edx], eax
  618. add dword [esp], 4
  619. add dword [esp+4], 4
  620. jmp _next_routine
  621. </t>
  622. <t tx="caminhante.20211216004321.1">MOVE1: dd _enter_native
  623. cld
  624. pop ecx
  625. mov edx, ecx
  626. shr ecx, 2
  627. and edx, 3
  628. pop edi
  629. pop esi
  630. rep movsd
  631. mov ecx, edx
  632. rep movsb
  633. jmp _next_routine
  634. </t>
  635. <t tx="knoppix.20200918114306.1">nome = ''.join(c.p.h.split('@kml ')[1:])
  636. c.p.h = f"@file {nome}.kml"
  637. c.p.b = f"""@language xml
  638. ##@tabwidth -2
  639. &lt;kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2"&gt;
  640. &lt;Document&gt;
  641. &lt;name&gt;{nome}&lt;/name&gt;
  642. &lt;Style id="poi"&gt;
  643. &lt;IconStyle&gt;
  644. &lt;Icon&gt;
  645. &lt;href&gt;/usr/share/marble/data/bitmaps/annotation.png&lt;/href&gt;
  646. &lt;scale&gt;0.5&lt;/scale&gt;
  647. &lt;/Icon&gt;
  648. &lt;/IconStyle&gt;
  649. &lt;BalloonStyle&gt;
  650. &lt;bgColor&gt;ffffaabb&lt;/bgColor&gt;
  651. &lt;text&gt;$[description]&lt;/text&gt;
  652. &lt;/BalloonStyle&gt;
  653. &lt;/Style&gt;
  654. ##@others
  655. &lt;/Document&gt;
  656. &lt;/kml&gt;""".replace("##","")
  657. </t>
  658. <t tx="knoppix.20200918115239.1">nome = ''.join(c.p.h.split('@kmlfolder ')[1:])
  659. c.p.b = f"""@language xml
  660. &lt;Folder&gt;
  661. &lt;name&gt;{nome}&lt;/name&gt;
  662. ##@others
  663. &lt;/Folder&gt;""".replace("##","")
  664. </t>
  665. <t tx="knoppix.20200918115703.1">import re
  666. a = c.p.h
  667. b = re.match(r'^@latlon\s+(-?\d+(\.\d+)?)\s*,\s*(-?\d+(\.\d+)?)\s*(.*)$',a)
  668. title = (lambda: b.groups()[4] if b else a)()
  669. lat = (lambda: b.groups()[0] if b else '&lt;|latitude|&gt;')()
  670. lon = (lambda: b.groups()[2] if b else '&lt;|longitude|&gt;')()
  671. c.p.b = f"""@language xml
  672. &lt;Placemark&gt;
  673. &lt;name&gt;{title}&lt;/name&gt;
  674. &lt;description&gt;&lt;![CDATA[
  675. ##@others
  676. ]]&gt;&lt;/description&gt;
  677. &lt;LookAt&gt;
  678. &lt;longitude&gt;{lon}&lt;/longitude&gt;
  679. &lt;latitude&gt;{lat}&lt;/latitude&gt;
  680. &lt;altitude&gt;0.0000000000&lt;/altitude&gt;
  681. &lt;range&gt;100&lt;/range&gt;
  682. &lt;/LookAt&gt;
  683. &lt;styleUrl&gt;#poi&lt;/styleUrl&gt;
  684. &lt;Point&gt;
  685. &lt;coordinates&gt; {lon},{lat} &lt;/coordinates&gt;
  686. &lt;/Point&gt;
  687. &lt;/Placemark&gt;""".replace("##","")
  688. </t>
  689. <t tx="knoppix.20200918120617.1">import re
  690. a = c.p.h
  691. b = re.match(r'^@latlonh\s+(-?\d+(\.\d+)?)\s*,\s*(-?\d+(\.\d+)?)\s*(.*)$',a)
  692. title = (lambda: b.groups()[4] if b else a)()
  693. lat = (lambda: b.groups()[0] if b else '&lt;|latitude|&gt;')()
  694. lon = (lambda: b.groups()[2] if b else '&lt;|longitude|&gt;')()
  695. try:
  696. lt=float(lat)
  697. ln=float(lon)
  698. nslat=(lambda: 'N'+lat if lt&gt;0 else 'S'+lat[1:])()
  699. welon=(lambda: 'E'+lon if ln&gt;0 else 'W'+lon[1:])()
  700. c.p.b = f"""@language xml
  701. &lt;Placemark&gt;
  702. &lt;name&gt;{title}&lt;/name&gt;
  703. &lt;description&gt;&lt;![CDATA[
  704. &lt;html&gt;&lt;body&gt;
  705. &lt;pre style="white-space:pre-line;"&gt;
  706. ##@others
  707. &lt;/pre&gt;
  708. &lt;p&gt;&lt;a href="https://wego.here.com/directions/mix/{nslat},{welon}?map={lat},{lon},15,normal" target="_blank"&gt;Abrir no HERE Maps&lt;/a&gt;&lt;/p&gt;
  709. &lt;/body&gt;&lt;/html&gt;
  710. ]]&gt;&lt;/description&gt;
  711. &lt;LookAt&gt;
  712. &lt;longitude&gt;{lon}&lt;/longitude&gt;
  713. &lt;latitude&gt;{lat}&lt;/latitude&gt;
  714. &lt;altitude&gt;0.0000000000&lt;/altitude&gt;
  715. &lt;range&gt;100&lt;/range&gt;
  716. &lt;/LookAt&gt;
  717. &lt;styleUrl&gt;#poi&lt;/styleUrl&gt;
  718. &lt;iconUrl&gt;imovel.png&lt;/iconUrl&gt;
  719. &lt;Point&gt;
  720. &lt;coordinates&gt;{lon},{lat}&lt;/coordinates&gt;
  721. &lt;/Point&gt;
  722. &lt;/Placemark&gt;""".replace("##","")
  723. except:
  724. c.p.b = f"""title: {title}
  725. lat: {lat}
  726. lon: {lon}
  727. """
  728. </t>
  729. </tnodes>
  730. </leo_file>