ranger-compiler 2.1.70 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/README.md +956 -133
  3. package/{compiler/Lang.clj → dist/Lang.rgr} +2345 -75
  4. package/dist/README.md +116 -0
  5. package/dist/{bin/api.d.ts → api.d.ts} +430 -154
  6. package/dist/api.js +34345 -0
  7. package/{lib/Ajax.clj → dist/lib/Ajax.rgr} +1 -1
  8. package/{lib/CmdParams.clj → dist/lib/CmdParams.rgr} +72 -72
  9. package/{lib/Crypto.clj → dist/lib/Crypto.rgr} +1 -1
  10. package/{lib/DOMLib.clj → dist/lib/DOMLib.rgr} +2 -2
  11. package/{lib/Engine3D.clj → dist/lib/Engine3D.rgr} +1 -1
  12. package/{lib/ImmutableVector.clj → dist/lib/ImmutableVector.rgr} +364 -364
  13. package/{lib/IndexedDB.clj → dist/lib/IndexedDB.rgr} +1 -1
  14. package/{lib/JSON.clj → dist/lib/JSON.rgr} +105 -2
  15. package/{lib/JinxProcess.clj → dist/lib/JinxProcess.rgr} +3 -3
  16. package/{lib/Storage.clj → dist/lib/Storage.rgr} +1 -1
  17. package/{lib/Timers.clj → dist/lib/Timers.rgr} +176 -170
  18. package/{lib/ViewLib.clj → dist/lib/ViewLib.rgr} +1 -1
  19. package/dist/lib/lib/ACEEditor.rgr +5 -0
  20. package/dist/lib/lib/Ajax.rgr +196 -0
  21. package/dist/lib/lib/CmdParams.rgr +72 -0
  22. package/dist/lib/lib/Crypto.rgr +90 -0
  23. package/dist/lib/lib/DOMLib.rgr +307 -0
  24. package/{examples/3D/Engine3D.clj → dist/lib/lib/Engine3D.rgr} +870 -857
  25. package/dist/lib/lib/ImmutableVector.rgr +364 -0
  26. package/dist/lib/lib/IndexedDB.rgr +32 -0
  27. package/{compiler/JSON.clj → dist/lib/lib/JSON.rgr} +106 -3
  28. package/dist/lib/lib/JinxProcess.rgr +838 -0
  29. package/dist/lib/lib/SQL.rgr +44 -0
  30. package/dist/lib/lib/ServiceLib.rgr +9 -0
  31. package/dist/lib/lib/Storage.rgr +89 -0
  32. package/dist/lib/lib/Time.rgr +75 -0
  33. package/dist/lib/lib/Timers.rgr +176 -0
  34. package/dist/lib/lib/TypedArrays.rgr +14 -0
  35. package/dist/lib/lib/ViewLib.rgr +851 -0
  36. package/dist/lib/lib/WebLib.rgr +47 -0
  37. package/dist/lib/lib/WebServerLib.rgr +137 -0
  38. package/{lib/ranger-dir.clj → dist/lib/lib/ranger-dir.rgr} +1 -1
  39. package/{compiler/stdlib.clj → dist/lib/lib/stdlib.rgr} +42 -19
  40. package/{lib/stdops.clj → dist/lib/lib/stdops.rgr} +1 -1
  41. package/dist/lib/ranger-dir.rgr +175 -0
  42. package/{lib/stdlib.clj → dist/lib/stdlib.rgr} +2 -2
  43. package/dist/lib/stdops.rgr +168 -0
  44. package/dist/package.json +47 -0
  45. package/{compiler/bin/output.js → dist/rgrc.js} +15377 -7936
  46. package/dist/stdops.rgr +168 -0
  47. package/package.json +196 -39
  48. package/adventofcode/day1/bin/LambdaSignature1.java +0 -3
  49. package/adventofcode/day1/bin/LambdaSignature2.java +0 -3
  50. package/adventofcode/day1/bin/LambdaSignature3.java +0 -3
  51. package/adventofcode/day1/bin/day1.cpp +0 -124
  52. package/adventofcode/day1/bin/day1.go +0 -75
  53. package/adventofcode/day1/bin/day1.js +0 -45
  54. package/adventofcode/day1/bin/day1.php +0 -46
  55. package/adventofcode/day1/bin/day1.scala +0 -48
  56. package/adventofcode/day1/bin/day1.swift +0 -48
  57. package/adventofcode/day1/bin/day1_part2.cpp +0 -180
  58. package/adventofcode/day1/bin/day1_part2.go +0 -123
  59. package/adventofcode/day1/bin/day1_part2.js +0 -76
  60. package/adventofcode/day1/bin/day1_part2.php +0 -88
  61. package/adventofcode/day1/bin/day1_part2.scala +0 -81
  62. package/adventofcode/day1/bin/day1_part2.swift +0 -91
  63. package/adventofcode/day1/bin/day_one.java +0 -38
  64. package/adventofcode/day1/bin/day_one_part_two.java +0 -57
  65. package/adventofcode/day1/bin/operatorsOf.java +0 -37
  66. package/adventofcode/day1/bin/operatorsOf_5.java +0 -10
  67. package/adventofcode/day1/bin/operatorsOfboolean_5.java +0 -10
  68. package/adventofcode/day1/bin/variant.hpp +0 -2416
  69. package/adventofcode/day1/compile.bat +0 -7
  70. package/adventofcode/day1/compile2.bat +0 -7
  71. package/adventofcode/day1/day1.clj +0 -19
  72. package/adventofcode/day1/day1_part2.clj +0 -43
  73. package/adventofcode/day1/input1.txt +0 -1
  74. package/adventofcode/day2/bin/LambdaSignature1.class +0 -0
  75. package/adventofcode/day2/bin/LambdaSignature1.java +0 -3
  76. package/adventofcode/day2/bin/LambdaSignature2.class +0 -0
  77. package/adventofcode/day2/bin/LambdaSignature2.java +0 -3
  78. package/adventofcode/day2/bin/day2.cpp +0 -133
  79. package/adventofcode/day2/bin/day2.go +0 -85
  80. package/adventofcode/day2/bin/day2.js +0 -45
  81. package/adventofcode/day2/bin/day2.php +0 -59
  82. package/adventofcode/day2/bin/day2.scala +0 -54
  83. package/adventofcode/day2/bin/day2.swift +0 -62
  84. package/adventofcode/day2/bin/day2_part2.cpp +0 -150
  85. package/adventofcode/day2/bin/day2_part2.go +0 -101
  86. package/adventofcode/day2/bin/day2_part2.js +0 -54
  87. package/adventofcode/day2/bin/day2_part2.php +0 -80
  88. package/adventofcode/day2/bin/day2_part2.scala +0 -68
  89. package/adventofcode/day2/bin/day2_part2.swift +0 -82
  90. package/adventofcode/day2/bin/day_two.java +0 -61
  91. package/adventofcode/day2/bin/day_two_part_two$1$1$1.class +0 -0
  92. package/adventofcode/day2/bin/day_two_part_two$1$1.class +0 -0
  93. package/adventofcode/day2/bin/day_two_part_two$1.class +0 -0
  94. package/adventofcode/day2/bin/day_two_part_two.class +0 -0
  95. package/adventofcode/day2/bin/day_two_part_two.java +0 -80
  96. package/adventofcode/day2/bin/operatorsOf.class +0 -0
  97. package/adventofcode/day2/bin/operatorsOf.java +0 -18
  98. package/adventofcode/day2/bin/variant.hpp +0 -2416
  99. package/adventofcode/day2/compile.bat +0 -7
  100. package/adventofcode/day2/compile2.bat +0 -7
  101. package/adventofcode/day2/day2.clj +0 -60
  102. package/adventofcode/day2/day2_part2.clj +0 -69
  103. package/adventofcode/day2/input1.txt +0 -1
  104. package/adventofcode/day3/bin/Grid.java +0 -92
  105. package/adventofcode/day3/bin/GridRow.java +0 -5
  106. package/adventofcode/day3/bin/LambdaSignature1.java +0 -3
  107. package/adventofcode/day3/bin/LambdaSignature2.java +0 -3
  108. package/adventofcode/day3/bin/LambdaSignature3.java +0 -3
  109. package/adventofcode/day3/bin/day3.cpp +0 -64
  110. package/adventofcode/day3/bin/day3.go +0 -55
  111. package/adventofcode/day3/bin/day3.js +0 -42
  112. package/adventofcode/day3/bin/day3.php +0 -41
  113. package/adventofcode/day3/bin/day3.scala +0 -52
  114. package/adventofcode/day3/bin/day3.swift +0 -43
  115. package/adventofcode/day3/bin/day3_part2.cpp +0 -216
  116. package/adventofcode/day3/bin/day3_part2.go +0 -188
  117. package/adventofcode/day3/bin/day3_part2.js +0 -123
  118. package/adventofcode/day3/bin/day3_part2.php +0 -135
  119. package/adventofcode/day3/bin/day3_part2.swift +0 -131
  120. package/adventofcode/day3/bin/day_three_part_two.java +0 -43
  121. package/adventofcode/day3/bin/day_two.java +0 -42
  122. package/adventofcode/day3/bin/operatorsOf.java +0 -14
  123. package/adventofcode/day3/bin/variant.hpp +0 -2416
  124. package/adventofcode/day3/compile.bat +0 -7
  125. package/adventofcode/day3/compile2.bat +0 -7
  126. package/adventofcode/day3/day3.clj +0 -42
  127. package/adventofcode/day3/day3_part2.clj +0 -112
  128. package/adventofcode/day4/bin/LambdaSignature1.java +0 -3
  129. package/adventofcode/day4/bin/day4.cpp +0 -118
  130. package/adventofcode/day4/bin/day4.go +0 -75
  131. package/adventofcode/day4/bin/day4.js +0 -40
  132. package/adventofcode/day4/bin/day4.php +0 -52
  133. package/adventofcode/day4/bin/day4.scala +0 -47
  134. package/adventofcode/day4/bin/day4.swift +0 -56
  135. package/adventofcode/day4/bin/day4_part2.go +0 -129
  136. package/adventofcode/day4/bin/day4_part2.js +0 -72
  137. package/adventofcode/day4/bin/day_four.java +0 -41
  138. package/adventofcode/day4/bin/inputData.java +0 -7
  139. package/adventofcode/day4/bin/operatorsOf.java +0 -11
  140. package/adventofcode/day4/bin/variant.hpp +0 -2416
  141. package/adventofcode/day4/compile.bat +0 -7
  142. package/adventofcode/day4/compile2.bat +0 -7
  143. package/adventofcode/day4/day4.clj +0 -32
  144. package/adventofcode/day4/day4_part2.clj +0 -44
  145. package/adventofcode/day4/input.clj +0 -519
  146. package/adventofcode/day4/input.txt +0 -512
  147. package/bin/api.ts +0 -24471
  148. package/bin/compiler.ts +0 -24482
  149. package/bin/output.js +0 -23819
  150. package/compiler/ColorConsole.clj +0 -22
  151. package/compiler/ContextOperators.clj +0 -75
  152. package/compiler/FlowEnterVarDef.clj +0 -223
  153. package/compiler/InputFileSystem.clj +0 -276
  154. package/compiler/RangerDocs.clj +0 -7
  155. package/compiler/TFactory.clj +0 -146
  156. package/compiler/TFiles.clj +0 -23
  157. package/compiler/TFlow.clj +0 -39
  158. package/compiler/TNodeFactory.clj +0 -84
  159. package/compiler/TTypes.clj +0 -188
  160. package/compiler/VirtualCompiler.clj +0 -807
  161. package/compiler/bin/ng_Compiler.js +0 -23779
  162. package/compiler/commonmark_plugin.clj +0 -359
  163. package/compiler/feat2.bat +0 -2
  164. package/compiler/feats.bat +0 -9
  165. package/compiler/feature_tests.clj +0 -192
  166. package/compiler/index.js +0 -2
  167. package/compiler/issue_57.clj +0 -25
  168. package/compiler/makefile_plugin.clj +0 -135
  169. package/compiler/markdown_plugin.clj +0 -386
  170. package/compiler/maven_plugin.clj +0 -162
  171. package/compiler/ng_AndroidPageWriter.clj +0 -299
  172. package/compiler/ng_CodeNode.clj +0 -756
  173. package/compiler/ng_CodeNodeCompilerExtensions.clj +0 -839
  174. package/compiler/ng_Compiler.clj +0 -49
  175. package/compiler/ng_CompilerGeneric.clj +0 -260
  176. package/compiler/ng_CompilerOrig.clj +0 -854
  177. package/compiler/ng_DictNode.clj +0 -346
  178. package/compiler/ng_DictNode2.clj +0 -316
  179. package/compiler/ng_Execute.clj +0 -138
  180. package/compiler/ng_Execute1.clj +0 -129
  181. package/compiler/ng_FlowWork.clj +0 -3951
  182. package/compiler/ng_LiveCompiler.clj +0 -1109
  183. package/compiler/ng_RagnerJavaScriptClassWriter.clj +0 -402
  184. package/compiler/ng_RangerActiveOperators.clj +0 -86
  185. package/compiler/ng_RangerAppClassDesc.clj +0 -400
  186. package/compiler/ng_RangerAppEnums.clj +0 -86
  187. package/compiler/ng_RangerAppFunctionDesc.clj +0 -127
  188. package/compiler/ng_RangerAppMessages.clj +0 -15
  189. package/compiler/ng_RangerAppOperatorDesc.clj +0 -20
  190. package/compiler/ng_RangerAppParamDesc.clj +0 -388
  191. package/compiler/ng_RangerAppWriterContext.clj +0 -1793
  192. package/compiler/ng_RangerArgMatch.clj +0 -638
  193. package/compiler/ng_RangerCSharpClassWriter.clj +0 -484
  194. package/compiler/ng_RangerCppClassWriter.clj +0 -1023
  195. package/compiler/ng_RangerDocGenerator.clj +0 -305
  196. package/compiler/ng_RangerFlowParser.clj +0 -4992
  197. package/compiler/ng_RangerFlowParserOrig.clj +0 -4002
  198. package/compiler/ng_RangerGenericClassWriter.clj +0 -573
  199. package/compiler/ng_RangerGolangClassWriter.clj +0 -1766
  200. package/compiler/ng_RangerImmutableExtension.clj +0 -77
  201. package/compiler/ng_RangerJava7ClassWriter.clj +0 -961
  202. package/compiler/ng_RangerJavaScriptClassWriter.clj +0 -1040
  203. package/compiler/ng_RangerKotlinClassWriter.clj +0 -372
  204. package/compiler/ng_RangerLanguageWriters.clj +0 -14
  205. package/compiler/ng_RangerLispParser.clj +0 -873
  206. package/compiler/ng_RangerPHPClassWriter.clj +0 -643
  207. package/compiler/ng_RangerPlugin.clj +0 -41
  208. package/compiler/ng_RangerRangerClassWriter.clj +0 -357
  209. package/compiler/ng_RangerRustClassWriter.clj +0 -420
  210. package/compiler/ng_RangerScalaClassWriter.clj +0 -818
  211. package/compiler/ng_RangerSerializeClass.clj +0 -502
  212. package/compiler/ng_RangerServiceBuilder.clj +0 -63
  213. package/compiler/ng_RangerSwift3ClassWriter.clj +0 -809
  214. package/compiler/ng_RangerSwiftClassWriter.clj +0 -0
  215. package/compiler/ng_RangerTypeClass.clj +0 -45
  216. package/compiler/ng_SourceParser.clj +0 -241
  217. package/compiler/ng_SourceParser2.clj +0 -214
  218. package/compiler/ng_WebPageWriter.clj +0 -39
  219. package/compiler/ng_jsonParser.clj +0 -340
  220. package/compiler/ng_p_test.clj +0 -1711
  221. package/compiler/ng_parser.clj +0 -911
  222. package/compiler/ng_parser2.clj +0 -735
  223. package/compiler/ng_parser2_backup.clj +0 -1679
  224. package/compiler/ng_parser_backup.clj +0 -886
  225. package/compiler/ng_parser_ok.clj +0 -1718
  226. package/compiler/ng_parser_ok2.clj +0 -1717
  227. package/compiler/ng_parser_std_match.clj +0 -687
  228. package/compiler/ng_parser_std_match2.clj +0 -1012
  229. package/compiler/ng_parser_v2.clj +0 -1251
  230. package/compiler/ng_ui.clj +0 -403
  231. package/compiler/ng_ui_test.clj +0 -18
  232. package/compiler/ng_writer.clj +0 -338
  233. package/compiler/ng_xmlParser.clj +0 -472
  234. package/compiler/ng_xmlParser2.clj +0 -317
  235. package/compiler/ng_xmlParser3.clj +0 -251
  236. package/compiler/opdoc.bat +0 -4
  237. package/compiler/operators.md +0 -290
  238. package/compiler/p.bat +0 -4
  239. package/compiler/package.json +0 -10
  240. package/compiler/pcmd.bat +0 -4
  241. package/compiler/pcmd2.bat +0 -3
  242. package/compiler/plaintext_plugin.clj +0 -69
  243. package/compiler/plugin.bat +0 -19
  244. package/compiler/plugin2.bat +0 -4
  245. package/compiler/plugin_app.bat +0 -3
  246. package/compiler/plugin_apps.clj +0 -27
  247. package/compiler/plugins.bat +0 -10
  248. package/compiler/reveal_plugin.clj +0 -409
  249. package/compiler/simplePlugin.clj +0 -780
  250. package/compiler/t.bat +0 -3
  251. package/compiler/test_any.clj +0 -43
  252. package/compiler/test_call.clj +0 -141
  253. package/compiler/test_chain.clj +0 -79
  254. package/compiler/test_json.clj +0 -10
  255. package/compiler/test_lambda.clj +0 -153
  256. package/compiler/test_pcmd.clj +0 -32
  257. package/compiler/test_pcmd2.clj +0 -29
  258. package/compiler/test_plugin.clj +0 -237
  259. package/compiler/test_readfile.clj +0 -13
  260. package/compiler/test_reveal.clj +0 -19
  261. package/compiler/test_slides.clj +0 -312
  262. package/compiler/test_types.clj +0 -143
  263. package/compiler/test_types2.clj +0 -49
  264. package/compiler/test_types3.clj +0 -53
  265. package/compiler/test_var.clj +0 -40
  266. package/compiler/tonpm.bat +0 -14
  267. package/compiler/tonpm2.bat +0 -12
  268. package/compiler/ui_plugin.clj +0 -507
  269. package/compiler/ui_plugin2.clj +0 -427
  270. package/compiler/update-git.bat +0 -3
  271. package/compiler/vcomp.bat +0 -4
  272. package/compiler/viewbuilder_Android.clj +0 -176
  273. package/compiler/viewbuilder_Web.clj +0 -105
  274. package/dist/bin/api.js +0 -32422
  275. package/dist/bin/compiler.d.ts +0 -1638
  276. package/dist/bin/compiler.js +0 -32444
  277. package/examples/3D/bin/test_3d.js +0 -329
  278. package/examples/3D/test_3d.clj +0 -385
  279. package/examples/EVGColor/EVGColor.clj +0 -310
  280. package/examples/EVGColor/EVGColorContext.clj +0 -176
  281. package/examples/EVGColor/bin/EVGColor.js +0 -286
  282. package/examples/EVGColor/bin/minimized.js +0 -286
  283. package/examples/SVGPath/SVGPath.clj +0 -625
  284. package/examples/SVGPath/Vec2.clj +0 -103
  285. package/examples/SVGPath/bin/SVGPath.cpp +0 -887
  286. package/examples/SVGPath/bin/SVGPath.js +0 -682
  287. package/examples/SVGPath/bin/SVGPath.ts +0 -711
  288. package/examples/SVGPath/bin/minimized.js +0 -578
  289. package/examples/SVGPath/bin/variant.hpp +0 -2416
  290. package/examples/minification/Vec2.clj +0 -103
  291. package/examples/minification/bin/minified.js +0 -44
  292. package/examples/minification/bin/test.js +0 -117
  293. package/examples/minification/test.clj +0 -13
  294. package/fiddle/VirtualCompiler.js +0 -23495
  295. package/fiddle/browser_editor.js +0 -13240
  296. package/fiddle/compileEnv.js +0 -1
  297. package/fiddle/compileEnv.json +0 -1
  298. package/fiddle/lang_data.js +0 -1
  299. package/index.html +0 -18
  300. package/native/httpd/HttpTester.clj +0 -33
  301. package/native/httpd/RangerWebService.clj +0 -81
  302. package/operators.md +0 -290
  303. package/tsconfig.json +0 -29
  304. package/versions/cpp/compiler.cpp +0 -15032
  305. package/versions/es6/compiler.js +0 -12860
  306. package/versions/go/compiler.go +0 -21338
  307. package/versions/java/AfterCodeNode.java +0 -4
  308. package/versions/java/ClassJoinPoint.java +0 -6
  309. package/versions/java/CodeFile.java +0 -42
  310. package/versions/java/CodeFileSystem.java +0 -72
  311. package/versions/java/CodeNode.java +0 -807
  312. package/versions/java/CodeSlice.java +0 -13
  313. package/versions/java/CodeWriter.java +0 -185
  314. package/versions/java/ColorConsole.java +0 -8
  315. package/versions/java/CompilerInterface.java +0 -213
  316. package/versions/java/DictNode.java +0 -353
  317. package/versions/java/LiveCompiler.java +0 -772
  318. package/versions/java/NodeEvalState.java +0 -24
  319. package/versions/java/OpFindResult.java +0 -6
  320. package/versions/java/RangerAppArrayValue.java +0 -7
  321. package/versions/java/RangerAppClassDesc.java +0 -217
  322. package/versions/java/RangerAppEnum.java +0 -14
  323. package/versions/java/RangerAppFunctionDesc.java +0 -20
  324. package/versions/java/RangerAppHashValue.java +0 -11
  325. package/versions/java/RangerAppInterfaceImpl.java +0 -6
  326. package/versions/java/RangerAppMethodVariants.java +0 -6
  327. package/versions/java/RangerAppParamDesc.java +0 -321
  328. package/versions/java/RangerAppTodo.java +0 -6
  329. package/versions/java/RangerAppValue.java +0 -10
  330. package/versions/java/RangerAppWriterContext.java +0 -800
  331. package/versions/java/RangerArgMatch.java +0 -317
  332. package/versions/java/RangerBackReference.java +0 -7
  333. package/versions/java/RangerCSharpClassWriter.java +0 -287
  334. package/versions/java/RangerCompilerMessage.java +0 -9
  335. package/versions/java/RangerCppClassWriter.java +0 -725
  336. package/versions/java/RangerFlowParser.java +0 -2142
  337. package/versions/java/RangerGenericClassWriter.java +0 -367
  338. package/versions/java/RangerGolangClassWriter.java +0 -1379
  339. package/versions/java/RangerJava7ClassWriter.java +0 -652
  340. package/versions/java/RangerJavaScriptClassWriter.java +0 -305
  341. package/versions/java/RangerKotlinClassWriter.java +0 -380
  342. package/versions/java/RangerLispParser.java +0 -845
  343. package/versions/java/RangerNodeValue.java +0 -9
  344. package/versions/java/RangerPHPClassWriter.java +0 -527
  345. package/versions/java/RangerParamEventHandler.java +0 -6
  346. package/versions/java/RangerParamEventList.java +0 -5
  347. package/versions/java/RangerParamEventMap.java +0 -27
  348. package/versions/java/RangerRangerClassWriter.java +0 -268
  349. package/versions/java/RangerRefForce.java +0 -7
  350. package/versions/java/RangerScalaClassWriter.java +0 -365
  351. package/versions/java/RangerSerializeClass.java +0 -148
  352. package/versions/java/RangerSwift3ClassWriter.java +0 -548
  353. package/versions/java/RangerTypeClass.java +0 -17
  354. package/versions/java/SourceCode.java +0 -65
  355. package/versions/php/compiler.php +0 -13830
  356. package/versions/swift3/compiler.swift +0 -12542
  357. /package/{lib/ACEEditor.clj → dist/lib/ACEEditor.rgr} +0 -0
  358. /package/{lib/SQL.clj → dist/lib/SQL.rgr} +0 -0
  359. /package/{lib/ServiceLib.clj → dist/lib/ServiceLib.rgr} +0 -0
  360. /package/{lib/Time.clj → dist/lib/Time.rgr} +0 -0
  361. /package/{lib/TypedArrays.clj → dist/lib/TypedArrays.rgr} +0 -0
  362. /package/{lib/WebLib.clj → dist/lib/WebLib.rgr} +0 -0
  363. /package/{lib/WebServerLib.clj → dist/lib/WebServerLib.rgr} +0 -0
@@ -1,682 +0,0 @@
1
- class Vec2 {
2
- constructor() {
3
- this.x = 0.0;
4
- this.y = 0.0;
5
- }
6
- }
7
- Vec2.CreateNew = function(i, j) {
8
- const v = new Vec2();
9
- v.x = i;
10
- v.y = j;
11
- return v;
12
- };
13
- class Mat2 {
14
- constructor() {
15
- this.m0 = 1.0;
16
- this.m1 = 0.0;
17
- this.m2 = 0.0;
18
- this.m3 = 1.0;
19
- this.m4 = 0.0;
20
- this.m5 = 0.0;
21
- }
22
- toIdentity () {
23
- this.m0 = 1.0;
24
- this.m1 = 0.0;
25
- this.m2 = 0.0;
26
- this.m3 = 1.0;
27
- this.m4 = 0.0;
28
- this.m5 = 0.0;
29
- };
30
- setTranslate (tx, ty) {
31
- this.m4 = tx;
32
- this.m5 = ty;
33
- };
34
- setScale (sx, sy) {
35
- this.m1 = sx;
36
- this.m3 = sy;
37
- };
38
- setSkewX (v) {
39
- this.m0 = 1.0;
40
- this.m1 = 0.0;
41
- this.m2 = Math.tan(v);
42
- this.m3 = 1.0;
43
- this.m4 = 0.0;
44
- this.m5 = 0.0;
45
- };
46
- setSkewY (v) {
47
- this.m0 = 1.0;
48
- this.m1 = Math.tan(v);
49
- this.m2 = 0.0;
50
- this.m3 = 1.0;
51
- this.m4 = 0.0;
52
- this.m5 = 0.0;
53
- };
54
- setRotation (v) {
55
- const cs = Math.cos(v);
56
- const sn = Math.sin(v);
57
- this.m0 = cs;
58
- this.m1 = sn;
59
- this.m2 = -1.0 * sn;
60
- this.m3 = cs;
61
- this.m4 = 0.0;
62
- this.m5 = 0.0;
63
- };
64
- multiply (b) {
65
- const t0 = (this.m0 * b.m0) + (this.m1 * b.m2);
66
- const t2 = (this.m2 * b.m0) + (this.m3 * b.m2);
67
- const t4 = ((this.m4 * b.m0) + (this.m5 * b.m2)) + b.m4;
68
- this.m1 = (this.m0 * b.m1) + (this.m1 * b.m3);
69
- this.m3 = (this.m2 * b.m1) + (this.m3 * b.m3);
70
- this.m5 = ((this.m4 * b.m1) + (this.m5 * b.m3)) + b.m5;
71
- this.m0 = t0;
72
- this.m2 = t2;
73
- this.m4 = t4;
74
- };
75
- inverse () {
76
- let invdet = (this.m0 * this.m3) - (this.m2 * this.m1);
77
- const det = invdet;
78
- if ( (det > -0.0001) && (det < 0.0001) ) {
79
- this.toIdentity();
80
- return this;
81
- }
82
- invdet = 1.0 / det;
83
- const inv = new Mat2();
84
- inv.m0 = this.m3 * invdet;
85
- inv.m2 = (-1.0 * this.m2) * invdet;
86
- inv.m4 = (this.m2 * this.m5) - ((this.m3 * this.m4) * invdet);
87
- inv.m1 = (-1.0 * this.m1) * invdet;
88
- inv.m3 = this.m0 * invdet;
89
- inv.m5 = (this.m1 * this.m4) - ((this.m0 * this.m5) * invdet);
90
- return inv;
91
- };
92
- transformPoint (v) {
93
- const res = new Vec2();
94
- res.x = ((v.x * this.m0) + (v.y * this.m2)) + this.m4;
95
- res.y = ((v.x * this.m1) + (v.y * this.m3)) + this.m5;
96
- return res;
97
- };
98
- rotateVector (v) {
99
- const res = new Vec2();
100
- res.x = (v.x * this.m0) + (v.y * this.m2);
101
- res.y = (v.x * this.m1) + (v.y * this.m3);
102
- return res;
103
- };
104
- }
105
- class PathExecutor {
106
- constructor() {
107
- }
108
- Move (x, y) {
109
- console.log((("Move called with " + x) + ", ") + y);
110
- };
111
- Line (x, y) {
112
- console.log((("Line called with " + x) + ", ") + y);
113
- };
114
- Curve (x0, y0, x1, y1, x2, y2) {
115
- console.log(((((((((((("Cubic bezier curve called with " + x0) + ", ") + y0) + " ") + x1) + ", ") + y1) + " ") + x2) + ", ") + y2) + " ");
116
- };
117
- }
118
- class PathCollector extends PathExecutor {
119
- constructor() {
120
- super()
121
- this.pathParts = [];
122
- }
123
- Move (x, y) {
124
- this.pathParts.push(((("M " + x) + " ") + y) + " ");
125
- };
126
- Line (x, y) {
127
- this.pathParts.push(((("L " + x) + " ") + y) + " ");
128
- };
129
- Curve (x0, y0, x1, y1, x2, y2) {
130
- this.pathParts.push(((((((((((("C " + x0) + " ") + y0) + " ") + x1) + " ") + y1) + " ") + x2) + " ") + y2) + " ");
131
- };
132
- getString () {
133
- return this.pathParts.join(" ");
134
- };
135
- }
136
- class PathSegment {
137
- constructor() {
138
- this.t0 = 0.0;
139
- this.t1 = 0.0;
140
- this.t2 = 0.0;
141
- this.t3 = 0.0;
142
- this.t4 = 0.0;
143
- this.t5 = 0.0;
144
- this.t6 = 0.0;
145
- }
146
- }
147
- class EVGBezierPath {
148
- constructor() {
149
- this.points = []; /** note: unused */
150
- this.pointCnt = 0; /** note: unused */
151
- this.closed = false;
152
- this.bounds = Vec2.CreateNew(0.0, 0.0); /** note: unused */
153
- this.cp1 = Vec2.CreateNew(0.0, 0.0); /** note: unused */
154
- this.cp2 = Vec2.CreateNew(0.0, 0.0); /** note: unused */
155
- this.controlPoint = Vec2.CreateNew(0.0, 0.0);
156
- }
157
- close () {
158
- this.closed = true;
159
- };
160
- Line (point) {
161
- };
162
- moveTo (point) {
163
- this.controlPoint.x = point.x;
164
- this.controlPoint.y = point.y;
165
- };
166
- }
167
- class EVGPathParser {
168
- constructor() {
169
- this.i = 0;
170
- this.__len = 0;
171
- this.last_number = 0.0;
172
- }
173
- __sqr (v) {
174
- return v * v;
175
- };
176
- __xformPoint (point, seg) {
177
- const res = Vec2.CreateNew((((point.x * seg.t0) + (point.y * seg.t2)) + seg.t4), (((point.x * seg.t1) + (point.y * seg.t3)) + seg.t5));
178
- return res;
179
- };
180
- __xformVec (point, seg) {
181
- return Vec2.CreateNew(((point.x * seg.t0) + (point.y * seg.t2)), ((point.x * seg.t1) + (point.y * seg.t3)));
182
- };
183
- __vmag (point) {
184
- return Math.sqrt(((point.x * point.x) + (point.y * point.y)));
185
- };
186
- __vecrat (u, v) {
187
- return ((u.x * v.x) + (u.y * v.y)) / (this.__vmag(u) * this.__vmag(v));
188
- };
189
- __vecang (u, v) {
190
- let r = this.__vecrat(u, v);
191
- if ( r < -1.0 ) {
192
- r = -1.0;
193
- }
194
- if ( r > 1.0 ) {
195
- r = 1.0;
196
- }
197
- let res = 1.0;
198
- if ( (u.x * v.y) < (u.y * v.x) ) {
199
- res = -1.0;
200
- }
201
- return res * (Math.acos(r));
202
- };
203
- scanNumber () {
204
- const s = this.buff;
205
- let fc = s.charCodeAt(this.i );
206
- let c = fc;
207
- let sp = 0;
208
- let ep = 0;
209
- fc = s.charCodeAt(this.i );
210
- if ( (((fc == 45) && ((s.charCodeAt((this.i + 1) )) >= 46)) && ((s.charCodeAt((this.i + 1) )) <= 57)) || ((fc >= 48) && (fc <= 57)) ) {
211
- sp = this.i;
212
- this.i = 1 + this.i;
213
- c = s.charCodeAt(this.i );
214
- while ((this.i < this.__len) && ((((c >= 48) && (c <= 57)) || (c == (46))) || ((this.i == sp) && ((c == (43)) || (c == (45)))))) {
215
- this.i = 1 + this.i;
216
- if ( this.i >= this.__len ) {
217
- break;
218
- }
219
- c = s.charCodeAt(this.i );
220
- };
221
- ep = this.i;
222
- this.last_number = (isNaN( parseFloat((s.substring(sp, ep ))) ) ? undefined : parseFloat((s.substring(sp, ep ))));
223
- return true;
224
- }
225
- return false;
226
- };
227
- pathArcTo (callback, cp, args, rel) {
228
- let rx = 0.0;
229
- let ry = 0.0;
230
- let rotx = 0.0;
231
- let x1 = 0.0;
232
- let y1 = 0.0;
233
- let x2 = 0.0;
234
- let y2 = 0.0;
235
- let cx = 0.0;
236
- let cy = 0.0;
237
- let dx = 0.0;
238
- let dy = 0.0;
239
- let d = 0.0;
240
- let x1p = 0.0;
241
- let y1p = 0.0;
242
- let cxp = 0.0;
243
- let cyp = 0.0;
244
- let s = 0.0;
245
- let sa = 0.0;
246
- let sb = 0.0;
247
- /** unused: const ux = 0.0 **/
248
- /** unused: const uy = 0.0 **/
249
- /** unused: const vx = 0.0 **/
250
- /** unused: const vy = 0.0 **/
251
- let a1 = 0.0;
252
- let da = 0.0;
253
- let x = 0.0;
254
- let y = 0.0;
255
- let tanx = 0.0;
256
- let tany = 0.0;
257
- let a = 0.0;
258
- let px = 0.0;
259
- let py = 0.0;
260
- let ptanx = 0.0;
261
- let ptany = 0.0;
262
- const t = new PathSegment();
263
- let sinrx = 0.0;
264
- let cosrx = 0.0;
265
- let fa = 0.0;
266
- let fs = 0.0;
267
- let i_1 = 0;
268
- let ndivs = 0;
269
- let hda = 0.0;
270
- let kappa = 0.0;
271
- const PI_VALUE = Math.PI;
272
- const cpx = cp.x;
273
- const cpy = cp.y;
274
- rx = Math.abs(args.t0);
275
- ry = Math.abs(args.t1);
276
- rotx = (args.t2 / 180.0) * PI_VALUE;
277
- fa = ((Math.abs(args.t3)) > 0.00001) ? 1.0 : 0.0;
278
- fs = ((Math.abs(args.t4)) > 0.00001) ? 1.0 : 0.0;
279
- x1 = cpx;
280
- y1 = cpy;
281
- if ( rel ) {
282
- x2 = cpx + args.t5;
283
- y2 = cpy + args.t6;
284
- } else {
285
- x2 = args.t5;
286
- y2 = args.t6;
287
- }
288
- dx = x1 - x2;
289
- dy = y1 - y2;
290
- d = Math.sqrt(((dx * dx) + (dy * dy)));
291
- if ( ((d < 0.00001) || (rx < 0.00001)) || (ry < 0.00001) ) {
292
- callback.Line(x2, y2);
293
- return Vec2.CreateNew(x2, y2);
294
- }
295
- sinrx = Math.sin(rotx);
296
- cosrx = Math.cos(rotx);
297
- x1p = ((cosrx * dx) / 2.0) + ((sinrx * dy) / 2.0);
298
- y1p = (((-1.0 * sinrx) * dx) / 2.0) + ((cosrx * dy) / 2.0);
299
- d = ((x1p * x1p) / (rx * rx)) + ((y1p * y1p) / (ry * ry));
300
- if ( d > 1.0 ) {
301
- d = Math.sqrt(d);
302
- rx = rx * d;
303
- ry = ry * d;
304
- }
305
- s = 0.0;
306
- sa = (((rx * rx) * (ry * ry)) - ((rx * rx) * (y1p * y1p))) - ((ry * ry) * (x1p * x1p));
307
- sb = ((rx * rx) * (y1p * y1p)) + ((ry * ry) * (x1p * x1p));
308
- if ( sa < 0.0 ) {
309
- sa = 0.0;
310
- }
311
- if ( sb > 0.0 ) {
312
- s = Math.sqrt((sa / sb));
313
- }
314
- if ( fa == fs ) {
315
- s = -1.0 * s;
316
- }
317
- cxp = ((s * rx) * y1p) / ry;
318
- cyp = ((s * (-1.0 * ry)) * x1p) / rx;
319
- cx = ((x1 + x2) / 2.0) + ((cosrx * cxp) - (sinrx * cyp));
320
- cy = ((y1 + y2) / 2.0) + ((sinrx * cxp) + (cosrx * cyp));
321
- const u = Vec2.CreateNew(((x1p - cxp) / rx), ((y1p - cyp) / ry));
322
- const v = Vec2.CreateNew((((-1.0 * x1p) - cxp) / rx), (((-1.0 * y1p) - cyp) / ry));
323
- const unitV = Vec2.CreateNew(1.0, 0.0);
324
- a1 = this.__vecang(unitV, u);
325
- da = this.__vecang(u, v);
326
- if ( (fs == 0.0) && (da > 0.0) ) {
327
- da = da - (2.0 * PI_VALUE);
328
- } else {
329
- if ( (fs == 1.0) && (da < 0.0) ) {
330
- da = (2.0 * PI_VALUE) + da;
331
- }
332
- }
333
- t.t0 = cosrx;
334
- t.t1 = sinrx;
335
- t.t2 = -1.0 * sinrx;
336
- t.t3 = cosrx;
337
- t.t4 = cx;
338
- t.t5 = cy;
339
- ndivs = Math.floor( (((Math.abs(da)) / (PI_VALUE * 0.5)) + 1.0));
340
- hda = (da / (ndivs)) / 2.0;
341
- kappa = Math.abs((((4.0 / 3.0) * (1.0 - (Math.cos(hda)))) / (Math.sin(hda))));
342
- if ( da < 0.0 ) {
343
- kappa = -1.0 * kappa;
344
- }
345
- i_1 = 0;
346
- while (i_1 <= ndivs) {
347
- a = a1 + ((da * (i_1)) / (ndivs));
348
- dx = Math.cos(a);
349
- dy = Math.sin(a);
350
- const trans = this.__xformPoint(Vec2.CreateNew((dx * rx), (dy * ry)), t);
351
- x = trans.x;
352
- y = trans.y;
353
- const v_trans = this.__xformVec(Vec2.CreateNew((((-1.0 * dy) * rx) * kappa), ((dx * ry) * kappa)), t);
354
- tanx = v_trans.x;
355
- tany = v_trans.y;
356
- if ( i_1 > 0 ) {
357
- callback.Curve(px + ptanx, py + ptany, x - tanx, y - tany, x, y);
358
- }
359
- px = x;
360
- py = y;
361
- ptanx = tanx;
362
- ptany = tany;
363
- i_1 = i_1 + 1;
364
- };
365
- const rv = Vec2.CreateNew(x2, y2);
366
- return rv;
367
- };
368
- parsePath (path, callback) {
369
- this.i = 0;
370
- this.buff = path;
371
- const s = this.buff;
372
- this.__len = s.length;
373
- /** unused: const buff_1 = path **/
374
- let cmd = 76;
375
- /** unused: const path_1 = new EVGBezierPath() **/
376
- const args = new PathSegment();
377
- let require_args = 2;
378
- let arg_cnt = 0;
379
- const QPx = new PathSegment();
380
- const QPy = new PathSegment();
381
- const CPx = new PathSegment();
382
- const CPy = new PathSegment();
383
- let cx = 0.0;
384
- let cy = 0.0;
385
- let cx2 = 0.0;
386
- let cy2 = 0.0;
387
- let last_i = -1;
388
- while (this.i < this.__len) {
389
- if ( last_i == this.i ) {
390
- this.i = this.i + 1;
391
- }
392
- last_i = this.i;
393
- const c = s.charCodeAt(this.i );
394
- if ( (((c == (86)) || (c == (118))) || (c == (72))) || (c == (104)) ) {
395
- cmd = c;
396
- require_args = 1;
397
- arg_cnt = 0;
398
- continue;
399
- }
400
- if ( (((((c == (109)) || (c == (77))) || (c == (76))) || (c == (108))) || (c == (116))) || (c == (84)) ) {
401
- cmd = c;
402
- require_args = 2;
403
- arg_cnt = 0;
404
- continue;
405
- }
406
- if ( (((c == (113)) || (c == (81))) || (c == (83))) || (c == (115)) ) {
407
- cmd = c;
408
- require_args = 4;
409
- arg_cnt = 0;
410
- continue;
411
- }
412
- if ( (c == (99)) || (c == (67)) ) {
413
- cmd = c;
414
- require_args = 6;
415
- arg_cnt = 0;
416
- continue;
417
- }
418
- if ( (c == (97)) || (c == (65)) ) {
419
- cmd = c;
420
- require_args = 7;
421
- arg_cnt = 0;
422
- continue;
423
- }
424
- if ( this.scanNumber() ) {
425
- switch (arg_cnt ) {
426
- case 0 :
427
- args.t0 = this.last_number;
428
- break;
429
- case 1 :
430
- args.t1 = this.last_number;
431
- break;
432
- case 2 :
433
- args.t2 = this.last_number;
434
- break;
435
- case 3 :
436
- args.t3 = this.last_number;
437
- break;
438
- case 4 :
439
- args.t4 = this.last_number;
440
- break;
441
- case 5 :
442
- args.t5 = this.last_number;
443
- break;
444
- case 6 :
445
- args.t6 = this.last_number;
446
- break;
447
- default:
448
- break;
449
- };
450
- arg_cnt = arg_cnt + 1;
451
- if ( arg_cnt >= require_args ) {
452
- switch (cmd ) {
453
- case 109 :
454
- callback.Move(cx + args.t0, cy + args.t1);
455
- cx = args.t0;
456
- cy = args.t1;
457
- cmd = 76;
458
- require_args = 2;
459
- cx2 = cx;
460
- cy2 = cy;
461
- break;
462
- case 77 :
463
- callback.Move(args.t0, args.t1);
464
- cx = args.t0;
465
- cy = args.t1;
466
- cmd = 76;
467
- require_args = 2;
468
- cx2 = cx;
469
- cy2 = cy;
470
- break;
471
- case 108 :
472
- callback.Line(cx + args.t0, cy + args.t1);
473
- cx = cx + args.t0;
474
- cy = cy + args.t1;
475
- cx2 = cx;
476
- cy2 = cy;
477
- break;
478
- case 76 :
479
- callback.Line(args.t0, args.t1);
480
- cx = args.t0;
481
- cy = args.t1;
482
- cx2 = cx;
483
- cy2 = cy;
484
- break;
485
- case 104 :
486
- callback.Line(cx + args.t0, cy);
487
- cx = cx + args.t0;
488
- cx2 = cx;
489
- break;
490
- case 72 :
491
- callback.Line(args.t0, cy);
492
- cx = args.t0;
493
- cx2 = cx;
494
- break;
495
- case 118 :
496
- callback.Line(cx, cy + args.t0);
497
- cy = cy + args.t0;
498
- cy2 = cy;
499
- break;
500
- case 86 :
501
- callback.Line(cx, args.t0);
502
- cy = args.t0;
503
- cy2 = cy;
504
- break;
505
- case 99 :
506
- callback.Curve(cx + args.t0, cy + args.t1, cx + args.t2, cy + args.t3, cx + args.t4, cy + args.t5);
507
- cx2 = cx + args.t2;
508
- cy2 = cy + args.t3;
509
- cx = cx + args.t4;
510
- cy = cy + args.t5;
511
- break;
512
- case 67 :
513
- callback.Curve(args.t0, args.t1, args.t2, args.t3, args.t4, args.t5);
514
- cx2 = args.t2;
515
- cy2 = args.t3;
516
- cx = args.t4;
517
- cy = args.t5;
518
- break;
519
- case 115 :
520
- callback.Curve((cx + cx) - cx2, (cy + cy) - cy2, cx + args.t0, cy + args.t1, cx + args.t2, cy + args.t3);
521
- cx2 = cx + args.t0;
522
- cy2 = cy + args.t1;
523
- cx = cx + args.t2;
524
- cy = cy + args.t3;
525
- break;
526
- case 83 :
527
- callback.Curve((cx + cx) - cx2, (cy + cy) - cy2, args.t0, args.t1, args.t2, args.t3);
528
- cx2 = args.t0;
529
- cy2 = args.t1;
530
- cx = args.t2;
531
- cy = args.t3;
532
- break;
533
- case 113 :
534
- QPx.t0 = cx;
535
- QPy.t0 = cy;
536
- QPx.t1 = cx + args.t0;
537
- QPy.t1 = cy + args.t1;
538
- QPx.t2 = cx + args.t2;
539
- QPy.t2 = cy + args.t3;
540
- CPx.t0 = QPx.t0;
541
- CPy.t0 = QPy.t0;
542
- CPx.t1 = QPx.t0 + ((2.0 / 3.0) * (QPx.t1 - QPx.t0));
543
- CPy.t1 = QPy.t0 + ((2.0 / 3.0) * (QPy.t1 - QPy.t0));
544
- CPx.t2 = QPx.t2 + ((2.0 / 3.0) * (QPx.t1 - QPx.t2));
545
- CPy.t2 = QPy.t2 + ((2.0 / 3.0) * (QPy.t1 - QPy.t2));
546
- CPx.t3 = QPx.t2;
547
- CPy.t3 = QPy.t2;
548
- callback.Curve(CPx.t1, CPy.t1, CPx.t2, CPy.t2, CPx.t3, CPy.t3);
549
- cx2 = CPx.t2;
550
- cy2 = CPy.t2;
551
- cx = CPx.t3;
552
- cy = CPy.t3;
553
- break;
554
- case 81 :
555
- QPx.t0 = cx;
556
- QPy.t0 = cy;
557
- QPx.t1 = args.t0;
558
- QPy.t1 = args.t1;
559
- QPx.t2 = args.t2;
560
- QPy.t2 = args.t3;
561
- CPx.t0 = QPx.t0;
562
- CPy.t0 = QPy.t0;
563
- CPx.t1 = QPx.t0 + ((2.0 / 3.0) * (QPx.t1 - QPx.t0));
564
- CPy.t1 = QPy.t0 + ((2.0 / 3.0) * (QPy.t1 - QPy.t0));
565
- CPx.t2 = QPx.t2 + ((2.0 / 3.0) * (QPx.t1 - QPx.t2));
566
- CPy.t2 = QPy.t2 + ((2.0 / 3.0) * (QPy.t1 - QPy.t2));
567
- CPx.t3 = QPx.t2;
568
- CPy.t3 = QPy.t2;
569
- callback.Curve(CPx.t1, CPy.t1, CPx.t2, CPy.t2, CPx.t3, CPy.t3);
570
- cx2 = CPx.t1;
571
- cy2 = CPy.t1;
572
- cx = CPx.t2;
573
- cy = CPy.t3;
574
- break;
575
- case 84 :
576
- QPx.t0 = cx;
577
- QPy.t0 = cy;
578
- QPx.t1 = (2.0 * cx) - cx2;
579
- QPy.t1 = (2.0 * cy) - cy2;
580
- QPx.t2 = args.t0;
581
- QPy.t2 = args.t1;
582
- CPx.t0 = QPx.t0;
583
- CPy.t0 = QPy.t0;
584
- CPx.t1 = QPx.t0 + ((2.0 / 3.0) * (QPx.t1 - QPx.t0));
585
- CPy.t1 = QPy.t0 + ((2.0 / 3.0) * (QPy.t1 - QPy.t0));
586
- CPx.t2 = QPx.t2;
587
- CPy.t2 = QPy.t2;
588
- callback.Curve(CPx.t0, CPy.t0, CPx.t1, CPy.t1, CPx.t2, CPy.t2);
589
- cx2 = CPx.t1;
590
- cy2 = CPy.t1;
591
- cx = CPx.t2;
592
- cy = CPy.t3;
593
- break;
594
- case 116 :
595
- QPx.t0 = cx;
596
- QPy.t0 = cy;
597
- QPx.t1 = (2.0 * cx) - cx2;
598
- QPy.t1 = (2.0 * cy) - cy2;
599
- QPx.t2 = cx + args.t0;
600
- QPy.t2 = cy + args.t1;
601
- CPx.t0 = QPx.t0;
602
- CPy.t0 = QPy.t0;
603
- CPx.t1 = QPx.t0 + ((2.0 / 3.0) * (QPx.t1 - QPx.t0));
604
- CPy.t1 = QPy.t0 + ((2.0 / 3.0) * (QPy.t1 - QPy.t0));
605
- CPx.t2 = QPx.t2;
606
- CPy.t2 = QPy.t2;
607
- callback.Curve(CPx.t0, CPy.t0, CPx.t1, CPy.t1, CPx.t2, CPy.t2);
608
- cx2 = CPx.t1;
609
- cy2 = CPy.t1;
610
- cx = CPx.t2;
611
- cy = CPy.t3;
612
- break;
613
- case 97 :
614
- const res = this.pathArcTo(callback, Vec2.CreateNew(cx, cy), args, true);
615
- cx = res.x;
616
- cy = res.y;
617
- cx2 = cx;
618
- cy2 = cy;
619
- break;
620
- case 65 :
621
- const res_1 = this.pathArcTo(callback, Vec2.CreateNew(cx, cy), args, false);
622
- cx = res_1.x;
623
- cy = res_1.y;
624
- cx2 = cx;
625
- cy2 = cy;
626
- break;
627
- default:
628
- if ( arg_cnt >= 2 ) {
629
- cx = args.t0;
630
- cy = args.t1;
631
- cx2 = cx;
632
- cy2 = cy;
633
- }
634
- break;
635
- };
636
- arg_cnt = 0;
637
- }
638
- }
639
- };
640
- };
641
- }
642
- /* static JavaSript main routine at the end of the JS file */
643
- function __js_main() {
644
- const path1 = "M130 110 C 120 140, 180 140, 170 110";
645
- const path2 = "M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80";
646
- const path3 = "M10 80 Q 95 10 180 80";
647
- const path4 = "M10 80 Q 52.5 10, 95 80 T 180 80";
648
- const path5 = "M-130 -110 C 120 140, 180 140, 170 110";
649
- const path6 = "M10 315\r\n L 110 215\r\n A 30 50 0 0 1 162.55 162.45\r\n L 172.55 152.45\r\n A 30 50 -45 0 1 215.1 109.9\r\n L 315 10";
650
- const path7 = "M 14.781 14.347 h 1.738 c 0.24 0 0.436 -0.194 0.436 -0.435 v -1.739 c 0 -0.239 -0.195 -0.435 -0.436 -0.435 h -1.738 c -0.239 0 -0.435 0.195 -0.435 0.435 v 1.739 C 14.347 14.152 14.542 14.347 14.781 14.347 M 18.693 3.045 H 1.307 c -0.48 0 -0.869 0.39 -0.869 0.869 v 12.17 c 0 0.479 0.389 0.869 0.869 0.869 h 17.387 c 0.479 0 0.869 -0.39 0.869 -0.869 V 3.915 C 19.562 3.435 19.173 3.045 18.693 3.045 M 18.693 16.085 H 1.307 V 9.13 h 17.387 V 16.085 Z M 18.693 5.653 H 1.307 V 3.915 h 17.387 V 5.653 Z M 3.48 12.608 h 7.824 c 0.24 0 0.435 -0.195 0.435 -0.436 c 0 -0.239 -0.194 -0.435 -0.435 -0.435 H 3.48 c -0.24 0 -0.435 0.195 -0.435 0.435 C 3.045 12.413 3.24 12.608 3.48 12.608 M 3.48 14.347 h 6.085 c 0.24 0 0.435 -0.194 0.435 -0.435 s -0.195 -0.435 -0.435 -0.435 H 3.48 c -0.24 0 -0.435 0.194 -0.435 0.435 S 3.24 14.347 3.48 14.347";
651
- const path8 = "M 4.423 9.141 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 4.66 9.141 4.423 9.141 M 6.997 16.861 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 7.234 16.861 6.997 16.861 M 4.423 16.861 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 4.66 16.861 4.423 16.861 M 13.861 9.998 h 0.857 c 0.236 0 0.429 -0.192 0.429 -0.429 s -0.192 -0.429 -0.429 -0.429 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.429 S 13.624 9.998 13.861 9.998 M 14.719 16.861 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.43 s 0.192 0.429 0.43 0.429 h 0.857 c 0.236 0 0.429 -0.191 0.429 -0.429 S 14.955 16.861 14.719 16.861 M 15.576 13.001 c -0.236 0 -0.429 0.192 -0.429 0.43 c 0 0.236 0.192 0.429 0.429 0.429 c 0.237 0 0.43 -0.192 0.43 -0.429 C 16.006 13.193 15.813 13.001 15.576 13.001 M 6.997 9.141 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 7.234 9.141 6.997 9.141 M 12.145 9.141 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.429 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.192 0.43 -0.429 S 12.382 9.141 12.145 9.141 M 17.722 10.856 V 7.424 c 0 -0.948 -0.769 -1.716 -1.716 -1.716 h -0.617 l -1.038 -3.873 c -0.245 -0.916 -1.186 -1.458 -2.101 -1.213 L 3.592 2.912 C 2.676 3.157 2.133 4.098 2.378 5.014 l 0.186 0.695 H 2.278 c -0.947 0 -1.716 0.768 -1.716 1.716 V 17.72 c 0 0.947 0.769 1.716 1.716 1.716 h 13.728 c 0.947 0 1.716 -0.769 1.716 -1.716 v -1.716 c 0.947 0 1.716 -0.769 1.716 -1.716 v -1.716 C 19.438 11.624 18.669 10.856 17.722 10.856 M 16.006 6.566 c 0.473 0 0.857 0.384 0.857 0.858 v 0.238 c -0.253 -0.146 -0.544 -0.238 -0.857 -0.238 h -0.157 l -0.229 -0.858 H 16.006 Z M 14.41 5.372 l 0.55 2.053 H 6.67 L 14.41 5.372 Z M 3.814 3.741 l 8.657 -2.29 c 0.458 -0.123 0.928 0.149 1.051 0.607 l 0.222 0.828 L 3.43 5.621 l -0.223 -0.83 C 3.084 4.333 3.356 3.863 3.814 3.741 M 1.42 7.424 c 0 -0.474 0.384 -0.858 0.858 -0.858 h 0.517 l 0.229 0.858 H 2.278 c -0.314 0 -0.605 0.091 -0.858 0.238 V 7.424 Z M 16.863 17.72 c 0 0.474 -0.385 0.858 -0.857 0.858 H 2.278 c -0.474 0 -0.858 -0.385 -0.858 -0.858 V 9.141 c 0 -0.474 0.384 -0.858 0.858 -0.858 h 13.728 c 0.473 0 0.857 0.384 0.857 0.858 v 1.715 h -1.716 c -0.947 0 -1.716 0.768 -1.716 1.716 v 1.716 c 0 0.947 0.769 1.716 1.716 1.716 h 1.716 V 17.72 Z M 18.58 14.288 c 0 0.474 -0.385 0.857 -0.858 0.857 h -2.574 c -0.474 0 -0.857 -0.384 -0.857 -0.857 v -1.716 c 0 -0.474 0.384 -0.858 0.857 -0.858 h 2.574 c 0.474 0 0.858 0.385 0.858 0.858 V 14.288 Z M 9.571 16.861 H 8.713 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.236 0 0.429 -0.191 0.429 -0.429 S 9.808 16.861 9.571 16.861 M 12.145 16.861 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.43 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.191 0.43 -0.429 S 12.382 16.861 12.145 16.861 M 9.571 9.141 H 8.713 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 C 9.808 9.998 10 9.806 10 9.569 S 9.808 9.141 9.571 9.141";
652
- const path9 = "M 4.423 9.141 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 4.66 9.141 4.423 9.141 M 6.997 16.861 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 7.234 16.861 6.997 16.861 M 4.423 16.861 H 3.565 c -0.237 0 -0.429 0.192 -0.429 0.43 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.191 0.429 -0.429 S 4.66 16.861 4.423 16.861 M 13.861 9.998 h 0.857 c 0.236 0 0.429 -0.192 0.429 -0.429 s -0.192 -0.429 -0.429 -0.429 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.429 S 13.624 9.998 13.861 9.998 M 14.719 16.861 h -0.857 c -0.237 0 -0.43 0.192 -0.43 0.43 s 0.192 0.429 0.43 0.429 h 0.857 c 0.236 0 0.429 -0.191 0.429 -0.429 S 14.955 16.861 14.719 16.861 M 15.576 13.001 c -0.236 0 -0.429 0.192 -0.429 0.43 c 0 0.236 0.192 0.429 0.429 0.429 c 0.237 0 0.43 -0.192 0.43 -0.429 C 16.006 13.193 15.813 13.001 15.576 13.001 M 6.997 9.141 H 6.139 c -0.237 0 -0.429 0.192 -0.429 0.429 s 0.192 0.429 0.429 0.429 h 0.858 c 0.237 0 0.429 -0.192 0.429 -0.429 S 7.234 9.141 6.997 9.141 M 12.145 9.141 h -0.857 c -0.236 0 -0.429 0.192 -0.429 0.429 s 0.193 0.429 0.429 0.429 h 0.857 c 0.237 0 0.43 -0.192 0.43 -0.429 S 12.382 9.141 12.145 9.141 M 17.722 10.856 V 7.424 c 0 -0.948 -0.769 -1.716 -1.716 -1.716 h -0.617 l -1.038 -3.873 -3 -4";
653
- const path10 = "M 16.853 8.355 V 5.888 c 0 -3.015 -2.467 -5.482 -5.482 -5.482 H 8.629 c -3.015 0 -5.482 2.467 -5.482 5.482 v 2.467 l -2.741 7.127 c 0 1.371 4.295 4.112 9.594 4.112 s 9.594 -2.741 9.594 -4.112 L 16.853 8.355 Z M 5.888 17.367 c -0.284 0 -0.514 -0.23 -0.514 -0.514 c 0 -0.284 0.23 -0.514 0.514 -0.514 c 0.284 0 0.514 0.23 0.514 0.514 C 6.402 17.137 6.173 17.367 5.888 17.367 Z M 5.203 10 c 0 -0.377 0.19 -0.928 0.423 -1.225 c 0 0 0.651 -0.831 1.976 -0.831 c 0.672 0 1.141 0.309 1.141 0.309 C 9.057 8.46 9.315 8.938 9.315 9.315 v 1.028 c 0 0.188 -0.308 0.343 -0.685 0.343 H 5.888 C 5.511 10.685 5.203 10.377 5.203 10 Z M 7.944 16.853 H 7.259 v -1.371 l 0.685 -0.685 V 16.853 Z M 9.657 16.853 H 8.629 v -2.741 h 1.028 V 16.853 Z M 8.972 13.426 v -1.028 c 0 -0.568 0.46 -1.028 1.028 -1.028 c 0.568 0 1.028 0.46 1.028 1.028 v 1.028 H 8.972 Z M 11.371 16.853 h -1.028 v -2.741 h 1.028 V 16.853 Z M 12.741 16.853 h -0.685 v -2.056 l 0.685 0.685 V 16.853 Z M 14.112 17.367 c -0.284 0 -0.514 -0.23 -0.514 -0.514 c 0 -0.284 0.23 -0.514 0.514 -0.514 c 0.284 0 0.514 0.23 0.514 0.514 C 14.626 17.137 14.396 17.367 14.112 17.367 Z M 14.112 10.685 h -2.741 c -0.377 0 -0.685 -0.154 -0.685 -0.343 V 9.315 c 0 -0.377 0.258 -0.855 0.572 -1.062 c 0 0 0.469 -0.309 1.141 -0.309 c 1.325 0 1.976 0.831 1.976 0.831 c 0.232 0.297 0.423 0.848 0.423 1.225 S 14.489 10.685 14.112 10.685 Z M 18.347 15.801 c -0.041 0.016 -0.083 0.023 -0.124 0.023 c -0.137 0 -0.267 -0.083 -0.319 -0.218 l -2.492 -6.401 c -0.659 -1.647 -1.474 -2.289 -2.905 -2.289 c -0.95 0 -1.746 0.589 -1.754 0.595 c -0.422 0.317 -1.084 0.316 -1.507 0 C 9.239 7.505 8.435 6.916 7.492 6.916 c -1.431 0 -2.246 0.642 -2.906 2.292 l -2.491 6.398 c -0.069 0.176 -0.268 0.264 -0.443 0.195 c -0.176 -0.068 -0.264 -0.267 -0.195 -0.444 l 2.492 -6.401 c 0.765 -1.911 1.824 -2.726 3.543 -2.726 c 1.176 0 2.125 0.702 2.165 0.731 c 0.179 0.135 0.506 0.135 0.685 0 c 0.04 -0.029 0.99 -0.731 2.165 -0.731 c 1.719 0 2.779 0.814 3.542 2.723 l 2.493 6.404 C 18.611 15.534 18.524 15.733 18.347 15.801 Z";
654
- /** unused: const path11 = "M10,6.536c-2.263,0-4.099,1.836-4.099,4.098S7.737,14.732,10,14.732s4.099-1.836,4.099-4.098S12.263,6.536,10,6.536M10,13.871c-1.784,0-3.235-1.453-3.235-3.237S8.216,7.399,10,7.399c1.784,0,3.235,1.452,3.235,3.235S11.784,13.871,10,13.871M17.118,5.672l-3.237,0.014L12.52,3.697c-0.082-0.105-0.209-0.168-0.343-0.168H7.824c-0.134,0-0.261,0.062-0.343,0.168L6.12,5.686H2.882c-0.951,0-1.726,0.748-1.726,1.699v7.362c0,0.951,0.774,1.725,1.726,1.725h14.236c0.951,0,1.726-0.773,1.726-1.725V7.195C18.844,6.244,18.069,5.672,17.118,5.672 M17.98,14.746c0,0.477-0.386,0.861-0.862,0.861H2.882c-0.477,0-0.863-0.385-0.863-0.861V7.384c0-0.477,0.386-0.85,0.863-0.85l3.451,0.014c0.134,0,0.261-0.062,0.343-0.168l1.361-1.989h3.926l1.361,1.989c0.082,0.105,0.209,0.168,0.343,0.168l3.451-0.014c0.477,0,0.862,0.184,0.862,0.661V14.746z" **/
655
- const ex = new PathExecutor();
656
- const parser = new EVGPathParser();
657
- parser.parsePath(path1, ex);
658
- parser.parsePath(path2, ex);
659
- parser.parsePath(path3, ex);
660
- parser.parsePath(path4, ex);
661
- parser.parsePath(path5, ex);
662
- parser.parsePath(path6, ex);
663
- const coll = new PathCollector();
664
- parser.parsePath(path6, coll);
665
- console.log(coll.getString());
666
- const coll_2 = new PathCollector();
667
- parser.parsePath(path7, coll_2);
668
- console.log(coll_2.getString());
669
- console.log(" ----- ");
670
- const coll_3 = new PathCollector();
671
- parser.parsePath(path8, coll_3);
672
- console.log(coll_3.getString());
673
- console.log(" ----- ");
674
- const coll_4 = new PathCollector();
675
- parser.parsePath(path9, coll_4);
676
- console.log(coll_4.getString());
677
- console.log(" ----- ");
678
- const coll_5 = new PathCollector();
679
- parser.parsePath(path10, coll_5);
680
- console.log(coll_5.getString());
681
- }
682
- __js_main();