]>
Commit | Line | Data |
---|---|---|
0e320a79 | 1 | ///////////////////////////////////////////////////////////////////////////// |
0e2a14e5 | 2 | // Name: src/os2/utils.cpp |
0e320a79 | 3 | // Purpose: Various utilities |
45fcbf3b | 4 | // Author: David Webster |
0e320a79 | 5 | // Modified by: |
45fcbf3b | 6 | // Created: 09/17/99 |
0e320a79 | 7 | // RCS-ID: $Id$ |
45fcbf3b | 8 | // Copyright: (c) David Webster |
65571936 | 9 | // Licence: wxWindows licence |
0e320a79 DW |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
45fcbf3b DW |
12 | // For compilers that support precompilation, includes "wx.h". |
13 | #include "wx/wxprec.h" | |
14 | ||
e4db172a WS |
15 | #include "wx/utils.h" |
16 | ||
45fcbf3b | 17 | #ifndef WX_PRECOMP |
88a7a4e1 | 18 | #include "wx/intl.h" |
e4db172a | 19 | #include "wx/log.h" |
45fcbf3b DW |
20 | #endif //WX_PRECOMP |
21 | ||
22 | #include "wx/os2/private.h" | |
cd478a95 | 23 | #include "wx/apptrait.h" |
783388d5 | 24 | #include "wx/filename.h" |
45fcbf3b | 25 | |
0e320a79 | 26 | #include <ctype.h> |
06298235 SN |
27 | #ifdef __EMX__ |
28 | #include <dirent.h> | |
06298235 | 29 | #endif |
45fcbf3b | 30 | |
45fcbf3b DW |
31 | |
32 | #include <io.h> | |
0e320a79 DW |
33 | |
34 | #include <stdio.h> | |
35 | #include <stdlib.h> | |
36 | #include <string.h> | |
45fcbf3b | 37 | #include <errno.h> |
0e320a79 DW |
38 | #include <stdarg.h> |
39 | ||
d90895ac | 40 | #define PURE_32 |
468e327a | 41 | |
6670f564 WS |
42 | #if defined(__WATCOMC__) |
43 | extern "C" | |
44 | { | |
45 | #include <upm.h> | |
46 | } | |
47 | #elif !defined(__EMX__) | |
48 | #include <upm.h> | |
49 | #include <netcons.h> | |
50 | #include <netbios.h> | |
06298235 | 51 | #endif |
45fcbf3b | 52 | |
77ffb593 | 53 | static const wxChar WX_SECTION[] = _T("wxWidgets"); |
86de7616 | 54 | static const wxChar eHOSTNAME[] = _T("HostName"); |
45fcbf3b DW |
55 | |
56 | // For the following functions we SHOULD fill in support | |
57 | // for Windows-NT (which I don't know) as I assume it begin | |
58 | // a POSIX Unix (so claims MS) that it has some special | |
59 | // functions beyond those provided by WinSock | |
60 | ||
0e320a79 | 61 | // Get full hostname (eg. DoDo.BSn-Germany.crg.de) |
63a3cd7a | 62 | bool wxGetHostName( wxChar* zBuf, int nMaxSize ) |
0e320a79 | 63 | { |
63a3cd7a WS |
64 | if (!zBuf) return false; |
65 | ||
66 | #if defined(wxUSE_NET_API) && wxUSE_NET_API | |
67 | char zServer[256]; | |
68 | char zComputer[256]; | |
69 | unsigned long ulLevel = 0; | |
70 | unsigned char* zBuffer = NULL; | |
71 | unsigned long ulBuffer = 256; | |
72 | unsigned long* pulTotalAvail = NULL; | |
10e5b930 | 73 | |
dde11e60 DW |
74 | NetBios32GetInfo( (const unsigned char*)zServer |
75 | ,(const unsigned char*)zComputer | |
909b4f08 | 76 | ,ulLevel |
dde11e60 | 77 | ,zBuffer |
909b4f08 DW |
78 | ,ulBuffer |
79 | ,pulTotalAvail | |
dde11e60 | 80 | ); |
10e5b930 | 81 | strcpy(zBuf, zServer); |
45fcbf3b | 82 | #else |
63a3cd7a WS |
83 | wxChar* zSysname; |
84 | const wxChar* zDefaultHost = _T("noname"); | |
45fcbf3b | 85 | |
4f6eaf5e SN |
86 | if ((zSysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL && |
87 | (zSysname = wxGetenv(_T("HOSTNAME"))) == NULL) | |
10e5b930 | 88 | { |
9923c37d DW |
89 | ::PrfQueryProfileString( HINI_PROFILE |
90 | ,(PSZ)WX_SECTION | |
91 | ,(PSZ)eHOSTNAME | |
92 | ,(PSZ)zDefaultHost | |
93 | ,(void*)zBuf | |
94 | ,(ULONG)nMaxSize - 1 | |
95 | ); | |
10e5b930 DW |
96 | } |
97 | else | |
63a3cd7a | 98 | { |
10e5b930 | 99 | wxStrncpy(zBuf, zSysname, nMaxSize - 1); |
63a3cd7a WS |
100 | } |
101 | ||
10e5b930 | 102 | zBuf[nMaxSize] = _T('\0'); |
45fcbf3b | 103 | #endif |
63a3cd7a | 104 | |
9d8aca48 | 105 | return *zBuf ? true : false; |
0e320a79 DW |
106 | } |
107 | ||
108 | // Get user ID e.g. jacs | |
6670f564 | 109 | bool wxGetUserId(wxChar* zBuf, int nType) |
0e320a79 | 110 | { |
6670f564 | 111 | #if defined(__VISAGECPP__) || defined(__WATCOMC__) |
2bd5bbc9 | 112 | // UPM procs return 0 on success |
6670f564 | 113 | long lrc = U32ELOCU((PUCHAR)zBuf, (PULONG)&nType); |
9d8aca48 | 114 | if (lrc == 0) return true; |
06298235 | 115 | #endif |
9d8aca48 | 116 | return false; |
0e320a79 DW |
117 | } |
118 | ||
6670f564 | 119 | bool wxGetUserName( wxChar* zBuf, int nMaxSize ) |
0e320a79 | 120 | { |
45fcbf3b | 121 | #ifdef USE_NET_API |
6670f564 | 122 | wxGetUserId( zBuf, nMaxSize ); |
45fcbf3b | 123 | #else |
10e5b930 | 124 | wxStrncpy(zBuf, _T("Unknown User"), nMaxSize); |
45fcbf3b | 125 | #endif |
9d8aca48 | 126 | return true; |
0e320a79 DW |
127 | } |
128 | ||
6670f564 WS |
129 | int wxKill(long lPid, |
130 | wxSignal WXUNUSED(eSig), | |
131 | wxKillError* WXUNUSED(peError), | |
132 | int WXUNUSED(flags)) | |
0e320a79 | 133 | { |
10e5b930 | 134 | return((int)::DosKillProcess(0, (PID)lPid)); |
0e320a79 DW |
135 | } |
136 | ||
137 | // | |
138 | // Execute a program in an Interactive Shell | |
139 | // | |
e4db172a | 140 | bool wxShell( const wxString& rCommand ) |
0e320a79 | 141 | { |
e4db172a WS |
142 | wxChar* zShell = _T("CMD.EXE"); |
143 | wxString sInputs; | |
144 | STARTDATA SData = {0}; | |
145 | PSZ PgmTitle = "Command Shell"; | |
146 | APIRET rc; | |
147 | PID vPid = 0; | |
148 | ULONG ulSessID = 0; | |
149 | UCHAR achObjBuf[256] = {0}; //error data if DosStart fails | |
150 | RESULTCODES vResult; | |
c5fb56c0 DW |
151 | |
152 | SData.Length = sizeof(STARTDATA); | |
153 | SData.Related = SSF_RELATED_INDEPENDENT; | |
154 | SData.FgBg = SSF_FGBG_FORE; | |
155 | SData.TraceOpt = SSF_TRACEOPT_NONE; | |
156 | SData.PgmTitle = PgmTitle; | |
0fba44b4 | 157 | SData.PgmName = (char*)zShell; |
c5fb56c0 | 158 | |
0fba44b4 | 159 | sInputs = _T("/C ") + rCommand; |
404aba09 | 160 | SData.PgmInputs = (BYTE*)sInputs.wx_str(); |
c5fb56c0 DW |
161 | SData.TermQ = 0; |
162 | SData.Environment = 0; | |
163 | SData.InheritOpt = SSF_INHERTOPT_SHELL; | |
164 | SData.SessionType = SSF_TYPE_WINDOWABLEVIO; | |
165 | SData.IconFile = 0; | |
166 | SData.PgmHandle = 0; | |
167 | SData.PgmControl = SSF_CONTROL_VISIBLE | SSF_CONTROL_MAXIMIZE; | |
168 | SData.InitXPos = 30; | |
169 | SData.InitYPos = 40; | |
170 | SData.InitXSize = 200; | |
171 | SData.InitYSize = 140; | |
172 | SData.Reserved = 0; | |
173 | SData.ObjectBuffer = (char*)achObjBuf; | |
174 | SData.ObjectBuffLen = (ULONG)sizeof(achObjBuf); | |
175 | ||
176 | rc = ::DosStartSession(&SData, &ulSessID, &vPid); | |
9ac6ff7b | 177 | if (rc == 0 || rc == 457) // NO_ERROR or SMG_START_IN_BACKGROUND |
c5fb56c0 DW |
178 | { |
179 | PTIB ptib; | |
180 | PPIB ppib; | |
10e5b930 | 181 | |
c5fb56c0 | 182 | ::DosGetInfoBlocks(&ptib, &ppib); |
10e5b930 | 183 | |
c5fb56c0 DW |
184 | ::DosWaitChild( DCWA_PROCESS |
185 | ,DCWW_WAIT | |
186 | ,&vResult | |
187 | ,&ppib->pib_ulpid | |
188 | ,vPid | |
189 | ); | |
190 | } | |
191 | return (rc != 0); | |
0e320a79 DW |
192 | } |
193 | ||
a23692f0 | 194 | // Shutdown or reboot the PC |
6670f564 | 195 | bool wxShutdown(wxShutdownFlags WXUNUSED(wFlags)) |
f6ba47d9 VZ |
196 | { |
197 | // TODO | |
9d8aca48 | 198 | return false; |
f6ba47d9 VZ |
199 | } |
200 | ||
0e320a79 | 201 | // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) |
9d8aca48 | 202 | wxMemorySize wxGetFreeMemory() |
0e320a79 | 203 | { |
5a23a495 WS |
204 | void* pMemptr = NULL; |
205 | LONG lSize; | |
206 | ULONG lMemFlags; | |
207 | APIRET rc; | |
78d50441 DW |
208 | |
209 | lMemFlags = PAG_FREE; | |
0d598bae | 210 | rc = ::DosQueryMem(pMemptr, (PULONG)&lSize, &lMemFlags); |
78d50441 | 211 | if (rc != 0) |
9d8aca48 WS |
212 | lSize = -1L; |
213 | return (wxMemorySize)lSize; | |
45fcbf3b DW |
214 | } |
215 | ||
264f00e7 SN |
216 | // Get Process ID |
217 | unsigned long wxGetProcessId() | |
218 | { | |
219 | return (unsigned long)getpid(); | |
220 | } | |
221 | ||
8269a903 SN |
222 | // ---------------------------------------------------------------------------- |
223 | // env vars | |
224 | // ---------------------------------------------------------------------------- | |
225 | ||
226 | bool wxGetEnv(const wxString& var, wxString *value) | |
227 | { | |
228 | // wxGetenv is defined as getenv() | |
229 | wxChar *p = wxGetenv(var); | |
230 | if ( !p ) | |
9d8aca48 | 231 | return false; |
8269a903 SN |
232 | |
233 | if ( value ) | |
234 | { | |
235 | *value = p; | |
236 | } | |
237 | ||
9d8aca48 | 238 | return true; |
8269a903 SN |
239 | } |
240 | ||
90a77e64 | 241 | bool wxSetEnv(const wxString& variable, const char *value) |
8269a903 SN |
242 | { |
243 | #if defined(HAVE_SETENV) | |
90a77e64 | 244 | return setenv(variable.mb_str(), value, 1 /* overwrite */) == 0; |
8269a903 SN |
245 | #elif defined(HAVE_PUTENV) |
246 | wxString s = variable; | |
247 | if ( value ) | |
248 | s << _T('=') << value; | |
249 | ||
250 | // transform to ANSI | |
251 | const char *p = s.mb_str(); | |
252 | ||
253 | // the string will be free()d by libc | |
254 | char *buf = (char *)malloc(strlen(p) + 1); | |
255 | strcpy(buf, p); | |
256 | ||
257 | return putenv(buf) == 0; | |
258 | #else // no way to set an env var | |
6670f564 WS |
259 | wxUnusedVar(variable); |
260 | wxUnusedVar(value); | |
9d8aca48 | 261 | return false; |
8269a903 SN |
262 | #endif |
263 | } | |
264 | ||
90a77e64 VS |
265 | bool wxSetEnv(const wxString& variable, const wxString& value) |
266 | { | |
267 | return wxDoSetEnv(variable, value.mb_str()); | |
268 | } | |
269 | ||
270 | bool wxUnsetEnv(const wxString& variable) | |
271 | { | |
272 | return wxDoSetEnv(variable, NULL); | |
273 | } | |
274 | ||
d3a919bd | 275 | void wxMilliSleep( |
10e5b930 DW |
276 | unsigned long ulMilliseconds |
277 | ) | |
45fcbf3b | 278 | { |
f53a0d32 | 279 | ::DosSleep(ulMilliseconds); |
0e320a79 DW |
280 | } |
281 | ||
d3a919bd SN |
282 | void wxMicroSleep( |
283 | unsigned long ulMicroseconds | |
284 | ) | |
285 | { | |
286 | ::DosSleep(ulMicroseconds/1000); | |
287 | } | |
288 | ||
10e5b930 DW |
289 | void wxSleep( |
290 | int nSecs | |
291 | ) | |
0e320a79 | 292 | { |
10e5b930 | 293 | ::DosSleep(1000 * nSecs); |
0e320a79 DW |
294 | } |
295 | ||
296 | // Consume all events until no more left | |
297 | void wxFlushEvents() | |
298 | { | |
45fcbf3b | 299 | // wxYield(); |
0e320a79 DW |
300 | } |
301 | ||
0e320a79 DW |
302 | // Emit a beeeeeep |
303 | void wxBell() | |
304 | { | |
45fcbf3b | 305 | DosBeep(1000,1000); // 1kHz during 1 sec. |
0e320a79 | 306 | } |
621ccd8a | 307 | |
5a23a495 WS |
308 | wxString wxGetOsDescription() |
309 | { | |
310 | wxString strVer(_T("OS/2")); | |
930a9efa | 311 | ULONG ulSysInfo = 0; |
5a23a495 | 312 | |
930a9efa SN |
313 | if (::DosQuerySysInfo( QSV_VERSION_MINOR, |
314 | QSV_VERSION_MINOR, | |
315 | (PVOID)&ulSysInfo, | |
316 | sizeof(ULONG) | |
5a23a495 WS |
317 | ) == 0L ) |
318 | { | |
319 | wxString ver; | |
930a9efa SN |
320 | ver.Printf( _T(" ver. %d.%d"), |
321 | int(ulSysInfo / 10), | |
322 | int(ulSysInfo % 10) | |
5a23a495 WS |
323 | ); |
324 | strVer += ver; | |
325 | } | |
326 | ||
327 | return strVer; | |
328 | } | |
8329e6c7 | 329 | |
4cc49137 SN |
330 | bool wxIsPlatform64Bit() |
331 | { | |
332 | // FIXME: No idea how to test for 64 bit processor | |
333 | // (Probably irrelevant anyhow, though). | |
334 | return false; | |
335 | } | |
336 | ||
6670f564 | 337 | void wxAppTraits::InitializeGui(unsigned long &WXUNUSED(ulHab)) |
8329e6c7 SN |
338 | { |
339 | } | |
340 | ||
6670f564 | 341 | void wxAppTraits::TerminateGui(unsigned long WXUNUSED(ulHab)) |
8329e6c7 SN |
342 | { |
343 | } | |
344 | ||
8bb6b2c0 | 345 | wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin) |
10e5b930 | 346 | { |
930a9efa | 347 | ULONG ulSysInfo = 0; |
9d8aca48 | 348 | APIRET ulrc; |
5d4b632b | 349 | |
930a9efa SN |
350 | ulrc = ::DosQuerySysInfo( QSV_VERSION_MINOR, |
351 | QSV_VERSION_MINOR, | |
352 | (PVOID)&ulSysInfo, | |
353 | sizeof(ULONG) | |
5d4b632b | 354 | ); |
8bb6b2c0 | 355 | |
5d4b632b | 356 | if (ulrc == 0L) |
10e5b930 | 357 | { |
8bb6b2c0 | 358 | if ( verMaj ) |
930a9efa | 359 | *verMaj = ulSysInfo / 10; |
8bb6b2c0 | 360 | if ( verMin ) |
930a9efa | 361 | *verMin = ulSysInfo % 10; |
10e5b930 | 362 | } |
8bb6b2c0 VZ |
363 | |
364 | return wxOS_OS2; | |
0e320a79 | 365 | } |
621ccd8a | 366 | |
8bb6b2c0 | 367 | |
45fcbf3b | 368 | // --------------------------------------------------------------------------- |
1be7f92a DW |
369 | const wxChar* wxGetHomeDir( |
370 | wxString* pStr | |
371 | ) | |
45fcbf3b | 372 | { |
1be7f92a | 373 | wxString& rStrDir = *pStr; |
0e320a79 | 374 | |
1be7f92a | 375 | // OS/2 has no idea about home, |
b08c90ca SN |
376 | // so use the working directory instead. |
377 | // However, we might have a valid HOME directory, | |
378 | // as is used on many machines that have unix utilities | |
379 | // on them, so we should use that, if available. | |
45fcbf3b | 380 | |
1be7f92a | 381 | // 256 was taken from os2def.h |
45fcbf3b DW |
382 | #ifndef MAX_PATH |
383 | # define MAX_PATH 256 | |
384 | #endif | |
385 | ||
0fba44b4 | 386 | const wxChar *szHome = wxGetenv((wxChar*)"HOME"); |
b08c90ca SN |
387 | if ( szHome == NULL ) { |
388 | // we're homeless, use current directory. | |
389 | rStrDir = wxT("."); | |
390 | } | |
391 | else | |
392 | rStrDir = szHome; | |
45fcbf3b | 393 | |
1be7f92a | 394 | return rStrDir.c_str(); |
45fcbf3b DW |
395 | } |
396 | ||
10e5b930 | 397 | // Hack for OS/2 |
2173b18f SN |
398 | #if wxUSE_UNICODE |
399 | const wxMB2WXbuf wxGetUserHome( const wxString &rUser ) | |
400 | #else // just for binary compatibility -- there is no 'const' here | |
401 | wxChar* wxGetUserHome ( const wxString &rUser ) | |
402 | #endif | |
1be7f92a | 403 | { |
5a23a495 WS |
404 | wxChar* zHome; |
405 | wxString sUser1(rUser); | |
1be7f92a | 406 | |
0fba44b4 | 407 | wxChar *wxBuffer = new wxChar[256]; |
06298235 | 408 | #ifndef __EMX__ |
27b2dd53 | 409 | if (!sUser1.empty()) |
45fcbf3b | 410 | { |
1be7f92a DW |
411 | wxChar zTmp[64]; |
412 | ||
413 | if (wxGetUserId( zTmp | |
414 | ,sizeof(zTmp)/sizeof(char) | |
415 | )) | |
416 | { | |
417 | // Guests belong in the temp dir | |
418 | if (wxStricmp(zTmp, _T("annonymous")) == 0) | |
419 | { | |
420 | if ((zHome = wxGetenv(_T("TMP"))) != NULL || | |
421 | (zHome = wxGetenv(_T("TMPDIR"))) != NULL || | |
422 | (zHome = wxGetenv(_T("TEMP"))) != NULL) | |
13a4ea8d | 423 | delete[] wxBuffer; |
1be7f92a DW |
424 | return *zHome ? zHome : (wxChar*)_T("\\"); |
425 | } | |
426 | if (wxStricmp(zTmp, WXSTRINGCAST sUser1) == 0) | |
5a23a495 | 427 | sUser1 = wxEmptyString; |
1be7f92a | 428 | } |
45fcbf3b | 429 | } |
06298235 | 430 | #endif |
27b2dd53 | 431 | if (sUser1.empty()) |
13a4ea8d | 432 | { |
1be7f92a DW |
433 | if ((zHome = wxGetenv(_T("HOME"))) != NULL) |
434 | { | |
435 | wxStrcpy(wxBuffer, zHome); | |
2b5f62a0 | 436 | wxUnix2DosFilename(wxBuffer); |
2173b18f | 437 | #if wxUSE_UNICODE |
6670f564 | 438 | wxWCharBuffer retBuffer (wxBuffer); |
2173b18f SN |
439 | delete[] wxBuffer; |
440 | return retBuffer; | |
6670f564 | 441 | #else |
13a4ea8d DW |
442 | wxStrcpy(zHome, wxBuffer); |
443 | delete[] wxBuffer; | |
444 | return zHome; | |
2173b18f | 445 | #endif |
1be7f92a | 446 | } |
13a4ea8d DW |
447 | } |
448 | delete[] wxBuffer; | |
0fba44b4 | 449 | return (wxChar*)wxEmptyString; // No home known! |
0e320a79 DW |
450 | } |
451 | ||
783388d5 SN |
452 | bool wxGetDiskSpace(const wxString& path, |
453 | wxDiskspaceSize_t *pTotal, | |
454 | wxDiskspaceSize_t *pFree) | |
455 | { | |
456 | if (path.empty()) | |
457 | return false; | |
458 | ||
459 | wxFileName fn(path); | |
460 | FSALLOCATE fsaBuf = {0}; | |
461 | APIRET rc = NO_ERROR; | |
462 | ULONG disknum = 0; | |
463 | ||
464 | fn.MakeAbsolute(); | |
465 | ||
466 | if (wxDirExists(fn.GetFullPath()) == false) | |
467 | return false; | |
468 | ||
469 | disknum = 1 + wxToupper(fn.GetVolume().GetChar(0)) - _T('A'); | |
470 | ||
471 | rc = ::DosQueryFSInfo(disknum, // 1 = A, 2 = B, 3 = C, ... | |
472 | FSIL_ALLOC, // allocation info | |
473 | (PVOID)&fsaBuf, | |
474 | sizeof(FSALLOCATE)); | |
475 | ||
476 | if (rc != NO_ERROR) | |
477 | return false; | |
478 | else | |
479 | { | |
480 | if(pTotal) | |
481 | { | |
482 | // to try to avoid 32-bit overflow, let's not multiply right away | |
483 | // (num of alloc units) | |
484 | *pTotal = fsaBuf.cUnit; | |
485 | // * (num of sectors per alloc unit) * (num of bytes per sector) | |
486 | (*pTotal) *= fsaBuf.cSectorUnit * fsaBuf.cbSector; | |
487 | } | |
488 | if(pFree) | |
489 | { | |
490 | *pFree = fsaBuf.cUnitAvail; | |
491 | (*pFree) *= fsaBuf.cSectorUnit * fsaBuf.cbSector; | |
492 | } | |
493 | return true; | |
494 | } | |
495 | } | |
496 | ||
0e2a14e5 | 497 | wxString wxPMErrorToStr(ERRORID vError) |
914589c2 | 498 | { |
0e2a14e5 | 499 | wxString sError; |
914589c2 DW |
500 | |
501 | // | |
502 | // Remove the high order byte -- it is useless | |
503 | // | |
504 | vError &= 0x0000ffff; | |
505 | switch(vError) | |
506 | { | |
507 | case PMERR_INVALID_HWND: | |
508 | sError = wxT("Invalid window handle specified"); | |
509 | break; | |
510 | ||
511 | case PMERR_INVALID_FLAG: | |
512 | sError = wxT("Invalid flag bit set"); | |
513 | break; | |
514 | ||
515 | case PMERR_NO_MSG_QUEUE: | |
516 | sError = wxT("No message queue available"); | |
517 | break; | |
518 | ||
519 | case PMERR_INVALID_PARM: | |
520 | sError = wxT("Parameter contained invalid data"); | |
521 | break; | |
522 | ||
523 | case PMERR_INVALID_PARAMETERS: | |
524 | sError = wxT("Parameter value is out of range"); | |
525 | break; | |
526 | ||
527 | case PMERR_PARAMETER_OUT_OF_RANGE: | |
528 | sError = wxT("Parameter value is out of range"); | |
529 | break; | |
530 | ||
531 | case PMERR_INVALID_INTEGER_ATOM: | |
532 | sError = wxT("Not a valid atom"); | |
533 | break; | |
534 | ||
535 | case PMERR_INVALID_HATOMTBL: | |
536 | sError = wxT("Atom table handle is invalid"); | |
537 | break; | |
538 | ||
539 | case PMERR_INVALID_ATOM_NAME: | |
540 | sError = wxT("Not a valid atom name"); | |
541 | break; | |
542 | ||
543 | case PMERR_ATOM_NAME_NOT_FOUND: | |
544 | sError = wxT("Valid name format, but cannot find name in atom table"); | |
545 | break; | |
546 | ||
da51aebe SN |
547 | case PMERR_INV_HPS: |
548 | sError = wxT("PMERR_INV_HPS"); | |
549 | break; | |
550 | ||
551 | case PMERR_PS_BUSY: | |
552 | sError = wxT("PMERR_PS_BUSY"); | |
553 | break; | |
554 | ||
555 | case PMERR_INV_PRIMITIVE_TYPE: | |
556 | sError = wxT("PMERR_INV_PRIMITIVE_TYPE"); | |
557 | break; | |
558 | ||
559 | case PMERR_UNSUPPORTED_ATTR: | |
560 | sError = wxT("PMERR_UNSUPPORTED_ATTR"); | |
561 | break; | |
562 | ||
563 | case PMERR_INV_COLOR_ATTR: | |
564 | sError = wxT("PMERR_INV_COLOR_ATTR"); | |
565 | break; | |
566 | ||
567 | case PMERR_INV_BACKGROUND_COL_ATTR: | |
568 | sError = wxT("PMERR_INV_BACKGROUND_COL_ATTR"); | |
569 | break; | |
570 | ||
571 | case PMERR_INV_MIX_ATTR: | |
572 | sError = wxT("PMERR_INV_MIX_ATTR"); | |
573 | break; | |
574 | ||
575 | case PMERR_INV_LINE_WIDTH_ATTR: | |
576 | sError = wxT("PMERR_INV_LINE_WIDTH_ATTR"); | |
577 | break; | |
578 | ||
579 | case PMERR_INV_GEOM_LINE_WIDTH_ATTR: | |
580 | sError = wxT("PMERR_INV_GEOM_LINE_WIDTH_ATTR"); | |
581 | break; | |
582 | ||
583 | case PMERR_INV_LINE_TYPE_ATTR: | |
584 | sError = wxT("PMERR_INV_LINE_TYPE_ATTR"); | |
585 | break; | |
586 | ||
587 | case PMERR_INV_LINE_END_ATTR: | |
588 | sError = wxT("PMERR_INV_LINE_END_ATTR"); | |
589 | break; | |
590 | ||
591 | case PMERR_INV_LINE_JOIN_ATTR: | |
592 | sError = wxT("PMERR_INV_LINE_JOIN_ATTR"); | |
593 | break; | |
594 | ||
595 | case PMERR_INV_CHAR_SET_ATTR: | |
596 | sError = wxT("PMERR_INV_CHAR_SET_ATTR"); | |
597 | break; | |
598 | ||
599 | case PMERR_INV_CHAR_MODE_ATTR: | |
600 | sError = wxT("PMERR_INV_CHAR_MODE_ATTR"); | |
601 | break; | |
602 | ||
603 | case PMERR_INV_CHAR_DIRECTION_ATTR: | |
604 | sError = wxT("PMERR_INV_CHAR_DIRECTION_ATTR"); | |
605 | break; | |
606 | ||
607 | case PMERR_INV_CHAR_SHEAR_ATTR: | |
608 | sError = wxT("PMERR_INV_CHAR_SHEAR_ATTR"); | |
609 | break; | |
610 | ||
611 | case PMERR_INV_CHAR_ANGLE_ATTR: | |
612 | sError = wxT("PMERR_INV_CHAR_ANGLE_ATTR"); | |
613 | break; | |
614 | ||
615 | case PMERR_INV_MARKER_SET_ATTR: | |
616 | sError = wxT("PMERR_INV_MARKER_SET_ATTR"); | |
617 | break; | |
618 | ||
619 | case PMERR_INV_MARKER_SYMBOL_ATTR: | |
620 | sError = wxT("PMERR_INV_MARKER_SYMBOL_ATTR"); | |
621 | break; | |
622 | ||
623 | case PMERR_INV_PATTERN_SET_ATTR: | |
624 | sError = wxT("PMERR_INV_PATTERN_SET_ATTR"); | |
625 | break; | |
626 | ||
627 | case PMERR_INV_PATTERN_ATTR: | |
628 | sError = wxT("PMERR_INV_PATTERN_ATTR"); | |
629 | break; | |
630 | ||
631 | case PMERR_INV_COORDINATE: | |
632 | sError = wxT("PMERR_INV_COORDINATE"); | |
633 | break; | |
634 | ||
635 | case PMERR_UNSUPPORTED_ATTR_VALUE: | |
636 | sError = wxT("PMERR_UNSUPPORTED_ATTR_VALUE"); | |
637 | break; | |
638 | ||
639 | case PMERR_INV_PATTERN_SET_FONT: | |
640 | sError = wxT("PMERR_INV_PATTERN_SET_FONT"); | |
641 | break; | |
642 | ||
643 | case PMERR_HUGE_FONTS_NOT_SUPPORTED: | |
644 | sError = wxT("PMERR_HUGE_FONTS_NOT_SUPPORTED"); | |
645 | break; | |
646 | ||
914589c2 DW |
647 | default: |
648 | sError = wxT("Unknown error"); | |
649 | } | |
0e2a14e5 | 650 | return sError; |
914589c2 | 651 | } // end of wxPMErrorToStr |
621ccd8a SN |
652 | |
653 | // replacement for implementation in unix/utilsunx.cpp, | |
654 | // to be used by all X11 based ports. | |
655 | struct wxEndProcessData; | |
656 | ||
6670f564 | 657 | void wxHandleProcessTermination(wxEndProcessData *WXUNUSED(proc_data)) |
621ccd8a SN |
658 | { |
659 | // For now, just do nothing. To be filled in as needed. | |
660 | } |