Rev 536 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
259 | daniel-mar | 1 | /* |
268 | daniel-mar | 2 | This file is part of a common library for Adobe(R) plugins |
536 | daniel-mar | 3 | Copyright (C) 2002-2006 Toby Thain, toby@telegraphics.net |
259 | daniel-mar | 4 | |
5 | This program is free software; you can redistribute it and/or modify |
||
6 | it under the terms of the GNU General Public License as published by |
||
7 | the Free Software Foundation; either version 2 of the License, or |
||
8 | (at your option) any later version. |
||
9 | |||
10 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | GNU General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU General Public License |
||
16 | along with this program; if not, write to the Free Software |
||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
18 | */ |
||
19 | |||
20 | /* Build environment for cross-platform plugin */ |
||
21 | |||
22 | #ifndef WORLD_H_ |
||
23 | #define WORLD_H_ |
||
24 | |||
25 | #include <string.h> |
||
26 | #include <stdlib.h> |
||
27 | //#include <stddef.h> |
||
28 | #include <stdio.h> |
||
29 | |||
30 | #if defined(__GNUC__) |
||
31 | // probably OS X or MinGW gcc |
||
32 | #include <stdint.h> // for intptr_t req'd by CS4 SDK |
||
33 | #elif defined(powerc) || defined(__SC__) |
||
34 | // Mac PPC and 68K have 32 bit pointers |
||
35 | typedef long intptr_t; |
||
36 | #endif |
||
37 | |||
559 | daniel-mar | 38 | #ifndef WIN_ENV |
39 | #ifdef UNICODE |
||
40 | typedef wchar_t TCHAR; |
||
41 | #else |
||
42 | typedef char TCHAR; |
||
43 | #endif |
||
44 | #endif |
||
45 | |||
46 | #ifndef WIN_ENV |
||
47 | // ??? |
||
48 | #define MAX_PATH 255 |
||
49 | #endif |
||
50 | |||
259 | daniel-mar | 51 | #include "dbg.h" |
52 | #include "str.h" |
||
53 | |||
54 | #ifdef macintosh |
||
55 | #include "carbonstuff.h" |
||
56 | |||
57 | #include <quickdraw.h> |
||
58 | #include <events.h> |
||
59 | |||
60 | #define TICKCOUNT TickCount |
||
61 | #define TICKS_SEC 60 |
||
62 | |||
63 | #if defined(powerc) || defined(__GNUC__) |
||
64 | #define EnterCodeResource() |
||
65 | #define ExitCodeResource() |
||
66 | #define ENTERCALLBACK() |
||
67 | #define EXITCALLBACK() |
||
68 | #else |
||
69 | #ifdef __SC__ |
||
70 | // Symantec C (MPW compiler) - does not support A4 globals |
||
71 | |||
72 | #define EnterCodeResource() |
||
73 | #define ExitCodeResource() |
||
74 | #define ENTERCALLBACK() |
||
75 | #define EXITCALLBACK() |
||
76 | |||
77 | // avoid some standard library routines (can't have global data) |
||
78 | #include "sprintf_tiny.h" |
||
79 | #define sprintf sprintf_tiny |
||
80 | |||
81 | #define memset my_memset |
||
82 | |||
83 | #include <macmemory.h> |
||
84 | #define malloc (void*)NewPtr |
||
85 | #define free(p) DisposePtr((void*)(p)) |
||
86 | #else |
||
87 | // CodeWarrior supports A4-based globals |
||
88 | |||
89 | #include <a4stuff.h> |
||
90 | |||
91 | #define ENTERCALLBACK() long old_a4 = SetCurrentA4() |
||
92 | #define EXITCALLBACK() SetA4(old_a4) |
||
93 | #endif |
||
94 | #endif |
||
95 | |||
96 | #define DIRSEP ':' |
||
97 | |||
98 | typedef Handle HMODULE; |
||
99 | #else |
||
100 | // Win32 target |
||
101 | #include <windows.h> |
||
102 | |||
103 | #include "compat_win.h" |
||
104 | |||
105 | #define TICKCOUNT _GetTickCount64 |
||
106 | #define TICKS_SEC 1000 |
||
107 | |||
108 | #define EnterCodeResource() |
||
109 | #define ExitCodeResource() |
||
110 | |||
111 | #define DIRSEP '\\' |
||
112 | |||
113 | extern HINSTANCE hDllInstance; |
||
114 | #endif |
||
115 | |||
116 | #define SETRECT(rect,l,t,r,b) \ |
||
117 | ((rect).left=(l),(rect).top=(t),(rect).right=(r),(rect).bottom=(b)) |
||
118 | #define OFFSETRECT(rect,h,v) \ |
||
119 | ( (rect).left+=(h),(rect).right+=(h),(rect).top+=(v),(rect).bottom+=(v) ) |
||
120 | |||
121 | #ifdef __GNUC__ |
||
122 | #define ATTRIBUTE_PACKED __attribute__ (( packed )) |
||
123 | #else |
||
124 | #define ATTRIBUTE_PACKED |
||
434 | daniel-mar | 125 | #endif /* __GNUC__ */ |
259 | daniel-mar | 126 | |
536 | daniel-mar | 127 | #ifdef __WATCOMC__ |
434 | daniel-mar | 128 | #define strcasecmp _stricmp |
129 | #endif /* __WATCOMC__ */ |
||
130 | |||
371 | daniel-mar | 131 | #ifdef _MSC_VER |
132 | #define strcasecmp _stricmp |
||
133 | #define snprintf _snprintf |
||
134 | #endif /* _MSC_VER */ |
||
135 | |||
259 | daniel-mar | 136 | #endif |