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