Compare commits

...

321 Commits
0.28 ... 0.33

Author SHA1 Message Date
Paul Kulchenko
a7797f9d9a Updated CHANGELOG and MANIFEST for v0.33. 2012-10-22 17:52:36 -07:00
Paul Kulchenko
78e1f176a5 Updated OSX build script to include 'myprograms' folder if exists. 2012-10-22 17:44:36 -07:00
Paul Kulchenko
a592893b4d Updated Gideros interpreter to extend wait time for Gideros player to start. 2012-10-22 15:59:01 -07:00
Paul Kulchenko
1a1f25c135 Added configuration option to specify hostname when the default one is not reachable (fixes #68). 2012-10-21 13:53:42 -07:00
Paul Kulchenko
00692634a8 Updated text and added timestamp to auto-recover message. 2012-10-20 21:24:13 -07:00
Paul Kulchenko
1037389ce0 Added search for Moai and Love2d executables in default locations on OSX and Windows. 2012-10-20 21:17:34 -07:00
Paul Kulchenko
cc645ebb69 Added values from package.path to LUA_PATH that is used for processes started from the IDE. 2012-10-20 20:29:34 -07:00
Paul Kulchenko
544ada09e2 Restored animation of closing tabs when switching projects.
Using Freeze/Thaw to disable animation didn't work well as it was
interfering with popup messages (for example, when a file is modified) and
was not consistent with the behavior of opening files.
2012-10-20 20:18:36 -07:00
Paul Kulchenko
85d14ca6fd Added conversion of relative filenames to absolute when used in command line. 2012-10-20 11:37:15 -07:00
Paul Kulchenko
1d33dd6482 Added handling of command line parameters on OSX and Linux; updated documentation. 2012-10-20 10:42:04 -07:00
Paul Kulchenko
faa0e0e16d Added auto-recovery to save/restore editor content (fixes #23). 2012-10-19 13:59:55 -07:00
Paul Kulchenko
bb60b9421c Updated configuration example to avoid using ide.spec that is not available (fixes #67). 2012-10-19 12:43:11 -07:00
Paul Kulchenko
ab44438859 Updated CMake build script to handle wildcards in the MANIFEST. 2012-10-17 12:37:54 -07:00
Paul Kulchenko
a463b5fd28 Moved all Estrela features into a separate bundle that can be loaded using cfg/estrela.lua config. 2012-10-17 12:37:26 -07:00
Paul Kulchenko
d021bfa986 Fixed an issue with the current file name not showing in the title bar after startup. 2012-10-17 11:43:49 -07:00
Paul Kulchenko
beeee9e32f Removed multiple file types offered in Save As dialog.
All known types have been listed previously, which created problems
with different extensions assigned by default on different platforms.
Only the current extension is now being offered.
If the current file has no extension, then "*.*" is used as a mask.
2012-10-17 11:39:15 -07:00
Paul Kulchenko
dd682791e1 Updated changelog and documentation on configuration options. 2012-10-17 11:07:50 -07:00
Paul Kulchenko
dddcd96755 Fixed opening a non-existing file from the Recent Files list. 2012-10-16 15:09:57 -07:00
Paul Kulchenko
cb56311090 Fixed Find/Replace checkboxes on OSX (closes #63).
Fixed formatting/alignment of fields in Find/Replace dialog on OSX.
2012-10-16 15:08:14 -07:00
Paul Kulchenko
952f8325c0 Fixed Find/Replace dialog checkboxes that didn't react to clicks on OSX
(fixes #63).

It turned out that StaticBox(Sizer) needs to be created before checkboxes,
otherwise checkboxes don't get any clicks on OSX as the z-order for event
traversal appears to be incorrect.
2012-10-16 12:58:10 -07:00
Paul Kulchenko
0526fd4069 Improved reporting of compilation and run-time errors when running as scratchpad. 2012-10-14 13:54:09 -07:00
Paul Kulchenko
c0e369b175 Fixed an issue with restoring sessions with more than 9 files.
The indexes were sorted alphabetically, instead of numerically, which
caused files with indexes 1x to appear after index 1, instead of 9.
2012-10-14 09:59:01 -07:00
Paul Kulchenko
8e1d823eea Fixed an error when switching to a new project folder. 2012-10-12 17:34:24 -07:00
Paul Kulchenko
b73ef167bc Disabled closing files when switching projects if they are present in both projects. 2012-10-11 15:15:41 -07:00
Paul Kulchenko
7c889880d8 Updated autoindent rules to minimize de-indenting on already indented lines. 2012-10-11 15:13:32 -07:00
Paul Kulchenko
0387e32072 Made debugger strict.lua and LuaJIT friendly (upgraded to MobDebug v0.502). 2012-10-11 11:38:16 -07:00
Paul Kulchenko
e0c18c189a Disabled auto-complete in comments and strings. 2012-10-09 13:13:08 -07:00
Paul Kulchenko
489aaa3e8e Fixed transparency on toolbar search buttons. 2012-10-09 13:10:18 -07:00
Paul Kulchenko
fd92861998 Updated configuration examples to add editor settings and fix user.lua path. 2012-10-09 12:57:36 -07:00
Paul Kulchenko
bba9790a2a Added syntax aware indentation. 2012-10-09 12:04:44 -07:00
Paul Kulchenko
d68985c4a9 Added re/storing open files and interpreter when switching project folders. 2012-10-09 11:02:56 -07:00
Paul Kulchenko
4463cbd327 Updated changelog. 2012-10-07 21:24:46 -07:00
Paul Kulchenko
0d619b1326 Enable scratchpad support in the debugger when interpreter is capable of providing it. 2012-10-03 14:33:12 -07:00
Paul Kulchenko
8c2a4792f6 Added Gideros auto-complete and live coding support (closes #62). 2012-10-03 13:29:50 -07:00
Paul Kulchenko
0f71d4b9a0 Updated MANIFEST to add new debugger buttons. 2012-10-03 12:44:22 -07:00
Paul Kulchenko
30863a3dcc Added stopping gideros player when no connection can be made. 2012-10-02 23:32:17 -07:00
Paul Kulchenko
f74f56b917 Fixed an auto-complete issue with mixed case dynamic words (fixes #60). 2012-10-02 14:22:38 -07:00
Paul Kulchenko
a236d299de Added debugging-related buttons to the toolbar. 2012-10-02 11:57:11 -07:00
Paul Kulchenko
be54763f7e Disabled toggling breakpoints while debugger is running (as they wouldn't be changed anyway). 2012-10-02 11:52:57 -07:00
Paul Kulchenko
663b7cab8b Fixed 'Trying to solve a NULL hostname' warning message. 2012-10-02 11:51:41 -07:00
Paul Kulchenko
c68d45d697 Changed path for user.lua from .ZeroBraneStudio to .zbstudio to avoid name conflict on Linux (helps #44). 2012-10-02 11:49:37 -07:00
Paul Kulchenko
8b7407c3f2 Updated gideros integration to avoid blocking the IDE when the bridge does not respond; enabled debug output on OSX. 2012-10-02 11:46:13 -07:00
Paul Kulchenko
1b29f2e05f Added Gideros integration on OSX; added search for gideros in default locations on Windows and OSX. 2012-10-01 10:40:52 -07:00
Paul Kulchenko
8d4ce56619 Added Gideros integration and debugging support. 2012-09-30 21:49:52 -07:00
Paul Kulchenko
67da97f32f Disabled 'Run as Scratchpad' in the menu for those intepreters that don't support scratchpad. 2012-09-30 21:47:39 -07:00
Paul Kulchenko
46aa3575cf Merge branch 'linux' of https://github.com/toiffel/ZeroBraneStudio 2012-09-29 17:20:43 -07:00
Paul Kulchenko
acc635b9b5 Updated readme with screenshot and changelog with recent changes. 2012-09-29 16:47:02 -07:00
toiffel
99e64f51cd Sort files by name in project filetree only on Linux 2012-09-29 11:39:03 +07:00
toiffel
9002286bcf Fixed mouse cursor behavior in scratchpad mode on Linux (for real this time) 2012-09-29 11:39:03 +07:00
Paul Kulchenko
72b5690689 Added zbstudio.sh script to run on OSX/Linux; updated permissions (closes #15). 2012-09-28 15:13:41 -07:00
Paul Kulchenko
e488ed095c Disabled 'not activated file for debugging' message when auto-activation is disabled. 2012-09-28 14:32:07 -07:00
Paul Kulchenko
9c54fb6507 Fixed a typo that prevented a corner case in autocomplete from working. 2012-09-28 14:16:25 -07:00
Paul Kulchenko
065422fa2d Fixed inconsistent error messages about various config files. Changed searching for user config in '$HOME/.ZeroBraneStudio' from '$HOME/.zbs'. 2012-09-28 10:32:20 -07:00
Paul Kulchenko
0c2d6b6d48 Added variable ratio for sliders in scratchpad.
The ratio depends on the number being adjusted. 1 will change to 2, but
1.1 will change to 1.2 and 1.01 will change to 1.02. 0.99 will change to
1.00 to preserve the ratio.
2012-09-27 10:59:19 -07:00
Paul Kulchenko
89cc631a58 Added editor.autoactivate parameter (false by default) to specify if files should be opened by the debugger. 2012-09-27 09:18:01 -07:00
Paul Kulchenko
83e725ef97 Fixed an issue with auto-complete when dot or colon is used (fixes #56). 2012-09-27 09:15:16 -07:00
Paul Kulchenko
76ec0de7ab Reorganized files and removed those that are no longer needed. 2012-09-26 20:00:58 -07:00
Paul Kulchenko
38a176d84f Updated a warning message about single instance communication. 2012-09-25 22:15:49 -07:00
Paul Kulchenko
3bb22f4c48 Added auto-activation of files requested during debugging. 2012-09-25 22:15:07 -07:00
Paul Kulchenko
7b60461787 Fixed an issue with debugging scripts started using absolute file path. 2012-09-25 22:02:28 -07:00
Paul Kulchenko
843024ec1d Fixed setting working directory for interpreters to the file path when the project directory is not set. 2012-09-25 10:22:24 -07:00
Paul Kulchenko
b4e1dda0d9 Fixed an issue with Backspace not closing auto-complete suggestions. 2012-09-25 10:20:29 -07:00
Paul Kulchenko
394c93e9e6 Merge branch 'linux' of https://github.com/toiffel/ZeroBraneStudio 2012-09-24 22:43:25 -07:00
toiffel
ded66391ac CMakeLists.txt moved to build folder 2012-09-25 11:22:35 +07:00
Paul Kulchenko
d81de133a9 Updated MobDebug to v0.497 to fix issues and improve performance.
Performance improvements.
Added conversion of file names on windows to lower case to make
breakpoints work.
Added reporting errors in deserializing stack data.
Fixed an issue with returning stack values with circular references.
Fixed an issue with wx IDLE event on Linux.
2012-09-24 17:03:56 -07:00
Paul Kulchenko
0f6316619f Added configuration parameter for the number of characters typed before displaying auto-complete suggestions for dynamic words. 2012-09-24 17:01:23 -07:00
Paul Kulchenko
ab8a38fd79 Added proper closing of the application after Shutdown/Logoff events (fixes #57). 2012-09-23 21:37:29 -07:00
Paul Kulchenko
c91d287025 Fixed enabling items in the Edit menu (fixes #56). 2012-09-23 20:30:18 -07:00
toiffel
9fa8c7a972 Small regex fixes 2012-09-24 07:53:18 +07:00
toiffel
ce90e7898f Support for MANIFEST files 2012-09-24 07:10:53 +07:00
toiffel
4cafb3c201 Removed estrela frontend, disabled system mobdebug 2012-09-24 01:29:54 +07:00
toiffel
60bc64283d OS X port of CMakeLists.txt 2012-09-22 22:42:37 +07:00
toiffel
83dc1c5065 unix_starter.cpp replaced with shell script 2012-09-22 01:24:16 +07:00
toiffel
124f70d342 Windows port of CMakeLists.txt 2012-09-22 01:24:16 +07:00
toiffel
1400bf6b3d Added icons of different sizes for Linux hicolor theme 2012-09-22 01:24:16 +07:00
toiffel
8f26e2df17 Added Linux .desktop file 2012-09-22 01:24:16 +07:00
toiffel
49b9b66394 Support for install in CMakeLists.txt 2012-09-22 01:24:16 +07:00
toiffel
ee9fe71657 Added system introspection to CMakeLists.txt 2012-09-22 01:24:16 +07:00
toiffel
ba0efe224a Implemented unix_starter.cpp 2012-09-22 01:24:16 +07:00
toiffel
96516c9454 Added initial CMakeLists.txt and unix_starter.cpp stub 2012-09-22 01:24:16 +07:00
toiffel
e6b8533cf9 - Fixed small UI issues with toolbar buttons
- Sort items by name in file tree
2012-09-22 01:24:15 +07:00
Paul Kulchenko
185ebb5bbf Added Moai auto-complete (closes #52). 2012-09-20 17:26:19 -07:00
Paul Kulchenko
f8b447425e Fixed function list in the toolbar on Mac (helps #14). 2012-09-20 11:12:57 -07:00
Paul Kulchenko
7330ac21ad Disabled tooltip when scratchpad is on (fixes #51). 2012-09-19 15:56:43 -07:00
Paul Kulchenko
e6bd7af1d7 Fixed deleting of comment blocks with hidden markup (fixes #40). 2012-09-19 15:54:28 -07:00
Paul Kulchenko
979b318647 Added hiding auto-complete suggestions on losing focus in the editor. 2012-09-18 17:57:29 -07:00
Paul Kulchenko
16a5934c52 Fixed an issue with function list when all editor tabs are closed. 2012-09-18 17:52:05 -07:00
Paul Kulchenko
2d22060e2c Disabled showing calltip when the editor is not in focus. 2012-09-14 21:59:41 -07:00
Paul Kulchenko
82071e6ce1 Added proper reporting of errors in the stack window. 2012-09-13 16:34:55 -07:00
Paul Kulchenko
6a23d09821 Fixed multiple calltips shown on Linux (helps #15).
On Linux DWELLSTART event seems to be generated even for those editor
windows that are not active. What's worse, when generated the event
seems to report "old" position when retrieved using event:GetX and
event:GetY, so instead we use wxGetMousePosition.
2012-09-12 18:04:48 -07:00
Paul Kulchenko
c4b9d3e31c Disabled showing calltip over markup in comments. 2012-09-12 17:45:13 -07:00
Paul Kulchenko
9b50cb3525 Fixed an issue with mouse cursor in scratchpad not properly updated on Linux (fixes #49; helps #15). 2012-09-11 20:06:15 -07:00
Paul Kulchenko
49e56f8f3c Fixed an issue with static analyzer that failes on function names like a.b.c (fixes #50). 2012-09-11 20:03:29 -07:00
Paul Kulchenko
a84f362c1f Fixed disabling Paste menu on Linux when needed (fixes #46; helps #15). 2012-09-11 11:23:29 -07:00
Paul Kulchenko
cfe5b37041 Fixed an issue with context menu on Linux (fixes #47; helps #15). 2012-09-11 11:21:25 -07:00
Paul Kulchenko
e9351c7fde Resolved conflict between lua executable names on Windows and Mac. 2012-09-11 11:17:32 -07:00
Paul Kulchenko
305f48ef6f Added wxlua.deb file and install script that pull and build all required dependencies on Linux (covers most of #15). 2012-09-10 22:27:08 -07:00
Paul Kulchenko
5ccafe93a8 Added osx executables and build files. 2012-09-10 22:20:46 -07:00
Paul Kulchenko
0f14a54843 Updated configuring toolbar size to improve Linux compatibility. 2012-09-10 21:04:42 -07:00
Paul Kulchenko
ac4a2598a3 Fixed debugger failure when debugging is initiated externally and there is an unsaved file in one of editor tabs. 2012-09-10 21:03:37 -07:00
Paul Kulchenko
66fdef6088 Fixed stopping the debugger when an editor tab where debugging happens is closed.
Closing tab didn't work when the debugging session was initiated
externally and not by the IDE.
2012-09-08 23:33:56 -07:00
Paul Kulchenko
4685fed4bb Updated cpath processing to allow Linux version to run side-by-side with Windows and Mac. 2012-09-07 23:36:02 -07:00
Paul Kulchenko
c4a3036794 Added disabling full screen mode when the last editor tab is closed. 2012-09-07 23:13:39 -07:00
Paul Kulchenko
fa5c31a7ec Fixed enabling of several menu items with no editor tab (fixes #42).
Fixed saveAll to allow saving of untitled.lua files;
  Disabled show tooltip if there is no editor tab;
  Disabled save if there is no editor tab;
  Disabled show prev/next in search if there is no editor tab;
  Enabled search/replace in files even if there is no editor tab;
  Disabled switching to fullscreen if there is no editor tab.
2012-09-07 22:34:24 -07:00
Paul Kulchenko
985b2c288b Fixed an issue with loading stock icons on Linux. 2012-09-07 12:15:35 -07:00
Paul Kulchenko
722378debb Added proper reporting of errors in config files. 2012-09-07 12:14:22 -07:00
Paul Kulchenko
4c37b51ae1 Added toggling folders in project pane by single click (fixes #41). 2012-09-07 12:13:12 -07:00
Paul Kulchenko
3e5f0ebf4d Added examples for configuring tabs and moai entry points. 2012-09-07 09:11:01 -07:00
Paul Kulchenko
fa522ae36b Added reporting compilation success rate (fixes #39) 2012-09-06 13:22:36 -07:00
Paul Kulchenko
6b85e36fd6 Updated licensing information. 2012-09-06 11:58:22 -07:00
Paul Kulchenko
fc420943b2 Added shortcuts for adding and removing watches. 2012-09-05 16:21:13 -07:00
Paul Kulchenko
989603655a Added highlighting rows with updated values in the Watch window. 2012-09-05 15:21:38 -07:00
Paul Kulchenko
543c0d7fad Added 'Add Watch Expression' and 'Evaluate in Console' context menu items in the editor. 2012-09-05 15:19:30 -07:00
Paul Kulchenko
cfd0d98270 Added handling of canceling editing in adding a watch. 2012-09-05 15:15:45 -07:00
Paul Kulchenko
e802e38dc2 Fixed Cut/Copy menu items to reflect proper status in the editor. 2012-09-05 11:34:28 -07:00
Paul Kulchenko
ac566de0ba Fixed typo in the static analyzer output 2012-09-04 16:31:17 -07:00
Paul Kulchenko
8419287316 Updated changelog for v0.32 2012-09-03 16:53:50 -07:00
Paul Kulchenko
27d1d159f6 Added configuration option for specifying entry points for moai projects (moai.entrypoints). 2012-09-02 21:21:05 -07:00
Paul Kulchenko
491d37038a Added changelog. 2012-09-02 19:58:16 -07:00
Paul Kulchenko
67eee4f9ef Corrected an image with Lua files used in the project tree 2012-09-02 14:23:40 -07:00
Paul Kulchenko
552a7373ca Switched moai to starting debugging right away without stopping on the first line. 2012-09-01 22:54:06 -07:00
Paul Kulchenko
376a25dfdd Added option to start debugging without stopping on the first line. 2012-09-01 22:53:38 -07:00
Paul Kulchenko
7945a09811 Fixed an issue with debugger not activating files with relative path information 2012-08-31 16:20:56 -07:00
Paul Kulchenko
327f650121 Fixed 'break' command to work after coming from debugger calls (like on()) 2012-08-31 15:58:10 -07:00
Paul Kulchenko
9bceb449e8 Added an IO filter to fix an issue with 0d0d0a line endings on Windows.
Scintilla doesn't strictly follow SetEOLMode setting and accepts both 0d
and 0d0a (and possibly 0a too) as line endings on Windows. Unfortunately,
the standard Lua interpreter does the right thing and only recognizes 0d0a
as the valid marker. This means line numbers are going to be different in
two cases, which creates a problem for breakpoints during debugging.
2012-08-31 15:48:37 -07:00
Paul Kulchenko
4278c25c60 Fixed an issue with highlighting selected item in the project tree.
An attempt to unhighlight the current item (that could have been
removed from the tree when the project directory is changed) led to
a crash of the application on OSX (but not on Windows).
2012-08-31 15:13:33 -07:00
Paul Kulchenko
7f47506eae Upgraded to mobdebug v0.489 to add support for debugging moai callbacks 2012-08-30 12:20:44 -07:00
Paul Kulchenko
b0b137eaf1 Added refresh of Stack and Watch windows to show updated values after executing a statement in remote shell 2012-08-30 12:13:32 -07:00
Paul Kulchenko
d1d29ced43 Added display of complex values on multiple lines in shell with '=' 2012-08-30 11:40:47 -07:00
Paul Kulchenko
2795d4d9ce Added rockspec to the list of extensions for lua (fixes #37) 2012-08-29 14:17:56 -07:00
Paul Kulchenko
02845f2e87 Added a check to avoid evaluating keywords in tooltip 2012-08-29 11:54:54 -07:00
Paul Kulchenko
ec46531c55 Merge branch 'master' of git://estrelaeditor.git.sourceforge.net/gitroot/estrelaeditor/estrelaeditor 2012-08-28 23:00:22 -07:00
Paul Kulchenko
9895f06f97 Added correctly stripped version of wx.dll (used --strip-unneded instead of --strip-all) 2012-08-28 22:39:31 -07:00
Paul Kulchenko
a67feb86aa Added current interpreter to the status bar; adding closing debugger when the interpreter is changed 2012-08-28 21:57:52 -07:00
Paul Kulchenko
6b990b652c Updated status bar style to make it consistent across platforms 2012-08-28 21:56:21 -07:00
Paul Kulchenko
7a2326cc9e Fixed evaluation of foo:bar in tooltip (now evaluates as foo.bar) 2012-08-28 21:26:59 -07:00
crazybutcher
e129f486d9 Merge remote-tracking branch 'zbstudio/master'
Conflicts:
	bin/lua51.dll
2012-08-25 15:48:54 +02:00
Paul Kulchenko
c09d9fc143 Updated wx.dll to include missing dependencies: libstdc++-6.dll and libgcc_s_dw2-1.dll (fixes #33) 2012-08-22 22:45:37 -07:00
crazybutcher
52ef014941 updated GLSL to 4.3 status
cg tool: glsl compilation no longer requires a selected word (main is always entry)
2012-08-22 16:53:45 +02:00
Paul Kulchenko
e79fedf764 Added aborting scratchpad processing when an interpreter can't start or report a fatal error 2012-08-20 21:25:34 -07:00
Paul Kulchenko
b7544577df Refactored LUA_PATH/CPATH processing to set it for all interpreters 2012-08-20 21:23:33 -07:00
Paul Kulchenko
53110b3b2f Updated wx.dll to fix scratchpad processing.
Partially reverted wxlua commit r104
(http://wxlua.svn.sourceforge.net/viewvc/wxlua?view=revision&revision=104).
2012-08-20 21:18:54 -07:00
Paul Kulchenko
d6ee3d1278 Added calltip on mouseover for functions during editing and for variables/expressions during debugging 2012-08-20 11:18:15 -07:00
Paul Kulchenko
c0109a26d1 Added a workaround for GetExecutablePath() reporting 'wx.dll' instead of a proper exe name with wxlua 2.8.12.2 on Windows 2012-08-20 10:47:57 -07:00
Paul Kulchenko
2a706f5bf3 Updated test module to use stringified values for comparison 2012-08-20 08:55:49 -07:00
Paul Kulchenko
1f266e04ab Added moai to the manifest 2012-08-19 23:25:13 -07:00
Paul Kulchenko
f45d6f84a3 Changed reporting of program execution time from CPU time to user time 2012-08-18 23:24:53 -07:00
Paul Kulchenko
76b8b7b07b Reassigned hotkeys in the Project menu to minimize conflicts on Mac 2012-08-18 23:22:20 -07:00
Paul Kulchenko
d45f893943 Fixed debugger termination after internal errors 2012-08-18 16:54:14 -07:00
Paul Kulchenko
53e725cf03 Removed .bak files from being replaced in when backup copies are saved 2012-08-18 16:41:12 -07:00
Paul Kulchenko
8a66df19fa Added support for unicode path files on Windows (fixes #30).
Replaced GetCwd() with wx.wxStandardPaths.Get():GetExecutablePath() as the
former doesn't return proper unicode path (at least in wxlua 2.8.12.2).
Replaced io.open with wxFile operations and disabled default error reporting.
Replaced os.rename with wxRenameFile.
Added support for unicode in dofile for Lua (replaced unicode names with
short names using winapi).
Fixed navigation in the Output window to recognize unicode file names.
Upgraded to MobDebug v0.485 to make debugging/breakpoints/step work for
files with unicode paths.
2012-08-17 22:14:27 -07:00
Paul Kulchenko
13be57ae39 Added an option to set path to lua executable 2012-08-16 17:32:43 -07:00
Paul Kulchenko
684150714f Updated love2d interpreter to use the project folder to check for
main.lua.

This allows Run/Debug project with any project file being currently active.
2012-08-11 22:27:41 -07:00
Paul Kulchenko
01e23f448e Fixed activating current file in the project tree on Mac (closes #29) 2012-08-11 22:25:38 -07:00
crazybutcher
036ec3534a modified slightly so ffitoapi can be run standalone 2012-08-11 15:37:51 +02:00
crazybutcher
af57806c69 updated luxinia2's glewgl and added anttweakbar 2012-08-11 15:36:19 +02:00
Paul Kulchenko
a4773563e9 Fixed running scripts with single quotes in path names 2012-08-07 20:10:52 -07:00
Paul Kulchenko
195c463a60 Added error handler to trap and display debugger errors 2012-08-07 19:56:07 -07:00
Paul Kulchenko
8cbf20ae42 Removed explicit path conversions and comparisons 2012-08-07 19:54:36 -07:00
Paul Kulchenko
a11bd6f0d3 Added search in PATH for love2d executable 2012-08-07 18:14:57 -07:00
Paul Kulchenko
1fc12a8a76 Fixed an issue with Run/Debug commands when IDE path includes exclamation mark ('!') 2012-08-07 17:01:26 -07:00
Paul Kulchenko
9a1e681569 Updated moai support to use full path to executable and to search for config.lua 2012-08-07 12:38:08 -07:00
Paul Kulchenko
43083742e6 Updated coroutine debugging to allow stepping through coroutine.resume/.yield calls 2012-08-06 16:40:29 -07:00
Paul Kulchenko
9a5b481189 Changed the call to unhide windows to the async version (ShowWindowAsync) to avoid blocking the IDE when the application doesn't respond 2012-08-05 21:07:22 -07:00
Paul Kulchenko
565f8e74fb Signed zbstudio executable to avoid issues with files not being saved without admin privileges and to remove warning about 'unknown publisher' on windows (fixes #25) 2012-08-05 18:05:17 -07:00
Paul Kulchenko
b1b87e9013 Fixed an issue with the app not starting on those systems that don't have HOME environment variable; fixes #28 2012-08-05 18:00:02 -07:00
Paul Kulchenko
539eddbf9d Fixed an issue with showing/hiding GUI windows that was occasionally causing a runtime error when the window disappears before it is manipulated 2012-08-03 12:43:58 -07:00
Paul Kulchenko
0abcff015e Added moai interpreter 2012-08-02 17:51:32 -07:00
Paul Kulchenko
7bb74b5fb4 Fixed returning proper name for unsaved files in reporting compilation and static analysis results; moved default names to ide.config (fixes #26) 2012-08-01 16:30:35 -07:00
Paul Kulchenko
b9bc6454b4 Added reporting of function name of the form a.b and a:b in static analysis (fixes #27) 2012-08-01 15:49:37 -07:00
Paul Kulchenko
5734455818 Merge branch 'master' of github.com:pkulchenko/ZeroBraneStudio 2012-08-01 15:07:06 -07:00
Paul Kulchenko
e6e0870a11 Merge pull request #24 from Odie/master
Added ability for user to keep their settings file in their home directory
2012-08-01 15:06:07 -07:00
Paul Kulchenko
2c45207436 Fixed pasting text into the Find dialog and project path box on Mac (fixes #22) 2012-08-01 15:02:36 -07:00
Jonathan Shieh
bf09d3748c Added per user settings file.
Users can now move their settings file to ~/.zbs/user.lua
2012-08-01 10:54:40 +08:00
Paul Kulchenko
452f99826e Upgraded to wxlua 2.8.12.2 (wxwidgets 2.8.12; unicode version); added
lua51.dll proxy (fixes #10 and #7)
2012-07-30 23:11:30 -07:00
Paul Kulchenko
bbfc1c3624 Reorganized handling of automcomplete event (to use AddPendingEvent instead of PostEvent) to avoid runtime application error 2012-07-30 23:02:47 -07:00
Paul Kulchenko
429bb24cb4 Upgraded to mobdebug 0.479 to fix bugs with localization of variables during debugging and handling dashes in paths; added support for coroutine debugging and on/off methods to enable debugging for selected code fragments (to improve performance under the debugger) 2012-07-25 23:10:23 -07:00
Paul Kulchenko
2a8e7fe423 Added ignoring Cmd-key combinations on Mac as this should be handled by wxwidgets, but is not (fixes #19) 2012-07-25 16:19:13 -07:00
Paul Kulchenko
cf1a657b80 Updated manifest to add testwell module 2012-07-23 21:13:52 -07:00
crazybutcher
cf6b328a52 lua51 dll forwards to lua5.1.dll 2012-07-22 10:42:05 +02:00
crazybutcher
b0f98f30dc bugfix in interpreter setting 2012-07-21 11:51:56 +02:00
crazybutcher
5c0bf93d9c Merge remote-tracking branch 'zbstudio/master'
Conflicts:
	interpreters/luxinia2.lua
2012-07-21 10:45:23 +02:00
Paul Kulchenko
7b2241085d Added refresh of filetree on MacOS to get it displayed correctly when the app is started 2012-07-14 11:45:57 -07:00
Paul Kulchenko
c9cfd42d34 Corrected resetting of project directory when it's already set and doesn't need to be changed 2012-07-13 23:30:13 -07:00
Paul Kulchenko
c25c56069d Added handling of balanced brackets in markup links 2012-07-13 22:43:27 -07:00
Paul Kulchenko
a68e8f7bd3 Added unit test module 2012-07-13 22:42:35 -07:00
Paul Kulchenko
fc6de036e0 Reorganized handling of font configuration and added font config for filetree (with a different size default on MacOS) 2012-07-13 09:54:52 -07:00
Paul Kulchenko
08d42a2501 Removed setting the editor font in the config as the default font is different on different platforms 2012-07-12 22:07:10 -07:00
Paul Kulchenko
da32878984 Added reporting the number of traced lines during debugging 2012-07-12 14:21:56 -07:00
Paul Kulchenko
3fd5d88656 Reset project directory if the current one doesn't exist 2012-07-11 23:16:33 -07:00
Paul Kulchenko
7d9ad5100c Fixed markup styling and file tree drawing on MacOS 2012-07-11 16:11:11 -07:00
Paul Kulchenko
6bff634446 Added explicit calls to CreateBitmap as wxArtProvider.GetBitmap doesn't alway call a custom art provider on MacOS (2.8.12) and in some cases on msWin (2.8.7) 2012-07-11 13:24:45 -07:00
Paul Kulchenko
b0de487bf0 Fixed detecting executable name in commands with spaces 2012-07-11 13:21:22 -07:00
Paul Kulchenko
560d56835a Fixed typo 2012-07-11 13:20:35 -07:00
Paul Kulchenko
3c6a06f537 Added setting of PATH and CPATH to find proper libs on windows and mac os platforms 2012-07-11 11:24:33 -07:00
Paul Kulchenko
b1f3bf0bd9 Fixed incorrect folders reported in the file tree when no project directory is set and a file is open 2012-07-10 23:32:38 -07:00
Paul Kulchenko
6ea3a4708d Fixed incorrect filename reported in compile errors when the file is not saved 2012-07-10 22:31:06 -07:00
Paul Kulchenko
4de0eb1dc0 Made 'View Stack Window' and 'View Watch Window' refresh window content if it's already shown 2012-07-07 15:08:58 -07:00
Paul Kulchenko
c2f6ed6338 Removed extension from the template to match folders to make it more portable 2012-07-07 11:49:30 -07:00
Paul Kulchenko
fad7ff0cc3 Updated matching of links to make them less greedy (to avoid capturing link terminators) 2012-07-07 11:46:41 -07:00
Paul Kulchenko
9afa35f9b2 Upgraded deprecated constants and logic for compatibility with wxwidgets 2.9.x 2012-07-06 20:54:11 -07:00
Paul Kulchenko
3a5b46f65e Fixed an error thrown when a window with debugging is closed before the application being debugged is terminated 2012-07-06 20:51:01 -07:00
Paul Kulchenko
26d0908c89 Added scratchpad support for love2d 2012-07-03 13:00:18 -07:00
Paul Kulchenko
770db579d9 Added reset of 'modified' status to keep tab names and their config settings correct upon exit 2012-07-03 12:47:18 -07:00
Paul Kulchenko
8e09ed1658 Fixed incorrect storing of settings for editor tabs with the same text (filename). This was causing only one tab displayed for multiple StyledText controls with interesting effects 2012-07-02 11:53:24 -07:00
Paul Kulchenko
25ac96d39a Removed styling of function calls and capturing definitions in strings and comments (fixed #18) 2012-07-01 22:11:03 -07:00
Paul Kulchenko
22fda661ec Updated matching logic for function definitions to allow for a.b.c() definitions (fixes #17) 2012-07-01 21:59:13 -07:00
Paul Kulchenko
529a0e8c9e Added window title update and filetree refresh after SaveAs command 2012-07-01 15:13:12 -07:00
Paul Kulchenko
7cc061e18d Fixed an issue with launching a process when its output is not redirected to the IDE (fixes #16). Added callback for all started processes to make them call OnTerminate event upon completion 2012-07-01 09:44:00 -07:00
Paul Kulchenko
5f2226bac2 Fixed console to evaluate 'function a() ... end' without errors 2012-06-30 11:12:30 -07:00
Paul Kulchenko
37795c2480 Added tooltip to display variable/expression values during debugging 2012-06-30 11:04:48 -07:00
Paul Kulchenko
5e934dfd69 Added checks around ShowFullScreen() calls to avoid failures on those systems that don't provide it (linux/GTK) 2012-06-29 23:39:53 -07:00
Paul Kulchenko
f970ba38a0 Removed setting focus to the Output window when output is processed as it interfered with Run as Scratchpad 2012-06-29 23:35:35 -07:00
Paul Kulchenko
8af6c1b5b6 Fixed a compilation error caused by shebang in scripts 2012-06-29 16:58:25 -07:00
Paul Kulchenko
0777a5fbd8 Added check for debugger calls to avoid errors when debugger is not loaded 2012-06-29 15:31:09 -07:00
Paul Kulchenko
942681e246 Fixed an issue with love2d path with spaces 2012-06-28 20:05:35 -07:00
Paul Kulchenko
ce8f120e48 Improved logic in love2d integration to distinguish Debug and Run commands
(closes #13)
2012-06-28 10:24:13 -07:00
Paul Kulchenko
048fd2349a Updated menus to avoid conflicts with MacOS shortcuts 2012-06-26 22:13:52 -07:00
Paul Kulchenko
2627957e5a Updated logic creating menubar to make it work correctly on MacOS with special Help/About items 2012-06-26 21:32:06 -07:00
Paul Kulchenko
16b0ca0fc7 Updated path handling to better detect how the app is started and to avoid loading dlls on non-windows platforms 2012-06-26 19:29:00 -07:00
Paul Kulchenko
e3189ba38a Updated logic for detecting hostname (used in the debugger) to make sure it is resolvable 2012-06-26 19:11:39 -07:00
Paul Kulchenko
ad48622f68 Fixed aborting running/debugged programs on MacOS by adding MAKE_GROUP_LEADER option to wxExecute 2012-06-26 19:06:14 -07:00
Paul Kulchenko
0a9439ad22 Added display of hierarchical data in Stack window 2012-06-25 18:23:26 -07:00
Paul Kulchenko
a7577d5054 Updated Analyze output 2012-06-25 18:22:20 -07:00
Paul Kulchenko
668cdcb4db Added auto complete for love2d API 2012-06-25 14:47:21 -07:00
crazybutcher
46da5b6697 Merge remote-tracking branch 'zbstudio/master'
Conflicts:
	src/editor/debugger.lua
2012-06-25 22:34:07 +02:00
Paul Kulchenko
4ec3e87473 Added support for debugging processes running under LuaJIT (requires MobDebug v0.467+) 2012-06-24 22:01:02 -07:00
Paul Kulchenko
90b4f38223 Added love2d support 2012-06-24 17:52:59 -07:00
Paul Kulchenko
c1918e5c38 Removed extensions from launch commands and updated display logic in the Output window 2012-06-24 16:40:10 -07:00
Paul Kulchenko
34baaa9447 Fixed an issue in the logic for setting breakpoints, which ignored breakpoints in luxinia2 debug sessions 2012-06-24 16:00:25 -07:00
Paul Kulchenko
817938593a Fixed logic in the local/remote console that returned incorrect error message on executing code like '%s':format(1); expressions are evaluated first now and the order of evaluation is consistent between local and remote consoles 2012-06-23 23:55:59 -07:00
Paul Kulchenko
b944f9d01d Fixed IDs for Project menu items to allow them to be removed from the menu if needed 2012-06-23 23:53:34 -07:00
Paul Kulchenko
5d4b2395b5 Added execution time and updated messages in the Output window to be more consistent 2012-06-23 13:33:29 -07:00
crazybutcher
80f83d781e fix regression, make luxinia2 debuggable again (still issues left with breaking and adding breakpoints when none were active) 2012-06-23 12:02:42 +02:00
Paul Kulchenko
f9ab1546ff Added displaying 'nil' values in local console when no result is returned by an expression 2012-06-20 21:36:04 -07:00
Paul Kulchenko
971e7c8316 Disabled Stack and Watch updates when scratchpad is active as they interfere with application execution 2012-06-20 21:30:42 -07:00
Paul Kulchenko
60a89b8f32 Fixed an app running without debugger when 'stack' command is sent immediately after an external application connects to the debugger 2012-06-20 19:21:25 -07:00
Paul Kulchenko
7275f0d11a Fixed an issue with remote application not terminating when IDE is closed while debugging is in progress 2012-06-20 18:19:40 -07:00
Paul Kulchenko
35213d7d3b Added a check to refuse starting a new debugging session if there is one in progress already 2012-06-20 17:02:05 -07:00
Paul Kulchenko
cde26253e3 Fixed sending breakpoints set before establishing a debugging session started from another process that connects to the IDE debugger 2012-06-20 16:54:50 -07:00
Paul Kulchenko
b45c0600c7 Added handling of tail calls in the Stack window 2012-06-20 16:33:24 -07:00
Paul Kulchenko
5784dea99a Fixed refreshing a modified file when the editor is set to read-only mode 2012-06-19 12:24:06 -07:00
Paul Kulchenko
e880fdde60 Added pretty printing in Watch and Console (local and remote) windows and handling of multiple results in Console 2012-06-19 09:34:32 -07:00
Paul Kulchenko
b7d8512b7b Added Stack window to display stack information and local/upvalue values for each stack frame 2012-06-18 14:53:10 -07:00
Paul Kulchenko
a7a8f32c91 Fixed saving/restoring configuration of 'Output'/'Console' tabs when IDE is closed while debugging is in progress 2012-06-16 17:31:21 -07:00
Paul Kulchenko
9fc4ab5e9b Fixed removing variable name in Watch window after escaping editing 2012-06-15 16:39:51 -07:00
Paul Kulchenko
37434534cc Fixed #9 as it had incorrect logic in one of UTF filters 2012-06-11 08:24:27 -07:00
Paul Kulchenko
fc03c2843b Fixed ability to set font encoding for 'Output' and 'Console' windows in the config 2012-06-10 16:01:24 -07:00
Paul Kulchenko
2abbad04ac Added ability to set font encoding in the config 2012-06-10 15:40:14 -07:00
Paul Kulchenko
dbb392e009 Moved processing of user.lua to a later phase after tools and specs are
already loaded to allow modification of IDE configuration from `user.lua`.
Closes #5.

Added example to user-sample.lua on how the configuration can be modified.
2012-06-09 18:57:11 -07:00
Paul Kulchenko
65947ff924 Added checks to prevent text modification in 'Output' and 'Console'
windows. Fixes #8.

Text modifications are checked against (1) direct input, (2) actions using
context menu, and (3) move/copy using selection and mouse drag and drop.
Added input marker to the 'Output' window to indicate where input is
expected.
2012-06-09 17:17:24 -07:00
Paul Kulchenko
d8324b269d Fixed edit menu shortcuts to work in the 'Output' window (when allowed) 2012-06-08 16:44:17 -07:00
Paul Kulchenko
ac9c2e9a84 Added ability to interact with scripts by allowing text to be entered in the 'Output' window.
This is controlled by ide.config.allowinteractivescript variable".
 The window is only activated and switched into read-write mode after
 there is some output to it.
2012-06-08 13:07:48 -07:00
Paul Kulchenko
3b2fcfd1f9 Added restoring cursor position when a modified file is reloaded in the editor; removed unnecessary isFileAlteredOnDisk check 2012-06-08 13:01:44 -07:00
Paul Kulchenko
14fe7af771 Fixed reporting of processes that failed to start after 'Run' or 'Debug' commands 2012-06-07 14:13:17 -07:00
Paul Kulchenko
7b0405bc79 Fixed executable path matching to work on systems that don't have file extensions 2012-06-07 13:52:50 -07:00
Paul Kulchenko
fc6b0c176d Cleaned up ShellSupportRemote interface to remove a parameter not being used 2012-06-07 13:51:20 -07:00
Paul Kulchenko
5c50a2645b Improved reporting in static analysis for functions and global variables.
Added "unknown global function...".
Added "unused local function...".
Added "local function ... masks...".
Updated reporting of unused global to "first use of unknown global" to
minimise the number of instances reported until globals assigned through
"required" modules are recognized.
2012-06-05 16:15:02 -07:00
Paul Kulchenko
11cfbfa68d Fixed localization of variables in several places 2012-06-05 15:37:30 -07:00
Paul Kulchenko
e6b318c643 Fixed #3 'unused parameter...' check not to fail on anonymous functions that are part of an expression 2012-06-05 14:06:40 -07:00
Paul Kulchenko
1351db6114 Several fixes to the static code analyzer.
"Unknown global" is only reported once per line.
"First assignment to global..." is fixed to only report when the variable
is on the left side of the assignment.
"Value discarded" warning is added when multiple assignment has more values than
variables.
2012-06-05 11:06:46 -07:00
Paul Kulchenko
b58e931409 Changed static analyzer to only load metalua when Analyze function is
used, rather than on startup.
2012-06-04 12:21:47 -07:00
Paul Kulchenko
e0eb05b122 Disabled 'Run as Scratchpad' if there is no debugger registered capable of running it 2012-06-04 12:15:14 -07:00
Paul Kulchenko
8ecd8dfa6b Changed order of lualibs/ and bin/ directories in package.path and
package.cpath to load included modules first.

This should minimize conflicts with other versions of same modules that
may exist somewhere else in the path.
2012-06-04 12:01:10 -07:00
Paul Kulchenko
c1961e5c4b Added Ctrl(-Shift)-TAB navigation between tabs in the editor 2012-05-31 14:20:48 -07:00
Paul Kulchenko
3ead2966d8 Fixed localization of variables based on static analysis 2012-05-30 13:15:58 -07:00
Paul Kulchenko
0bcf590f45 Added reporting of assignment to global variables in the code analyzer 2012-05-30 11:27:17 -07:00
Paul Kulchenko
e8f308ca08 Added ability to turn external processes that connect to debugger into a scratchpad; fixed 'exit' to make it work for remote applications; upgraded to MobDebug 0.449 2012-05-26 23:02:20 -07:00
Paul Kulchenko
ecb59ceb9e Updated comment styling to follow markdown syntax 2012-05-15 23:05:26 -07:00
Paul Kulchenko
a317f986e1 Fixed styling in markup module that wasn't always working when a block comment was uncommented 2012-05-14 19:01:40 -07:00
Paul Kulchenko
623905c81c Added navigation between editor tabs using Ctrl-PgUp and Ctrl-PgDn 2012-05-13 23:10:25 -07:00
Paul Kulchenko
11b702ac6e Added exit from full screen mode using ESC key 2012-05-13 22:38:17 -07:00
Paul Kulchenko
f926aef2f8 Updated MANIFEST with luainspect module files and luasocket module reorg 2012-05-13 22:36:12 -07:00
Paul Kulchenko
3754406e85 Merge branch 'scratchpad' 2012-05-11 16:39:21 -07:00
Paul Kulchenko
981bccbe27 Added menu shortcut for Run As Scratchpad 2012-05-11 14:56:35 -07:00
Paul Kulchenko
047a9e8ac5 Upgraded to Mobdebug 0.448 to fix handling of scripts with comments in the remote shell 2012-05-11 14:30:58 -07:00
Paul Kulchenko
d1f2e8450a Fixed an issue with Analyze process when the analyzed script has compilation errors 2012-05-07 23:01:31 -07:00
Paul Kulchenko
21cfba9cb6 Added reporting of compilation errors during debugging sessions (when external client connects to the debugger and the current script has compilation errors) 2012-05-07 22:56:30 -07:00
Paul Kulchenko
3f711373ed Added handling of more error in the shell to allow calculations like '(1+2)' to be executed correctly (both locally and remotely) 2012-05-07 22:25:22 -07:00
Paul Kulchenko
00fe05e89f Fixed an earlier introduced bug with Run/Debug proceeding after failed compilation; removed references to internal code in compilation errors (in scratchpad) 2012-05-06 18:27:15 -07:00
Paul Kulchenko
3bcd54bd46 Added moving focus back to the notebook after unhiding/activating a wx window 2012-05-06 15:28:16 -07:00
Paul Kulchenko
8de9e41fd6 Updated README 2012-05-06 14:34:45 -07:00
Paul Kulchenko
29b6755a9b Fixed cursor to change to a default one (instead of an arrow) after number sliding 2012-05-06 14:29:49 -07:00
Paul Kulchenko
7d6be282f1 Updated clearing 'output' window to minimize showing duplicate output when running as scratchpad 2012-05-06 14:20:59 -07:00
Paul Kulchenko
f89fd4d752 Added handling of negative numbers for number sliders in scratchpad; added logic to ignore malformed numbers (they are still styled though) 2012-05-05 23:11:22 -07:00
Paul Kulchenko
03adda1cef Added stopping debugger and scratchpad when a window with debugging/scratchpad action is closed 2012-05-05 18:42:12 -07:00
Paul Kulchenko
2992424e87 Fixed an issue with scratchpad being on after Save dialog is canceled 2012-05-05 17:16:24 -07:00
Paul Kulchenko
e302a97682 Added support for using different debugger calls and moved scratchpad to a different debugger for performance reasons; upgraded to Mobdebug 0.446 2012-05-05 14:20:55 -07:00
Paul Kulchenko
7b5d37d595 Added mouse capture for slider operations in scratchpad to increase the range of available values 2012-05-03 16:40:47 -07:00
Paul Kulchenko
01ae85dc5a Reorganized the scratchpad code and added scratchpad teardown code to run when the debugged application is closed 2012-05-03 16:27:54 -07:00
Paul Kulchenko
f650d8f64f Added clearing output window when requested and formatting for compile/execution error messages 2012-05-03 12:58:39 -07:00
Paul Kulchenko
602f8ef223 Fixed debugging menu items to be hidden when running as scratchpad 2012-05-03 12:22:03 -07:00
Paul Kulchenko
6afc999b75 Added number slider processing with dynamic reloading of scratchpad scripts; upgraded to MobDebug 0.445 for better stability 2012-05-03 10:25:25 -07:00
Paul Kulchenko
2ccd214a1f Added stopping criteria to allow execution of any scripts (even empty ones) under 'Run as Scratchpad'; removed stack trace from remote error messages in the scratchpad 2012-05-02 10:45:59 -07:00
Paul Kulchenko
8efde0ec1f Added a check to turn 'Run as Scratchpad' on even when the initial compilation fails 2012-05-02 10:16:30 -07:00
Paul Kulchenko
1c5b14870c Updated event logic in the scratchpad to make sure editor change events do not get lost while an earlier change is being worked on 2012-05-02 00:09:48 -07:00
Paul Kulchenko
2c87909920 Disabled 'Run as Scratchpad' option when the script is already running 2012-05-01 22:00:46 -07:00
Paul Kulchenko
2a2a3bed96 Added reporting of run-time errors when running as scratchpad; upgraded to MobDebug 0.444 2012-05-01 21:49:45 -07:00
Paul Kulchenko
e2f65bced5 Fixed an issue with frequent modifications in a scratchpad; added safety check to avoid reloads from loaded modules (like wx) 2012-04-30 13:49:33 -07:00
Paul Kulchenko
c979d60d28 Moved the logic to disable checkbox for scratchpad menu to IDLE event as EVT_UPDATE_UI is only executed when the user opens up the menu (menu is updated) 2012-04-29 23:08:29 -07:00
Paul Kulchenko
7954ff1f64 Fixed about screen 2012-04-29 21:57:47 -07:00
Paul Kulchenko
a3a5c75694 Reorganized scratchpad code to have all its logic in one place 2012-04-29 18:41:23 -07:00
Paul Kulchenko
d6f3b4052b Reimplemented scratchpad functionality using internal processes (similar to how the debugger is done) as IDE was too unstable when running in the same process 2012-04-29 17:26:22 -07:00
Paul Kulchenko
7bc64d90c7 Removed 'error during pre-compilation' message from compile errors 2012-04-28 15:11:42 -07:00
Paul Kulchenko
56d262b753 Added stopping the debugger when a debugged program exits 2012-04-27 16:33:56 -07:00
Paul Kulchenko
a368f0acf9 Merge branch 'master' of github.com:pkulchenko/ZeroBraneStudio 2012-04-23 09:32:45 -07:00
Paul Kulchenko
d4a53733e7 Added to static analysis reporting of unused parameters in functions (the function name is also reported when possible) 2012-04-23 09:16:13 -07:00
Paul Kulchenko
1117e9df9a Disabled warning in static analysis about unused 'self' in methods 2012-04-22 23:31:58 -07:00
Paul Kulchenko
230de3450f Cleaned up warnings based on results of static analysis 2012-04-22 23:29:32 -07:00
Paul Kulchenko
0ae48ce6de Cleaned up warnings based on results of static analysis 2012-04-22 22:04:23 -07:00
Paul Kulchenko
6a90c5e850 Turned 'unhiding' wx window while running or debugging off by default as it was causing performance problems with some applications 2012-04-22 15:39:03 -07:00
Paul Kulchenko
f1ac72b265 Added scratchpad (running live) functionality 2012-04-21 22:29:21 -07:00
Paul Kulchenko
79fd90c986 Removed logic to update project directory based on file selection in the filetree 2012-04-21 22:26:15 -07:00
Paul Kulchenko
4dcf470c09 Fixed an issue with menu search to insert a new item 2012-04-20 22:25:14 -07:00
Paul Kulchenko
fcdbd456de Added code analyzer based on lua-inspect 2012-04-20 14:47:31 -07:00
Paul Kulchenko
e92127d6c8 Added luainspect library (https://github.com/davidm/lua-inspect) 2012-04-20 14:36:38 -07:00
Paul Kulchenko
0d8e6b0581 Added LuaSec (including binary Windows package from http://www.inf.puc-rio.br/~brunoos/luasec/) to provide SSL/HTTPS support for the socket library (needed for gist/github integration) 2012-04-19 18:17:48 -07:00
Paul Kulchenko
16d72396b1 Added missing mime/code.dll and reorganized socket module files (socket.*) to load correctly with require 2012-04-07 22:40:55 -07:00
Paul Kulchenko
6c7e289f71 Merge pull request #1 from dkulchenko/master
Format README with Markdown
2012-04-07 22:26:03 -07:00
Daniil Kulchenko
deb99ec084 Formatting improvements. 2012-03-27 14:08:36 -07:00
Daniil Kulchenko
12f84d3509 Switch README to Markdown. 2012-03-27 13:58:19 -07:00
178 changed files with 36743 additions and 15317 deletions

329
CHANGELOG.md Normal file
View File

@@ -0,0 +1,329 @@
# ZeroBrane Studio Changelog
## v0.33 (Oct 22 2012)
### Highlights
- Added **Linux support**.
- Added **Moai auto-complete**.
- Added **Gideros debugging, auto-complete, and live coding**.
- Added **syntax aware indentation**.
- Added **re/storing open files and interpreter** when switching project folders.
### Improvements
- Added configuration option to specify hostname when the default one is not reachable (fixes #68).
- Added search for Moai and Love2d executables in default locations on OSX and Windows.
- Added handling of command line parameters on OSX and Linux; updated documentation.
- Added auto-recovery to save/restore editor content (fixes #23).
- Added syntax aware indentation.
- Added re/storing open files and interpreter when switching project folders.
- Added auto-activation of files requested during debugging.
- Added editor.autoactivate parameter (false by default) to enable activation.
- Added zbstudio.sh script to run on OSX/Linux; updated permissions (closes #15).
- Added variable ratio for sliders in scratchpad.
- Added Linux/OSX/Windows CMake-based launcher build (thanks to toiffel).
- Added configuration parameter for the number of characters typed before displaying auto-complete suggestions for dynamic words.
- Added proper closing of the application after Shutdown/Logoff events (fixes #57).
- Added Moai auto-complete (closes #52).
- Added hiding auto-complete suggestions on losing focus in the editor.
- Added proper reporting of errors in the stack window.
- Added wxlua.deb file and install script that pull and build all required dependencies on Linux (covers most of #15).
- Added osx executables and build files.
- Added disabling full screen mode when the last editor tab is closed.
- Added proper reporting of errors in config files.
- Added toggling folders in project pane by single click (fixes #41).
- Added examples for configuring tabs and moai entry points.
- Added reporting compilation success rate (fixes #39)
- Added shortcuts for adding and removing watches.
- Added highlighting rows with updated values in the Watch window.
- Added 'Add Watch Expression' and 'Evaluate in Console' context menu items in the editor.
- Added handling of canceling editing in adding a watch.
- Added Gideros auto-complete and live coding support (closes #62).
- Added Gideros integration on OSX; added search for gideros in default locations on Windows and OSX.
- Added Gideros integration and debugging support.
- Added debugging-related buttons to the toolbar.
- Improved reporting of compilation and run-time errors when running as scratchpad.
- Made debugger strict.lua and LuaJIT friendly (upgraded to MobDebug v0.502).
- Updated configuration example to avoid using ide.spec that is not available (fixes #67).
- Updated CMake build script to handle wildcards in the MANIFEST.
- Updated configuring toolbar size to improve Linux compatibility.
- Updated MobDebug to v0.497 to fix issues and improve performance.
- Updated a warning message about single instance communication.
- Updated cpath processing to allow Linux version to run side-by-side with Windows and Mac.
- Updated licensing information.
- Enabled scratchpad support in the debugger when interpreter is capable of providing it.
- Disabled auto-complete in comments and strings.
- Disabled toggling breakpoints while debugger is running (as they wouldn't be changed anyway).
- Disabled 'not activated file for debugging' message when auto-activation is disabled.
- Disabled tooltip when scratchpad is on (fixes #51).
- Disabled showing calltip when the editor is not in focus.
- Disabled showing calltip over markup in comments.
- Disabled 'Run as Scratchpad' in the menu for those intepreters that don't support scratchpad.
- Updated configuration examples to add editor settings and fix user.lua path.
- Moved all Estrela features into a separate bundle that can be loaded using cfg/estrela.lua config.
- Removed multiple file types offered in Save As dialog.
### Incompatibilities
- Changed searching for user config in '$HOME/.zbstudio' from '$HOME/.zbs'.
- Temporarily removed the ability to modify spec-related configuration parameters from configuration files.
### Fixes
- Fixed opening a non-existing file from the Recent Files list.
- Fixed Find/Replace dialog checkboxes that didn't react to clicks on OSX (fixes #63).
- Fixed an auto-complete issue with mixed case dynamic words (fixes #60).
- Fixed 'Trying to solve a NULL hostname' warning message.
- Fixed a typo that prevented a corner case in autocomplete from working.
- Fixed inconsistent error messages about various config files.
- Fixed an issue with auto-complete when dot or colon is used (fixes #56).
- Fixed an issue with debugging scripts started using absolute file path.
- Fixed setting working directory for interpreters to the file path when the project directory is not set.
- Fixed an issue with Backspace not closing auto-complete suggestions.
- Fixed enabling items in the Edit menu (fixes #56).
- Fixed function list in the toolbar on Mac (helps #14).
- Fixed deleting of comment blocks with hidden markup (fixes #40).
- Fixed an issue with function list when all editor tabs are closed.
- Fixed multiple calltips shown on Linux (helps #15).
- Fixed an issue with mouse cursor in scratchpad not properly updated on Linux (fixes #49; helps #15).
- Fixed an issue with static analyzer that failes on function names like a.b.c (fixes #50).
- Fixed disabling Paste menu on Linux when needed (fixes #46; helps #15).
- Fixed an issue with context menu on Linux (fixes #47; helps #15).
- Fixed debugger failure when debugging is initiated externally and there is an unsaved file in one of editor tabs.
- Fixed stopping the debugger when an editor tab where debugging happens is closed.
- Fixed enabling of several menu items with no editor tab (fixes #42).
- Fixed an issue with loading stock icons on Linux.
- Fixed Cut/Copy menu items to reflect proper status in the editor.
- Fixed typo in the static analyzer output.
- Resolved conflict between lua executable names on Windows and Mac.
## v0.32 (Sep 03 2012)
### Highlights
- Added **Unicode support** for file encoding and file paths on Windows (fixes #30).
- Added **Moai integration and debugging** (including debugging of Moai threads and callbacks).
- Added refresh of Stack and Watch windows after executing a statement in remote shell.
- Added **display of complex values** on multiple lines in shell with '='.
- Added calltip on mouseover for functions during editing and for variables/expressions during debugging.
- Added configuration options to set paths to lua and love2d executables.
- Added support for **coroutine debugging** with stepping through coroutine.resume/.yield calls.
- Updated wx.dll to wxlua 2.8.12.2 and wxwidgets 2.8.12.
- Signed zbstudio app and executable to avoid issues with files not being saved without admin privileges and to remove warning about 'unknown publisher' on windows (fixes #25).
### Improvements
- Added calltip on mouseover for functions during editing and for variables/expressions during debugging.
- Added an IO filter to fix an issue with 0d0d0a line endings on Windows.
- Added support for debugging moai callbacks (upgraded to mobdebug v0.489).
- Added refresh of Stack and Watch windows to show updated values after executing a statement in remote shell.
- Added display of complex values on multiple lines in shell with '='.
- Added rockspec to the list of extensions for lua (fixes #37).
- Added a check to avoid evaluating keywords in tooltip.
- Added current interpreter to the status bar; adding closing debugger when the interpreter is changed.
- Added aborting scratchpad processing when an interpreter can't start or report a fatal error.
- Added support for unicode path files on Windows (fixes #30).
- Added an option to set path to lua executable.
- Added error handler to trap and display debugger errors.
- Added search in PATH for love2d executable.
- Added a workaround for GetExecutablePath() reporting 'wx.dll' instead of a proper exe name with wxlua 2.8.12.2 on Windows.
- Added reporting of function name of the form a.b and a:b in static analysis (fixes #27).
- Added ability for user to keep their settings file in their home directory.
- Added per user settings file. Users can now move their settings file to ~/.zbs/user.lua.
- Added ignoring Cmd-key combinations on Mac as this should be handled by wxwidgets, but is not (fixes #19).
- Added support for coroutine debugging with stepping through coroutine.resume/.yield calls.
- Changed reporting of program execution time from CPU time to user time.
- Changed the call to unhide windows to the async version (ShowWindowAsync) to avoid blocking the IDE when the application doesn't respond.
- Upgraded to wxlua 2.8.12.2 (wxwidgets 2.8.12; unicode version); added lua51.dll proxy (fixes #10 and #7).
- Updated love2d interpreter to use the project folder to check for main.lua.
- Updated test module to use stringified values for comparison.
- Updated status bar style to make it consistent across platforms.
- Removed .bak files from being replaced in when backup copies are saved.
- Removed explicit path conversions and comparisons.
- Refactored LUA_PATH/CPATH processing to set it for all interpreters.
- Signed zbstudio app and executable to avoid issues with files not being saved without admin privileges and to remove warning about 'unknown publisher' on windows (fixes #25).
### Incompatibilities
- Reassigned hotkeys in the Project menu to minimize conflicts on Mac (reassigned Shift-F12 and F11).
### Fixes
- Fixed an issue with double click on analylsis results being out-of-sync when the editor switched to another file (fixes #38)
- Fixed an issue with debugger not activating files with relative path information.
- Fixed 'break' command to work after coming from debugger calls (like on()).
- Fixed an issue with highlighting selected item in the project tree.
- Fixed evaluation of foo:bar in tooltip (now evaluates as foo.bar).
- Fixed debugger termination after internal errors.
- Fixed activating current file in the project tree on Mac (closes #29).
- Fixed running scripts with single quotes in path names.
- Fixed an issue with Run/Debug commands when IDE path includes exclamation mark ('!').
- Fixed an issue with the app not starting on those systems that don't have HOME environment variable; fixes #28.
- Fixed an issue with showing/hiding GUI windows that was occasionally causing a runtime error when the window disappears before it is manipulated.
- Fixed returning proper name for unsaved files in reporting compilation and static analysis results; moved default names to ide.config (fixes #26).
- Fixed pasting text into the Find dialog and project path box on Mac (fixes #22).
- Fixed handling of dashes in paths (upgraded to mobdebug 0.479).
- Reorganized handling of automcomplete event (to use AddPendingEvent instead of PostEvent) to avoid runtime application error.
## v0.31 (Jul 14 2012)
### Highlights
- Added **scratchpad support for love2d**.
- Added tooltip to display variable/expression values during debugging.
- Added **MacOS support**.
### Improvements
- Added handling of balanced brackets in markup links.
- Added unit test module.
- Added reporting the number of traced lines during debugging.
- Added setting of PATH and CPATH to find proper libs on windows and mac os platforms.
- Added scratchpad support for love2d.
- Added reset of 'modified' status to keep tab names and their config settings correct upon exit.
- Added window title update and filetree refresh after SaveAs command.
- Added tooltip to display variable/expression values during debugging.
- Made 'View Stack Window' and 'View Watch Window' refresh window content if it's already shown.
- Removed setting the editor font in the config as the default font is different on different platforms.
- Removed extension from the template to match folders to make it more portable.
- Reorganized handling of font configuration and added font config for filetree (with a different size default on MacOS).
- Updated matching logic for function definitions to allow for a.b.c() definitions (fixes #17).
### Fixes
- Fixed markup styling and file tree drawing on MacOS.
- Fixed detecting executable name in commands with spaces.
- Fixed incorrect folders reported in the file tree when no project directory is set and a file is open.
- Fixed incorrect filename reported in compile errors when the file is not saved.
- Fixed refresh of filetree on MacOS to get it displayed correctly when the app is started.
- Fixed an error thrown when a window with debugging is closed before the application being debugged is terminated.
- Fixed incorrect storing of settings for editor tabs with the same text (filename). This was causing only one tab displayed for multiple StyledText controls with interesting effects.
- Fixed an issue with launching a process when its output is not redirected to the IDE (fixes #16).
- Fixed console to evaluate 'function a() ... end' without errors.
- Fixed a compilation error caused by shebang in scripts.
- Fixed an issue with love2d path with spaces.
- Corrected resetting of project directory when it's already set and doesn't need to be changed.
- Added checks around ShowFullScreen() calls to avoid failures on those systems that don't provide it (linux/GTK).
- Added check for debugger calls to avoid errors when debugger is not loaded.
- Updated matching of links to make them less greedy (to avoid capturing link terminators).
- Upgraded deprecated constants and logic for compatibility with wxwidgets 2.9.x.
- Reset project directory if the current one doesn't exist.
- Removed styling of function calls and capturing definitions in strings and comments (fixed #18).
- Removed setting focus to the Output window when output is processed as it interfered with Run as Scratchpad.
## v0.30 (Jun 27 2012)
### Highlights
- Added **love2d support**.
- Added auto complete for love2d API.
- Added support for debugging processes running under LuaJIT.
- Added display of **hierarchical data in Stack window**.
- Added **pretty printing in Watch and Console** (local and remote) windows and handling of multiple results in Console.
- Added **Stack window to display stack information** and local/upvalue values for each stack frame.
- Added ability to **interact with scripts** by allowing text to be entered in the 'Output' window.
### Improvements
- Added love2d support.
- Added auto complete for love2d API.
- Added support for debugging processes running under LuaJIT.
- Added display of hierarchical data in Stack window.
- Added execution time and updated messages in the Output window to be more consistent.
- Added displaying 'nil' values in local console when no result is returned by an expression.
- Added a check to refuse starting a new debugging session if there is one in progress already.
- Added handling of tail calls in the Stack window.
- Added pretty printing in Watch and Console (local and remote) windows and handling of multiple results in Console.
- Added Stack window to display stack information and local/upvalue values for each stack frame.
- Added ability to set font encoding in the config.
- Added restoring cursor position when a modified file is reloaded in the editor.
- Added ability to interact with scripts by allowing text to be entered in the 'Output' window.
- Improved logic in love2d integration to distinguish Debug and Run commands (closes #13).
- Improved reporting in static analysis for functions and global variables.
- Updated menus to avoid conflicts with MacOS shortcuts.
- Updated logic creating menubar to make it work correctly on MacOS with special Help/About items.
- Updated path handling to better detect how the app is started and to avoid loading dlls on non-windows platforms.
- Updated logic for detecting hostname (used in the debugger) to make sure it is resolvable.
- Changed order of lualibs/ and bin/ directories in package.path and package.cpath to load included modules first.
- Removed extensions from launch commands and updated display logic in the Output window.
### Fixes
- Fixed aborting running/debugged programs on MacOS by adding MAKE_GROUP_LEADER option to wxExecute.
- Fixed an issue in the logic for setting breakpoints, which ignored breakpoints in luxinia2 debug sessions.
- Fixed logic in the local/remote console that returned incorrect error message on executing code like '%s':format(1).
- Fixed IDs for Project menu items to allow them to be removed from the menu if needed.
- Fixed an issue with remote application not terminating when IDE is closed while debugging is in progress.
- Fixed refreshing a modified file when the editor is set to read-only mode.
- Fixed saving/restoring configuration of 'Output'/'Console' tabs when IDE is closed while debugging is in progress.
- Fixed removing variable name in Watch window after escaping editing.
- Fixed #9 as it had incorrect logic in one of UTF filters.
- Fixed edit menu shortcuts to work in the 'Output' window (when allowed).
- Fixed reporting of processes that failed to start after 'Run' or 'Debug' commands.
- Fixed executable path matching to work on systems that don't have file extensions.
- Fixed #3 'unused parameter...' check not to fail on anonymous functions that are part of an expression.
- Moved processing of `user.lua` to a later phase after tools and specs are already loaded to allow modification of IDE configuration from `user.lua`. Closes #5.
- Added checks to prevent text modification in 'Output' and 'Console' windows. Fixes #8.
- Disabled 'Run as Scratchpad' if there is no debugger registered capable of running it.
- Disabled Stack and Watch updates when scratchpad is active as they interfere with application execution.
## v0.29 (May 31 2012)
### Highlights
- Added **scratchpad** (running live) functionality.
- Added **code analyzer** based on lua-inspect.
- Updated **comment styling** to follow markdown syntax.
### Improvements
- Added scratchpad (running live) functionality.
- Added code analyzer based on lua-inspect.
- Added Ctrl(-Shift)-TAB navigation between tabs in the editor.
- Added navigation between editor tabs using Ctrl-PgUp and Ctrl-PgDn.
- Added reporting of assignment to global variables in the code analyzer.
- Added ability to turn external processes that connect to debugger into a scratchpad.
- Added exit from full screen mode using ESC key.
- Added reporting of compilation errors during debugging sessions.
- Added handling of more errors in the shell to allow calculations like '(1+2)' to be executed correctly.
- Added moving focus back to the notebook after unhiding/activating a wx window.
- Added missing mime/code.dll and reorganized socket module files (socket.*) to load correctly with require.
- Added stopping the debugger when a debugged program exits.
- Added to static analysis reporting of unused parameters in functions.
- Disabled warning in static analysis about unused 'self' in methods.
- Removed 'error during pre-compilation' message from compile errors.
- Updated comment styling to follow markdown syntax.
### Fixes
- Fixed handling of scripts with comments in the remote shell.
- Fixed an issue with Analyze process when the analyzed script has compilation errors.
- Fixed an issue with scratchpad being on after Save dialog is canceled.
- Fixed about screen.
## v0.28 (Mar 21 2012)
### Highlights
- Added full screen mode.
### Improvements
- Added option to activate output/console when Run/Debug/Compile commands are executed.
- Added full screen mode.
- Added killing a running process on IDE exit.
- Added killing a running process with Shift-F12.
- Disabled buffering of the output for scripts run from IDE.
### Fixes
- Fixed 'Trace' command to continue working when a debugged file is not activated.
- Fixed an issue with saving a file when no project directory is set.
- Fixed missing semicolon in lualibs path; added path for debugger to search under lualibs.
- Fixed an issue with a missing path separator, which prevented debugging from executing step commands in some cases.
- Fixed missing slash on SaveAs by enforcing trailing slash for the project path.
## v0.27 (Feb 14 2012)
### Highlights
- Added markup formatting in the comments.
### Improvements
- Added markup formatting in the comments.
- Added Debug and Run methods to simulate menu commands.
- Added setting a project folder on initial start.
- Added style processing for font name, font size, visibility and hotspot attributes.
- Added setting the current project directory for the shell to allow 'require' commands to work with local modules.
- Updated markup processing with run and debug commands, http link processing, and opening local files in a new window.
- Enforced visibility for shell prompt.
### Fixes
- Fixed activation of a correct tab when one of the editor tabs is closed.
- Fixed an issue with file activation from a debugger.
- Fixed the issue of ClosePage method being called with two different parameters.
- Fixed the issue of the project dir being returned with two trailing slashes.
- Fixed an issue with activating the currenly edited file in the file tree.
- Wrapped DragAcceptFiles into a protected call to make it not fail on MacOS (compiled with wxwidgets 2.8.12).
## v0.26 (Jan 18 2012)

View File

@@ -49,7 +49,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
--[[ wxLua License License ]]----------------------------------------------
--[[ wxLua License ]]------------------------------------------------------
http://wxlua.sourceforge.net/
@@ -61,7 +61,7 @@ Original wxLua Lua sample IDE:
luascript at thersgb.net
wxLua is based on
wxWindows Library Licence, Version 3
wxWindows Library License, Version 3
Copyright (c) 1998 Julian Smart, Robert Roebling et al
@@ -178,7 +178,7 @@ output file generation.
MobDebug sources are released under the MIT License
Copyright (c) 2011 Paul Kulchenko (paul@kulchenko.com)
Copyright (c) 2011-2012 Paul Kulchenko (paul@kulchenko.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

63
README
View File

@@ -1,63 +0,0 @@
A simple and extensible Lua IDE and debugger. It supports multiple file
formats, "api" for autocompletion and tooltips, and custom command-line
tools. Its main focus is extensibility for target applications using Lua.
--[[ FEATURES ]]-----------------------------------------------------------
* Written in Lua, so easily customizable
* Automatically loads several 'plugin' like classes
- applications: overall control of applications settings
- specs (spec/): file syntax, lexer, keywords
- apis (api/): for code-completion and tool-tips
- interpreters (interpreters/): how a project is run
- config (cfg/): contains style and basic editor settings
- tools (tools/): additional tools, e.g. cg compiler, dx fxc compiler
* Auto-completion for functions, keywords...
* Function tips
* Function list in file (quick jump to)
* Function call highlighting
* Bracket matching/highlighting
* Project file browser
* Experimental type/class guessing for auto-completion
* Support for different editor styles
* Console to directly test code snippets with local and remote execution
* Integrated debugger (with support for local and remote debugging)
--[[ FRONT-ENDS ]]--------------------------------------------------------
There is currently two front-ends using the same editor engine. The original
is "estrela", which has a focus on 3d graphics related usage of Lua, especially
in combination with the luxinia engine or luxinia2 framework.
The second is "zbstudio" which has a focus on remote use of Lua in robotics.
Both are part of the standard distribution.
--[[ INSTALLATION ]]-------------------------------------------------------
git clone git://github.com/pkulchenko/ZeroBraneStudio.git zbstudio
or
git clone git://estrelaeditor.git.sourceforge.net/gitroot/estrelaeditor/estrelaeditor estrelaeditor
--[[ USAGE ]]--------------------------------------------------------------
Open File(s):
<exe> <filename> [<filename>...]
any non-option will be treated as filename
Overriding Config:
<exe> [...] -cfg "<luacode overriding config>" [...]
e.g.: zbstudio.exe -cfg "singleinstance=false;" somefile.lua
--[[ AUTHOR ]]-------------------------------------------------------------
Estrela Editor
Luxinia Dev: Christoph Kubisch (crazybutcher@luxinia.de)
ZeroBrane Studio and MobDebug
ZeroBrane LLC: Paul Kulchenko (paul@kulchenko.com)
--[[ LICENSE ]]------------------------------------------------------------
See LICENSE file

56
README.md Normal file
View File

@@ -0,0 +1,56 @@
# Project Description
[ZeroBrane Studio](http://studio.zerobrane.com/) is a lightweight Lua IDE with code completion, syntax
highlighting, remote debugger, code analyzer, live coding, and debugging
support for several Lua engines (LuaJIT, Löve 2D, Moai, Gideros, MobileLua,
and others).
## Features
* Written in Lua, so easily customizable.
* Small, portable, and cross-platform (Windows, Mac OSX, and Linux).
* Auto-completion for functions, keywords, and custom APIs.
* Interactive console to directly test code snippets with local and remote execution.
* Integrated debugger (with support for local and remote debugging).
* Live coding with Lua ([demo](http://notebook.kulchenko.com/zerobrane/live-coding-in-lua-bret-victor-style)), Löve 2D ([demo](http://notebook.kulchenko.com/zerobrane/live-coding-with-love)), and Gideros ([demo](http://notebook.kulchenko.com/zerobrane/gideros-live-coding-with-zerobrane-studio-ide)).
* Support for plugin-like components:
- applications: overall control of applications settings;
- specs (spec/): file syntax, lexer, keywords;
- apis (api/): for code-completion and tool-tips;
- interpreters (interpreters/): how a project is run;
- config (cfg/): contains style and basic editor settings;
- tools (tools/): additional tools.
## Screenshot
![ZeroBrane Studio debugger screenshot](http://studio.zerobrane.com/images/debugging.png)
## Usage
```
Open file(s):
<zbstudio> <filename> [<filename>...]
any non-option will be treated as filename
Overriding default configuration:
<zbstudio> -cfg "<luacode overriding config>" [<filename>]
e.g.: zbstudio -cfg "editor.fontsize=12" somefile.lua
Loading custom configuration:
<zbstudio> -cfg "config/file.lua" [<filename>]
e.g.: zbstudio -cfg cfg/estrela.lua
```
## Author
### ZeroBrane Studio and MobDebug
**ZeroBrane LLC:** Paul Kulchenko (paul@kulchenko.com)
### Estrela Editor
**Luxinia Dev:** Christoph Kubisch (crazybutcher@luxinia.de)
## License
See LICENSE file.

View File

@@ -71,13 +71,14 @@ ldexp = fn "build floating point number from x and the corresponding integral ex
packUnorm2x16 = fn "Converts each comp. of v into 16-bit ints, packs results into the returned 32-bit uint. - (uint)(vec2 v)",
packUnorm4x8 = fn "Converts each comp. of v into 8-bit ints, packs results into the returned 32-bit uint. - (uint)(vec4 v)",
packSnorm4x8 = fn "Converts each comp. of v into 8-bit ints, packs results into the returned 32-bit uint. - (uint)(vec4 v)",
packDouble2x32 = fn "Packs components of v into a 64-bit value and returns a double-prec value. - (double)(uvec2 v)",
packHalf2x16 = fn "Converts each comp. of v into 16-bit half float, packs results into the returned 32-bit uint. - (uint)(vec2 v)",
unpackUnorm2x16 = fn "Unpacks 32-bit p into two 16-bit uints and converts them to normalized float. - (vec2)(uint p)",
unpackUnorm4x8 = fn "Unpacks 32-bit p into four 8-bit uints and converts them to normalized float. - (vec4)(uint p)",
unpackSnorm4x8 = fn "Unpacks 32-bit p into four 8-bit uints and converts them to normalized float. - (vec4)(uint p)",
packDouble2x32 = fn "Packs components of v into a 64-bit value and returns a double-prec value. - (double)(uvec2 v)",
unpackDouble2x32 = fn "Returns a 2 component vector representation of v. - (uvec2)(double v)",
unpackHalf2x16 = fn "Interprets p as two 16-bit half floats and returns them as vector. - (vec2)(uint p)",
length = fn "return scalar Euclidean length of a vector. - (type)(vecN)",
distance = fn "return the Euclidean distance between two points. - (vecN)(vecN a, b)",
@@ -135,6 +136,11 @@ EndPrimitive = fn "Completes current output primitive and starts a new one. - ()
barrier = fn "Synchronizes across shader invocations. - ()()",
memoryBarrier = fn "control ordering of memory transactions issued by shader thread. - ()()",
memoryBarrierAtomicCounter = fn "control ordering of memory transactions issued by shader thread. - ()()",
memoryBarrierShared = fn "control ordering of memory transactions issued by shader thread. - ()()",
memoryBarrierBuffer = fn "control ordering of memory transactions issued by shader thread. - ()()",
memoryBarrierImage = fn "control ordering of memory transactions issued by shader thread. - ()()",
groupMemoryBarrier = fn "control ordering of memory transactions issued by shader thread. - ()()",
imageAtomicAdd = fn "performs atomic operation on individual texels returns new value. - (uint)(imageN, intN coord, [int sample], uint data)",
imageAtomicMin = fn "performs atomic operation on individual texels returns new value. - (uint)(imageN, intN coord, [int sample], uint data)",
imageAtomicMax = fn "performs atomic operation on individual texels returns new value. - (uint)(imageN, intN coord, [int sample], uint data)",
@@ -167,41 +173,51 @@ texelFetchOffset = fn "integer coordinate lookup for a single texel with offset.
}
local keyw =
[[int uint half float bool double
vec2 vec3 vec4 dvec2 dvec3 dvec4
ivec2 ivec3 ivec4 uvec2 uvec3 uvec4 bvec2 bvec3 bvec4
mat2 mat3 mat4 mat2x2 mat3x3 mat4x4 mat2x3 mat3x2 mat4x2 mat2x4 mat4x3 mat3x4
dmat2 dmat3 dmat4 dmat2x2 dmat3x3 dmat4x4 dmat2x3 dmat3x2 dmat4x2 dmat2x4 dmat4x3 dmat3x4
struct typedef void
usampler1D usampler2D usampler3D usampler2DRect usamplerCube isampler1DArray usampler2DARRAY usamplerCubeArray usampler2DMS usampler2DMSArray
isampler1D isampler2D isampler3D isampler2DRect isamplerCube isampler1DArray isampler2DARRAY isamplerCubeArray isampler2DMS isampler2DMSArray
sampler1D sampler2D sampler3D sampler2DRect samplerCube sampler1DArray sampler2DArray samplerCubeArray sampler2DMS sampler2DMSArray
sampler1DShadow sampler2DShadow sampler2DRectShadow sampler1DArrayShadow sampler2DArrayShadow samplerCubeArrayShadow
usamplerBuffer isamplerBuffer samplerBuffer
in out inout uniform const centroid sample attribute varying patch
return switch case for do while if else break continue
layout location vertices line_strip triangle_strip max_vertices stream
triangles quads equal_spacing isolines fractional_even_spacing
fractional_odd_spacing cw ccw point_mode lines_adjacency triangles_adjacency
invocations
origin_upper_left pixel_center_integer
smooth flat noperspective highp mediump lowp shared packed std140 row_major column_major
gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_Color gl_SecondaryColor
subroutine gl_Position
gl_VertexID gl_InstanceID gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1
gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6
gl_MultiTexCoord7 gl_FogCoord gl_PointSize gl_ClipDistance
gl_TexCoord gl_FogFragCoord gl_ClipVertex gl_in
gl_PatchVerticesIn
gl_PrimitiveID gl_InvocationID gl_TessLevelOuter gl_TessLevelInner gl_TessCoord
gl_InvocationID gl_PrimitiveIDIn gl_Layer gl_ViewportIndex gl_FrontFacing
gl_PointCoord gl_SampleID gl_SamplePosition gl_FragColor
gl_FragData gl_FragDepth gl_SampleMask
[[ int uint half float bool double atomic_uint binding offset
vec2 vec3 vec4 dvec2 dvec3 dvec4
ivec2 ivec3 ivec4 uvec2 uvec3 uvec4 bvec2 bvec3 bvec4
mat2 mat3 mat4 mat2x2 mat3x3 mat4x4 mat2x3 mat3x2 mat4x2 mat2x4 mat4x3 mat3x4
dmat2 dmat3 dmat4 dmat2x2 dmat3x3 dmat4x4 dmat2x3 dmat3x2 dmat4x2 dmat2x4 dmat4x3 dmat3x4
struct typedef void
usampler1D usampler2D usampler3D usampler2DRect usamplerCube isampler1DArray usampler2DARRAY usamplerCubeArray usampler2DMS usampler2DMSArray
isampler1D isampler2D isampler3D isampler2DRect isamplerCube isampler1DArray isampler2DARRAY isamplerCubeArray isampler2DMS isampler2DMSArray
sampler1D sampler2D sampler3D sampler2DRect samplerCube sampler1DArray sampler2DArray samplerCubeArray sampler2DMS sampler2DMSArray
sampler1DShadow sampler2DShadow sampler2DRectShadow sampler1DArrayShadow sampler2DArrayShadow samplerCubeArrayShadow
usamplerBuffer isamplerBuffer samplerBuffer samplerRenderbuffer isamplerRenderbuffer usamplerRenderbuffer
in out inout uniform const centroid sample attribute varying patch index true false
return switch case for do while if else break continue main inline
layout location vertices line_strip triangle_strip max_vertices stream
triangles quads equal_spacing isolines fractional_even_spacing lines points
fractional_odd_spacing cw ccw point_mode lines_adjacency triangles_adjacency
invocations
origin_upper_left pixel_center_integer depth_greater depth_greater depth_greater depth_unchanged
smooth flat noperspective highp mediump lowp shared packed std140 std430 row_major column_major buffer
gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_Color gl_SecondaryColor
subroutine gl_Position gl_FragCoord
gl_VertexID gl_InstanceID gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1
gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6
gl_MultiTexCoord7 gl_FogCoord gl_PointSize gl_ClipDistance
gl_TexCoord gl_FogFragCoord gl_ClipVertex gl_in
gl_PatchVerticesIn
gl_PrimitiveID gl_InvocationID gl_TessLevelOuter gl_TessLevelInner gl_TessCoord
gl_InvocationID gl_PrimitiveIDIn gl_Layer gl_ViewportIndex gl_FrontFacing
gl_PointCoord gl_SampleID gl_SamplePosition gl_FragColor
gl_FragData gl_FragDepth gl_SampleMask
gl_NumWorkGroups gl_WorkGroupSize gl_WorkGroupID gl_LocalInvocationID gl_GlobalInvocationID gl_LocalInvocationIndex
local_size_x local_size_y local_size_z
coherent volatile restrict readonly writeonly
image1D image2D image3D image2DRect imageCube imageBuffer image1DArray image2DArray imageCubeArray image2DMS image2DMSArray
uimage1D uimage2D uimage3D uimage2DRect uimageCube uimageBuffer uimage1DArray uimage2DArray uimageCubeArray uimage2DMS uimage2DMSArray
iimage1D iimage2D iimage3D iimage2DRect iimageCube iimageBuffer iimage1DArray iimage2DArray iimageCubeArray iimage2DMS iimage2DMSArray
size1x8 size1x16 size1x32 size2x32 size4x32 rgba32f rgba16f rg32f rg16f r32f r16f rgba8 rgba16 r11f_g11f_b10f rgb10_a2ui
rgb10_a2i rg16 rg8 r16 r8 rgba32i rgba16i rgba8i rg32i rg16i rg8i r32i r16i r8i rgba32ui rgba16ui rgba8ui rg32ui rg16ui rg8ui
r32ui r16ui r8ui rgba16_snorm rgba8_snorm rg16_snorm rg8_snorm r16_snorm r8_snorm
]]
-- keywords - shouldn't be left out
for w in keyw:gmatch("([a-zA-Z_0-9]+)") do
api[w] = {type="keyword"}
api[w] = {type="keyword"}
end
return api

553
api/lua/anttweakbar.lua Normal file
View File

@@ -0,0 +1,553 @@
--[[// tw tweakbar | AntTweakBar UI
enum { TW_VERSION = 114 }
typedef enum ETwType {
TW_TYPE_UNDEF,
TW_TYPE_BOOLCPP,
TW_TYPE_BOOL8,
TW_TYPE_BOOL16,
TW_TYPE_BOOL32,
TW_TYPE_CHAR,
TW_TYPE_INT8,
TW_TYPE_UINT8,
TW_TYPE_INT16,
TW_TYPE_UINT16,
TW_TYPE_INT32,
TW_TYPE_UINT32,
TW_TYPE_FLOAT,
TW_TYPE_DOUBLE,
TW_TYPE_COLOR32, // 32 bits color. Order is RGBA if API is OpenGL or Direct3D10, and inversed if API is Direct3D9 (can be modified by defining 'colorOrder=...', see doc)
TW_TYPE_COLOR3F, // 3 floats color. Order is RGB.
TW_TYPE_COLOR4F, // 4 floats color. Order is RGBA.
TW_TYPE_CDSTRING, // Null-terminated C Dynamic String (pointer to an array of char dynamically allocated with malloc/realloc/strdup)
TW_TYPE__TEMP1, //
TW_TYPE_QUAT4F, // 4 floats encoding a quaternion {qx,qy,qz,qs}
TW_TYPE_QUAT4D, // 4 doubles encoding a quaternion {qx,qy,qz,qs}
TW_TYPE_DIR3F, // direction vector represented by 3 floats
TW_TYPE_DIR3D, // direction vector represented by 3 doubles
TW_TYPE_CSSTRING_LEN0 = 0x30000000,
TW_TYPE_CSSTRING_LEN256 = 0x30000000 + 256,
} TwType;
typedef struct CTwEnumVal {
int Value;
const char * Label;
} TwEnumVal;
typedef struct CTwStructMember {
const char * Name;
TwType Type;
size_t Offset;
const char * DefString;
} TwStructMember;
typedef enum ETwParamValueType {
TW_PARAM_INT32,
TW_PARAM_FLOAT,
TW_PARAM_DOUBLE,
TW_PARAM_CSTRING // Null-terminated array of char (ie, c-string)
} TwParamValueType;
typedef enum ETwGraphAPI {
TW_OPENGL = 1,
TW_DIRECT3D9 = 2,
TW_DIRECT3D10 = 3,
TW_DIRECT3D11 = 4
} TwGraphAPI;
typedef enum ETwKeyModifier {
TW_KMOD_NONE = 0x0000, // same codes as SDL keysym.mod
TW_KMOD_SHIFT = 0x0003,
TW_KMOD_CTRL = 0x00c0,
TW_KMOD_ALT = 0x0100,
TW_KMOD_META = 0x0c00
} TwKeyModifier;
typedef enum EKeySpecial {
TW_KEY_BACKSPACE = '\b',
TW_KEY_TAB = '\t',
TW_KEY_CLEAR = 0x0c,
TW_KEY_RETURN = '\r',
TW_KEY_PAUSE = 0x13,
TW_KEY_ESCAPE = 0x1b,
TW_KEY_SPACE = ' ',
TW_KEY_DELETE = 0x7f,
TW_KEY_UP = 273,
TW_KEY_DOWN,
TW_KEY_RIGHT,
TW_KEY_LEFT,
TW_KEY_INSERT,
TW_KEY_HOME,
TW_KEY_END,
TW_KEY_PAGE_UP,
TW_KEY_PAGE_DOWN,
TW_KEY_F1,
TW_KEY_F2,
TW_KEY_F3,
TW_KEY_F4,
TW_KEY_F5,
TW_KEY_F6,
TW_KEY_F7,
TW_KEY_F8,
TW_KEY_F9,
TW_KEY_F10,
TW_KEY_F11,
TW_KEY_F12,
TW_KEY_F13,
TW_KEY_F14,
TW_KEY_F15,
TW_KEY_LAST
} TwKeySpecial;
typedef enum ETwMouseAction {
TW_MOUSE_RELEASED,
TW_MOUSE_PRESSED
} TwMouseAction;
typedef enum ETwMouseButtonID {
TW_MOUSE_LEFT = 1,
TW_MOUSE_MIDDLE = 2,
TW_MOUSE_RIGHT = 3
} TwMouseButtonID;
typedef void (*TwSetVarCallback) ( const void *value, void *clientData );
typedef void (*TwGetVarCallback) ( void *value, void *clientData );
typedef void (*TwButtonCallback) ( void *clientData );
typedef void (*TwSummaryCallback) ( char *summaryString, size_t summaryMaxLength, const void *value, void *clientData );
typedef void (*TwCopyCDStringToClient) ( char **destinationClientStringPtr, const char *sourceString );
typedef void (*TwErrorHandler) ( const char *errorMessage );
typedef void (*TwGLUTmousebuttonfun) ( int glutButton, int glutState, int mouseX, int mouseY );
typedef void (*TwGLUTmousemotionfun) ( int mouseX, int mouseY );
typedef void (*TwGLUTkeyboardfun) ( unsigned char glutKey, int mouseX, int mouseY );
typedef void (*TwGLUTspecialfun) ( int glutKey, int mouseX, int mouseY );
typedef struct CTwBar TwBar;
TwBar* TwNewBar( const char *barName );
int TwDeleteBar( TwBar *bar );
int TwDeleteAllBars( );
int TwSetTopBar( const TwBar *bar );
TwBar* TwGetTopBar( );
int TwSetBottomBar( const TwBar *bar );
TwBar* TwGetBottomBar( );
const char* TwGetBarName( TwBar *bar );
int TwGetBarCount( );
TwBar* TwGetBarByIndex( int barIndex );
TwBar* TwGetBarByName( const char *barName );
int TwRefreshBar( TwBar *bar );
int TwAddVarRW( TwBar *bar, const char *name, TwType type, void *var, const char *def );
int TwAddVarRO( TwBar *bar, const char *name, TwType type, const void *var, const char *def );
int TwAddVarCB( TwBar *bar, const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def );
int TwAddButton( TwBar *bar, const char *name, TwButtonCallback callback, void *clientData, const char *def );
int TwAddSeparator( TwBar *bar, const char *name, const char *def );
int TwRemoveVar( TwBar *bar, const char *name );
int TwRemoveAllVars( TwBar *bar );
int TwDefine( const char *def );
TwType TwDefineEnum( const char *name, const TwEnumVal *enumValues, unsigned int nbValues );
TwType TwDefineEnumFromString( const char *name, const char *enumString );
TwType TwDefineStruct( const char *name, const TwStructMember *structMembers, unsigned int nbMembers, size_t structSize, TwSummaryCallback summaryCallback, void *summaryClientData );
void TwCopyCDStringToClientFunc( TwCopyCDStringToClient copyCDStringFunc );
void TwCopyCDStringToLibrary( char **destinationLibraryStringPtr, const char *sourceClientString );
int TwGetParam( TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int outValueMaxCount, void *outValues );
int TwSetParam( TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues );
int TwInit( TwGraphAPI graphAPI, void *device );
int TwTerminate();
int TwDraw();
int TwWindowSize( int width, int height);
int TwSetCurrentWindow( int windowID); // multi-windows support
int TwGetCurrentWindow();
int TwWindowExists( int windowID);
int TwKeyPressed( int key, int modifiers);
int TwKeyTest( int key, int modifiers);
int TwMouseButton( TwMouseAction action, TwMouseButtonID button);
int TwMouseMotion( int mouseX, int mouseY);
int TwMouseWheel( int pos);
const char* TwGetLastError( );
void TwHandleErrors( TwErrorHandler errorHandler);
int TwEventSDL( const void *sdlEvent, unsigned char sdlMajorVersion, unsigned char sdlMinorVersion);
int TwEventSDL12( const void *sdlEvent);
int TwEventSDL13( const void *sdlEvent);
int TwEventMouseButtonGLFW( int glfwButton, int glfwAction );
int TwEventKeyGLFW( int glfwKey, int glfwAction );
int TwEventCharGLFW( int glfwChar, int glfwAction );
int TwEventMouseButtonGLUT( int glutButton, int glutState, int mouseX, int mouseY);
int TwEventMouseMotionGLUT( int mouseX, int mouseY);
int TwEventKeyboardGLUT( unsigned char glutKey, int mouseX, int mouseY );
int TwEventSpecialGLUT( int glutKey, int mouseX, int mouseY );
int TwGLUTModifiersFunc( int (*glutGetModifiersFunc)(void) );
int TwEventSFML( const void *sfmlEvent, unsigned char sfmlMajorVersion, unsigned char sfmlMinorVersion);
]]
--auto-generated api from ffi headers
local api =
{
["TW_TYPE_UNDEF"] = { type ='value', },
["TW_TYPE_BOOLCPP"] = { type ='value', },
["TW_TYPE_BOOL8"] = { type ='value', },
["TW_TYPE_BOOL16"] = { type ='value', },
["TW_TYPE_BOOL32"] = { type ='value', },
["TW_TYPE_CHAR"] = { type ='value', },
["TW_TYPE_INT8"] = { type ='value', },
["TW_TYPE_UINT8"] = { type ='value', },
["TW_TYPE_INT16"] = { type ='value', },
["TW_TYPE_UINT16"] = { type ='value', },
["TW_TYPE_INT32"] = { type ='value', },
["TW_TYPE_UINT32"] = { type ='value', },
["TW_TYPE_FLOAT"] = { type ='value', },
["TW_TYPE_DOUBLE"] = { type ='value', },
["TW_TYPE_COLOR32"] = { type ='value', },
["TW_TYPE_COLOR3F"] = { type ='value', },
["TW_TYPE_COLOR4F"] = { type ='value', },
["TW_TYPE_CDSTRING"] = { type ='value', },
["TW_TYPE__TEMP1"] = { type ='value', },
["TW_TYPE_QUAT4F"] = { type ='value', },
["TW_TYPE_QUAT4D"] = { type ='value', },
["TW_TYPE_DIR3F"] = { type ='value', },
["TW_TYPE_DIR3D"] = { type ='value', },
["TW_TYPE_CSSTRING_LEN0"] = { type ='value', },
["TW_TYPE_CSSTRING_LEN256"] = { type ='value', },
["TW_PARAM_INT32"] = { type ='value', },
["TW_PARAM_FLOAT"] = { type ='value', },
["TW_PARAM_DOUBLE"] = { type ='value', },
["TW_PARAM_CSTRING"] = { type ='value', },
["TW_OPENGL"] = { type ='value', },
["TW_DIRECT3D9"] = { type ='value', },
["TW_DIRECT3D10"] = { type ='value', },
["TW_DIRECT3D11"] = { type ='value', },
["TW_KMOD_NONE"] = { type ='value', },
["TW_KMOD_SHIFT"] = { type ='value', },
["TW_KMOD_CTRL"] = { type ='value', },
["TW_KMOD_ALT"] = { type ='value', },
["TW_KMOD_META"] = { type ='value', },
["TW_KEY_BACKSPACE"] = { type ='value', },
["TW_KEY_TAB"] = { type ='value', },
["TW_KEY_CLEAR"] = { type ='value', },
["TW_KEY_RETURN"] = { type ='value', },
["TW_KEY_PAUSE"] = { type ='value', },
["TW_KEY_ESCAPE"] = { type ='value', },
["TW_KEY_SPACE"] = { type ='value', },
["TW_KEY_DELETE"] = { type ='value', },
["TW_KEY_UP"] = { type ='value', },
["TW_KEY_DOWN"] = { type ='value', },
["TW_KEY_RIGHT"] = { type ='value', },
["TW_KEY_LEFT"] = { type ='value', },
["TW_KEY_INSERT"] = { type ='value', },
["TW_KEY_HOME"] = { type ='value', },
["TW_KEY_END"] = { type ='value', },
["TW_KEY_PAGE_UP"] = { type ='value', },
["TW_KEY_PAGE_DOWN"] = { type ='value', },
["TW_KEY_F1"] = { type ='value', },
["TW_KEY_F2"] = { type ='value', },
["TW_KEY_F3"] = { type ='value', },
["TW_KEY_F4"] = { type ='value', },
["TW_KEY_F5"] = { type ='value', },
["TW_KEY_F6"] = { type ='value', },
["TW_KEY_F7"] = { type ='value', },
["TW_KEY_F8"] = { type ='value', },
["TW_KEY_F9"] = { type ='value', },
["TW_KEY_F10"] = { type ='value', },
["TW_KEY_F11"] = { type ='value', },
["TW_KEY_F12"] = { type ='value', },
["TW_KEY_F13"] = { type ='value', },
["TW_KEY_F14"] = { type ='value', },
["TW_KEY_F15"] = { type ='value', },
["TW_KEY_LAST"] = { type ='value', },
["TW_MOUSE_RELEASED"] = { type ='value', },
["TW_MOUSE_PRESSED"] = { type ='value', },
["TW_MOUSE_LEFT"] = { type ='value', },
["TW_MOUSE_MIDDLE"] = { type ='value', },
["TW_MOUSE_RIGHT"] = { type ='value', },
["TwNewBar"] = { type ='function',
description = "",
returns = "(TwBar*)",
valuetype = nil,
args = "(const char *barName)", },
["TwDeleteBar"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar)", },
["TwDeleteAllBars"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "()", },
["TwSetTopBar"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const TwBar *bar)", },
["TwGetTopBar"] = { type ='function',
description = "",
returns = "(TwBar*)",
valuetype = nil,
args = "()", },
["TwSetBottomBar"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const TwBar *bar)", },
["TwGetBottomBar"] = { type ='function',
description = "",
returns = "(TwBar*)",
valuetype = nil,
args = "()", },
["TwGetBarName"] = { type ='function',
description = "",
returns = "(const char*)",
valuetype = "string",
args = "(TwBar *bar)", },
["TwGetBarCount"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "()", },
["TwGetBarByIndex"] = { type ='function',
description = "",
returns = "(TwBar*)",
valuetype = nil,
args = "(int barIndex)", },
["TwGetBarByName"] = { type ='function',
description = "",
returns = "(TwBar*)",
valuetype = nil,
args = "(const char *barName)", },
["TwRefreshBar"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar)", },
["TwAddVarRW"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *name, TwType type, void *var, const char *def)", },
["TwAddVarRO"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *name, TwType type, const void *var, const char *def)", },
["TwAddVarCB"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def)", },
["TwAddButton"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *name, TwButtonCallback callback, void *clientData, const char *def)", },
["TwAddSeparator"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *name, const char *def)", },
["TwRemoveVar"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *name)", },
["TwRemoveAllVars"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar)", },
["TwDefine"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const char *def)", },
["TwDefineEnum"] = { type ='function',
description = "",
returns = "(TwType)",
valuetype = nil,
args = "(const char *name, const TwEnumVal *enumValues, unsigned int nbValues)", },
["TwDefineEnumFromString"] = { type ='function',
description = "",
returns = "(TwType)",
valuetype = nil,
args = "(const char *name, const char *enumString)", },
["TwDefineStruct"] = { type ='function',
description = "",
returns = "(TwType)",
valuetype = nil,
args = "(const char *name, const TwStructMember *structMembers, unsigned int nbMembers, size_t structSize, TwSummaryCallback summaryCallback, void *summaryClientData)", },
["TwCopyCDStringToClientFunc"] = { type ='function',
description = "",
returns = "(void)",
valuetype = nil,
args = "(TwCopyCDStringToClient copyCDStringFunc)", },
["TwCopyCDStringToLibrary"] = { type ='function',
description = "",
returns = "(void)",
valuetype = nil,
args = "(char **destinationLibraryStringPtr, const char *sourceClientString)", },
["TwGetParam"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int outValueMaxCount, void *outValues)", },
["TwSetParam"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues)", },
["TwInit"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwGraphAPI graphAPI, void *device)", },
["TwTerminate"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "()", },
["TwDraw"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "()", },
["TwWindowSize"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int width, int height)", },
["TwSetCurrentWindow"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int windowID)", },
["TwGetCurrentWindow"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "()", },
["TwWindowExists"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int windowID)", },
["TwKeyPressed"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int key, int modifiers)", },
["TwKeyTest"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int key, int modifiers)", },
["TwMouseButton"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(TwMouseAction action, TwMouseButtonID button)", },
["TwMouseMotion"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int mouseX, int mouseY)", },
["TwMouseWheel"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int pos)", },
["TwGetLastError"] = { type ='function',
description = "",
returns = "(const char*)",
valuetype = "string",
args = "()", },
["TwHandleErrors"] = { type ='function',
description = "",
returns = "(void)",
valuetype = nil,
args = "(TwErrorHandler errorHandler)", },
["TwEventSDL"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const void *sdlEvent, unsigned char sdlMajorVersion, unsigned char sdlMinorVersion)", },
["TwEventSDL12"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const void *sdlEvent)", },
["TwEventSDL13"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const void *sdlEvent)", },
["TwEventMouseButtonGLFW"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int glfwButton, int glfwAction)", },
["TwEventKeyGLFW"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int glfwKey, int glfwAction)", },
["TwEventCharGLFW"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int glfwChar, int glfwAction)", },
["TwEventMouseButtonGLUT"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int glutButton, int glutState, int mouseX, int mouseY)", },
["TwEventMouseMotionGLUT"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int mouseX, int mouseY)", },
["TwEventKeyboardGLUT"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(unsigned char glutKey, int mouseX, int mouseY)", },
["TwEventSpecialGLUT"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int glutKey, int mouseX, int mouseY)", },
["glutGetModifiersFunc"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(void))", },
["TwEventSFML"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const void *sfmlEvent, unsigned char sfmlMajorVersion, unsigned char sfmlMinorVersion)", },
["TwEnumVal"] = { type ='class',
description = "",
childs = {
["Value"] = { type ='value', description = "int ", valuetype = nil, },
["Label"] = { type ='value', description = "const char * ", valuetype = "string", },
}
},
["TwStructMember"] = { type ='class',
description = "",
childs = {
["Name"] = { type ='value', description = "const char * ", valuetype = "string", },
["Type"] = { type ='value', description = "TwType ", valuetype = nil, },
["Offset"] = { type ='value', description = "size_t ", valuetype = nil, },
["DefString"] = { type ='value', description = "const char * ", valuetype = "string", },
}
},
}
return {
tw = {
type = 'lib',
description = "AntTweakBar UI",
childs = api,
},
tweakbar = {
type = 'lib',
description = "AntTweakBar UI",
childs = api,
},
}

2577
api/lua/gideros.lua Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4301
api/lua/love2d.lua Normal file

File diff suppressed because it is too large Load Diff

6828
api/lua/moai.lua Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
bin/clibs/mime/core.dll Executable file

Binary file not shown.

BIN
bin/clibs/mime/core.dylib Normal file

Binary file not shown.

0
bin/clibs/socket/core.dll Normal file → Executable file
View File

BIN
bin/clibs/socket/core.dylib Normal file

Binary file not shown.

BIN
bin/clibs/ssl.dll Normal file

Binary file not shown.

Binary file not shown.

BIN
bin/libjpeg.8.dylib Normal file

Binary file not shown.

BIN
bin/libwx.dylib Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/lua Executable file

Binary file not shown.

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>lua</string>
<key>CFBundleDisplayName</key>
<string>Lua</string>
<key>CFBundleGetInfoString</key>
<string></string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>Lua</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string></string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string></string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
</dict>
</plist>

BIN
bin/lua.app/Contents/MacOS/lua Executable file

Binary file not shown.

0
bin/lua.exe Normal file → Executable file
View File

0
bin/lua5.1.dll Normal file → Executable file
View File

BIN
bin/lua51.dll Normal file

Binary file not shown.

Binary file not shown.

BIN
bin/wx.dll Normal file → Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

142
build/CMakeLists.txt Normal file
View File

@@ -0,0 +1,142 @@
# setup the minimum allowed CMake version
cmake_minimum_required(VERSION 2.8)
# set the default build type (this needs to be done *before* project command)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif()
# restrict configuration types to the selected build type
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE INTERNAL "" FORCE)
# set the project name
project("zbstudio")
# set the top-level project directory relative to CMakeLists.txt location
set(TOPDIR ..)
# checks if the Lua module is available
function(check_lua_module MODULE)
if(NOT ${MODULE}_FOUND)
# find Lua executable at first
find_program(LUA_EXECUTABLE "lua")
if(NOT LUA_EXECUTABLE)
message(FATAL_ERROR "Lua executable is not found")
endif()
# run a short script with "require" statement to determine if the Lua module is available
execute_process(COMMAND "${LUA_EXECUTABLE}" -e "require(\"${MODULE}\")"
RESULT_VARIABLE EXIT_CODE OUTPUT_QUIET ERROR_QUIET)
if(EXIT_CODE EQUAL 0)
set(${MODULE}_FOUND TRUE CACHE INTERNAL "")
message(STATUS "Found Lua module: ${MODULE}")
elseif(ARGV1)
message(FATAL_ERROR "Lua module \"${MODULE}\" is not found")
endif()
endif()
endfunction()
# adds an user option to select between system-wide and bundled Lua module
function(add_system_lua_module_option MODULE)
string(TOUPPER ${MODULE} UPPERCASE_MODULE)
if(NOT DEFINED USE_SYSTEM_${UPPERCASE_MODULE})
option(USE_SYSTEM_${UPPERCASE_MODULE}
"Use a system-wide \"${MODULE}\" Lua module instead of the bundled one." ${${MODULE}_FOUND})
endif()
endfunction()
# installs all files listed in the manifest
function(install_from_manifest TYPE MANIFEST DESTDIR EXCLUDE_REGEX)
file(STRINGS ${MANIFEST} PATTERN_LIST)
foreach(PATTERN ${PATTERN_LIST})
string(STRIP ${PATTERN} PATTERN)
if(NOT PATTERN MATCHES ${EXCLUDE_REGEX})
file(GLOB FILELIST RELATIVE "${CMAKE_SOURCE_DIR}/${TOPDIR}" "${CMAKE_SOURCE_DIR}/${TOPDIR}/${PATTERN}")
foreach(FILENAME ${FILELIST})
get_filename_component(FILEPATH ${FILENAME} PATH)
install(${TYPE} ${TOPDIR}/${FILENAME} DESTINATION ${DESTDIR}/${FILEPATH})
endforeach()
endif()
endforeach()
endfunction()
if(WIN32)
# add the executable file to our project
add_executable(zbstudio WIN32 ${TOPDIR}/build/win32_starter.c ${TOPDIR}/zbstudio/res/zbstudio.rc)
# link to the static multi-threaded CRT under MSVC
if(MSVC)
string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
foreach(FLAGS_VAR CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_C_FLAGS_${BUILD_TYPE} CMAKE_CXX_FLAGS_${BUILD_TYPE})
string(REGEX REPLACE "/MD" "/MT" ${FLAGS_VAR} ${${FLAGS_VAR}})
string(REGEX REPLACE "/MDd" "/MTd" ${FLAGS_VAR} ${${FLAGS_VAR}})
endforeach()
endif()
# setup the data directory
set(DATADIR .)
# install IDE executable
install(TARGETS zbstudio DESTINATION ${DATADIR})
# install files from manifest
install_from_manifest(FILES ${TOPDIR}/zbstudio/MANIFEST ${DATADIR} "^$")
install_from_manifest(FILES ${TOPDIR}/zbstudio/MANIFEST-bin-win32 ${DATADIR} "^zbstudio.exe$")
elseif(APPLE)
# setup the data directory
set(ROOTDIR ZeroBraneStudio.app/Contents)
set(DATADIR ${ROOTDIR}/ZeroBraneStudio)
# install IDE shell script
install(PROGRAMS ${TOPDIR}/zbstudio/ZeroBraneStudio.app/Contents/MacOS/ZeroBraneStudio DESTINATION ${ROOTDIR}/MacOS)
# install icon pack and .plist file
install(DIRECTORY ${TOPDIR}/zbstudio/ZeroBraneStudio.app/Contents/Resources DESTINATION ${ROOTDIR})
install(FILES ${TOPDIR}/zbstudio/ZeroBraneStudio.app/Contents/Info.plist DESTINATION ${ROOTDIR})
# install files from manifest
install_from_manifest(FILES ${TOPDIR}/zbstudio/MANIFEST ${DATADIR} "^$")
install_from_manifest(PROGRAMS ${TOPDIR}/zbstudio/MANIFEST-bin-macos ${DATADIR} "^$")
else()
# check the available Lua modules
check_lua_module(wx TRUE)
check_lua_module(socket TRUE)
check_lua_module(copas ${USE_SYSTEM_COPAS})
check_lua_module(luainspect ${USE_SYSTEM_LUAINSPECT})
#check_lua_module(mobdebug ${USE_SYSTEM_MOBDEBUG})
# add user options to select between system-wide and bundled Lua modules
add_system_lua_module_option(copas)
add_system_lua_module_option(luainspect)
#add_system_lua_module_option(mobdebug)
# setup the data directory
set(DATADIR share/zbstudio)
# install IDE shell script
set(IDE_DATADIR "${CMAKE_INSTALL_PREFIX}/${DATADIR}")
configure_file(${TOPDIR}/zbstudio/zbstudio.in "${CMAKE_BINARY_DIR}/zbstudio")
install(PROGRAMS "${CMAKE_BINARY_DIR}/zbstudio" DESTINATION bin)
# install bundled Lua modules
if(NOT USE_SYSTEM_COPAS)
install(DIRECTORY ${TOPDIR}/lualibs/copas ${TOPDIR}/lualibs/coxpcall DESTINATION ${DATADIR}/lualibs)
endif()
if(NOT USE_SYSTEM_LUAINSPECT)
install(DIRECTORY ${TOPDIR}/lualibs/luainspect ${TOPDIR}/lualibs/metalua DESTINATION ${DATADIR}/lualibs)
endif()
if(NOT USE_SYSTEM_MOBDEBUG)
install(DIRECTORY ${TOPDIR}/lualibs/mobdebug DESTINATION ${DATADIR}/lualibs)
endif()
# install .desktop file and hicolor icon theme
install(DIRECTORY ${TOPDIR}/zbstudio/res/icons/ DESTINATION share/icons/hicolor)
install(FILES ${TOPDIR}/zbstudio/res/zbstudio.desktop DESTINATION share/applications)
# install miscellaneous documentation files
install(FILES ${TOPDIR}/CHANGELOG.md ${TOPDIR}/LICENSE ${TOPDIR}/README.md DESTINATION share/doc/zbstudio)
# install files from manifest
install_from_manifest(FILES ${TOPDIR}/zbstudio/MANIFEST ${DATADIR} "^(CHANGELOG.md|LICENSE|README.md)$|^lualibs/")
endif()

Binary file not shown.

42
build/build-dmg.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
set -x
TEMPLATE_DMG=/tmp/ZeroBraneStudio-template.dmg
BUILT_DMG=ZeroBraneStudio.dmg
WKDIR=/tmp/zbs-build
# remove problematic symlink
rm ../zbstudio/ZeroBraneStudio.app/Contents/ZeroBraneStudio
bunzip2 -kf ZeroBraneStudio.dmg.bz2
mv ZeroBraneStudio.dmg $TEMPLATE_DMG
hdiutil attach "${TEMPLATE_DMG}" -noautoopen -quiet -mountpoint "${WKDIR}"
rm -rf "${WKDIR}/ZeroBraneStudio.app"
# copy the app to where it should be
cp -pr "../zbstudio/ZeroBraneStudio.app" "${WKDIR}/ZeroBraneStudio.app"
mkdir "${WKDIR}/ZeroBraneStudio.app/Contents/ZeroBraneStudio"
# only pick the files listed in manifests and 'myprograms' (if exists)
if [[ -d ../myprograms ]]; then MYPROGRAMS=$(cd ..; find myprograms -iname *.lua); fi
(cd ".."; tar cf - $MYPROGRAMS $(< zbstudio/MANIFEST) $(< zbstudio/MANIFEST-bin-macos) | (cd "${WKDIR}/ZeroBraneStudio.app/Contents/ZeroBraneStudio/"; tar xf -))
codesign -s "ZeroBrane LLC" ${WKDIR}/ZeroBraneStudio.app
codesign --signature-size 6400 -s "ZeroBrane LLC" ${WKDIR}/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/lua.app
# clean up
sudo rm -rf "${WKDIR}/.Trashes"
sudo rm -rf "${WKDIR}/.fseventsd"
hdiutil detach "${WKDIR}" -quiet -force
hdiutil convert "${TEMPLATE_DMG}" -quiet -format UDZO -imagekey zlib-level=9 -o "${BUILT_DMG}"
rm -f "${TEMPLATE_DMG}"
cd ../zbstudio/ZeroBraneStudio.app/Contents
ln -s ../../.. ZeroBraneStudio
echo Built ${BUILT_DMG}.

4
build/install-deb.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
sudo apt-get install gdebi
sudo gdebi wxlua*.deb

View File

@@ -4,7 +4,7 @@
// (providing a single exe file in our main directory without
// polluting it with all these dlls located in the /bin folder)
#ifdef __MINGW__ /* not sure if this is the *official* define */
#ifdef __MINGW32__
#define _WIN32_WINNT 0x0502
#endif

Binary file not shown.

View File

@@ -1,9 +1,15 @@
local G = ... -- point to the global environment in the script
-- update app configuration to load all tools, specs, and interpreters
G.ide.app.loadfilters.tools = function() return true end
G.ide.app.loadfilters.specs = function() return true end
G.ide.app.loadfilters.interpreters = function() return true end
local luxpath = os.getenv("LUXINIA")
path.luxinia = luxpath and luxpath.."/" or "../luxinia/engine/"
local luxpath2 = os.getenv("LUXINIA2")
path.luxinia2 = luxpath2 and luxpath2.."/" or "../luxinia2/runtime/bin_Windows_x86/"
interpreter = "estrelashell"
interpreter = "luadeb"
editor.fontname = "Courier New"
editor.caretline = true

53
cfg/user-sample.lua Normal file
View File

@@ -0,0 +1,53 @@
--[[-- Copy required content from this file to `user.lua`
Configuration files are loaded in the following order
1. <application>\config.lua
2. cfg\user.lua
3. ~\.zbstudio\user.lua
4. -cfg commandline strings
--]]--
-- an example of how loaded configuration can be modified from this file
-- change font size to 12
editor.fontsize = 12 -- this is mapped to ide.config.editor.fontsize
editor.fontname = "Courier New"
filehistorylength = 20 -- this is mapped to ide.config.filehistorylength
-- specify full path to love2d *executable*; this is only needed
-- if the game folder and the executable are NOT in the same folder.
path.love2d = 'd:/lua/love/love'
-- specify full path to moai *executable* if it's not in one of PATH folders
path.moai = 'd:/lua/moai/moai'
-- specify full path to gideros *executable* if it's not in one of PATH folders
path.gideros = 'd:/Program Files/Gideros/GiderosPlayer.exe'
-- specify full path to lua interpreter if you need to use your own version
path.lua = 'd:/lua/lua'
-- fix an issue with 0d0d0a line endings in MOAI examples,
-- which may negatively affect breakpoints during debugging
editor.iofilter = "0d0d0aFix"
-- to have 4 spaces when TAB is used in the editor
editor.tabwidth = 4
-- to have TABs stored in the file (to allow mixing tabs and spaces)
editor.usetabs = true
-- to disable wrapping of long lines in the editor
editor.usewrap = false
-- to turn dynamic words on and to start suggestions after 4 characters
acandtip.nodynwords = false
acandtip.startat = 4
-- to automatically open files requested during debugging
editor.autoactivate = true
-- specify a list of MOAI entrypoints
moai = { entrypoints = { "main.lua", "source/main.lua" } }

View File

@@ -1,9 +0,0 @@
--[[--
estrela loads configs in the following order
1. <application>\config.lua
2. cfg\user.lua
3. -cfg commandline strings
--]]--

Binary file not shown.

View File

@@ -1,29 +0,0 @@
local ide = ide
local app = {
loadfilters = {
tools = function(file) return true end,
specs = function(file) return true end,
interpreters = function(file) return true end,
},
postinit = function ()
dofile("estrela/menu_help.lua")
local icon = wx.wxIcon()
icon:LoadFile("estrela/res/estrela.ico",wx.wxBITMAP_TYPE_ICO)
ide.frame:SetIcon(icon)
end,
stringtable = {
editor = "Estrela Editor",
about = "About Estrela Editor",
editormessage = "Estrela Editor Message",
statuswelcome = "Welcome to Estrela Editor",
settingsapp = "EstrelaEditor",
settingsvendor = "LuxiniaDev",
},
}
return app

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="starter" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="..\..\estrela" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\" />
<Option object_output="obj\Debug\" />
<Option type="1" />
<Option compiler="gcc" />
<Option use_console_runner="0" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="..\..\estrela" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\" />
<Option object_output="obj\Release\" />
<Option type="0" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-D__MINGW__" />
</Compiler>
<Linker>
<Add library="kernel32" />
</Linker>
<Unit filename="..\res\estrela.ico" />
<Unit filename="..\res\estrela.rc">
<Option compilerVar="WINDRES" />
</Unit>
<Unit filename="..\win32_starter.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@@ -1,212 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Name="estrela_editor"
ProjectGUID="{065C5DC6-EAE4-4A57-9069-39810D816C41}"
RootNamespace="luxinia_glfw"
Keyword="Win32Proj"
TargetFrameworkVersion="131072"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
OutputFile="../../estrela.exe"
LinkIncremental="2"
AdditionalLibraryDirectories=""
IgnoreDefaultLibraryNames="libc"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(TargetPath).pdb"
SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;"
RuntimeLibrary="0"
EnableEnhancedInstructionSet="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CompileAs="1"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
AdditionalIncludeDirectories=""
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
OutputFile="../../estrela.exe"
LinkIncremental="1"
AdditionalLibraryDirectories=""
GenerateManifest="true"
IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
ProgramDatabaseFile="$(TargetPath).pdb"
SubSystem="2"
OptimizeReferences="0"
EnableCOMDATFolding="0"
RandomizedBaseAddress="0"
DataExecutionPrevention="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Sources"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\win32_starter.c"
>
</File>
</Filter>
<Filter
Name="Ressourcendateien"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath="..\..\res\estrela.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,113 +0,0 @@
-- authors: Lomtik Software (J. Winwood & John Labenski)
-- Luxinia Dev (Eike Decker & Christoph Kubisch)
---------------------------------------------------------
local ide = ide
-- ---------------------------------------------------------------------------
-- Create the Help menu and attach the callback functions
local frame = ide.frame
local menuBar = frame.menuBar
local helpMenu = wx.wxMenu{
{ ID_ABOUT, "&About\tF1", "About Estrela Editor" },
}
menuBar:Append(helpMenu, "&Help")
local function DisplayAbout(event)
local page = [[
<html>
<body bgcolor = "#ffffff" text='#ffffff'>
<table border='0' width="100%">
<tr><td><img src = "estrela/res/estrela.png"></center></td><td>
<table cellspacing = 4 cellpadding = 4 width = "400">
<tr>
<td bgcolor = "#010156">
<center>
<font size = +2 color = "#FFFFFF"><br><b>]]..
wxlua.wxLUA_VERSION_STRING..[[</b></font>
<font size = +1 color = "#FFFFFF">built with</font>
<font size = +2 color = "#FFFFFF"><b>]]..
wx.wxVERSION_STRING..[[</b></font>
</center>
</td>
</tr>
<tr>
<td bgcolor = "#4747A1">
<b>Estrela Editor</b><br>
<b><font color='#ffffff'>Copyright &copy; 2008-2011 Luxinia DevTeam</font></b>
<p>
<font size=-1>
<table cellpadding = 0 cellspacing = 0 width = "100%">
<tr>
<td width = "65%">
Christoph Kubisch<br>
Eike Decker<p>
</td>
<td valign = top>
</td>
</tr>
</table>
<font size = 1>
Licensed under The MIT License.
</font>
</font>
</td>
</tr>
<tr>
<td bgcolor = "#4747A1">
<b>based on wxLua editor sample</b><br>
<b>Copyright &copy; 2002-2005 Lomtick Software</b>
<p>
<font size=-1>
<table cellpadding = 0 cellspacing = 0 width = "100%">
<tr>
<td width = "65%">
J. Winwood (luascript@thersgb.net)<br>
John Labenski<p>
</td>
<td valign = top>
<img src = "estrela/res/wxlualogo2.png">
</td>
</tr>
</table>
<font size = 1>
wxLua binding licensed under wxWindows Library License, Version 3.
</font>
</font>
</td>
</tr>
</table>
</td></tr></table>
</body>
</html>
]]
local dlg = wx.wxDialog(frame, wx.wxID_ANY, "About Estrela Editor")
local html = wx.wxLuaHtmlWindow(dlg, wx.wxID_ANY,
wx.wxDefaultPosition, wx.wxSize(500, 270),
wx.wxHW_SCROLLBAR_NEVER)
local line = wx.wxStaticLine(dlg, wx.wxID_ANY)
local button = wx.wxButton(dlg, wx.wxID_OK, "OK")
button:SetDefault()
html:SetBorders(0)
html:SetPage(page)
html:SetSize(html:GetInternalRepresentation():GetWidth(),
html:GetInternalRepresentation():GetHeight())
local topsizer = wx.wxBoxSizer(wx.wxVERTICAL)
topsizer:Add(html, 1, wx.wxALL, 10)
topsizer:Add(line, 0, wx.wxEXPAND + wx.wxLEFT + wx.wxRIGHT, 10)
topsizer:Add(button, 0, wx.wxALL + wx.wxALIGN_RIGHT, 10)
dlg:SetAutoLayout(true)
dlg:SetSizer(topsizer)
topsizer:Fit(dlg)
dlg:ShowModal()
dlg:Destroy()
end
frame:Connect(ID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED, DisplayAbout)

View File

@@ -1,20 +0,0 @@
Estrela Editor
-----------------
Estrela Editor is a wxLua based IDE. It supports multiple
fileformats, "api" for autocompletion and tooltips, and custom
commandline tools. Focus is extensibility for target applications
using Lua. Its main purpose is as IDE for the 3D engine "Luxinia".
Commandline:
------------
Open File(s):
<exe> <filename> [<filename>...]
any non-option will be treated as filename
Overriding Config:
<exe> [...] -cfg "<luacode overriding config>" [...]
e.g.: estrela.exe -cfg "singleinstance=false;" somefile.lua

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

View File

@@ -1 +0,0 @@
icon ICON "../res/estrela.ico"

View File

@@ -1,706 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg2178"
sodipodi:version="0.32"
inkscape:version="0.46+devel"
width="146"
height="146"
version="1.0"
sodipodi:docname="idelogo.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="36.990002"
inkscape:export-ydpi="36.990002">
<metadata
id="metadata2183">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs2181">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 73 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="146 : 73 : 1"
inkscape:persp3d-origin="73 : 48.666667 : 1"
id="perspective86" />
<linearGradient
id="linearGradient4596">
<stop
style="stop-color:#5151ac;stop-opacity:1;"
offset="0"
id="stop4598" />
<stop
style="stop-color:#000055;stop-opacity:1;"
offset="1"
id="stop4600" />
</linearGradient>
<linearGradient
id="linearGradient4588">
<stop
style="stop-color:#62769d;stop-opacity:1;"
offset="0"
id="stop4590" />
<stop
style="stop-color:#ff0000;stop-opacity:0;"
offset="1"
id="stop4592" />
</linearGradient>
<linearGradient
id="linearGradient5185">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop5187" />
<stop
style="stop-color:#000000;stop-opacity:1"
offset="1"
id="stop5189" />
</linearGradient>
<linearGradient
id="linearGradient2237">
<stop
style="stop-color:#0d0d3f;stop-opacity:1;"
offset="0"
id="stop2239" />
<stop
id="stop3702"
offset="0.33628318"
style="stop-color:#12127a;stop-opacity:1;" />
<stop
style="stop-color:#3e3e80;stop-opacity:1"
offset="1"
id="stop2241" />
</linearGradient>
<filter
inkscape:collect="always"
x="-0.13963953"
width="1.279279"
y="-0.14821953"
height="1.2964391"
id="filter3840">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="6.5521521"
id="feGaussianBlur3842" />
</filter>
<filter
inkscape:collect="always"
id="filter6278">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.214876"
id="feGaussianBlur6280" />
</filter>
<mask
maskUnits="userSpaceOnUse"
id="mask6290">
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
id="rect6292"
width="128"
height="128"
x="0"
y="-8.5265128e-014"
ry="13.206349"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
</mask>
<mask
maskUnits="userSpaceOnUse"
id="mask6295">
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
id="rect6297"
width="128"
height="128"
x="0"
y="-8.5265128e-014"
ry="13.206349"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
</mask>
<filter
inkscape:collect="always"
id="filter6316">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="0.6425"
id="feGaussianBlur6318" />
</filter>
<filter
inkscape:collect="always"
x="-0.096865753"
width="1.1937315"
y="-0.13864499"
height="1.27729"
id="filter6400">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="5.3595156"
id="feGaussianBlur6402" />
</filter>
<filter
inkscape:collect="always"
x="-0.091426807"
width="1.1828536"
y="-0.21857401"
height="1.437148"
id="filter6510">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="4.3854492"
id="feGaussianBlur6512" />
</filter>
<filter
inkscape:collect="always"
x="-0.065166176"
width="1.1303324"
y="-0.14160248"
height="1.283205"
id="filter6588">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="3.0129427"
id="feGaussianBlur6590" />
</filter>
<filter
inkscape:collect="always"
x="-0.10324995"
width="1.2064999"
y="-0.19036609"
height="1.3807322"
id="filter6628">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="5.1083162"
id="feGaussianBlur6630" />
</filter>
<filter
inkscape:collect="always"
x="-0.66312472"
width="2.3262494"
y="-0.13057123"
height="1.2611425"
id="filter6690">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.059841"
id="feGaussianBlur6692" />
</filter>
<filter
inkscape:collect="always"
x="-0.75290101"
width="2.505802"
y="-0.11094242"
height="1.2218848"
id="filter6776">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.1015794"
id="feGaussianBlur6778" />
</filter>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4596"
id="linearGradient4602"
x1="63.296463"
y1="141"
x2="63.296463"
y2="-5.0469656"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(13.788582,2.1213203)" />
<filter
inkscape:collect="always"
id="filter3377"
x="-0.1015625"
width="1.203125"
y="-0.087053571"
height="1.1741071">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.7929688"
id="feGaussianBlur3379" />
</filter>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4596"
id="linearGradient3381"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.89166667,0,0,0.89166667,19.638582,9.162987)"
x1="63.296463"
y1="141"
x2="63.296463"
y2="-5.0469656" />
<filter
inkscape:collect="always"
id="filter3419"
x="-0.10422356"
width="1.2084471"
y="-0.093260085"
height="1.1865202">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="4.0324593"
id="feGaussianBlur3421" />
</filter>
<filter
inkscape:collect="always"
id="filter3425"
x="-0.12187501"
width="1.24375"
y="-0.10446428"
height="1.2089286">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.9431967"
id="feGaussianBlur3427" />
</filter>
<filter
inkscape:collect="always"
id="filter3451"
x="-0.1187245"
width="1.237449"
y="-0.12130321"
height="1.2426064">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="7.6549135"
id="feGaussianBlur3453" />
</filter>
<filter
height="1.3165256"
y="-0.15826278"
width="1.3097967"
x="-0.15489837"
id="filter3467"
inkscape:collect="always">
<feGaussianBlur
id="feGaussianBlur3469"
stdDeviation="9.98727"
inkscape:collect="always" />
</filter>
<filter
inkscape:collect="always"
id="filter3483"
x="-0.27362286"
width="1.5472457"
y="-0.27956598"
height="1.559132">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="17.642184"
id="feGaussianBlur3485" />
</filter>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4596"
id="linearGradient3497"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.9558335,0,0,0.9558335,16.173573,4.9921428)"
x1="63.296463"
y1="141"
x2="63.296463"
y2="-5.0469656" />
<filter
inkscape:collect="always"
id="filter3499"
x="-0.059528317"
width="1.1190566"
y="-0.10133829"
height="1.2026766">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.667066"
id="feGaussianBlur3501" />
</filter>
<filter
inkscape:collect="always"
id="filter3509"
x="-0.0309375"
width="1.061875"
y="-2.0109374"
height="5.0218749">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="1.3472814"
id="feGaussianBlur3511" />
</filter>
</defs>
<sodipodi:namedview
inkscape:window-height="719"
inkscape:window-width="1024"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10.0"
gridtolerance="10.0"
objecttolerance="10.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
inkscape:zoom="1"
inkscape:cx="74.122861"
inkscape:cy="61.737644"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:current-layer="layer2"
showborder="true"
inkscape:showpageshadow="false"
showgrid="false" />
<g
inkscape:groupmode="layer"
id="layer1"
style="opacity:0.34615383;display:none"
transform="translate(6,5)">
<image
xlink:href="c:\temp\luxlogo.png"
sodipodi:absref="c:\temp\luxlogo.png"
width="128"
height="128"
id="image2185"
x="0"
y="0" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
style="display:inline"
transform="translate(6,5)">
<rect
y="4.7046537"
x="14.288583"
height="124.83334"
width="107"
id="rect3423"
style="opacity:1;fill:url(#linearGradient3381);fill-opacity:1;fill-rule:evenodd;stroke:none;filter:url(#filter3425)"
transform="matrix(1.0719628,0,0,1.0719628,-4.8782561,-4.8302384)"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587" />
<rect
style="opacity:1;fill:url(#linearGradient3497);fill-opacity:1;fill-rule:evenodd;stroke:none"
id="rect4586"
width="114.70002"
height="133.8167"
x="10.438573"
y="0.21297537"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587" />
<g
id="g3227"
transform="matrix(0.36255137,0,0,0.36255137,43.548278,21.953343)"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587">
<g
id="g2599"
transform="matrix(0.73621364,0,0,0.73621364,15.540372,-36.334537)">
<path
sodipodi:nodetypes="csscssc"
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="M 19.37247,3.0246539 C -16.608082,20.649318 -41.404147,57.657551 -41.404147,100.40056 c 0,59.80351 48.5400427,108.34356 108.343566,108.34356 40.892381,0 76.510811,-22.69984 94.952061,-56.1714 -15.59146,8.96867 -33.63299,14.11858 -52.89924,14.11858 C 50.276054,166.69131 2.5877015,119.06356 2.5877015,60.347369 c 0,-21.110232 6.1656802,-40.772917 16.7847685,-57.3227151 z"
id="path2193"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none"
d="m 46.59366,22.910342 11.81888,0 9.19246,-10.505671 5.252837,14.445294 11.818878,1.969814 -11.818878,9.192463 0.656603,13.132087 -11.81888,-9.849067 -11.818877,3.939627 4.59623,-11.818877 -7.879253,-10.50567 z"
id="path2205"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none"
d="m 113.62886,82.661339 13.7887,-14.445296 -5.25284,-19.69813 18.38488,8.535854 15.10187,-10.505668 -1.9698,19.698131 15.1019,12.475482 -19.04153,4.596232 -7.87924,15.758505 -8.53582,-16.41511 -19.69812,0 z"
id="path2207"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none;display:inline"
d="m 84.710796,92.101734 3.261705,-2.372978 0.427566,-4.744945 4.349957,2.931871 3.6572,-1.829365 -1.416054,4.909864 2.817849,3.492287 -5.239188,-0.345107 -2.470713,3.460214 -1.104536,-4.184532 -4.283786,-1.317309 z"
id="path2209"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
</g>
</g>
<text
xml:space="preserve"
style="font-size:29.89867401px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Palatino Linotype;-inkscape-font-specification:Palatino Linotype"
x="66.859642"
y="95.922615"
id="text2585"
sodipodi:linespacing="100%"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587"><tspan
sodipodi:role="line"
id="tspan2587"
x="66.859642"
y="95.922615">Estrela</tspan><tspan
sodipodi:role="line"
x="66.859642"
y="125.82129"
id="tspan2589">Editor</tspan></text>
<rect
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;"
id="rect3383"
width="104.51637"
height="1.6079443"
x="15.530396"
y="99.936134"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587" />
<g
transform="matrix(0.36255137,0,0,0.36255137,43.548278,21.953343)"
id="g3439"
style="filter:url(#filter3451)"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587">
<g
transform="matrix(0.73621364,0,0,0.73621364,15.540372,-36.334537)"
id="g3441">
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3443"
d="M 19.37247,3.0246539 C -16.608082,20.649318 -41.404147,57.657551 -41.404147,100.40056 c 0,59.80351 48.5400427,108.34356 108.343566,108.34356 40.892381,0 76.510811,-22.69984 94.952061,-56.1714 -15.59146,8.96867 -33.63299,14.11858 -52.89924,14.11858 C 50.276054,166.69131 2.5877015,119.06356 2.5877015,60.347369 c 0,-21.110232 6.1656802,-40.772917 16.7847685,-57.3227151 z"
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
sodipodi:nodetypes="csscssc" />
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3445"
d="m 46.59366,22.910342 11.81888,0 9.19246,-10.505671 5.252837,14.445294 11.818878,1.969814 -11.818878,9.192463 0.656603,13.132087 -11.81888,-9.849067 -11.818877,3.939627 4.59623,-11.818877 -7.879253,-10.50567 z"
style="fill:#ffffff;fill-rule:evenodd;stroke:none" />
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3447"
d="m 113.62886,82.661339 13.7887,-14.445296 -5.25284,-19.69813 18.38488,8.535854 15.10187,-10.505668 -1.9698,19.698131 15.1019,12.475482 -19.04153,4.596232 -7.87924,15.758505 -8.53582,-16.41511 -19.69812,0 z"
style="fill:#ffffff;fill-rule:evenodd;stroke:none" />
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3449"
d="m 84.710796,92.101734 3.261705,-2.372978 0.427566,-4.744945 4.349957,2.931871 3.6572,-1.829365 -1.416054,4.909864 2.817849,3.492287 -5.239188,-0.345107 -2.470713,3.460214 -1.104536,-4.184532 -4.283786,-1.317309 z"
style="fill:#ffffff;fill-rule:evenodd;stroke:none;display:inline" />
</g>
</g>
<g
style="filter:url(#filter3467)"
id="g3455"
transform="matrix(0.36255137,0,0,0.36255137,43.548278,21.953343)"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587">
<g
id="g3457"
transform="matrix(0.73621364,0,0,0.73621364,15.540372,-36.334537)">
<path
sodipodi:nodetypes="csscssc"
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
d="M 19.37247,3.0246539 C -16.608082,20.649318 -41.404147,57.657551 -41.404147,100.40056 c 0,59.80351 48.5400427,108.34356 108.343566,108.34356 40.892381,0 76.510811,-22.69984 94.952061,-56.1714 -15.59146,8.96867 -33.63299,14.11858 -52.89924,14.11858 C 50.276054,166.69131 2.5877015,119.06356 2.5877015,60.347369 c 0,-21.110232 6.1656802,-40.772917 16.7847685,-57.3227151 z"
id="path3459"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none"
d="m 46.59366,22.910342 11.81888,0 9.19246,-10.505671 5.252837,14.445294 11.818878,1.969814 -11.818878,9.192463 0.656603,13.132087 -11.81888,-9.849067 -11.818877,3.939627 4.59623,-11.818877 -7.879253,-10.50567 z"
id="path3461"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none"
d="m 113.62886,82.661339 13.7887,-14.445296 -5.25284,-19.69813 18.38488,8.535854 15.10187,-10.505668 -1.9698,19.698131 15.1019,12.475482 -19.04153,4.596232 -7.87924,15.758505 -8.53582,-16.41511 -19.69812,0 z"
id="path3463"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:none;display:inline"
d="m 84.710796,92.101734 3.261705,-2.372978 0.427566,-4.744945 4.349957,2.931871 3.6572,-1.829365 -1.416054,4.909864 2.817849,3.492287 -5.239188,-0.345107 -2.470713,3.460214 -1.104536,-4.184532 -4.283786,-1.317309 z"
id="path3465"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
</g>
</g>
<g
transform="matrix(0.36255137,0,0,0.36255137,43.548278,21.953343)"
id="g3471"
style="filter:url(#filter3483)"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587">
<g
transform="matrix(0.73621364,0,0,0.73621364,15.540372,-36.334537)"
id="g3473">
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3475"
d="M 19.37247,3.0246539 C -16.608082,20.649318 -41.404147,57.657551 -41.404147,100.40056 c 0,59.80351 48.5400427,108.34356 108.343566,108.34356 40.892381,0 76.510811,-22.69984 94.952061,-56.1714 -15.59146,8.96867 -33.63299,14.11858 -52.89924,14.11858 C 50.276054,166.69131 2.5877015,119.06356 2.5877015,60.347369 c 0,-21.110232 6.1656802,-40.772917 16.7847685,-57.3227151 z"
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
sodipodi:nodetypes="csscssc" />
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3477"
d="m 46.59366,22.910342 11.81888,0 9.19246,-10.505671 5.252837,14.445294 11.818878,1.969814 -11.818878,9.192463 0.656603,13.132087 -11.81888,-9.849067 -11.818877,3.939627 4.59623,-11.818877 -7.879253,-10.50567 z"
style="fill:#ffffff;fill-rule:evenodd;stroke:none" />
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3479"
d="m 113.62886,82.661339 13.7887,-14.445296 -5.25284,-19.69813 18.38488,8.535854 15.10187,-10.505668 -1.9698,19.698131 15.1019,12.475482 -19.04153,4.596232 -7.87924,15.758505 -8.53582,-16.41511 -19.69812,0 z"
style="fill:#ffffff;fill-rule:evenodd;stroke:none" />
<path
inkscape:export-ydpi="300"
inkscape:export-xdpi="300"
inkscape:export-filename="c:\temp\logotest"
id="path3481"
d="m 84.710796,92.101734 3.261705,-2.372978 0.427566,-4.744945 4.349957,2.931871 3.6572,-1.829365 -1.416054,4.909864 2.817849,3.492287 -5.239188,-0.345107 -2.470713,3.460214 -1.104536,-4.184532 -4.283786,-1.317309 z"
style="fill:#ffffff;fill-rule:evenodd;stroke:none;display:inline" />
</g>
</g>
<text
sodipodi:linespacing="100%"
id="text3487"
y="93.989136"
x="66.922005"
style="font-size:27.89152144999999900px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:100%;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Palatino Linotype;-inkscape-font-specification:Palatino Linotype;filter:url(#filter3499);opacity:1"
xml:space="preserve"
transform="matrix(1.0719628,0,0,1.0719628,-4.8782561,-4.8302384)"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587"><tspan
y="93.989136"
x="66.922005"
id="tspan3489"
sodipodi:role="line">Estrela</tspan><tspan
id="tspan3491"
y="121.88066"
x="66.922005"
sodipodi:role="line">Editor</tspan></text>
<rect
y="99.936134"
x="15.530396"
height="1.6079443"
width="104.51637"
id="rect3507"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter3509)"
inkscape:export-xdpi="181.25587"
inkscape:export-ydpi="181.25587"
inkscape:export-filename="D:\dev\c\tools\wxide\res\estrela.png" />
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="uninstall"
style="opacity:0.87179488;display:none">
<path
style="opacity:0.90909095;fill:#ff0000;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6628)"
d="M 14,129.5 C 14.336023,78.681123 10.223888,102.29852 28,126 C 30.459675,129.27957 31.666667,118.66667 33.5,115 C 34.280157,113.43969 60.370804,77.40912 51.5,105.5 C 50.690734,108.06268 52.166667,110.83333 52.5,113.5 C 53.627928,122.52343 58.069819,95.430181 64.5,89 C 77.260993,76.239007 72.034223,53.027263 77.5,84 C 81.920823,109.05133 73.638657,88.715336 86.5,85.5 C 115.4259,78.268526 69.170508,123.74712 95.5,104 C 128.78796,79.03403 116,64.235283 116,113.5 C 116,117.62311 118,105.5 119,101.5 C 121.13437,92.962501 126.33333,117.5 130,125.5 C 130.87839,127.41648 131.33333,121.5 132,119.5 C 133.424,115.228 131.66667,128.5 131.5,133"
id="path6594"
transform="matrix(1,0,0,1.6987359,0,-92.931881)" />
<path
style="opacity:0.81404952;fill:#ff0000;fill-rule:nonzero;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline;filter:url(#filter6400)"
d="M 9.5,127 C 9.3333333,127 9.1666667,127 9,127 C 5.1450826,127 5,115.26288 5,113 C 5,108.88399 4.5,104.31286 4.5,100 C 4.5,90.729345 9.3911698,86.181384 14,78.5 C 16.525846,74.290257 21.294069,70.176551 23.5,66.5 C 24.010025,65.649958 19.12736,72.1816 18,75 C 16.175585,79.561038 16.938863,85.255452 18,89.5 C 19.417577,95.17031 20.550245,97.050245 24.5,101 C 27.204082,103.70408 28.564013,105.87197 30.5,102 C 32.717007,97.565986 32.821681,88.213274 34,83.5 C 36.21779,74.628838 33.5,60.648945 33.5,51.5 C 33.5,51.084452 43.746631,33.513476 40.5,46.5 C 37.526688,58.393246 42.328731,65.743097 48.5,75 C 57.52302,88.53453 51.657407,61.728395 65.5,52.5 C 75.452786,45.864809 69.5,56.563364 69.5,63.5 C 69.5,97.806907 73.726993,52.544988 80,63 C 104.74932,104.24887 98.5,68.637999 98.5,48 C 98.5,43.548461 105.9654,52.637713 112,63.5 C 131.67898,98.922169 101.60755,95.392446 125.5,71.5 C 131.39727,65.602731 126.5,88.160003 126.5,96.5 C 126.5,103.50198 126.00977,110.56839 127,117.5 C 127.95497,124.1848 139.22574,81.791102 137,108.5 C 136.48054,114.73353 136,120.29333 136,126.5 C 136,131.40801 136.45529,134 131,134 C 124.83333,134 118.66667,134 112.5,134 C 106.66667,134 100.83333,134 95,134 C 87.666667,134 80.333333,134 73,134 C 59.815481,134 46.676285,134.5 33.5,134.5 C 29,134.5 24.5,134.5 20,134.5 C 17.560468,134.5 15.299427,130.79943 14.5,130 C 12.881524,128.38152 11.876707,127.47534 9.5,127 z "
id="path6360" />
<path
style="opacity:0.7892562;fill:#ffff00;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6510)"
d="M 18,133 C 17.666667,128.16667 17.333333,123.33333 17,118.5 C 16.12131,105.759 12.392768,108.83915 20.5,121 C 26.928487,130.64273 27.121348,121.87865 34.5,114.5 C 40.14466,108.85534 28.809035,133.69097 46.5,116 C 69.437036,93.062964 57.251105,73.257733 62,106.5 C 62.141421,107.48995 62,108.5 62,109.5 C 62,116.18839 65.961948,99.019026 77,93.5 C 84.016889,89.991555 79.782388,94.911939 82,106 C 84.489642,118.44821 104.6601,90.259847 107.5,86 C 108.99663,83.755053 110.63899,106.80503 109.5,112.5 C 107.85301,120.73495 118.5,80.922943 118.5,109 C 118.5,136.59389 130.5,113.97346 130.5,123.5 C 130.5,126.59415 130.47115,131.64424 130,134"
id="path6404" />
<path
style="opacity:0.47107436;fill:#ffff00;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6588)"
d="M 23,129.5 C 23,132.18128 23.707157,117.52684 20.5,105.5 C 18.755021,98.956331 22.5,82.949866 22.5,98 C 22.5,101.13302 26.815124,126.46219 32,113.5 C 37.373635,100.06591 49.880495,78.048761 46.5,86.5 C 45.909734,87.975665 37.7573,136.7281 47.5,107.5 C 47.857122,106.42863 51.414918,124.58508 58,118 C 68.456644,107.54336 70,50.914151 70,100.5 C 70,131.81187 78.663987,96.334003 94,92.5 C 101.72907,90.567732 88.111037,107.55652 87.5,115.5 C 87.384247,117.00479 87.833333,118.5 88,120 C 89.236992,131.13293 100.98113,100.50944 111,95.5 C 121.54122,90.229389 111.5,106.05757 111.5,112 C 111.5,113.79505 112.83333,115.33333 113.5,117 C 114.6363,119.84076 116.5,111.66667 118,109 C 127.18664,92.668192 120.25003,138.81244 129.5,118 C 129.81325,117.2952 131,128.12728 131,131.5"
id="path6514"
transform="matrix(1,0,0,1.558102,0,-73.390417)" />
<path
style="opacity:0.73966944;fill:#ffa500;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6690)"
d="M 98.5,75 C 103.15482,68.57691 90.320092,24.848129 101.5,40.5 C 102.88049,42.432688 106.61962,69.035283 102,72.5 C 100.85302,73.360232 99.666667,74.166667 98.5,75 z "
id="path6632" />
<path
style="opacity:0.94214872;fill:#ffba00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6776)"
d="M 51,68 C 45.233621,73.766379 50.387595,36.449622 50.5,36 C 53.115126,25.539495 57.714899,13.962753 49.5,34.5 C 44.403872,47.24032 50.084923,57.754768 53.5,68 C 53.763523,68.790569 51.833333,68 51,68 z "
id="path6696" />
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="border"
style="display:none">
<rect
transform="translate(6,5)"
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline;filter:url(#filter6316)"
id="rect6282"
width="128"
height="128"
x="0"
y="-8.5265128e-014"
ry="13.206349"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300" />
<rect
transform="translate(6,5)"
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline;filter:url(#filter6278)"
id="rect4190"
width="128"
height="128"
x="0"
y="-8.5265128e-014"
ry="13.206349"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300"
mask="url(#mask6290)" />
<rect
transform="translate(6,5)"
style="opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
id="rect5203"
width="128"
height="128"
x="0"
y="-8.5265128e-014"
ry="13.206349"
inkscape:export-filename="c:\temp\logotest"
inkscape:export-xdpi="300"
inkscape:export-ydpi="300"
mask="url(#mask6295)" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="204.22055"
height="96.006279"
id="svg3513"
sodipodi:version="0.32"
inkscape:version="0.46+devel"
version="1.0"
inkscape:export-filename="D:\dev\c\tools\wxide\res\wxlualogo2.png"
inkscape:export-xdpi="59.996075"
inkscape:export-ydpi="59.996075"
sodipodi:docname="wxlogo.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs3515">
<linearGradient
id="linearGradient3538">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3540" />
<stop
style="stop-color:#e3e3eb;stop-opacity:1;"
offset="1"
id="stop3542" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective3521" />
<inkscape:perspective
id="perspective3530"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3538"
id="linearGradient3544"
x1="88.214287"
y1="0.2142856"
x2="88.214287"
y2="81.130592"
gradientUnits="userSpaceOnUse" />
<filter
inkscape:collect="always"
id="filter4057"
x="-0.044305418"
width="1.0886108"
y="-0.10071105"
height="1.2014221">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="2.2929748"
id="feGaussianBlur4059" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="98.55416"
inkscape:cy="58.784487"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1024"
inkscape:window-height="719"
inkscape:window-x="-4"
inkscape:window-y="-4" />
<metadata
id="metadata3518">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-102.354,-435.00191)">
<rect
ry="12.142858"
y="-1.9285716"
x="-5"
height="85"
width="193.21428"
id="rect3546"
style="opacity:0.5;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;filter:url(#filter4057)"
transform="translate(112.85714,442.43362)" />
<rect
style="opacity:1;fill:url(#linearGradient3544);fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect3536"
width="193.21428"
height="85"
x="-5"
y="-1.9285716"
transform="translate(112.85714,442.43362)"
ry="12.142858" />
<image
y="442.43362"
x="112.85714"
id="image3532"
height="77"
width="180"
sodipodi:absref="D:\dev\c\tools\wxide\res\wxlualogo.png"
xlink:href="wxlualogo.png" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -1,12 +0,0 @@
return {
name = "Estrela Editor",
description = "Estrela Editor as run target (IDE development)",
api = {"wxwidgets","baselib"},
frun = function(self,wfilename)
local cmd = ide.editorFilename and '"'..ide.editorFilename..'" '..(wfilename and wfilename:GetFullPath() or "")..' -cfg "singleinstance=false;"' or nil
CommandLineRun(cmd,nil,false,true)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
}

121
interpreters/gideros.lua Normal file
View File

@@ -0,0 +1,121 @@
local gideros
local win = ide.osname == "Windows"
local mac = ide.osname == "Macintosh"
return {
name = "Gideros",
description = "Gideros mobile platform",
api = {"baselib", "gideros"},
frun = function(self,wfilename,rundebug)
gideros = gideros or ide.config.path.gideros -- check if the path is configured
if not gideros then
local sep = win and ';' or ':'
local default =
win and ([[C:\Program Files\Gideros]]..sep..[[D:\Program Files\Gideros]]..sep)
or mac and ('/Applications/Gideros Studio/Gideros Player.app/Contents/MacOS'..sep)
or ''
local path = default
..(os.getenv('PATH') or '')..sep
..(os.getenv('HOME') and os.getenv('HOME') .. '/bin' or '')
local paths = {}
for p in path:gmatch("[^"..sep.."]+") do
gideros = gideros or GetFullPathIfExists(p, win and 'GiderosPlayer.exe' or 'Gideros Player')
table.insert(paths, p)
end
if not gideros then
DisplayOutput("Can't find gideros executable in any of the folders in PATH: "
..table.concat(paths, ", ").."\n")
return
end
end
if gideros and not wx.wxFileName(gideros):FileExists() then
DisplayOutput("Can't find the specified gideros executable '"..gideros.."'.\n")
return
end
local giderostools = wx.wxFileName.DirName(wx.wxFileName(gideros)
:GetPath(wx.wxPATH_GET_VOLUME)
..(win and '/Tools' or '/../../../Gideros Studio.app/Contents/Tools'))
giderostools:Normalize()
local giderospath = giderostools:GetPath(wx.wxPATH_GET_VOLUME)
local gdrbridge = GetFullPathIfExists(giderospath, win and 'gdrbridge.exe' or 'gdrbridge')
if not gdrbridge then
DisplayOutput("Can't find gideros bridge executable in '"..giderospath.."'.\n")
return
end
-- find *.gproj file in the project directory
local file
for _, proj in ipairs(FileSysGet(self:fworkdir(wfilename).."/*.gproj", wx.wxFILE)) do
if file then
DisplayOutput("Found multiple .gproj files in the project directory; ignored '"..proj.."'\n")
end
file = proj
end
if not file then
DisplayOutput("Can't find gideros project file in the project directory.\n")
return
end
if rundebug then DebuggerAttachDefault() end
local cmd = ('"%s"'):format(gideros)
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
local pid = CommandLineRun(cmd,self:fworkdir(wfilename),not mac,true,nil,nil,
function() ide.debugger.pid = nil end)
do
DisplayOutput("Starting the player and waiting for the bridge to connect at '"..gdrbridge.."'.\n")
local cmd = ('"%s" %s'):format(gdrbridge, 'isconnected')
local attempts, connected = 12
for _ = 1, attempts do
local proc = wx.wxProcess()
proc:Redirect()
proc:Connect(wx.wxEVT_END_PROCESS, function(event) proc = nil end)
local bid = wx.wxExecute(cmd, wx.wxEXEC_ASYNC + wx.wxEXEC_MAKE_GROUP_LEADER, proc)
if not bid or bid == -1 or bid == 0 then
DisplayOutput(("Program unable to run as '%s'\n"):format(cmd))
return
end
local streamin = proc:GetInputStream()
for _ = 1, 20 do
if streamin:CanRead() then
connected = tonumber(streamin:Read(4096)) == 1
break end
wx.wxSafeYield()
wx.wxWakeUpIdle()
wx.wxMilliSleep(250)
end
if connected then break end
if connected == nil and proc then
wx.wxProcess.Kill(bid, wx.wxSIGKILL, wx.wxKILL_CHILDREN)
wx.wxProcess.Kill(pid, wx.wxSIGKILL, wx.wxKILL_CHILDREN)
DisplayOutput("Couldn't connect to the player. Try again or check starting the player and the bridge manually.\n")
return
end
end
if not connected then
wx.wxProcess.Kill(pid, wx.wxSIGKILL, wx.wxKILL_CHILDREN)
DisplayOutput("Couldn't connect after "..attempts.." attempts. Try again or check starting the player manually.\n")
return
end
DisplayOutput("Starting project file '"..file.."'.\n")
cmd = ('"%s" %s "%s"'):format(gdrbridge, 'play', file)
wx.wxExecute(cmd, wx.wxEXEC_ASYNC)
end
return pid
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
fworkdir = function(self,wfilename)
return ide.config.path.projectdir or wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
hasdebugger = true,
fattachdebug = function(self) DebuggerAttachDefault() end,
scratchextloop = true,
}

55
interpreters/love2d.lua Normal file
View File

@@ -0,0 +1,55 @@
local love2d
local win = ide.osname == "Windows"
local mac = ide.osname == "Macintosh"
return {
name = "Love2d",
description = "Love2d game engine",
api = {"baselib", "love2d"},
frun = function(self,wfilename,rundebug)
love2d = love2d or ide.config.path.love2d -- check if the path is configured
if not love2d then
local sep = win and ';' or ':'
local default =
win and ([[C:\Program Files\love]]..sep..[[D:\Program Files\love]]..sep)
or mac and ('/Applications/love.app/Contents/MacOS'..sep)
or ''
local path = default
..(os.getenv('PATH') or '')..sep
..(GetPathWithSep(self:fworkdir(wfilename)))..sep
..(os.getenv('HOME') and GetPathWithSep(os.getenv('HOME'))..'bin' or '')
local paths = {}
for p in path:gmatch("[^"..sep.."]+") do
love2d = love2d or GetFullPathIfExists(p, win and 'love.exe' or 'love')
table.insert(paths, p)
end
if not love2d then
DisplayOutput("Can't find love2d executable in any of the following folders: "
..table.concat(paths, ", ").."\n")
return
end
end
if not GetFullPathIfExists(self:fworkdir(wfilename), 'main.lua') then
DisplayOutput("Can't find 'main.lua' file in the current project folder.\n")
return
end
if rundebug then DebuggerAttachDefault() end
local cmd = ('"%s" "%s"%s'):format(love2d,
self:fworkdir(wfilename), rundebug and ' -debug' or '')
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil end)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
fworkdir = function(self,wfilename)
return ide.config.path.projectdir or wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
hasdebugger = true,
fattachdebug = function(self) DebuggerAttachDefault() end,
scratchextloop = true,
}

View File

@@ -1,22 +0,0 @@
return {
name = "Lua",
description = "Commandline Lua interpreter",
api = {"wxwidgets","baselib"},
frun = function(self,wfilename)
local mainpath = ide.editorFilename:gsub("[^/\\]+$","")
local filepath = wfilename:GetFullPath()
local code = ([[
xpcall(function() dofile '%s' end,
function(err) print(debug.traceback(err)) end)
]]):format(filepath:gsub("\\","/"))
local cmd = '"'..mainpath..'/bin/lua.exe" -e "'..code..'"'
CommandLineRun(cmd,self:fworkdir(wfilename),true,false)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
fworkdir = function (self,wfilename)
return ide.config.path.projectdir and ide.config.path.projectdir:len()>0 and
ide.config.path.projectdir
end,
}

View File

@@ -1,22 +1,40 @@
local exe
local function exePath()
local mainpath = ide.editorFilename:gsub("[^/\\]+$","")
local macExe = mainpath..'bin/lua.app/Contents/MacOS/lua'
return ide.config.path.lua or
(ide.osname == "Windows" and mainpath..[[bin\lua.exe]]
or (ide.osname == "Unix" and [[lua]]) -- using installed lua
or (wx.wxFileExists(macExe) and macExe or mainpath..[[bin/lua]]))
end
return {
name = "Lua Debug",
description = "Commandline Lua interpreter",
name = "Lua",
description = "Lua interpreter with debugger",
api = {"wxwidgets","baselib"},
frun = function(self,wfilename,rundebug)
local mainpath = string.gsub(ide.editorFilename:gsub("[^/\\]+$",""),"\\","/")
local filepath = string.gsub(wfilename:GetFullPath(), "\\","/")
exe = exe or exePath()
local filepath = wfilename:GetFullPath()
local script
if rundebug then
DebuggerAttachDefault()
script = (""..
"package.path=package.path..';"..mainpath.."lualibs/?/?.lua;"..mainpath.."lualibs/?.lua';"..
"package.cpath=package.cpath..';"..mainpath.."bin/clibs/?.dll';"..
"require('mobdebug').loop('" .. wx.wxGetHostName().."',"..ide.debugger.portnumber..")")
script = rundebug
else
script = ([[dofile '%s']]):format(filepath)
-- if running on Windows and can't open the file, this may mean that
-- the file path includes unicode characters that need special handling
local fh = io.open(filepath, "r")
if fh then fh:close() end
if ide.osname == 'Windows' and pcall(require, "winapi")
and wfilename:FileExists() and not fh then
winapi.set_encoding(winapi.CP_UTF8)
filepath = winapi.short_path(filepath)
end
script = ('dofile [[%s]]'):format(filepath)
end
local code = ([[xpcall(function() io.stdout:setvbuf('no'); %s end,function(err) print(debug.traceback(err)) end)]]):format(script)
local cmd = '"'..mainpath..'bin/lua.exe" -e "'..code..'"'
local cmd = '"'..exe..'" -e "'..code..'"'
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil end)
@@ -25,11 +43,9 @@ return {
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
fworkdir = function (self,wfilename)
return ide.config.path.projectdir
or wfilename:GetPath(wx.wxPATH_GET_VOLUME)
return ide.config.path.projectdir or wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
hasdebugger = true,
fattachdebug = function(self)
DebuggerAttachDefault()
end,
fattachdebug = function(self) DebuggerAttachDefault() end,
scratchextloop = false,
}

View File

@@ -52,7 +52,7 @@ return {
local editorDir = string.gsub(ide.editorFilename:gsub("[^/\\]+$",""),"\\","/")
script = ""..
"package.path=package.path..';"..editorDir.."lualibs/?/?.lua';"..
"io.stdout:setvbuf('no'); require('mobdebug').start('" .. wx.wxGetHostName().."',"..ide.debugger.portnumber..")"
"io.stdout:setvbuf('no'); require('mobdebug').start('" .. ide.debugger.hostname.."',"..ide.debugger.portnumber..")"
args = args..' -es "'..script..'"'..startargs
else
@@ -77,6 +77,7 @@ return {
if not rundebug then
local client = self:finitclient()
ShellSupportRemote(client,self:fuid(wfilename))
pid = nil
end
return pid

88
interpreters/moai.lua Normal file
View File

@@ -0,0 +1,88 @@
local moai
local win = ide.osname == "Windows"
return {
name = "Moai",
description = "Moai mobile platform",
api = {"baselib", "moai"},
frun = function(self,wfilename,rundebug)
moai = moai or ide.config.path.moai -- check if the path is configured
if not moai then
local sep = win and ';' or ':'
local default =
win and ([[C:\Program Files\moai]]..sep..[[D:\Program Files\moai]]..sep)
or ''
local path = default
..(os.getenv('PATH') or '')..sep
..(os.getenv('MOAI_BIN') or '')..sep
..(os.getenv('HOME') and os.getenv('HOME') .. '/bin' or '')
local paths = {}
for p in path:gmatch("[^"..sep.."]+") do
moai = moai or GetFullPathIfExists(p, win and 'moai.exe' or 'moai')
table.insert(paths, p)
end
if not moai then
DisplayOutput("Can't find moai executable in any of the folders in PATH or MOAI_BIN: "
..table.concat(paths, ", ").."\n")
return
end
end
local file
local epoints = ide.config.moai and ide.config.moai.entrypoints
if epoints then
epoints = type(epoints) == 'table' and epoints or {epoints}
for _,entry in pairs(epoints) do
file = GetFullPathIfExists(self:fworkdir(wfilename), entry)
if file then break end
end
if not file then
DisplayOutput("Can't find any of the specified entry points ("
..table.concat(epoints, ", ")
..") in the current project; continuing with the current file...\n")
end
end
if rundebug then
-- start running the application right away
DebuggerAttachDefault({runstart=true, startwith = file})
local code = (
[[xpcall(function()
io.stdout:setvbuf('no')
require("mobdebug").moai() -- enable debugging for coroutines
%s
end, function(err) print(debug.traceback(err)) end)]]):format(rundebug)
local tmpfile = wx.wxFileName()
tmpfile:AssignTempFileName(".")
file = tmpfile:GetFullPath()
local f = io.open(file, "w")
if not f then
DisplayOutput("Can't open temporary file '"..file.."' for writing\n")
return
end
f:write(code)
f:close()
end
file = file or wfilename:GetFullPath()
-- try to find a config file: (1) MOAI_CONFIG, (2) project directory,
-- (3) folder with the current file, (4) folder with moai executable
local config = GetFullPathIfExists(os.getenv('MOAI_CONFIG') or self:fworkdir(wfilename), 'config.lua')
or GetFullPathIfExists(wfilename:GetPath(wx.wxPATH_GET_VOLUME), 'config.lua')
or GetFullPathIfExists(wx.wxFileName(moai):GetPath(wx.wxPATH_GET_VOLUME), 'config.lua')
local cmd = config and ('"%s" "%s" "%s"'):format(moai, config, file)
or ('"%s" "%s"'):format(moai, file)
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil if rundebug then wx.wxRemoveFile(file) end end)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
fworkdir = function(self,wfilename)
return ide.config.path.projectdir or wfilename:GetPath(wx.wxPATH_GET_VOLUME)
end,
hasdebugger = true,
fattachdebug = function(self) DebuggerAttachDefault() end,
}

929
lualibs/luainspect/ast.lua Normal file
View File

@@ -0,0 +1,929 @@
-- luainspect.ast - Lua Abstract Syntax Tree (AST) and token list operations.
--
-- Two main structures are maintained. A Metalua-style AST represents the
-- nested syntactic structure obtained from the parse.
-- A separate linear ordered list of tokens represents the syntactic structure
-- from the lexing, including line information (character positions only not row/columns),
-- comments, and keywords, which is originally built from the lineinfo attributes
-- injected by Metalua into the AST (IMPROVE: it probably would be simpler
-- to obtain this from the lexer directly rather then inferring it from the parsing).
-- During AST manipulations, the lineinfo maintained in the AST is ignored
-- because it was found more difficult to maintain and not in the optimal format.
--
-- The contained code deals with
-- - Building the AST from source.
-- - Building the tokenlist from the AST lineinfo.
-- - Querying the AST+tokenlist.
-- - Modifying the AST+tokenlist (including incremental parsing source -> AST)
-- - Annotating the AST with navigational info (e.g. parent links) to assist queries.
-- - Dumping the tokenlist for debugging.
--
-- (c) 2010 David Manura, MIT License.
--! require 'luainspect.typecheck' (context)
-- boilerplate/utility
-- LUA_PATH="?.lua;/path/to/metalua/src/compiler/?.lua;/path/to/metalua/src/lib/?.lua"
-- import modules -- order is important
require "lexer"
require "gg"
require "mlp_lexer"
require "mlp_misc"
require "mlp_table"
require "mlp_meta"
require "mlp_expr"
require "mlp_stat"
--require "mlp_ext"
_G.mlc = {} -- make gg happy
-- Metalua:IMPROVE: make above imports simpler
local M = {}
--[=TESTSUITE
-- utilities
local ops = {}
ops['=='] = function(a,b) return a == b end
local function check(opname, a, b)
local op = assert(ops[opname])
if not op(a,b) then
error("fail == " .. tostring(a) .. " " .. tostring(b))
end
end
--]=]
-- CATEGORY: debug
local function DEBUG(...)
if LUAINSPECT_DEBUG then
print('DEBUG:', ...)
end
end
-- Converts character position to row,column position in string src.
-- Add values are 1-indexed.
function M.pos_to_linecol(pos, src)
local linenum = 1
local lasteolpos = 0
for eolpos in src:gmatch"()\n" do
if eolpos > pos then break end
linenum = linenum + 1
lasteolpos = eolpos
end
local colnum = pos - lasteolpos
return linenum, colnum
end
-- Removes any sheband ("#!") line from Lua source string.
-- CATEGORY: Lua parsing
function M.remove_shebang(src)
local shebang = src:match("^#![^\r\n]*")
return shebang and (" "):rep(#shebang) .. src:sub(#shebang+1) or src
end
-- Custom version of loadstring that parses out line number info
-- CATEGORY: Lua parsing
function M.loadstring(src)
local f, err = loadstring(src, "")
if f then
return f
else
err = err:gsub('^%[string ""%]:', "")
local linenum = assert(err:match("(%d+):"))
local colnum = 0
local linenum2 = err:match("^%d+: '[^']+' expected %(to close '[^']+' at line (%d+)")
return nil, err, linenum, colnum, linenum2
end
end
-- helper for ast_from_string. Raises on error.
-- FIX? filename currently ignored in Metalua
-- CATEGORY: Lua parsing
local function ast_from_string_helper(src, filename)
filename = filename or '(string)'
local lx = mlp.lexer:newstream (src, filename)
local ast = mlp.chunk(lx)
return ast
end
-- Counts number of lines in text.
-- Warning: the decision of whether to count a trailing new-line in a file
-- or an empty file as a line is a little subjective. This function currently
-- defines the line count as 1 plus the number of new line characters.
-- CATEGORY: utility/string
local function linecount(text)
local n = 1
for _ in text:gmatch'\n' do
n = n + 1
end
return n
end
-- Converts Lua source string to Lua AST (via mlp/gg).
-- CATEGORY: Lua parsing
function M.ast_from_string(src, filename)
local ok, ast = pcall(ast_from_string_helper, src, filename)
if not ok then
local err = ast
err = err:match('[^\n]*')
err = err:gsub("^.-:%s*line", "line")
-- mlp.chunk prepending this is undesirable. error(msg,0) would be better in gg.lua. Reported.
-- TODO-Metalua: remove when fixed in Metalua.
local linenum, colnum = err:match("line (%d+), char (%d+)")
if not linenum then
-- Metalua libraries may return "...gg.lua:56: .../mlp_misc.lua:179: End-of-file expected"
-- without the normal line/char numbers given things like "if x then end end". Should be
-- fixed probably with gg.parse_error in _chunk in mlp_misc.lua.
-- TODO-Metalua: remove when fixed in Metalua.
linenum = linecount(src)
colnum = 1
end
local linenum2 = nil
return nil, err, linenum, colnum, linenum2
else
return ast
end
end
-- Simple comment parser. Returns Metalua-style comment.
-- CATEGORY: Lua lexing
local function quick_parse_comment(src)
local s = src:match"^%-%-([^\n]*)()\n$"
if s then return {s, 1, #src, 'short'} end
local _, s = src:match(lexer.lexer.patterns.long_comment .. '\r?\n?$')
if s then return {s, 1, #src, 'long'} end
return nil
end
--FIX:check new-line correctness
--note: currently requiring \n at end of single line comment to avoid
-- incremental compilation with `--x\nf()` and removing \n from still
-- recognizing as comment `--x`.
-- currently allowing \r\n at end of long comment since Metalua includes
-- it in lineinfo of long comment (FIX:Metalua?)
-- Gets length of longest prefix string in both provided strings.
-- Returns max n such that text1:sub(1,n) == text2:sub(1,n) and n <= max(#text1,#text2)
-- CATEGORY: string utility
local function longest_prefix(text1, text2)
local nmin = 0
local nmax = math.min(#text1, #text2)
while nmax > nmin do
local nmid = math.ceil((nmin+nmax)/2)
if text1:sub(1,nmid) == text2:sub(1,nmid) then
nmin = nmid
else
nmax = nmid-1
end
end
return nmin
end
-- Gets length of longest postfix string in both provided strings.
-- Returns max n such that text1:sub(-n) == text2:sub(-n) and n <= max(#text1,#text2)
-- CATEGORY: string utility
local function longest_postfix(text1, text2)
local nmin = 0
local nmax = math.min(#text1, #text2)
while nmax > nmin do
local nmid = math.ceil((nmin+nmax)/2)
if text1:sub(-nmid) == text2:sub(-nmid) then --[*]
nmin = nmid
else
nmax = nmid-1
end
end
return nmin
end -- differs from longest_prefix only on line [*]
-- Determines AST node that must be re-evaluated upon changing code string from
-- `src` to `bsrc`, given previous top_ast/tokenlist/src.
-- Note: decorates top_ast as side-effect.
-- If preserve is true, then does not expand AST match even if replacement is invalid.
-- CATEGORY: AST/tokenlist manipulation
function M.invalidated_code(top_ast, tokenlist, src, bsrc, preserve)
-- Converts posiiton range in src to position range in bsrc.
local function range_transform(src_fpos, src_lpos)
local src_nlpos = #src - src_lpos
local bsrc_fpos = src_fpos
local bsrc_lpos = #bsrc - src_nlpos
return bsrc_fpos, bsrc_lpos
end
if src == bsrc then return end -- up-to-date
-- Find range of positions in src that differences correspond to.
-- Note: for zero byte range, src_pos2 = src_pos1 - 1.
local npre = longest_prefix(src, bsrc)
local npost = math.min(#src-npre, longest_postfix(src, bsrc))
-- note: min avoids overlap ambiguity
local src_fpos, src_lpos = 1 + npre, #src - npost
-- Find smallest AST node containing src range above. May also
-- be contained in (smaller) comment or whitespace.
local match_ast, match_comment, iswhitespace =
M.smallest_ast_containing_range(top_ast, tokenlist, src_fpos, src_lpos)
DEBUG('invalidate-smallest:', match_ast and (match_ast.tag or 'notag'), match_comment, iswhitespace)
-- Determine which (ast, comment, or whitespace) to match, and get its pos range in src and bsrc.
local srcm_fpos, srcm_lpos, bsrcm_fpos, bsrcm_lpos, mast, mtype
if iswhitespace then
mast, mtype = nil, 'whitespace'
srcm_fpos, srcm_lpos = src_fpos, src_lpos
elseif match_comment then
mast, mtype = match_comment, 'comment'
srcm_fpos, srcm_lpos = match_comment.fpos, match_comment.lpos
else
mast, mtype = match_ast, 'ast'
repeat
srcm_fpos, srcm_lpos = M.ast_pos_range(mast, tokenlist)
if not srcm_fpos then
if mast == top_ast then
srcm_fpos, srcm_lpos = 1, #src
break
else
M.ensure_parents_marked(top_ast)
mast = mast.parent
end
end
until srcm_fpos
end
bsrcm_fpos, bsrcm_lpos = range_transform(srcm_fpos, srcm_lpos)
-- Never expand match if preserve specified.
if preserve then
return srcm_fpos, srcm_lpos, bsrcm_fpos, bsrcm_lpos, mast, mtype
end
-- Determine if replacement could break parent nodes.
local isreplacesafe
if mtype == 'whitespace' then
if bsrc:sub(bsrcm_fpos, bsrcm_lpos):match'^%s*$' then -- replaced with whitespace
if bsrc:sub(bsrcm_fpos-1, bsrcm_lpos+1):match'%s' then -- not eliminating whitespace
isreplacesafe = true
end
end
elseif mtype == 'comment' then
local m2src = bsrc:sub(bsrcm_fpos, bsrcm_lpos)
DEBUG('invalidate-comment[' .. m2src .. ']')
if quick_parse_comment(m2src) then -- replaced with comment
isreplacesafe = true
end
end
if isreplacesafe then -- return on safe replacement
return srcm_fpos, srcm_lpos, bsrcm_fpos, bsrcm_lpos, mast, mtype
end
-- Find smallest containing statement block that will compile (or top_ast).
while 1 do
match_ast = M.get_containing_statementblock(match_ast, top_ast)
if match_ast == top_ast then
return 1,#src, 1, #bsrc, match_ast, 'statblock'
-- entire AST invalidated
end
local srcm_fpos, srcm_lpos = M.ast_pos_range(match_ast, tokenlist)
local bsrcm_fpos, bsrcm_lpos = range_transform(srcm_fpos, srcm_lpos)
local msrc = bsrc:sub(bsrcm_fpos, bsrcm_lpos)
DEBUG('invalidate-statblock:', match_ast and match_ast.tag, '[' .. msrc .. ']')
if loadstring(msrc) then -- compiled
return srcm_fpos, srcm_lpos, bsrcm_fpos, bsrcm_lpos, match_ast, 'statblock'
end
M.ensure_parents_marked(top_ast)
match_ast = match_ast.parent
end
end
-- Walks AST `ast` in arbitrary order, visiting each node `n`, executing `fdown(n)` (if specified)
-- when doing down and `fup(n)` (if specified) when going if.
-- CATEGORY: AST walk
function M.walk(ast, fdown, fup)
assert(type(ast) == 'table')
if fdown then fdown(ast) end
for _,bast in ipairs(ast) do
if type(bast) == 'table' then
M.walk(bast, fdown, fup)
end
end
if fup then fup(ast) end
end
-- Replaces contents of table t1 with contents of table t2.
-- Does not change metatable (if any).
-- This function is useful for swapping one AST node with another
-- while preserving any references to the node.
-- CATEGORY: table utility
function M.switchtable(t1, t2)
for k in pairs(t1) do t1[k] = nil end
for k in pairs(t2) do t1[k] = t2[k] end
end
-- Inserts all elements in list bt at index i in list t.
-- CATEGORY: table utility
local function tinsertlist(t, i, bt)
local oldtlen, delta = #t, i - 1
for ti = #t + 1, #t + #bt do t[ti] = false end -- preallocate (avoid holes)
for ti = oldtlen, i, -1 do t[ti + #bt] = t[ti] end -- shift
for bi = 1, #bt do t[bi + delta] = bt[bi] end -- fill
end
--[=[TESTSUITE:
local function _tinsertlist(t, i, bt)
for bi=#bt,1,-1 do table.insert(t, i, bt[bi]) end
end -- equivalent but MUCH less efficient for large tables
local function _tinsertlist(t, i, bt)
for bi=1,#bt do table.insert(t, i+bi-1, bt[bi]) end
end -- equivalent but MUCH less efficient for large tables
local t = {}; tinsertlist(t, 1, {}); assert(table.concat(t)=='')
local t = {}; tinsertlist(t, 1, {2,3}); assert(table.concat(t)=='23')
local t = {4}; tinsertlist(t, 1, {2,3}); assert(table.concat(t)=='234')
local t = {2}; tinsertlist(t, 2, {3,4}); assert(table.concat(t)=='234')
local t = {4,5}; tinsertlist(t, 1, {2,3}); assert(table.concat(t)=='2345')
local t = {2,5}; tinsertlist(t, 2, {3,4}); assert(table.concat(t)=='2345')
local t = {2,3}; tinsertlist(t, 3, {4,5}); assert(table.concat(t)=='2345')
print 'DONE'
--]=]
-- Gets list of keyword positions related to node ast in source src
-- note: ast must be visible, i.e. have lineinfo (e.g. unlike `Id "self" definition).
-- Note: includes operators.
-- Note: Assumes ast Metalua-style lineinfo is valid.
-- CATEGORY: tokenlist build
function M.get_keywords(ast, src)
local list = {}
if not ast.lineinfo then return list end
-- examine space between each pair of children i and j.
-- special cases: 0 is before first child and #ast+1 is after last child
-- Put children in lexical order.
-- Some binary operations have arguments reversed from lexical order.
-- For example, `a > b` becomes `Op{'lt', `Id 'b', `Id 'a'}
local oast =
(ast.tag == 'Op' and #ast == 3 and ast[2].lineinfo.first[3] > ast[3].lineinfo.first[3])
and {ast[1], ast[3], ast[2]} or ast
local i = 0
while i <= #ast do
-- j is node following i that has lineinfo
local j = i+1; while j < #ast+1 and not oast[j].lineinfo do j=j+1 end
-- Get position range [fpos,lpos] between subsequent children.
local fpos
if i == 0 then -- before first child
fpos = ast.lineinfo.first[3]
else
local last = oast[i].lineinfo.last; local c = last.comments
fpos = (c and #c > 0 and c[#c][3] or last[3]) + 1
end
local lpos
if j == #ast+1 then -- after last child
lpos = ast.lineinfo.last[3]
else
local first = oast[j].lineinfo.first; local c = first.comments
--DEBUG('first', ast.tag, first[3], src:sub(first[3], first[3]+3))
lpos = (c and #c > 0 and c[1][2] or first[3]) - 1
end
-- Find keyword in range.
local spos = fpos
repeat
local mfpos, tok, mlppos = src:match("^%s*()(%a+)()", spos)
if not mfpos then
mfpos, tok, mlppos = src:match("^%s*()(%p+)()", spos)
end
if mfpos then
local mlpos = mlppos-1
if mlpos > lpos then mlpos = lpos end
--DEBUG('look', ast.tag, #ast,i,j,'*', mfpos, tok, mlppos, fpos, lpos, src:sub(fpos, fpos+5))
if mlpos >= mfpos then
list[#list+1] = mfpos
list[#list+1] = mlpos
end
end
spos = mlppos
until not spos or spos > lpos
-- note: finds single keyword. in `local function` returns only `local`
--DEBUG(i,j ,'test[' .. src:sub(fpos, lpos) .. ']')
i = j -- next
--DESIGN:Lua: comment: string.match accepts a start position but not a stop position
end
return list
end
-- Q:Metalua: does ast.lineinfo[loc].comments imply #ast.lineinfo[loc].comments > 0 ?
-- Generates ordered list of tokens in top_ast/src.
-- Note: currently ignores operators and parens.
-- Note: Modifies ast.
-- Note: Assumes ast Metalua-style lineinfo is valid.
-- CATEGORY: AST/tokenlist query
local isterminal = {Nil=true, Dots=true, True=true, False=true, Number=true, String=true,
Dots=true, Id=true}
local function compare_tokens_(atoken, btoken) return atoken.fpos < btoken.fpos end
function M.ast_to_tokenlist(top_ast, src)
local tokens = {} -- {nbytes=#src}
local isseen = {}
M.walk(top_ast, function(ast)
if isterminal[ast.tag] then -- Extract terminal
local token = ast
if ast.lineinfo then
token.fpos, token.lpos, token.ast = ast.lineinfo.first[3], ast.lineinfo.last[3], ast
table.insert(tokens, token)
end
else -- Extract non-terminal
local keywordposlist = M.get_keywords(ast, src)
for i=1,#keywordposlist,2 do
local fpos, lpos = keywordposlist[i], keywordposlist[i+1]
local toksrc = src:sub(fpos, lpos)
local token = {tag='Keyword', fpos=fpos, lpos=lpos, ast=ast, toksrc}
table.insert(tokens, token)
end
end
-- Extract comments
for i=1,2 do
local comments = ast.lineinfo and ast.lineinfo[i==1 and 'first' or 'last'].comments
if comments then for _, comment in ipairs(comments) do
if not isseen[comment] then
comment.tag = 'Comment'
local token = comment
token.fpos, token.lpos, token.ast = comment[2], comment[3], comment
table.insert(tokens, token)
isseen[comment] = true
end
end end
end
end, nil)
table.sort(tokens, compare_tokens_)
return tokens
end
-- Gets tokenlist range [fidx,lidx] covered by ast. Returns nil,nil if not found.
--FIX:PERFORMANCE:this is slow on large files.
-- CATEGORY: AST/tokenlist query
function M.ast_idx_range_in_tokenlist(tokenlist, ast)
-- Get list of primary nodes under ast.
local isold = {}; M.walk(ast, function(ast) isold[ast] = true end)
-- Get range.
local fidx, lidx
for idx=1,#tokenlist do
local token = tokenlist[idx]
if isold[token.ast] then
lidx = idx
if not fidx then fidx = idx end
end
end
return fidx, lidx
end
-- Gets index range in tokenlist overlapped by character position range [fpos, lpos].
-- For example, `do ff() end` with range ` ff() ` would match tokens `ff()`.
-- Tokens partly inside range are counted, so range `f()` would match tokens `ff()`.
-- If lidx = fidx - 1, then position range is whitespace between tokens lidx (on left)
-- and fidx (on right), and this may include token pseudoindices 0 (start of file) and
-- #tokenlist+1 (end of file).
-- Note: lpos == fpos - 1 indicates zero-width range between chars lpos and fpos.
-- CATEGORY: tokenlist query
function M.tokenlist_idx_range_over_pos_range(tokenlist, fpos, lpos)
-- Find first/last indices of tokens overlapped (even partly) by position range.
local fidx, lidx
for idx=1,#tokenlist do
local token = tokenlist[idx]
--if (token.fpos >= fpos and token.fpos <= lpos) or (token.lpos >= fpos and token.lpos <= lpos) then -- token overlaps range
if fpos <= token.lpos and lpos >= token.fpos then -- range overlaps token (even partially)
if not fidx then fidx = idx end
lidx = idx
end
end
if not fidx then -- on fail, check between tokens
for idx=1,#tokenlist+1 do -- between idx-1 and idx
local tokfpos, toklpos = tokenlist[idx-1] and tokenlist[idx-1].lpos, tokenlist[idx] and tokenlist[idx].fpos
if (not tokfpos or fpos > tokfpos) and (not toklpos or lpos < toklpos) then -- range between tokens
return idx, idx-1
end
end
end
return fidx, lidx
end
--[=[TESTSUITE
local function test(...)
return table.concat({M.tokenlist_idx_range_over_pos_range(...)}, ',')
end
check('==', test({}, 2, 2), "1,0") -- no tokens
check('==', test({{tag='Id', fpos=1, lpos=1}}, 2, 2), "2,1") -- right of one token
check('==', test({{tag='Id', fpos=3, lpos=3}}, 2, 2), "1,0") -- left of one token
check('==', test({{tag='Id', fpos=3, lpos=4}}, 2, 3), "1,1") -- left partial overlap one token
check('==', test({{tag='Id', fpos=3, lpos=4}}, 4, 5), "1,1") -- right partial overlap one token
check('==', test({{tag='Id', fpos=3, lpos=6}}, 4, 5), "1,1") -- partial inner overlap one token
check('==', test({{tag='Id', fpos=3, lpos=6}}, 3, 6), "1,1") -- exact overlap one token
check('==', test({{tag='Id', fpos=4, lpos=5}}, 3, 6), "1,1") -- extra overlap one token
check('==', test({{tag='Id', fpos=2, lpos=3}, {tag='Id', fpos=5, lpos=6}}, 4, 4), "2,1") -- between tokens, " " exact
check('==', test({{tag='Id', fpos=2, lpos=3}, {tag='Id', fpos=5, lpos=6}}, 4, 3), "2,1") -- between tokens, "" on left
check('==', test({{tag='Id', fpos=2, lpos=3}, {tag='Id', fpos=5, lpos=6}}, 5, 4), "2,1") -- between tokens, "" on right
check('==', test({{tag='Id', fpos=2, lpos=3}, {tag='Id', fpos=4, lpos=5}}, 4, 3), "2,1") -- between tokens, "" exact
--]=]
-- Removes tokens in tokenlist covered by ast.
-- CATEGORY: tokenlist manipulation
local function remove_ast_in_tokenlist(tokenlist, ast)
local fidx, lidx = M.ast_idx_range_in_tokenlist(tokenlist, ast)
if fidx then -- note: fidx implies lidx
for idx=lidx,fidx,-1 do table.remove(tokenlist, idx) end
end
end
-- Inserts tokens from btokenlist into tokenlist. Preserves sort.
-- CATEGORY: tokenlist manipulation
local function insert_tokenlist(tokenlist, btokenlist)
local ftoken = btokenlist[1]
if ftoken then
-- Get index in tokenlist in which to insert tokens in btokenlist.
local fidx
for idx=1,#tokenlist do
if tokenlist[idx].fpos > ftoken.fpos then fidx = idx; break end
end
fidx = fidx or #tokenlist + 1 -- else append
-- Insert tokens.
tinsertlist(tokenlist, fidx, btokenlist)
end
end
-- Get character position range covered by ast in tokenlist. Returns nil,nil on not found.
-- CATEGORY: AST/tokenlist query
function M.ast_pos_range(ast, tokenlist) -- IMPROVE:style: ast_idx_range_in_tokenlist has params reversed
local fidx, lidx = M.ast_idx_range_in_tokenlist(tokenlist, ast)
if fidx then
return tokenlist[fidx].fpos, tokenlist[lidx].lpos
else
return nil, nil
end
end
-- Gets string representation of AST node. nil if none.
-- IMPROVE: what if node is empty block?
-- CATEGORY: AST/tokenlist query
function M.ast_to_text(ast, tokenlist, src) -- IMPROVE:style: ast_idx_range_in_tokenlist has params reversed
local fpos, lpos = M.ast_pos_range(ast, tokenlist)
if fpos then
return src:sub(fpos, lpos)
else
return nil
end
end
-- Gets smallest AST node in top_ast/tokenlist/src
-- completely containing position range [pos1, pos2].
-- careful: "function" is not part of the `Function node.
-- If range is inside comment, returns comment also.
-- If range is inside whitespace, then returns true in third return value.
-- CATEGORY: AST/tokenlist query
function M.smallest_ast_containing_range(top_ast, tokenlist, pos1, pos2)
local f0idx, l0idx = M.tokenlist_idx_range_over_pos_range(tokenlist, pos1, pos2)
-- Find enclosing AST.
M.ensure_parents_marked(top_ast)
local fidx, lidx = f0idx, l0idx
while tokenlist[fidx] and not tokenlist[fidx].ast.parent do fidx = fidx - 1 end
while tokenlist[lidx] and not tokenlist[lidx].ast.parent do lidx = lidx + 1 end
-- DEBUG(fidx, lidx, f0idx, l0idx, #tokenlist, pos1, pos2, tokenlist[fidx], tokenlist[lidx])
local ast = not (tokenlist[fidx] and tokenlist[lidx]) and top_ast or
M.common_ast_parent(tokenlist[fidx].ast, tokenlist[lidx].ast, top_ast)
-- DEBUG('m2', tokenlist[fidx], tokenlist[lidx], top_ast, ast, ast and ast.tag)
if l0idx == f0idx - 1 then -- whitespace
return ast, nil, true
elseif l0idx == f0idx and tokenlist[l0idx].tag == 'Comment' then
return ast, tokenlist[l0idx], nil
else
return ast, nil, nil
end
end
--IMPROVE: handle string edits and maybe others
-- Gets smallest statement block containing position pos or
-- nearest statement block before pos, whichever is smaller, given ast/tokenlist.
function M.current_statementblock(ast, tokenlist, pos)
local fidx,lidx = M.tokenlist_idx_range_over_pos_range(tokenlist, pos, pos)
if fidx > lidx then fidx = lidx end -- use nearest backward
-- Find closest AST node backward
while fidx >= 1 and tokenlist[fidx].tag == 'Comment' do fidx=fidx-1 end
if fidx < 1 then return ast, false end
local mast = tokenlist[fidx].ast
if not mast then return ast, false end
mast = M.get_containing_statementblock(mast, ast)
local isafter = false
if mast.tag2 ~= 'Block' then
local mfidx,mlidx = M.ast_idx_range_in_tokenlist(tokenlist, mast)
if pos > mlidx then
isafter = true
end
end
return mast, isafter
end
-- Gets index of bast in ast (nil if not found).
-- CATEGORY: AST query
function M.ast_idx(ast, bast)
for idx=1,#ast do
if ast[idx] == bast then return idx end
end
return nil
end
-- Gets parent of ast and index of ast in parent.
-- Root node top_ast must also be provided. Returns nil, nil if ast is root.
-- Note: may call mark_parents.
-- CATEGORY: AST query
function M.ast_parent_idx(top_ast, ast)
if ast == top_ast then return nil, nil end
M.ensure_parents_marked(top_ast); assert(ast.parent)
local idx = M.ast_idx(ast.parent, ast)
return ast.parent, idx
end
-- Gets common parent of aast and bast. Always returns value.
-- Must provide root top_ast too.
-- CATEGORY: AST query
function M.common_ast_parent(aast, bast, top_ast)
M.ensure_parents_marked(top_ast)
local isparent = {}
local tast = bast; repeat isparent[tast] = true; tast = tast.parent until not tast
local uast = aast; repeat if isparent[uast] then return uast end; uast = uast.parent until not uast
assert(false)
end
-- Replaces old_ast with new_ast/new_tokenlist in top_ast/tokenlist.
-- Note: assumes new_ast is a block. assumes old_ast is a statement or block.
-- CATEGORY: AST/tokenlist
function M.replace_statements(top_ast, tokenlist, old_ast, new_ast, new_tokenlist)
remove_ast_in_tokenlist(tokenlist, old_ast)
insert_tokenlist(tokenlist, new_tokenlist)
if old_ast == top_ast then -- special case: no parent
M.switchtable(old_ast, new_ast) -- note: safe since block is not in tokenlist.
else
local parent_ast, idx = M.ast_parent_idx(top_ast, old_ast)
table.remove(parent_ast, idx)
tinsertlist(parent_ast, idx, new_ast)
end
-- fixup annotations
for _,bast in ipairs(new_ast) do
if top_ast.tag2 then M.mark_tag2(bast, bast.tag == 'Do' and 'StatBlock' or 'Block') end
if old_ast.parent then M.mark_parents(bast, old_ast.parent) end
end
end
-- Adjusts lineinfo in tokenlist.
-- All char positions starting at pos1 are shifted by delta number of chars.
-- CATEGORY: tokenlist
function M.adjust_lineinfo(tokenlist, pos1, delta)
for _,token in ipairs(tokenlist) do
if token.fpos >= pos1 then
token.fpos = token.fpos + delta
end
if token.lpos >= pos1 then
token.lpos = token.lpos + delta
end
end
--tokenlist.nbytes = tokenlist.nbytes + delta
end
-- For each node n in ast, sets n.parent to parent node of n.
-- Assumes ast.parent will be parent_ast (may be nil)
-- CATEGORY: AST query
function M.mark_parents(ast, parent_ast)
ast.parent = parent_ast
for _,ast2 in ipairs(ast) do
if type(ast2) == 'table' then
M.mark_parents(ast2, ast)
end
end
end
-- Calls mark_parents(ast) if ast not marked.
-- CATEGORY: AST query
function M.ensure_parents_marked(ast)
if ast[1] and not ast[1].parent then M.mark_parents(ast) end
end
-- For each node n in ast, sets n.tag2 to context string:
-- 'Block' - node is block
-- 'Stat' - node is statement
-- 'StatBlock' - node is statement and block (i.e. `Do)
-- 'Exp' - node is expression
-- 'Explist' - node is expression list (or identifier list)
-- 'Pair' - node is key-value pair in table constructor
-- note: ast.tag2 will be set to context.
-- CATEGORY: AST query
local iscertainstat = {Do=true, Set=true, While=true, Repeat=true, If=true,
Fornum=true, Forin=true, Local=true, Localrec=true, Return=true, Break=true}
function M.mark_tag2(ast, context)
context = context or 'Block'
ast.tag2 = context
for i,bast in ipairs(ast) do
if type(bast) == 'table' then
local nextcontext
if bast.tag == 'Do' then
nextcontext = 'StatBlock'
elseif iscertainstat[bast.tag] then
nextcontext = 'Stat'
elseif bast.tag == 'Call' or bast.tag == 'Invoke' then
nextcontext = context == 'Block' and 'Stat' or 'Exp'
--DESIGN:Metalua: these calls actually contain expression lists,
-- but the expression list is not represented as a complete node
-- by Metalua (as blocks are in `Do statements)
elseif bast.tag == 'Pair' then
nextcontext = 'Pair'
elseif not bast.tag then
if ast.tag == 'Set' or ast.tag == 'Local' or ast.tag == 'Localrec'
or ast.tag == 'Forin' and i <= 2
or ast.tag == 'Function' and i == 1
then
nextcontext = 'Explist'
else
nextcontext = 'Block'
end
else
nextcontext = 'Exp'
end
M.mark_tag2(bast, nextcontext)
end
end
end
-- Gets smallest statement or block containing or being `ast`.
-- The AST root node `top_ast` must also be provided.
-- Note: may decorate AST as side-effect (mark_tag2/mark_parents).
-- top_ast is assumed a block, so this is always successful.
-- CATEGORY: AST query
function M.get_containing_statementblock(ast, top_ast)
if not top_ast.tag2 then M.mark_tag2(top_ast) end
if ast.tag2 == 'Stat' or ast.tag2 == 'StatBlock' or ast.tag2 == 'Block' then
return ast
else
M.ensure_parents_marked(top_ast)
return M.get_containing_statementblock(ast.parent, top_ast)
end
end
-- Finds smallest statement, block, or comment AST in ast/tokenlist containing position
-- range [fpos, lpos]. If allowexpand is true (default nil) and located AST
-- coincides with position range, then next containing statement is used
-- instead (this allows multiple calls to further expand the statement selection).
-- CATEGORY: AST query
function M.select_statementblockcomment(ast, tokenlist, fpos, lpos, allowexpand)
--IMPROVE: rename ast to top_ast
local match_ast, comment_ast = M.smallest_ast_containing_range(ast, tokenlist, fpos, lpos)
local select_ast = comment_ast or M.get_containing_statementblock(match_ast, ast)
local nfpos, nlpos = M.ast_pos_range(select_ast, tokenlist)
--DEBUG('s', nfpos, nlpos, fpos, lpos, match_ast.tag, select_ast.tag)
if allowexpand and fpos == nfpos and lpos == nlpos then
if comment_ast then
-- Select enclosing statement.
select_ast = match_ast
nfpos, nlpos = M.ast_pos_range(select_ast, tokenlist)
else
-- note: multiple times may be needed to expand selection. For example, in
-- `for x=1,2 do f() end` both the statement `f()` and block `f()` have
-- the same position range.
M.ensure_parents_marked(ast)
while select_ast.parent and fpos == nfpos and lpos == nlpos do
select_ast = M.get_containing_statementblock(select_ast.parent, ast)
nfpos, nlpos = M.ast_pos_range(select_ast, tokenlist)
end
end
end
return nfpos, nlpos
end
-- Converts tokenlist to string representation for debugging.
-- CATEGORY: tokenlist debug
function M.dump_tokenlist(tokenlist)
local ts = {}
for i,token in ipairs(tokenlist) do
ts[#ts+1] = 'tok.' .. i .. ': [' .. token.fpos .. ',' .. token.lpos .. '] '
.. tostring(token[1]) .. ' ' .. tostring(token.ast.tag)
end
return table.concat(ts, '\n') -- .. 'nbytes=' .. tokenlist.nbytes .. '\n'
end
--FIX:Q: does this handle Unicode ok?
--FIX?:Metalua: fails on string with escape sequence '\/'. The Reference Manual
-- doesn't say this sequence is valid though.
--FIX:Metalua: In `local --[[x]] function --[[y]] f() end`,
-- 'x' comment omitted from AST.
--FIX:Metalua: `do --[[x]] end` doesn't generate comments in AST.
-- `if x then --[[x]] end` and `while 1 do --[[x]] end` generates
-- comments in first/last of block
--FIX:Metalua: `--[[x]] f() --[[y]]` returns lineinfo around `f()`.
-- `--[[x]] --[[y]]` returns lineinfo around everything.
--FIX:Metalua: `while 1 do --[[x]] --[[y]] end` returns first > last
-- lineinfo for contained block
--FIX:Metalua: search for "PATCHED:LuaInspect" in the metalualib folder.
--FIX?:Metalua: loadstring parses "--x" but metalua omits the comment in the AST
--FIX?:Metalua: `local x` is generating `Local{{`Id{x}}, {}}`, which
-- has no lineinfo on {}. This is contrary to the Metalua
-- spec: `Local{ {ident+} {expr+}? }.
-- Other things like `self` also generate no lineinfo.
-- The ast2.lineinfo above avoids this.
--FIX:Metalua: Metalua shouldn't overwrite ipairs/pairs. Note: Metalua version
-- doesn't set errorlevel correctly.
--Q:Metalua: Why does `return --[[y]] z --[[x]]` have
-- lineinfo.first.comments, lineinfo.last.comments,
-- plus lineinfo.comments (which is the same as lineinfo.first.comments) ?
--CAUTION:Metalua: `do f() end` returns lineinfo around `do f() end`, while
-- `while 1 do f() end` returns lineinfo around `f()` for inner block.
--CAUTION:Metalua: The lineinfo on Metalua comments is inconsistent with other
-- nodes
--CAUTION:Metalua: lineinfo of table in `f{}` is [3,2], of `f{ x,y }` it's [4,6].
-- This is inconsistent with `x={}` which is [3,4] and `f""` which is [1,2]
-- for the string.
--CAUTION:Metalua: only the `function()` form of `Function includes `function`
-- in lineinfo. 'function' is part of `Localrec and `Set in syntactic sugar form.
--[=[TESTSUITE
-- test longest_prefix/longest_postfix
local function pr(text1, text2)
local lastv
local function same(v)
assert(not lastv or v == lastv); lastv = v; return v
end
local function test1(text1, text2) -- test prefix/postfix
same(longest_prefix(text1, text2))
same(longest_postfix(text1:reverse(), text2:reverse()))
end
local function test2(text1, text2) -- test swap
test1(text1, text2)
test1(text2, text1)
end
for _,extra in ipairs{"", "x", "xy", "xyz"} do -- test extra chars
test2(text1, text2..extra)
test2(text2, text1..extra)
end
return lastv
end
check('==', pr("",""), 0)
check('==', pr("a",""), 0)
check('==', pr("a","a"), 1)
check('==', pr("ab",""), 0)
check('==', pr("ab","a"), 1)
check('==', pr("ab","ab"), 2)
check('==', pr("abcdefg","abcdefgh"), 7)
--]=]
--[=[TESTSUITE
print 'DONE'
--]=]
return M

View File

@@ -0,0 +1,390 @@
--[[
compat_env v$(_VERSION) - Lua 5.1/5.2 environment compatibility functions
SYNOPSIS
-- Get load/loadfile compatibility functions only if using 5.1.
local CL = pcall(load, '') and _G or require 'compat_env'
local load = CL.load
local loadfile = CL.loadfile
-- The following now works in both Lua 5.1 and 5.2:
assert(load('return 2*pi', nil, 't', {pi=math.pi}))()
assert(loadfile('ex.lua', 't', {print=print}))()
-- Get getfenv/setfenv compatibility functions only if using 5.2.
local getfenv = _G.getfenv or require 'compat_env'.getfenv
local setfenv = _G.setfenv or require 'compat_env'.setfenv
local function f() return x end
setfenv(f, {x=2})
print(x, getfenv(f).x) --> 2, 2
DESCRIPTION
This module provides Lua 5.1/5.2 environment related compatibility functions.
This includes implementations of Lua 5.2 style `load` and `loadfile`
for use in Lua 5.1. It also includes Lua 5.1 style `getfenv` and `setfenv`
for use in Lua 5.2.
API
local CL = require 'compat_env'
CL.load (ld [, source [, mode [, env] ] ]) --> f [, err]
This behaves the same as the Lua 5.2 `load` in both
Lua 5.1 and 5.2.
http://www.lua.org/manual/5.2/manual.html#pdf-load
CL.loadfile ([filename [, mode [, env] ] ]) --> f [, err]
This behaves the same as the Lua 5.2 `loadfile` in both
Lua 5.1 and 5.2.
http://www.lua.org/manual/5.2/manual.html#pdf-loadfile
CL.getfenv ([f]) --> t
This is identical to the Lua 5.1 `getfenv` in Lua 5.1.
This behaves similar to the Lua 5.1 `getfenv` in Lua 5.2.
When a global environment is to be returned, or when `f` is a
C function, this returns `_G` since Lua 5.2 doesn't have
(thread) global and C function environments. This will also
return `_G` if the Lua function `f` lacks an `_ENV`
upvalue, but it will raise an error if uncertain due to lack of
debug info. It is not normally considered good design to use
this function; when possible, use `load` or `loadfile` instead.
http://www.lua.org/manual/5.1/manual.html#pdf-getfenv
CL.setfenv (f, t)
This is identical to the Lua 5.1 `setfenv` in Lua 5.1.
This behaves similar to the Lua 5.1 `setfenv` in Lua 5.2.
This will do nothing if `f` is a Lua function that
lacks an `_ENV` upvalue, but it will raise an error if uncertain
due to lack of debug info. See also Design Notes below.
It is not normally considered good design to use
this function; when possible, use `load` or `loadfile` instead.
http://www.lua.org/manual/5.1/manual.html#pdf-setfenv
DESIGN NOTES
This module intends to provide robust and fairly complete reimplementations
of the environment related Lua 5.1 and Lua 5.2 functions.
No effort is made, however, to simulate rare or difficult to simulate features,
such as thread environments, although this is liable to change in the future.
Such 5.1 capabilities are discouraged and ideally
removed from 5.1 code, thereby allowing your code to work in both 5.1 and 5.2.
In Lua 5.2, a `setfenv(f, {})`, where `f` lacks any upvalues, will be silently
ignored since there is no `_ENV` in this function to write to, and the
environment will have no effect inside the function anyway. However,
this does mean that `getfenv(setfenv(f, t))` does not necessarily equal `t`,
which is incompatible with 5.1 code (a possible workaround would be [1]).
If `setfenv(f, {})` has an upvalue but no debug info, then this will raise
an error to prevent inadvertently executing potentially untrusted code in the
global environment.
It is not normally considered good design to use `setfenv` and `getfenv`
(one reason they were removed in 5.2). When possible, consider replacing
these with `load` or `loadfile`, which are more restrictive and have native
implementations in 5.2.
This module might be merged into a more general Lua 5.1/5.2 compatibility
library (e.g. a full reimplementation of Lua 5.2 `_G`). However,
`load/loadfile/getfenv/setfenv` perhaps are among the more cumbersome
functions not to have.
INSTALLATION
Download compat_env.lua:
wget https://raw.github.com/gist/1654007/compat_env.lua
Copy compat_env.lua into your LUA_PATH.
Alternately, unpack, test, and install into LuaRocks:
wget https://raw.github.com/gist/1422205/sourceunpack.lua
lua sourceunpack.lua compat_env.lua
(cd out && luarocks make)
Related work
http://lua-users.org/wiki/LuaVersionCompatibility
https://github.com/stevedonovan/Penlight/blob/master/lua/pl/utils.lua
- penlight implementations of getfenv/setfenv
http://lua-users.org/lists/lua-l/2010-06/msg00313.html
- initial getfenv/setfenv implementation
References
[1] http://lua-users.org/lists/lua-l/2010-06/msg00315.html
Copyright
(c) 2012 David Manura. Licensed under the same terms as Lua 5.1/5.2 (MIT license).
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
--]]---------------------------------------------------------------------
local M = {_TYPE='module', _NAME='compat_env', _VERSION='0.2.20120124'}
local function check_chunk_type(s, mode)
local nmode = mode or 'bt'
local is_binary = s and #s > 0 and s:byte(1) == 27
if is_binary and not nmode:match'b' then
return nil, ("attempt to load a binary chunk (mode is '%s')"):format(mode)
elseif not is_binary and not nmode:match't' then
return nil, ("attempt to load a text chunk (mode is '%s')"):format(mode)
end
return true
end
local IS_52_LOAD = pcall(load, '')
if IS_52_LOAD then
M.load = _G.load
M.loadfile = _G.loadfile
else
-- 5.2 style `load` implemented in 5.1
function M.load(ld, source, mode, env)
local f
if type(ld) == 'string' then
local s = ld
local ok, err = check_chunk_type(s, mode); if not ok then return ok, err end
local err; f, err = loadstring(s, source); if not f then return f, err end
elseif type(ld) == 'function' then
local ld2 = ld
if (mode or 'bt') ~= 'bt' then
local first = ld()
local ok, err = check_chunk_type(first, mode); if not ok then return ok, err end
ld2 = function()
if first then
local chunk=first; first=nil; return chunk
else return ld() end
end
end
local err; f, err = load(ld2, source); if not f then return f, err end
else
error(("bad argument #1 to 'load' (function expected, got %s)"):format(type(ld)), 2)
end
if env then setfenv(f, env) end
return f
end
-- 5.2 style `loadfile` implemented in 5.1
function M.loadfile(filename, mode, env)
if (mode or 'bt') ~= 'bt' then
local ioerr
local fh, err = io.open(filename, 'rb'); if not fh then return fh, err end
local function ld() local chunk; chunk,ioerr = fh:read(4096); return chunk end
local f, err = M.load(ld, filename and '@'..filename, mode, env)
fh:close()
if not f then return f, err end
if ioerr then return nil, ioerr end
return f
else
local f, err = loadfile(filename); if not f then return f, err end
if env then setfenv(f, env) end
return f
end
end
end
if _G.setfenv then -- Lua 5.1
M.setfenv = _G.setfenv
M.getfenv = _G.getfenv
else -- >= Lua 5.2
-- helper function for `getfenv`/`setfenv`
local function envlookup(f)
local name, val
local up = 0
local unknown
repeat
up=up+1; name, val = debug.getupvalue(f, up)
if name == '' then unknown = true end
until name == '_ENV' or name == nil
if name ~= '_ENV' then
up = nil
if unknown then error("upvalues not readable in Lua 5.2 when debug info missing", 3) end
end
return (name == '_ENV') and up, val, unknown
end
-- helper function for `getfenv`/`setfenv`
local function envhelper(f, name)
if type(f) == 'number' then
if f < 0 then
error(("bad argument #1 to '%s' (level must be non-negative)"):format(name), 3)
elseif f < 1 then
error("thread environments unsupported in Lua 5.2", 3) --[*]
end
f = debug.getinfo(f+2, 'f').func
elseif type(f) ~= 'function' then
error(("bad argument #1 to '%s' (number expected, got %s)"):format(type(name, f)), 2)
end
return f
end
-- [*] might simulate with table keyed by coroutine.running()
-- 5.1 style `setfenv` implemented in 5.2
function M.setfenv(f, t)
local f = envhelper(f, 'setfenv')
local up, val, unknown = envlookup(f)
if up then
debug.upvaluejoin(f, up, function() return up end, 1) -- unique upvalue [*]
debug.setupvalue(f, up, t)
else
local what = debug.getinfo(f, 'S').what
if what ~= 'Lua' and what ~= 'main' then -- not Lua func
error("'setfenv' cannot change environment of given object", 2)
end -- else ignore no _ENV upvalue (warning: incompatible with 5.1)
end
end
-- [*] http://lua-users.org/lists/lua-l/2010-06/msg00313.html
-- 5.1 style `getfenv` implemented in 5.2
function M.getfenv(f)
if f == 0 or f == nil then return _G end -- simulated behavior
local f = envhelper(f, 'setfenv')
local up, val = envlookup(f)
if not up then return _G end -- simulated behavior [**]
return val
end
-- [**] possible reasons: no _ENV upvalue, C function
end
return M
--[[ FILE rockspec.in
package = 'compat_env'
version = '$(_VERSION)-1'
source = {
url = 'https://raw.github.com/gist/1654007/$(GITID)/compat_env.lua',
--url = 'https://raw.github.com/gist/1654007/compat_env.lua', -- latest raw
--url = 'https://gist.github.com/gists/1654007/download',
md5 = '$(MD5)'
}
description = {
summary = 'Lua 5.1/5.2 environment compatibility functions',
detailed = [=[
Provides Lua 5.1/5.2 environment related compatibility functions.
This includes implementations of Lua 5.2 style `load` and `loadfile`
for use in Lua 5.1. It also includes Lua 5.1 style `getfenv` and `setfenv`
for use in Lua 5.2.
]=],
license = 'MIT/X11',
homepage = 'https://gist.github.com/1654007',
maintainer = 'David Manura'
}
dependencies = {} -- Lua 5.1 or 5.2
build = {
type = 'builtin',
modules = {
['compat_env'] = 'compat_env.lua'
}
}
--]]---------------------------------------------------------------------
--[[ FILE test.lua
-- test.lua - test suite for compat_env module.
local CL = require 'compat_env'
local load = CL.load
local loadfile = CL.loadfile
local setfenv = CL.setfenv
local getfenv = CL.getfenv
local function checkeq(a, b, e)
if a ~= b then error(
'not equal ['..tostring(a)..'] ['..tostring(b)..'] ['..tostring(e)..']')
end
end
local function checkerr(pat, ok, err)
assert(not ok, 'checkerr')
assert(type(err) == 'string' and err:match(pat), err)
end
-- test `load`
checkeq(load('return 2')(), 2)
checkerr('expected near', load'return 2 2')
checkerr('text chunk', load('return 2', nil, 'b'))
checkerr('text chunk', load('', nil, 'b'))
checkerr('binary chunk', load('\027', nil, 't'))
checkeq(load('return 2*x',nil,'bt',{x=5})(), 10)
checkeq(debug.getinfo(load('')).source, '')
checkeq(debug.getinfo(load('', 'foo')).source, 'foo')
-- test `loadfile`
local fh = assert(io.open('tmp.lua', 'wb'))
fh:write('return (...) or x')
fh:close()
checkeq(loadfile('tmp.lua')(2), 2)
checkeq(loadfile('tmp.lua', 't')(2), 2)
checkerr('text chunk', loadfile('tmp.lua', 'b'))
checkeq(loadfile('tmp.lua', nil, {x=3})(), 3)
checkeq(debug.getinfo(loadfile('tmp.lua')).source, '@tmp.lua')
checkeq(debug.getinfo(loadfile('tmp.lua', 't', {})).source, '@tmp.lua')
os.remove'tmp.lua'
-- test `setfenv`/`getfenv`
x = 5
local a,b=true; local function f(c) if a then return x,b,c end end
setfenv(f, {x=3})
checkeq(f(), 3)
checkeq(getfenv(f).x, 3)
checkerr('cannot change', pcall(setfenv, string.len, {})) -- C function
checkeq(getfenv(string.len), _G) -- C function
local function g()
setfenv(1, {x=4})
checkeq(getfenv(1).x, 4)
return x
end
checkeq(g(), 4) -- numeric level
if _G._VERSION ~= 'Lua 5.1' then
checkerr('unsupported', pcall(setfenv, 0, {}))
end
checkeq(getfenv(0), _G)
checkeq(getfenv(), _G) -- no arg
checkeq(x, 5) -- main unaltered
setfenv(function()end, {}) -- no upvalues, ignore
checkeq(getfenv(function()end), _G) -- no upvaluse
if _G._VERSION ~= 'Lua 5.1' then
checkeq(getfenv(setfenv(function()end, {})), _G) -- warning: incompatible with 5.1
end
x = nil
print 'OK'
--]]---------------------------------------------------------------------
--[[ FILE CHANGES.txt
0.2.20120124
Renamed module to compat_env (from compat_load)
Add getfenv/setfenv functions
0.1.20120121
Initial public release
--]]

View File

@@ -0,0 +1,90 @@
-- Recursive object dumper, for debugging.
-- (c) 2010 David Manura, MIT License.
local M = {}
-- My own object dumper.
-- Intended for debugging, not serialization, with compact formatting.
-- Robust against recursion.
-- Renders Metalua table tag fields specially {tag=X, ...} --> "`X{...}".
-- On first call, only pass parameter o.
-- CATEGORY: AST debug
local ignore_keys_ = {lineinfo=true}
local norecurse_keys_ = {parent=true, ast=true}
local function dumpstring_key_(k, isseen, newindent)
local ks = type(k) == 'string' and k:match'^[%a_][%w_]*$' and k or
'[' .. M.dumpstring(k, isseen, newindent) .. ']'
return ks
end
local function sort_keys_(a, b)
if type(a) == 'number' and type(b) == 'number' then
return a < b
elseif type(a) == 'number' then
return false
elseif type(b) == 'number' then
return true
elseif type(a) == 'string' and type(b) == 'string' then
return a < b
else
return tostring(a) < tostring(b) -- arbitrary
end
end
function M.dumpstring(o, isseen, indent, key)
isseen = isseen or {}
indent = indent or ''
if type(o) == 'table' then
if isseen[o] or norecurse_keys_[key] then
return (type(o.tag) == 'string' and '`' .. o.tag .. ':' or '') .. tostring(o)
else isseen[o] = true end -- avoid recursion
local used = {}
local tag = o.tag
local s = '{'
if type(o.tag) == 'string' then
s = '`' .. tag .. s; used['tag'] = true
end
local newindent = indent .. ' '
local ks = {}; for k in pairs(o) do ks[#ks+1] = k end
table.sort(ks, sort_keys_)
--for i,k in ipairs(ks) do print ('keys', k) end
local forcenummultiline
for k in pairs(o) do
if type(k) == 'number' and type(o[k]) == 'table' then forcenummultiline = true end
end
-- inline elements
for _,k in ipairs(ks) do
if used[k] then -- skip
elseif ignore_keys_[k] then used[k] = true
elseif (type(k) ~= 'number' or not forcenummultiline) and
type(k) ~= 'table' and (type(o[k]) ~= 'table' or norecurse_keys_[k])
then
s = s .. dumpstring_key_(k, isseen, newindent) .. '=' .. M.dumpstring(o[k], isseen, newindent, k) .. ', '
used[k] = true
end
end
-- elements on separate lines
local done
for _,k in ipairs(ks) do
if not used[k] then
if not done then s = s .. '\n'; done = true end
s = s .. newindent .. dumpstring_key_(k, isseen) .. '=' .. M.dumpstring(o[k], isseen, newindent, k) .. ',\n'
end
end
s = s:gsub(',(%s*)$', '%1')
s = s .. (done and indent or '') .. '}'
return s
elseif type(o) == 'string' then
return string.format('%q', o)
else
return tostring(o)
end
end
return M

View File

@@ -0,0 +1,222 @@
-- LuaInspect.globals - identifier scope analysis
-- Locates locals, globals, and their definitions.
--
-- (c) D.Manura, 2008-2010, MIT license.
-- based on http://lua-users.org/wiki/DetectingUndefinedVariables
local M = {}
--! require 'luainspect.typecheck' (context)
local LA = require "luainspect.ast"
local function definelocal(scope, name, ast)
if scope[name] then
scope[name].localmasked = true
ast.localmasking = scope[name]
end
scope[name] = ast
if name == '_' then ast.isignore = true end
end
-- Resolves scoping and usages of variable in AST.
-- Data Notes:
-- ast.localdefinition refers to lexically scoped definition of `Id node `ast`.
-- If ast.localdefinition == ast then ast is a "lexical definition".
-- If ast.localdefinition == nil, then variable is global.
-- ast.functionlevel is the number of functions the AST is contained in.
-- ast.functionlevel is defined iff ast is a lexical definition.
-- ast.isparam is true iff ast is a lexical definition and a function parameter.
-- ast.isset is true iff ast is a lexical definition and exists an assignment on it.
-- ast.isused is true iff ast is a lexical definition and has been referred to.
-- ast.isignore is true if local variable should be ignored (e.g. typically "_")
-- ast.localmasking - for a lexical definition, this is set to the lexical definition
-- this is masking (i.e. same name). nil if not masking.
-- ast.localmasked - true iff lexical definition masked by another lexical definition.
-- ast.isfield is true iff `String node ast is used for field access on object,
-- e.g. x.y or x['y'].z
-- ast.previous - For `Index{o,s} or `Invoke{o,s,...}, s.previous == o
local function traverse(ast, scope, globals, level, functionlevel)
scope = scope or {}
local blockrecurse
ast.level = level
-- operations on walking down the AST
if ast.tag == 'Local' then
blockrecurse = 1
-- note: apply new scope after processing values
elseif ast.tag == 'Localrec' then
local namelist_ast, valuelist_ast = ast[1], ast[2]
for _,value_ast in ipairs(namelist_ast) do
assert(value_ast.tag == 'Id')
local name = value_ast[1]
local parentscope = getmetatable(scope).__index
definelocal(parentscope, name, value_ast)
value_ast.localdefinition = value_ast
value_ast.functionlevel = functionlevel
value_ast.level = level+1
end
blockrecurse = 1
elseif ast.tag == 'Id' then
local name = ast[1]
if scope[name] then
ast.localdefinition = scope[name]
ast.functionlevel = functionlevel
scope[name].isused = true
else -- global, do nothing
end
elseif ast.tag == 'Function' then
local paramlist_ast, body_ast = ast[1], ast[2]
functionlevel = functionlevel + 1
for _,param_ast in ipairs(paramlist_ast) do
local name = param_ast[1]
assert(param_ast.tag == 'Id' or param_ast.tag == 'Dots')
if param_ast.tag == 'Id' then
definelocal(scope, name, param_ast)
param_ast.localdefinition = param_ast
param_ast.functionlevel = functionlevel
param_ast.isparam = true
end
param_ast.level = level+1
end
blockrecurse = 1
elseif ast.tag == 'Set' then
local reflist_ast, valuelist_ast = ast[1], ast[2]
for _,ref_ast in ipairs(reflist_ast) do
if ref_ast.tag == 'Id' then
local name = ref_ast[1]
if scope[name] then
scope[name].isset = true
else
if not globals[name] then
globals[name] = {set=ref_ast}
end
end
end
ref_ast.level = level+1
end
--ENHANCE? We could differentiate assignments to x (which indicates that
-- x is not const) and assignments to a member of x (which indicates that
-- x is not a pointer to const) and assignments to any nested member of x
-- (which indicates that x it not a transitive const).
elseif ast.tag == 'Fornum' then
blockrecurse = 1
elseif ast.tag == 'Forin' then
blockrecurse = 1
end
-- recurse (depth-first search down the AST)
if ast.tag == 'Repeat' then
local block_ast, cond_ast = ast[1], ast[2]
local scope = scope
for _,stat_ast in ipairs(block_ast) do
scope = setmetatable({}, {__index = scope})
traverse(stat_ast, scope, globals, level+1, functionlevel)
end
scope = setmetatable({}, {__index = scope})
traverse(cond_ast, scope, globals, level+1, functionlevel)
elseif ast.tag == 'Fornum' then
local name_ast, block_ast = ast[1], ast[#ast]
-- eval value list in current scope
for i=2, #ast-1 do traverse(ast[i], scope, globals, level+1, functionlevel) end
-- eval body in next scope
local name = name_ast[1]
definelocal(scope, name, name_ast)
name_ast.localdefinition = name_ast
name_ast.functionlevel = functionlevel
traverse(block_ast, scope, globals, level+1, functionlevel)
elseif ast.tag == 'Forin' then
local namelist_ast, vallist_ast, block_ast = ast[1], ast[2], ast[3]
-- eval value list in current scope
traverse(vallist_ast, scope, globals, level+1, functionlevel)
-- eval body in next scope
for _,name_ast in ipairs(namelist_ast) do
local name = name_ast[1]
definelocal(scope, name, name_ast)
name_ast.localdefinition = name_ast
name_ast.functionlevel = functionlevel
name_ast.level = level+1
end
traverse(block_ast, scope, globals, level+1, functionlevel)
else -- normal
for i,v in ipairs(ast) do
if i ~= blockrecurse and type(v) == 'table' then
local scope = setmetatable({}, {__index = scope})
traverse(v, scope, globals, level+1, functionlevel)
end
end
end
-- operations on walking up the AST
if ast.tag == 'Local' then
-- Unlike Localrec, variables come into scope after evaluating values.
local namelist_ast, valuelist_ast = ast[1], ast[2]
for _,name_ast in ipairs(namelist_ast) do
assert(name_ast.tag == 'Id')
local name = name_ast[1]
local parentscope = getmetatable(scope).__index
definelocal(parentscope, name, name_ast)
name_ast.localdefinition = name_ast
name_ast.functionlevel = functionlevel
name_ast.level = level+1
end
elseif ast.tag == 'Index' then
if ast[2].tag == 'String' then
ast[2].isfield = true
ast[2].previous = ast[1]
end
elseif ast.tag == 'Invoke' then
assert(ast[2].tag == 'String')
ast[2].isfield = true
ast[2].previous = ast[1]
end
end
function M.globals(ast)
-- Default list of defined variables.
local scope = setmetatable({}, {})
local globals = {}
traverse(ast, scope, globals, 1, 1) -- Start check.
return globals
end
-- Gets locals in scope of statement of block ast. If isafter is true and ast is statement,
-- uses scope just after statement ast.
-- Assumes 'parent' attributes on ast are marked.
-- Returns table mapping name -> AST local definition.
function M.variables_in_scope(ast, isafter)
local scope = {}
local cast = ast
while cast.parent do
local midx = LA.ast_idx(cast.parent, cast)
for idx=1,midx do
local bast = cast.parent[idx]
if bast.tag == 'Localrec' or bast.tag == 'Local' and (idx < midx or isafter) then
local names_ast = bast[1]
for bidx=1,#names_ast do
local name_ast = names_ast[bidx]
local name = name_ast[1]
scope[name] = name_ast
end
elseif cast ~= ast and (bast.tag == 'For' or bast.tag == 'Forin' or bast.tag == 'Function') then
local names_ast = bast[1]
for bidx=1,#names_ast do
local name_ast = names_ast[bidx]
if name_ast.tag == 'Id' then --Q: or maybe `Dots should be included
local name = name_ast[1]
scope[name] = name_ast
end
end
end
end
cast = cast.parent
end
return scope
end
return M

1431
lualibs/luainspect/init.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,433 @@
local M = {}
local T = require "luainspect.types"
-- signatures of known globals
M.global_signatures = {
assert = "assert (v [, message])",
collectgarbage = "collectgarbage (opt [, arg])",
dofile = "dofile (filename)",
error = "error (message [, level])",
_G = "(table)",
getfenv = "getfenv ([f])",
getmetatable = "getmetatable (object)",
ipairs = "ipairs (t)",
load = "load (func [, chunkname])",
loadfile = "loadfile ([filename])",
loadstring = "loadstring (string [, chunkname])",
next = "next (table [, index])",
pairs = "pairs (t)",
pcall = "pcall (f, arg1, ...)",
print = "print (...)",
rawequal = "rawequal (v1, v2)",
rawget = "rawget (table, index)",
rawset = "rawset (table, index, value)",
select = "select (index, ...)",
setfenv = "setfenv (f, table)",
setmetatable = "setmetatable (table, metatable)",
tonumber = "tonumber (e [, base])",
tostring = "tostring (e)",
type = "type (v)",
unpack = "unpack (list [, i [, j]])",
_VERSION = "(string)",
xpcall = "xpcall (f, err)",
module = "module (name [, ...])",
require = "require (modname)",
coroutine = "(table) coroutine manipulation library",
debug = "(table) debug facilities library",
io = "(table) I/O library",
math = "(table) math functions libary",
os = "(table) OS facilities library",
package = "(table) package library",
string = "(table) string manipulation library",
table = "(table) table manipulation library",
["coroutine.create"] = "coroutine.create (f)",
["coroutine.resume"] = "coroutine.resume (co [, val1, ...])",
["coroutine.running"] = "coroutine.running ()",
["coroutine.status"] = "coroutine.status (co)",
["coroutine.wrap"] = "coroutine.wrap (f)",
["coroutine.yield"] = "coroutine.yield (...)",
["debug.debug"] = "debug.debug ()",
["debug.getfenv"] = "debug.getfenv (o)",
["debug.gethook"] = "debug.gethook ([thread])",
["debug.getinfo"] = "debug.getinfo ([thread,] function [, what])",
["debug.getlocal"] = "debug.getlocal ([thread,] level, local)",
["debug.getmetatable"] = "debug.getmetatable (object)",
["debug.getregistry"] = "debug.getregistry ()",
["debug.getupvalue"] = "debug.getupvalue (func, up)",
["debug.setfenv"] = "debug.setfenv (object, table)",
["debug.sethook"] = "debug.sethook ([thread,] hook, mask [, count])",
["debug.setlocal"] = "debug.setlocal ([thread,] level, local, value)",
["debug.setmetatable"] = "debug.setmetatable (object, table)",
["debug.setupvalue"] = "debug.setupvalue (func, up, value)",
["debug.traceback"] = "debug.traceback ([thread,] [message] [, level])",
["io.close"] = "io.close ([file])",
["io.flush"] = "io.flush ()",
["io.input"] = "io.input ([file])",
["io.lines"] = "io.lines ([filename])",
["io.open"] = "io.open (filename [, mode])",
["io.output"] = "io.output ([file])",
["io.popen"] = "io.popen (prog [, mode])",
["io.read"] = "io.read (...)",
["io.tmpfile"] = "io.tmpfile ()",
["io.type"] = "io.type (obj)",
["io.write"] = "io.write (...)",
["math.abs"] = "math.abs (x)",
["math.acos"] = "math.acos (x)",
["math.asin"] = "math.asin (x)",
["math.atan"] = "math.atan (x)",
["math.atan2"] = "math.atan2 (y, x)",
["math.ceil"] = "math.ceil (x)",
["math.cos"] = "math.cos (x)",
["math.cosh"] = "math.cosh (x)",
["math.deg"] = "math.deg (x)",
["math.exp"] = "math.exp (x)",
["math.floor"] = "math.floor (x)",
["math.fmod"] = "math.fmod (x, y)",
["math.frexp"] = "math.frexp (x)",
["math.huge"] = "math.huge",
["math.ldexp"] = "math.ldexp (m, e)",
["math.log"] = "math.log (x)",
["math.log10"] = "math.log10 (x)",
["math.max"] = "math.max (x, ...)",
["math.min"] = "math.min (x, ...)",
["math.modf"] = "math.modf (x)",
["math.pi"] = "math.pi",
["math.pow"] = "math.pow (x, y)",
["math.rad"] = "math.rad (x)",
["math.random"] = "math.random ([m [, n]])",
["math.randomseed"] = "math.randomseed (x)",
["math.sin"] = "math.sin (x)",
["math.sinh"] = "math.sinh (x)",
["math.sqrt"] = "math.sqrt (x)",
["math.tan"] = "math.tan (x)",
["math.tanh"] = "math.tanh (x)",
["os.clock"] = "os.clock ()",
["os.date"] = "os.date ([format [, time]])",
["os.difftime"] = "os.difftime (t2, t1)",
["os.execute"] = "os.execute ([command])",
["os.exit"] = "os.exit ([code])",
["os.getenv"] = "os.getenv (varname)",
["os.remove"] = "os.remove (filename)",
["os.rename"] = "os.rename (oldname, newname)",
["os.setlocale"] = "os.setlocale (locale [, category])",
["os.time"] = "os.time ([table])",
["os.tmpname"] = "os.tmpname ()",
["package.cpath"] = "package.cpath",
["package.loaded"] = "package.loaded",
["package.loaders"] = "package.loaders",
["package.loadlib"] = "package.loadlib (libname, funcname)",
["package.path"] = "package.path",
["package.preload"] = "package.preload",
["package.seeall"] = "package.seeall (module)",
["string.byte"] = "string.byte (s [, i [, j]])",
["string.char"] = "string.char (...)",
["string.dump"] = "string.dump (function)",
["string.find"] = "string.find (s, pattern [, init [, plain]])",
["string.format"] = "string.format (formatstring, ...)",
["string.gmatch"] = "string.gmatch (s, pattern)",
["string.gsub"] = "string.gsub (s, pattern, repl [, n])",
["string.len"] = "string.len (s)",
["string.lower"] = "string.lower (s)",
["string.match"] = "string.match (s, pattern [, init])",
["string.rep"] = "string.rep (s, n)",
["string.reverse"] = "string.reverse (s)",
["string.sub"] = "string.sub (s, i [, j])",
["string.upper"] = "string.upper (s)",
["table.concat"] = "table.concat (table [, sep [, i [, j]]])",
["table.insert"] = "table.insert (table, [pos,] value)",
["table.maxn"] = "table.maxn (table)",
["table.remove"] = "table.remove (table [, pos])",
["table.sort"] = "table.sort (table [, comp])",
}
-- utility function. Converts e.g. name 'math.sqrt' to its value.
local function resolve_global_helper_(name)
local o = _G
for fieldname in name:gmatch'[^%.]+' do o = o[fieldname] end
return o
end
local function resolve_global(name)
local a, b = pcall(resolve_global_helper_, name)
if a then return b else return nil, b end
end
-- Same as global_signatures but maps value (not name) to signature.
M.value_signatures = {}
local isobject = {['function']=true, ['table']=true, ['userdata']=true, ['coroutine']=true}
for name,sig in pairs(M.global_signatures) do
local val, err = resolve_global(name)
if isobject[type(val)] then
M.value_signatures[val] = sig
end
end
-- min,max argument counts.
M.argument_counts = {
[assert] = {1,2},
[collectgarbage] = {1,2},
[dofile] = {1},
[error] = {1,2},
[getfenv or false] = {0,1},
[getmetatable] = {1,1},
[ipairs] = {1,1},
[load] = {1,2},
[loadfile] = {0,1},
[loadstring] = {1,2},
[next] = {1,2},
[pairs] = {1,1},
[pcall] = {1,math.huge},
[print] = {0,math.huge},
[rawequal] = {2,2},
[rawget] = {2,2},
[rawset] = {3,3},
[select] = {1, math.huge},
[setfenv or false] = {2,2},
[setmetatable] = {2,2},
[tonumber] = {1,2},
[tostring] = {1},
[type] = {1},
[unpack] = {1,3},
[xpcall] = {2,2},
[module] = {1,math.huge},
[require] = {1,1},
[coroutine.create] = {1,1},
[coroutine.resume] = {1, math.huge},
[coroutine.running] = {0,0},
[coroutine.status] = {1,1},
[coroutine.wrap] = {1,1},
[coroutine.yield] = {0,math.huge},
[debug.debug] = {0,0},
[debug.getfenv or false] = {1,1},
[debug.gethook] = {0,1},
[debug.getinfo] = {1,3},
[debug.getlocal] = {2,3},
[debug.getmetatable] = {1,1},
[debug.getregistry] = {0,0},
[debug.getupvalue] = {2,2},
[debug.setfenv or false] = {2,2},
[debug.sethook] = {2,4},
[debug.setlocal] = {3,4},
[debug.setmetatable] = {2,2},
[debug.setupvalue] = {3,3},
[debug.traceback] = {0,3},
[io.close] = {0,1},
[io.flush] = {0,0},
[io.input] = {0,1},
[io.lines] = {0,1},
[io.open] = {1,2},
[io.output] = {0,1},
[io.popen] = {1,2},
[io.read] = {0,math.huge},
[io.tmpfile] = {0},
[io.type] = {1},
[io.write] = {0,math.huge},
[math.abs] = {1},
[math.acos] = {1},
[math.asin] = {1},
[math.atan] = {1},
[math.atan2] = {2,2},
[math.ceil] = {1,1},
[math.cos] = {1,1},
[math.cosh] = {1,1},
[math.deg] = {1,1},
[math.exp] = {1,1},
[math.floor] = {1,1},
[math.fmod] = {2,2},
[math.frexp] = {1,1},
[math.ldexp] = {2,2},
[math.log] = {1,1},
[math.log10] = {1,1},
[math.max] = {1,math.huge},
[math.min] = {1,math.huge},
[math.modf] = {1,1},
[math.pow] = {2,2},
[math.rad] = {1,1},
[math.random] = {0,2},
[math.randomseed] = {1,1},
[math.sin] = {1,1},
[math.sinh] = {1,1},
[math.sqrt] = {1,1},
[math.tan] = {1,1},
[math.tanh] = {1,1},
[os.clock] = {0,0},
[os.date] = {0,2},
[os.difftime] = {2,2},
[os.execute] = {0,1},
[os.exit] = {0,1},
[os.getenv] = {1,1},
[os.remove] = {1,1},
[os.rename] = {2,2},
[os.setlocale] = {1,2},
[os.time] = {0,1},
[os.tmpname] = {0,0},
[package.loadlib] = {2,2},
[package.seeall] = {1,1},
[string.byte] = {1,3},
[string.char] = {0,math.huge},
[string.dump] = {1,1},
[string.find] = {2,4},
[string.format] = {1,math.huge},
[string.gmatch] = {2,2},
[string.gsub] = {3,4},
[string.len] = {1,1},
[string.lower] = {1,1},
[string.match] = {2,3},
[string.rep] = {2,2},
[string.reverse] = {1,1},
[string.sub] = {2,3},
[string.upper] = {1,1},
[table.concat] = {1,4},
[table.insert] = {2,3},
[table.maxn] = {1,1},
[table.remove] = {1,2},
[table.sort] = {1,2},
[false] = nil -- trick (relies on potentially undefined behavior)
}
-- functions with zero or nearly zero side-effects, and with deterministic results, that may be evaluated by the analyzer.
M.safe_function = {
[require] = true,
[rawequal] = true,
[rawget] = true,
[require] = true, -- sort of
[select] = true,
[tonumber] = true,
[tostring] = true,
[type] = true,
[unpack] = true,
[coroutine.create] = true,
-- [coroutine.resume]
[coroutine.running] = true,
[coroutine.status] = true,
[coroutine.wrap] = true,
--[coroutine.yield]
-- [debug.debug]
--[debug.getfenv] = true,
[debug.gethook] = true,
[debug.getinfo] = true,
[debug.getlocal] = true,
[debug.getmetatable] = true,
[debug.getregistry] = true,
[debug.getupvalue] = true,
-- [debug.setfenv]
-- [debug.sethook]
-- [debug.setlocal]
-- [debug.setmetatable]
-- [debug.setupvalue]
-- [debug.traceback] = true,
[io.type] = true,
-- skip all other io.*
[math.abs] = true,
[math.acos] = true,
[math.asin] = true,
[math.atan] = true,
[math.atan2] = true,
[math.ceil] = true,
[math.cos] = true,
[math.cosh] = true,
[math.deg] = true,
[math.exp] = true,
[math.floor] = true,
[math.fmod] = true,
[math.frexp] = true,
[math.ldexp] = true,
[math.log] = true,
[math.log10] = true,
[math.max] = true,
[math.min] = true,
[math.modf] = true,
[math.pow] = true,
[math.rad] = true,
--[math.random]
--[math.randomseed]
[math.sin] = true,
[math.sinh] = true,
[math.sqrt] = true,
[math.tan] = true,
[math.tanh] = true,
[os.clock] = true, -- safe but non-deterministic
[os.date] = true,-- safe but non-deterministic
[os.difftime] = true,
--[os.execute]
--[os.exit]
[os.getenv] = true, -- though depends on environment
--[os.remove]
--[os.rename]
--[os.setlocale]
[os.time] = true, -- safe but non-deterministic
--[os.tmpname]
[string.byte] = true,
[string.char] = true,
[string.dump] = true,
[string.find] = true,
[string.format] = true,
[string.gmatch] = true,
[string.gsub] = true,
[string.len] = true,
[string.lower] = true,
[string.match] = true,
[string.rep] = true,
[string.reverse] = true,
[string.sub] = true,
[string.upper] = true,
[table.maxn] = true,
}
M.mock_functions = {}
-- TODO:IMPROVE
local function mockfunction(func, ...)
local inputs = {n=0}
local outputs = {n=0}
local isoutputs
for i=1,select('#', ...) do
local v = select(i, ...)
if type(v) == 'table' then v = v[1] end
if v == 'N' or v == 'I' then v = T.number end
if v == '->' then
isoutputs = true
elseif isoutputs then
outputs[#outputs+1] = v; outputs.n = outputs.n + 1
else
inputs[#inputs+1] = v; inputs.n = inputs.n + 1
end
end
M.mock_functions[func] = {inputs=inputs, outputs=outputs}
end
mockfunction(math.abs, 'N', '->', {'N',0,math.huge})
mockfunction(math.acos, {'N',-1,1}, '->', {'N',0,math.pi/2})
mockfunction(math.asin, {'N',-1,1}, '->', {'N',-math.pi/2,math.pi/2})
mockfunction(math.atan, {'N',-math.huge,math.huge}, '->',
{'N',-math.pi/2,math.pi/2})
--FIX atan2
mockfunction(math.ceil, 'N','->','I')
mockfunction(math.cos, 'N','->',{'N',-1,1})
mockfunction(math.cosh, 'N','->',{'N',1,math.huge})
mockfunction(math.deg, 'N','->','N')
mockfunction(math.exp, 'N','->',{'N',0,math.huge})
mockfunction(math.floor, 'N','->','I')
mockfunction(math.fmod, 'N','N','->','N')
mockfunction(math.frexp, 'N','->',{'N',-1,1},'->','I')
mockfunction(math.ldexp, {'N','I'},'->','N')
mockfunction(math.log, {'N',0,math.huge},'->','N')
mockfunction(math.log10, {'N',0,math.huge},'->','N')
-- function max(...) print 'NOT IMPL'end
-- function min(...) print 'NOT IMPL'end
mockfunction(math.modf, 'N','->','I',{'N',-1,1})
mockfunction(math.pow, 'N','N','->','N') -- improve?
mockfunction(math.rad, 'N','->','N')
-- random = function() print 'NOT IMPL' end
mockfunction(math.randomseed, 'N')
mockfunction(math.sin, 'N','->',{'N',-1,1})
mockfunction(math.sinh, 'N','->','N')
mockfunction(math.sqrt, {'N',0,math.huge},'->',{'N',0,math.huge})
mockfunction(math.tan, 'N','->','N') -- improve?
mockfunction(math.tanh, 'N','->',{'N',-1,1})
return M

View File

@@ -0,0 +1,40 @@
-- luainspect.typecheck - Type definitions used to check LuaInspect itself.
--
-- (c) 2010 David Manura, MIT License.
local T = require "luainspect.types"
local ast_mt = {__tostring = function(s) return 'AST' end}
return function(context)
-- AST type.
local ast = T.table {
tag = T.string,
lineinfo=T.table{first=T.table{comments=T.table{T.table{T.string,T.number,T.number}},T.number,T.number,T.number,T.string},
ast=T.table{comments=T.table{T.table{T.string,T.number,T.number}},T.number,T.number,T.number,T.string}},
isfield=T.boolean, tag2=T.string,
value=T.universal, valueself=T.number, valuelist=T.table{n=T.number, isvaluepegged=T.boolean},
resolvedname=T.string, definedglobal=T.boolean, id=T.number, isparam=T.boolean, isset=T.boolean, isused=T.boolean,
isignore=T.boolean,
functionlevel=T.number, localmasked=T.boolean, note=T.string, nocollect=T.table{}, isdead=T.boolean}
-- FIX: some of these are "boolean or nil" actually
ast.localdefinition=ast; ast.localmasking = ast
ast.previous = ast; ast.parent = ast
ast.seevalue = ast; ast.seenote=ast
setmetatable(ast, ast_mt)
ast[1] = ast; ast[2] = ast
context.apply_value('ast$', ast)
-- Token type.
context.apply_value('token$', T.table{
tag=T.string, fpos=T.number, lpos=T.number, keywordid=T.number, ast=ast, [1]=T.string
})
-- Lua source code string type.
context.apply_value('src$', '')
-- SciTE syler object type.
local nf = function()end
context.apply_value('^styler$', T.table{SetState=nf, More=nf, Current=nf, Forward=nf, StartStyling=nf, EndStyling=nf, language=T.string})
end

View File

@@ -0,0 +1,130 @@
local T = {} -- types
-- istype[o] iff o represents a type (i.e. set of values)
T.istype = {}
-- iserror[o] iff o represents an error type (created via T.error).
T.iserror = {}
-- istabletype[o] iff o represents a table type (created by T.table).
T.istabletype = {}
-- Number type
T.number = {}
setmetatable(T.number, T.number)
function T.number.__tostring(self)
return 'number'
end
T.istype[T.number] = true
-- String type
T.string = {}
setmetatable(T.string, T.string)
function T.string.__tostring(self)
return 'string'
end
T.istype[T.string] = true
-- Boolean type
T.boolean = {}
setmetatable(T.boolean, T.boolean)
function T.boolean.__tostring(self)
return 'boolean'
end
T.istype[T.boolean] = true
-- Table type
function T.table(t)
T.istype[t] = true
T.istabletype[t] = true
return t
end
-- Universal type. This is a superset of all other types.
T.universal = {}
setmetatable(T.universal, T.universal)
function T.universal.__tostring(self)
return 'unknown'
end
T.istype[T.universal] = true
-- nil type. Represents `nil` but can be stored in tables.
T['nil'] = {}
setmetatable(T['nil'], T['nil'])
T['nil'].__tostring = function(self)
return 'nil'
end
T.istype[T['nil']] = true
-- None type. Represents a non-existent value, in a similar way
-- that `none` is used differently from `nil` in the Lua C API.
T.none = {}
setmetatable(T.none, T.none)
function T.none.__tostring(self)
return 'none'
end
T.istype[T.none] = true
-- Error type
local CError = {}; CError.__index = CError
function CError.__tostring(self) return "error:" .. tostring(self.value) end
function T.error(val)
local self = setmetatable({value=val}, CError)
T.istype[self] = true
T.iserror[self] = true
return self
end
-- Gets a type that is a superset of the two given types.
function T.superset_types(a, b)
if T.iserror[a] then return a end
if T.iserror[b] then return b end
if rawequal(a, b) then -- note: including nil == nil
return a
elseif type(a) == 'string' or a == T.string then
if type(b) == 'string' or b == T.string then
return T.string
else
return T.universal
end
elseif type(a) == 'number' or a == T.number then
if type(b) == 'number' or b == T.number then
return T.number
else
return T.universal
end
elseif type(a) == 'boolean' or a == T.boolean then
if type(b) == 'boolean' or b == T.boolean then
return T.boolean
else
return T.universal
end
else
return T.universal -- IMPROVE
end
end
--[[TESTS:
assert(T.superset_types(2, 2) == 2)
assert(T.superset_types(2, 3) == T.number)
assert(T.superset_types(2, T.number) == T.number)
assert(T.superset_types(T.number, T.string) == T.universal)
print 'DONE'
--]]
-- Determines whether type `o` certainly evaluates to true (true),
-- certainly evaluates to false (false) or could evaluate to either
-- true of false ('?').
function T.boolean_cast(o)
if T.iserror[o] then -- special case
return '?'
elseif o == nil or o == false or o == T['nil'] then -- all subsets of {nil, false}
return false
elseif o == T.universal or o == T.boolean then -- all supersets of boolean
return '?'
else -- all subsets of universal - {nil, false}
return true
end
end
return T

View File

@@ -28,8 +28,9 @@
module ("lexer", package.seeall)
require 'metalua.runtime'
-- don't load metalua.runtime as it loads metalua.base, which pollutes
-- global namespace and overwrites pairs/ipairs -- PK 6/4/2012
require 'metalua.table2'
lexer = { alpha={ }, sym={ } }
lexer.__index=lexer

View File

@@ -27,6 +27,6 @@ local keywords = {
"...", "..", "==", ">=", "<=", "~=",
"+{", "-{" }
for w in values(keywords) do mlp_lexer:add(w) end
for _,w in pairs(keywords) do mlp_lexer:add(w) end -- PK 6/4/2012
_M.lexer = mlp_lexer

Some files were not shown because too many files have changed in this diff Show More