1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
#include "plugin_internal.h"
static CWParserContext *GetContext(CWPluginContext context) {
if (context && (context->pluginType == CWDROPINPARSERTYPE))
return static_cast<CWParserContext *>(context);
else
return 0;
}
CW_CALLBACK CWParserGetBuildDate(CWPluginContext context, const char **bdate, const char **btime) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!bdate)
return cwErrInvalidParameter;
if (!btime)
return cwErrInvalidParameter;
*bdate = pc->build_date;
*btime = pc->build_time;
return cwNoErr;
}
CW_CALLBACK CWParserGetCommandLine(CWPluginContext context, CWCommandLineArgs **args) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!args)
return cwErrInvalidParameter;
*args = pc->args;
return cwNoErr;
}
CW_CALLBACK CWParserGetTargetInfo(CWPluginContext context, CWDataType *cpu, CWDataType *os) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!cpu)
return cwErrInvalidParameter;
if (!os)
return cwErrInvalidParameter;
*cpu = pc->cpu;
*os = pc->os;
return cwNoErr;
}
CW_CALLBACK CWParserGetToolInfo(CWPluginContext context, const ToolVersionInfo **toolVersionInfo) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!toolVersionInfo)
return cwErrInvalidParameter;
*toolVersionInfo = pc->build_tool;
return cwNoErr;
}
CW_CALLBACK CWParserGetPlugins(CWPluginContext context, int *numPlugins, const CLPluginInfo **pluginInfo) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!numPlugins)
return cwErrInvalidParameter;
if (!pluginInfo)
return cwErrInvalidParameter;
*numPlugins = pc->numPlugins;
*pluginInfo = pc->plugins;
return cwNoErr;
}
CW_CALLBACK CWParserGetPanels(CWPluginContext context, int *numPanels, const char ***panelNames) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!numPanels)
return cwErrInvalidParameter;
if (!panelNames)
return cwErrInvalidParameter;
*numPanels = pc->numPanels;
*panelNames = pc->panelNames;
return cwNoErr;
}
CW_CALLBACK CWParserStoreCommandLineForPanel(CWPluginContext context, int index, const CWCommandLineArgs *args) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (index < 0 || index >= pc->numPanels)
return cwErrInvalidParameter;
if (!args)
return cwErrInvalidParameter;
pc->panel_args[index] = *args;
return cwNoErr;
}
CW_CALLBACK CWParserStoreCommandLineForPlugin(CWPluginContext context, int index, const CWCommandLineArgs *args) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (index < 0 || index >= pc->numPlugins)
return cwErrInvalidParameter;
if (!args)
return cwErrInvalidParameter;
pc->plugin_args[index] = *args;
return cwNoErr;
}
CW_CALLBACK CWParserSetNamedPreferences(CWPluginContext context, const char *panelName, Handle paneldata) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!panelName)
return cwErrInvalidParameter;
return pc->callbacks->cbParserSetNamedPreferences(pc, panelName, paneldata);
}
CW_CALLBACK CWParserAddAccessPath(CWPluginContext context, const CWNewAccessPathInfo *api) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!api)
return cwErrInvalidParameter;
return pc->callbacks->cbParserAddAccessPath(pc, api);
}
CW_CALLBACK CWParserSwapAccessPaths(CWPluginContext context) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
return pc->callbacks->cbParserSwapAccessPaths(pc);
}
CW_CALLBACK CWParserSetOutputFileDirectory(CWPluginContext context, const CWFileSpec *idefss) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!idefss)
return cwErrInvalidParameter;
return pc->callbacks->cbParserSetOutputFileDirectory(pc, idefss);
}
CW_CALLBACK CWParserSetFileOutputName(CWPluginContext context, SInt32 position, short which, const char *outfilename) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!outfilename)
return cwErrInvalidParameter;
return pc->callbacks->cbParserSetFileOutputName(pc, position, which, outfilename);
}
CW_CALLBACK CWParserAddOverlay1Group(CWPluginContext context, const char *name, const CWAddr64 *addr, SInt32 *newGroupNumber) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!name)
return cwErrInvalidParameter;
if (!addr)
return cwErrInvalidParameter;
if (!newGroupNumber)
return cwErrInvalidParameter;
return pc->callbacks->cbParserAddOverlay1Group(pc, name, addr, newGroupNumber);
}
CW_CALLBACK CWParserAddOverlay1(CWPluginContext context, const char *name, SInt32 groupNumber, SInt32 *newOverlayNumber) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!name)
return cwErrInvalidParameter;
if (!newOverlayNumber)
return cwErrInvalidParameter;
return pc->callbacks->cbParserAddOverlay1(pc, name, groupNumber, newOverlayNumber);
}
CW_CALLBACK CWParserAddSegment(CWPluginContext context, const char *name, short attrs, SInt32 *newSegmentNumber) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!name)
return cwErrInvalidParameter;
if (!newSegmentNumber)
return cwErrInvalidParameter;
return pc->callbacks->cbParserAddSegment(pc, name, attrs, newSegmentNumber);
}
CW_CALLBACK CWParserSetSegment(CWPluginContext context, SInt32 segmentNumber, const char *name, short attrs) {
CWParserContext *pc;
if (!(pc = GetContext(context)))
return cwErrInvalidCallback;
if (!name)
return cwErrInvalidParameter;
return pc->callbacks->cbParserSetSegment(pc, segmentNumber, name, attrs);
}
CW_CALLBACK CWParserCreateVirtualFile(CWPluginContext context, const char *name, CWMemHandle text) {
CWNewTextDocumentInfo info;
info.documentname = name;
info.text = text;
info.markDirty = 1;
return CWCreateNewTextDocument(context, &info);
}
CW_CALLBACK CWParserDisplayTextHandle(CWPluginContext context, const char *name, CWMemHandle text) {
CWNewTextDocumentInfo info;
info.documentname = name;
info.text = text;
info.markDirty = 0;
return CWCreateNewTextDocument(context, &info);
}
|