Initial import of Scalos. To decrease size I have
[AROS-Contrib.git] / scalos / Plugins / OOP / wb39_plugin / wbrexx / wbrexx.h
blob9515efbfd24b36911d9c13c99a2261704b2b3e98
1 // WBRexx.h
2 // $Date$
3 // $Revision$
6 #ifndef WBREXX_H_INCLUDED
7 #define WBREXX_H_INCLUDED
9 #define d(x) ;
10 #define d1(x) ;
11 #define d2(x) x;
13 // from debug.lib
14 extern int kprintf(const char *fmt, ...);
15 extern int KPrintF(const char *fmt, ...);
17 #include <libraries/commodities.h>
18 #include <scalos/scalos.h>
20 #include <defs.h>
21 #include <stdlib.h>
23 struct InvokeMenu
25 const char *ivm_WBmenuName;
26 BOOL ivm_WindowRequired;
27 const char *ivm_ScalosMenuName;
28 ULONG (*ivm_MenuFunc)(struct ScaWindowStruct *swi);
31 enum UDataType
33 udaType_Nothing = 0,
34 udaType_ScaWindowStruct,
35 udaType_ScaIconNode,
36 udaType_TextFont,
37 udaType_Screen,
38 udaType_KeyCommand,
39 udaType_MenuCommand,
42 struct UData
44 APTR uda_Data;
45 enum UDataType uda_Type;
48 struct LeafData
50 long lres_Result;
52 const char *lres_ResultString; // nur wenn lres_Result == RETURN_OK;
54 const char *lres_ArgPtr; // Pointer auf nächsten Teil des Object-Namens
56 STRPTR *lres_Args; // die originalen Argumente
58 struct RexxMsg *lres_Message;
60 ULONG lres_Flags;
62 char lres_ResultBuffer[128];
65 #define LRESF_ORIGINALNAME 0x00000001
68 struct LeafCmd
70 const char *lc_Name;
72 const struct LeafCmd *lc_Next; // next Leaf on this Level or NULL
74 const struct LeafCmd *lc_Sub; // Sub-Tree or NULL;
76 struct UData (*lc_Function)(struct UData, struct LeafData *, const char *StemLeaf, ULONG Index);
78 ULONG (*lc_GetCount)(struct UData, struct LeafData *); // only if ENUM == lc_Name
81 struct RexxHost
83 APTR UserData;
84 const struct CmdFunc * CommandTable;
86 struct MsgPort * GlobalPort;
87 UBYTE PortName[1];
90 /* This is for parsing commands the ARexx port receives. We employ
91 * the dos.library/ReadArgs parser for this purpose.
94 struct RexxParseData
96 struct RDArgs * ReadArgs;
97 UBYTE Line[512]; /* We allow for commands to be up to
98 * 511 characters long. This is far
99 * below the maximum string length
100 * limit ARexx imposed (32768
101 * characters) but should be more
102 * than sufficient for normal
103 * applications.
105 STRPTR Args[32]; /* Up to 32 command arguments are
106 * allowed.
110 /* A table to map command names to functions which
111 * will handle them.
114 struct CmdFunc
116 STRPTR CommandName; /* Name of the command. */
117 STRPTR Template; /* The command template in standard
118 * AmigaDOS syntax.
121 /* Pointer to the function which implements this command. */
123 LONG (*Function)(APTR,struct RexxMsg *,STRPTR *);
126 /* The local data used by the functions the host supports. */
128 struct LocalData
130 struct RexxParseData * ParseData;
131 struct RexxHost * Host;
132 struct CmdFunc * CommandTable; /* Pointer to table of commands. */
133 struct MsgPort * GlobalPort; /* Copied from RexxHost. */
134 STRPTR PortName; /* Copied from RexxHost. */
135 ULONG Usage; /* Usage count for Rx command. */
136 BOOL Terminate; /* Set to TRUE if host should exit. */
139 /* This is a custom message the Rx command will need if the
140 * "CONSOLE" keyword is used.
143 struct ChildMessage
145 struct Message Message; /* Common message header. */
147 struct RexxMsg * RexxMsg; /* The client message. */
148 STRPTR PortName; /* Copied from LocalData. */
149 UBYTE Command[1]; /* Command to execute. */
153 enum IconState { icst_All, icst_Selected, icst_Unselected };
156 struct ToolMenuItem
158 struct Node tmi_Node;
159 STRPTR tmi_Name; // this is the "handle" to refer to this menu item
160 STRPTR tmi_Title; // the item title
161 STRPTR tmi_Cmd; // the command string
162 STRPTR tmi_Shortcut;
164 STRPTR tmi_MenuTitle; // menu title for menus NULL for common tool menu items
165 STRPTR tmi_SubItem; // sub item name or NULL for common tool menu items
167 APTR tmi_wbKey; // "key" retrieved by WBAPPMENUA_GetKey
168 APTR tmi_wbTitleKey; // "key" retrieved by WBAPPMENUA_GetTitleKey
170 struct AppObject *tmi_MenuAppObject;
171 struct AppObject *tmi_ItemAppObject;
172 struct AppObject *tmi_SubAppObject;
174 ULONG tmi_UseCount;
175 struct ToolMenuItem *tmi_Parent;
178 struct KeyboardCommand
180 struct Node kbc_Node;
181 STRPTR kbc_Name;
182 STRPTR kbc_Cmd;
183 STRPTR kbc_Key;
184 IX kbc_IX;
187 //----------------------------------------------------------------------------
189 #if defined(__SASC)
190 #include <stdarg.h>
191 int snprintf(char *, size_t, const char *, /*args*/ ...);
192 int vsnprintf(char *, size_t, const char *, va_list ap);
193 #endif /* __SASC */
195 //----------------------------------------------------------------------------
197 // WBRexx.c
198 LONG DoRexxCommand(CONST_STRPTR Command);
199 LONG ReturnRexxMsg(struct RexxMsg * Message,CONST_STRPTR Result);
200 SAVEDS(VOID) RxEntry(VOID);
201 VOID DeleteChildMessage(struct ChildMessage *ChildMessage);
202 struct ChildMessage *CreateChildMessage(struct MsgPort *ReplyPort,
203 CONST_STRPTR Command,struct RexxMsg *RexxMessage);
204 void ShutdownWBRexxProcess(void);
205 BOOL StartWBRexxProcess(void);
206 CONST_STRPTR GetNextArgPart(CONST_STRPTR ArgSrc, STRPTR Buffer, size_t MaxLen);
207 ULONG AddMenuItem(CONST_STRPTR Name, CONST_STRPTR Title, CONST_STRPTR Cmd, CONST_STRPTR Shortcut);
208 ULONG RemoveMenuItem(CONST_STRPTR Name);
209 ULONG AddKeyboardCommand(CONST_STRPTR Name, CONST_STRPTR Key, CONST_STRPTR Cmd);
210 ULONG RemoveKeyboardCommand(CONST_STRPTR Name);
211 BOOL DoKeyboardCommand(struct IntuiMessage *iMsg);
214 // RexxGetAttrs.c
215 LONG Cmd_GetAttr(APTR UserData,struct RexxMsg *Message,STRPTR *Args);
218 // RexxIcon.c
219 LONG Cmd_Icon(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
222 // RexxCmd.c
223 LONG Cmd_ActivateWindow(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
224 LONG Cmd_ChangeWindow(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
225 LONG Cmd_Delete(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
226 LONG Cmd_Fault(APTR UserData,struct RexxMsg *Message,STRPTR *Args);
227 LONG Cmd_Help(APTR UserData,struct RexxMsg *Message,STRPTR *Args);
228 LONG Cmd_Info(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
229 LONG Cmd_Keyboard(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
230 LONG Cmd_LockGUI(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
231 LONG Cmd_Menu(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
232 LONG Cmd_MoveWindow(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
233 LONG Cmd_NewDrawer(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
234 LONG Cmd_Rename(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
235 LONG Cmd_Rx(APTR UserData,struct RexxMsg *Message,STRPTR *Args);
236 LONG Cmd_SizeWindow(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
237 LONG Cmd_UnlockGUI(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
238 LONG Cmd_UnzoomWindow(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
239 LONG Cmd_View(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
240 LONG Cmd_Window(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
241 LONG Cmd_WindowToBack(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
242 LONG Cmd_WindowToFront(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
243 LONG Cmd_ZoomWindow(APTR UserData, struct RexxMsg *Message, STRPTR *Args);
246 //----------------------------------------------------------------------------
248 #endif