Added some more docs to String
[libs.git] / src / csylph / csylph.cpp
blobba7d8f5d64b0f7f219ff691c4088ce07aec6dca5
1 #include <sys/stat.h>
3 #include "csylph.h"
4 #include "../Sylph/Core/Application.h"
6 int sylph_init(int argc, char** argv, sylph_apptype_t app, char* name) {
7 try {
8 if (argv == 0 || name == 0) {
9 syerror = SYENULL;
10 return 0;
12 Sylph::AppType type;
13 switch (app) {
14 case sy_at_linux:
15 type = Sylph::S_APPTYPE_BUNDLE;
16 break;
17 case sy_at_lfhs:
18 type = Sylph::S_APPTYPE_FHS;
19 break;
20 case sy_at_mac:
21 type = Sylph::S_APPTYPE_MACOS;
22 break;
23 case sy_at_mfhs:
24 type = Sylph::S_APPTYPE_MACOS_FHS;
25 break;
26 default:
27 exit(1);
28 break;
30 Sylph::Application::init(argc, argv, 0, type, name);
31 return 1;
32 } catch (Sylph::Exception ex) {
33 strncpy(sy_excp, ex.what(), 255);
34 syerror = SYECPPEXC;
35 return 1;
39 int sylph_initm(int argc, char** argv, char** apple, sylph_apptype_t app,
40 char* name) {
41 try {
42 if (argv == 0 || name == 0) {
43 syerror = SYENULL;
44 return 0;
46 Sylph::AppType type;
47 switch (app) {
48 case sy_at_linux:
49 type = Sylph::S_APPTYPE_BUNDLE;
50 break;
51 case sy_at_lfhs:
52 type = Sylph::S_APPTYPE_FHS;
53 break;
54 case sy_at_mac:
55 type = Sylph::S_APPTYPE_MACOS;
56 break;
57 case sy_at_mfhs:
58 type = Sylph::S_APPTYPE_MACOS_FHS;
59 break;
60 default:
61 exit(1);
62 break;
64 Sylph::Application::init(argc, argv, apple, type, name);
65 } catch (Sylph::Exception ex) {
66 strncpy(sy_excp, ex.what(), 255);
67 syerror = SYECPPEXC;
68 return 1;
72 int sy_bundle(sylph_file_t* in) {
73 try {
74 if (in == 0) {
75 syerror = SYENULL;
76 return 1;
78 static Sylph::File f = thisapp->bundle();
79 in->sy_f_loc = f.nativeString();
80 return 0;
81 } catch (Sylph::Exception ex) {
82 strncpy(sy_excp, ex.what(), 255);
83 syerror = SYECPPEXC;
84 return 1;
88 int sy_rscdir(sylph_file_t* in) {
89 try {
90 if (in == 0) {
91 syerror = SYENULL;
92 return 1;
94 static Sylph::File f = thisapp->resourceDir();
95 in->sy_f_loc = f.nativeString();
96 return 0;
97 } catch (Sylph::Exception ex) {
98 strncpy(sy_excp, ex.what(), 255);
99 syerror = SYECPPEXC;
100 return 1;
104 int sy_rsc(sylph_file_t* in, const char* fname) {
105 try {
106 if (in == 0 || fname == 0) {
107 syerror = SYENULL;
108 return 1;
110 Sylph::File f = thisapp->resource(fname);
111 in->sy_f_loc = f.nativeString();
112 return 0;
113 } catch (Sylph::Exception ex) {
114 strncpy(sy_excp, ex.what(), 255);
115 syerror = SYECPPEXC;
116 return 1;
120 int sy_libdir(sylph_file_t* in) {
121 try {
122 if (in == 0) {
123 syerror = SYENULL;
124 return 1;
126 static Sylph::File f = thisapp->libraryDir();
127 in->sy_f_loc = f.nativeString();
128 return 0;
129 } catch (Sylph::Exception ex) {
130 strncpy(sy_excp, ex.what(), 255);
131 syerror = SYECPPEXC;
132 return 1;
136 int sy_pldir(sylph_file_t* in) {
137 try {
138 if (in == 0) {
139 syerror = SYENULL;
140 return 1;
142 static Sylph::File f = thisapp->pluginDir();
143 in->sy_f_loc = f.nativeString();
144 return 0;
145 } catch (Sylph::Exception ex) {
146 strncpy(sy_excp, ex.what(), 255);
147 syerror = SYECPPEXC;
148 return 1;
152 int sy_plddir(sylph_file_t* in) {
153 try {
154 if (in == 0) {
155 syerror = SYENULL;
156 return 1;
158 static Sylph::File f = thisapp->plugindisabledDir();
159 in->sy_f_loc = f.nativeString();
160 return 0;
161 } catch (Sylph::Exception ex) {
162 strncpy(sy_excp, ex.what(), 255);
163 syerror = SYECPPEXC;
164 return 1;
168 int sy_sys_libdir(sylph_file_t* in) {
169 try {
170 if (in == 0) {
171 syerror = SYENULL;
172 return 1;
174 static Sylph::File f = thisapp->systemLibraryDir();
175 in->sy_f_loc = f.nativeString();
176 return 0;
177 } catch (Sylph::Exception ex) {
178 strncpy(sy_excp, ex.what(), 255);
179 syerror = SYECPPEXC;
180 return 1;
184 int sy_sys_sts(sylph_file_t* in) {
185 try {
186 if (in == 0) {
187 syerror = SYENULL;
188 return 1;
190 static Sylph::File f = thisapp->systemSettings();
191 in->sy_f_loc = f.nativeString();
192 return 0;
193 } catch (Sylph::Exception ex) {
194 strncpy(sy_excp, ex.what(), 255);
195 syerror = SYECPPEXC;
196 return 1;
200 int sy_sys_stsdir(sylph_file_t* in) {
201 try {
202 if (in == 0) {
203 syerror = SYENULL;
204 return 1;
206 static Sylph::File f = thisapp->systemSettingsDir();
207 in->sy_f_loc = f.nativeString();
208 return 0;
209 } catch (Sylph::Exception ex) {
210 strncpy(sy_excp, ex.what(), 255);
211 syerror = SYECPPEXC;
212 return 1;
216 int sy_sys_pldir(sylph_file_t* in) {
217 try {
218 if (in == 0) {
219 syerror = SYENULL;
220 return 1;
222 static Sylph::File f = thisapp->systemPluginDir();
223 in->sy_f_loc = f.nativeString();
224 return 0;
225 } catch (Sylph::Exception ex) {
226 strncpy(sy_excp, ex.what(), 255);
227 syerror = SYECPPEXC;
228 return 1;
232 int sy_sys_plddir(sylph_file_t* in) {
233 try {
234 if (in == 0) {
235 syerror = SYENULL;
236 return 1;
238 static Sylph::File f = thisapp->systemPluginDisabledDir();
239 in->sy_f_loc = f.nativeString();
240 return 0;
241 } catch (Sylph::Exception ex) {
242 strncpy(sy_excp, ex.what(), 255);
243 syerror = SYECPPEXC;
244 return 1;
248 int sy_sys_rscdir(sylph_file_t* in) {
249 try {
250 if (in == 0) {
251 syerror = SYENULL;
252 return 1;
254 static Sylph::File f = thisapp->systemResourceDir();
255 in->sy_f_loc = f.nativeString();
256 return 0;
257 } catch (Sylph::Exception ex) {
258 strncpy(sy_excp, ex.what(), 255);
259 syerror = SYECPPEXC;
260 return 1;
264 int sy_sys_rsc(sylph_file_t* in, const char* fname) {
265 try {
266 if (in == 0 || fname == 0) {
267 syerror = SYENULL;
268 return 1;
270 Sylph::File f = thisapp->systemResource(fname);
271 in->sy_f_loc = f.nativeString();
272 return 0;
273 } catch (Sylph::Exception ex) {
274 strncpy(sy_excp, ex.what(), 255);
275 syerror = SYECPPEXC;
276 return 1;
280 int sy_usr(sylph_file_t* in) {
281 try {
282 if (in == 0) {
283 syerror = SYENULL;
284 return 1;
286 static Sylph::File f = thisapp->userHome();
287 in->sy_f_loc = f.nativeString();
288 return 0;
289 } catch (Sylph::Exception ex) {
290 strncpy(sy_excp, ex.what(), 255);
291 syerror = SYECPPEXC;
292 return 1;
296 int sy_usr_libdir(sylph_file_t* in) {
297 try {
298 if (in == 0) {
299 syerror = SYENULL;
300 return 1;
302 static Sylph::File f = thisapp->userLibraryDir();
303 in->sy_f_loc = f.nativeString();
304 return 0;
305 } catch (Sylph::Exception ex) {
306 strncpy(sy_excp, ex.what(), 255);
307 syerror = SYECPPEXC;
308 return 1;
312 int sy_usr_sts(sylph_file_t* in) {
313 try {
314 if (in == 0) {
315 syerror = SYENULL;
316 return 1;
318 static Sylph::File f = thisapp->userSettings();
319 in->sy_f_loc = f.nativeString();
320 return 0;
321 } catch (Sylph::Exception ex) {
322 strncpy(sy_excp, ex.what(), 255);
323 syerror = SYECPPEXC;
324 return 1;
328 int sy_usr_stsdir(sylph_file_t* in) {
329 try {
330 if (in == 0) {
331 syerror = SYENULL;
332 return 1;
334 static Sylph::File f = thisapp->userSettingsDir();
335 in->sy_f_loc = f.nativeString();
336 return 0;
337 } catch (Sylph::Exception ex) {
338 strncpy(sy_excp, ex.what(), 255);
339 syerror = SYECPPEXC;
340 return 1;
344 int sy_usr_pldir(sylph_file_t* in) {
345 try {
346 if (in == 0) {
347 syerror = SYENULL;
348 return 1;
350 static Sylph::File f = thisapp->userPluginDir();
351 in->sy_f_loc = f.nativeString();
352 return 0;
353 } catch (Sylph::Exception ex) {
354 strncpy(sy_excp, ex.what(), 255);
355 syerror = SYECPPEXC;
356 return 1;
360 int sy_usr_plddir(sylph_file_t* in)
361 try {
362 if (in == 0) {
363 syerror = SYENULL;
364 return 1;
366 static Sylph::File f = thisapp->userPluginDisabledDir();
367 in->sy_f_loc = f.nativeString();
368 return 0;
369 } catch (Sylph::Exception ex) {
370 strncpy(sy_excp, ex.what(), 255);
371 syerror = SYECPPEXC;
372 return 1;
376 int sy_usr_rscdir(sylph_file_t* in) {
377 try {
378 if (in == 0) {
379 syerror = SYENULL;
380 return 1;
382 static Sylph::File f = thisapp->userResourceDir();
383 in->sy_f_loc = f.nativeString();
384 return 0;
385 } catch (Sylph::Exception ex) {
386 strncpy(sy_excp, ex.what(), 255);
387 syerror = SYECPPEXC;
388 return 1;
392 int sy_usr_rsc(sylph_file_t* in, const char* fname) {
393 try {
394 if (in == 0 || fname == 0) {
395 syerror = SYENULL;
396 return 1;
398 Sylph::File f = thisapp->systemResource(fname);
399 in->sy_f_loc = f.nativeString();
400 return 0;
401 } catch (Sylph::Exception ex) {
402 strncpy(sy_excp, ex.what(), 255);
403 syerror = SYECPPEXC;
404 return 1;
408 int sy_prefix(sylph_file_t* in) {
409 try {
410 if (in == 0) {
411 syerror = SYENULL;
412 return 1;
414 static Sylph::File f = thisapp->prefix();
415 in->sy_f_loc = f.nativeString();
416 return 0;
417 } catch (Sylph::Exception ex) {
418 strncpy(sy_excp, ex.what(), 255);
419 syerror = SYECPPEXC;
420 return 1;
424 const char* sy_cppexp() {
425 return sy_excp;