Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Support for Interpreted Languages?
dmoore:
ok, I managed to get a very simple plugin to work that creates an "Interpreters" menu with a few options and adds a context menu item for right clicks on the project tree to execute relevant scripts (I only add this item to the context menu if the file extension matches a known type). So far I only have it setup to handle python files, but it will be easy to add support for any interpreter. I'm using wxExecute to run the interpreter.
Before I really jump into the deep end and work on debug support (more questions on that later) I have two quick questions:
1. is there away to register file type classes from the plugin? it's easy to do manually through the menus: Project -> Project Tree -> Edit file types & categories or the Project Tree context menu, but i may as well automate this if possible
2. Is there a standard format for plugin settings and configuration files? Where are they stored? I want to store the list of interpreters, paths, command strings etc.
mandrav:
--- Quote ---1. is there away to register file type classes from the plugin?
--- End quote ---
Unfortunately, not yet.
--- Quote ---2. Is there a standard format for plugin settings and configuration files? Where are they stored? I want to store the list of interpreters, paths, command strings etc.
--- End quote ---
ConfigManager comes to the rescue ;).
--- Code: (cpp) ---ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("your_plugin_name"));
cfg->Write(_T("/any/kind/of/path"), some_string);
cfg->Write(_T("/paths/are/not/filesystem/paths"), some_float);
cfg->Write(_T("/paths/are/just/a/way/for/you/to/organize/data"), some_bool);
some_string = cfg->Read(_T("/another/path"), a_default_string_if_the_key_doesnt_exist);
some_int = cfg->ReadInt(_T("/always/start/the/paths/with/a/slash"), a default_int);
...and so on and so forth...
--- End code ---
For more info, check ConfigManager's documentation and, as always, consult the other plugins' sources :).
dmoore:
thanks! more soon.
Game_Ender:
I am sure you aware of PyDev but perhaps you could port over the Java based python debugger for use in Code::Blocks.
dmoore:
--- Quote from: Game_Ender on September 30, 2006, 10:30:48 pm ---I am sure you aware of PyDev but perhaps you could port over the Java based python debugger for use in Code::Blocks.
--- End quote ---
Yes, I use PyDev and its pretty darn good. However, I don't think I want to go down that path (seems like I would have to know too much about Java libraries and the Eclipse SDK - no thanks). My current plan is to pass commands to the internal debuggers provided by most interpreted languages by rerouting std in/out. it should be possible to set up REGEX commands to obtain the current code position etc (I know I can do this for python and, probably, ruby). Ideally the user would setup a debug config file that contains the definitions required to pass commands to the debugger and interpret its output. If someone has better ideas I'm all ears.
Anyway, here is the code for the interpreters plugin to date. I used the data specification for the interpreters that Mandrav provided in the Wiki. There's some ugliness in the code and UI that I will eventually clean up. (blame it on unfamiliarity with wxWidgets)
Features:
add & edit interpreters + associated actions in the environment settings dialog (I'm using the build icon). (these are stored persistently)
Interpreters menu: run interpreter actions on a file target (selected using a file dialog - currently uses a "*.*" wildcard extension instead of the correct one)
Project Tree Context menu: run interpreter actions on selected file (obviously you have to add your file to the project first)
Feedback appreciated.
EDIT: Plugin removed - reposted on next page.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version