4 * Created by Toshi Nagata on 2008/11/05.
5 * Copyright 2005-2008 Toshi Nagata. All rights reserved.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation version 2 of the License.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
17 #ifndef __Molby_extern_h__
18 #define __Molby_extern_h__
24 #include "../MolLib.h"
26 /* This definition is to work around 'VALUE' type in sources without "ruby.h" */
27 #ifndef RubyValue_is_Defined
28 #define RubyValue_is_Defined
29 typedef void *RubyValue;
30 #define RubyNil ((RubyValue)4)
33 extern int gMolbyRunLevel;
34 extern int gMolbyIsCheckingInterrupt;
36 extern int gSuppressConsole;
39 extern char *gRubyVersion;
40 extern char *gRubyCopyright;
42 extern void Ruby_showError(int status);
43 extern int Ruby_showValue(RubyValue value, char **outValueString);
44 extern int Ruby_UpdateUI(int index, Molecule *mol, int *outChecked, char **outTitle);
46 extern int Molby_loadScript(const char *script, int from_file);
47 extern void Molby_startup(const char *script_path, const char *dir);
48 extern void Molby_getDescription(char **versionString, char **auxString);
49 extern RubyValue Molby_evalRubyScriptOnMolecule(const char *script, Molecule *mol, const char *fname, int *status);
50 /* extern RubyValue Molby_evalRubyScript(const char *script, int *status);
51 extern RubyValue Molby_evalRubyScriptOnActiveMoleculeWithInterrupt(const char *script, int *status); */
52 /*extern int Ruby_methodType(const char *className, const char *methodName);*/
53 extern void Molby_buildARGV(int argc, const char **argv);
55 /* RubyValue version of Ruby_funcall2_protect() */
56 extern RubyValue Ruby_funcall2_protect_extern(RubyValue recv, int mid, int argc, RubyValue *argv, int *status);
58 extern int g_RubyID_call; /* rb_intern("call") for external use */
60 STUB char *MyAppCallback_getGUIDescriptionString(void);
61 STUB char *MyAppCallback_getGlobalSettings(const char *key);
62 STUB void MyAppCallback_setGlobalSettings(const char *key, const char *value);
63 STUB int MyAppCallback_getGlobalSettingsWithType(const char *key, int type, void *ptr);
64 STUB int MyAppCallback_setGlobalSettingsWithType(const char *key, int type, const void *ptr);
65 STUB int MyAppCallback_showScriptMessage(const char *fmt, ...);
66 STUB void MyAppCallback_setConsoleColor(int color);
67 STUB void MyAppCallback_showRubyPrompt(void);
68 STUB int MyAppCallback_checkInterrupt(void);
69 STUB void MyAppCallback_showProgressPanel(const char *msg);
70 STUB void MyAppCallback_hideProgressPanel(void);
71 STUB void MyAppCallback_setProgressValue(double dval);
72 STUB void MyAppCallback_setProgressMessage(const char *msg);
73 //STUB int MyAppCallback_processUIWithTimeout(double seconds);
74 STUB int MyAppCallback_getTextWithPrompt(const char *prompt, char *buf, int bufsize);
75 STUB int MyAppCallback_messageBox(const char *message, const char *title, int flags, int icon);
76 STUB void MyAppCallback_errorMessageBox(const char *fmt, ...);
77 STUB char *MyAppCallback_getHomeDir(void);
78 STUB char *MyAppCallback_getDocumentHomeDir(void);
79 STUB int MyAppCallback_registerScriptMenu(const char *title);
80 STUB int MyAppCallback_lookupScriptMenu(const char *title);
81 STUB RubyValue MyAppCallback_executeScriptFromFile(const char *path, int *status);
82 STUB int MyAppCallback_callSubProcess(const char **argv, const char *procname, int (*callback)(void *), void *callback_data, FILE *output, FILE *errout, int *exitstatus_p, int *pid_p);
83 STUB void MyAppCallback_beginUndoGrouping(void);
84 STUB void MyAppCallback_endUndoGrouping(void);
85 STUB int MyAppCallback_switchToFilterMode(void);
86 STUB void MyAppCallback_showConsoleWindow(void);
87 STUB void MyAppCallback_hideConsoleWindow(void);
88 STUB void MyAppCallback_bell(void);
89 STUB int MyAppCallback_playSound(const char *filename, int flag);
90 STUB void MyAppCallback_stopSound(void);
91 STUB void MyAppCallback_initImageHandlers(void);
93 #define DUMMY_CALLBACK ((int (*)(void *))1)
99 #endif /* __Molby_h__ */