Rev 404 | Rev 440 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 404 | Rev 437 | ||
---|---|---|---|
1 | 1 | ||
2 | Building FilterFoundry with OpenWatcom |
2 | Building FilterFoundry with OpenWatcom |
3 | ====================================== |
3 | ====================================== |
4 | 4 | ||
5 | Most recently tested with OpenWatcom 1.9 and Adobe Photoshop SDK 2021. |
5 | Tested with OpenWatcom 1.9 and OpenWatcom 2.0 together with Adobe Photoshop SDK 2021. |
6 | 6 | ||
7 | 7 | ||
8 | Prerequisites |
8 | Prerequisites |
9 | ------------- |
9 | ------------- |
10 | 10 | ||
11 | 1) Flex and Bison |
11 | 1) Flex and Bison |
12 | Available here: |
12 | Available here: |
13 | https://sourceforge.net/projects/winflexbison/ |
13 | https://sourceforge.net/projects/winflexbison/ |
14 | 14 | ||
15 | 2) Adobe Photoshop SDK |
15 | 2) Adobe Photoshop SDK |
16 | Available on some Photoshop CDs, or can be downloaded at |
16 | Available on some Photoshop CDs, or can be downloaded at |
17 | https://www.adobe.com/devnet/photoshop/sdk.html |
17 | https://www.adobe.com/devnet/photoshop/sdk.html |
18 | 18 | ||
19 | 3) Watcom 1.6beta RC1 or later |
19 | 3) Watcom 1.6beta RC1 or later |
20 | Available here: |
20 | Available here: |
21 | http://www.openwatcom.org/ |
21 | http://www.openwatcom.org/ |
22 | After installing, do a reboot, or set the environment manually. |
22 | After installing, do a reboot, or set the environment manually. |
23 | 23 | ||
24 | 24 | ||
25 | Build setup |
25 | Build setup |
26 | ----------- |
26 | ----------- |
27 | 27 | ||
28 | There is no special build setup required. |
28 | There is no special build setup required. |
29 | Just open wpj\filterfoundry.wpj in Watcom's IDE and click "Make target". |
29 | Just open **wpj\filterfoundry.wpj** in Watcom's IDE and click "Make target". |
- | 30 | ||
- | 31 | Alternatively, run **wpj\make_watcom.bat** which should do the same. |
|
30 | 32 | ||
31 | IMPORTANT: Your path must not contain whitespaces! |
33 | IMPORTANT: Your path must not contain whitespaces! |
32 | For example, you must not use "C:\Users\John Doe\SVN\Filter Foundry\". |
34 | For example, you must not use "C:\Users\John Doe\SVN\Filter Foundry\". |
33 | 35 | ||
34 | 36 | ||
35 | Troubleshooting |
37 | Troubleshooting |
36 | --------------- |
38 | --------------- |
37 | 39 | ||
38 | - Please make sure that you must not have whitespaces in the pathname. |
40 | - Please make sure that you must not have whitespaces in the pathname. |
39 | 41 | ||
40 | - Missing **sdkddkver.h**: |
42 | - Missing **sdkddkver.h**: |
41 | * In OpenWatcom 1.9: |
43 | * In OpenWatcom 1.9: |
42 | If you get the error message "Fatal Error! 62: Unable to open 'sdkddkver.h'", please open |
44 | If you get the error message "Fatal Error! 62: Unable to open 'sdkddkver.h'", please open |
43 | pluginsdk\photoshopapi\photoshop\PITypes.h in your Adobe Photoshop SDK and |
45 | pluginsdk\photoshopapi\photoshop\PITypes.h in your Adobe Photoshop SDK and |
44 | comment out the line "#include <sdkddkver.h> // for WINVER". |
46 | comment out the line "#include <sdkddkver.h> // for WINVER". |
45 | Alternatively, you can create an empty sdkddkver.h file in your wpj folder. |
47 | Alternatively, you can create an empty sdkddkver.h file in your wpj folder. |
46 | * In Open Watcom 2.0: |
48 | * In Open Watcom 2.0: |
47 | The error message has the error code E062. |
49 | The error message has the error code E062. |
48 | Creating an empty sdkddkver.h does not work anymore. |
50 | Creating an empty sdkddkver.h does not work anymore. |
49 | You need to comment out the line in PITypes.h. |
51 | You need to comment out the line in PITypes.h. |
- | 52 | (Bug will be fixed: https://github.com/open-watcom/open-watcom-v2/issues/770 ) |
|
50 | 53 | ||
51 | - It is important that the correct calling convention is used. |
54 | - It is important that the correct calling convention is used. |
52 | The calling convention needs to be set in |
55 | The calling convention needs to be set in |
53 | Options -> C Compiler Switches -> Memory Model and Processor Switches. |
56 | Options -> C Compiler Switches -> Memory Model and Processor Switches. |
54 | There, select "Pentium Pro stack-based calling" (default is "Pentium Pro register based calling"). |
57 | There, select "Pentium Pro stack-based calling" (default is "Pentium Pro register based calling"). |
55 | The wpj project should already have this setting applied. |
58 | The wpj project should already have this setting applied. |
56 | 59 | ||
57 | - If you receive the error message "lex.yy.c(580): Error! E1009: Expecting ';' but found '1'", |
60 | - If you receive the error message "lex.yy.c(580): Error! E1009: Expecting ';' but found '1'", |
58 | check if the compiler directive "YY_SKIP_YYWRAP" is set. |
61 | check if the compiler directive "YY_SKIP_YYWRAP" is set. |
59 | Go to Options -> C Compiler Switches -> Source switches, and add YY_SKIP_YYWRAP=1 . |
62 | Go to Options -> C Compiler Switches -> Source switches, and add YY_SKIP_YYWRAP=1 . |
60 | The wpj project should already have this setting applied. |
63 | The wpj project should already have this setting applied. |
61 | 64 | ||
62 | - The path to the Photoshop SDK and to Win Flex/Bison (PreBuild event) |
65 | - The path to the Photoshop SDK and to Win Flex/Bison (PreBuild event) |
63 | is already set in the project file. Please note that changing these |
66 | is already set in the project file. Please note that changing these |
64 | paths is a bit complicated. There are several bugs in OpenWatcom |
67 | paths is a bit complicated. There are several bugs in older versions of OpenWatcom |
65 | where you can only make the pre-build-events shorter, but not longer). |
68 | where you can only make the pre-build-events shorter, but not longer). |
66 | You have to edit the WPJ file with a text editor. |
69 | You have to edit the WPJ file with a text editor. |
67 | Remember how many characters you have added or deleted, |
70 | Remember how many characters you have added or deleted, |
68 | and subtract or add them to the number written above the before-instructions |
71 | and subtract or add them to the number written above the before-instructions. |
69 | (currently 367). This is the number of bytes of the commands. |
72 | This is the number of bytes of the commands. |
70 | 73 | ||
71 | - In the code, it is important that all variables are declared at the |
74 | - In the code, it is important that all variables are declared at the |
72 | top of the scope (curly brackets) and that there is no executable code or |
75 | top of the scope (curly brackets) and that there is no executable code or |
73 | assignments in between. |
76 | assignments in between. |
74 | 77 | ||
- | 78 | Wrong: |
|
- | 79 | ||
- | 80 | int a; |
|
- | 81 | int b = GetXYZ(); |
|
- | 82 | int c; |
|
- | 83 | ||
- | 84 | Correct: |
|
- | 85 | ||
- | 86 | int a; |
|
- | 87 | int b; |
|
- | 88 | int c; |
|
- | 89 | b = GetXYZ(); |
|
- | 90 | ||
75 | 91 | ||
76 | Attention! Some optimizations break the code |
92 | Attention! Some optimizations break the code |
77 | -------------------------------------------- |
93 | -------------------------------------------- |
78 | 94 | ||
79 | Don't choose "Fastest possible code (-otexan)" for optimization! |
95 | Don't choose "Fastest possible code (-otexan)" for optimization! |
80 | 96 | ||
81 | As soon as "Disable stack depth checking" is enabled, the code crashes |
97 | As soon as "Disable stack depth checking" is enabled, the code crashes |
82 | on some combinations of machines and Photoshop versions. |
98 | on some combinations of machines and Photoshop versions. |
83 | 99 | ||
84 | Win98 VM + Photoshop 3.0.x: Clicking any button (Make, Load, Cancel) will cause SegFault. |
100 | Win98 VM + Photoshop 3.0.x: Clicking any button (Make, Load, Cancel) will cause SegFault. |
85 | Win10 PC + Photoshop 3.0.x: No problem. |
101 | Win10 PC + Photoshop 3.0.x: No problem. |
86 | 102 | ||
87 | "otexan" contains "s" (because "ox" is equal to "obmiler" and "s"). |
103 | "otexan" contains "s" (because "ox" is equal to "obmiler" and "s"). |
88 | 104 | ||
89 | So, "-otexan" means: |
105 | So, "-otexan" means: |
90 | 106 | ||
91 | - Branch prediction (-ob) |
107 | - Branch prediction (-ob) |
92 | - Loop optimizations (-ol) |
108 | - Loop optimizations (-ol) |
93 | - In-line intrinsic functions (-oi) |
109 | - In-line intrinsic functions (-oi) |
94 | - Instruction scheduling (-or) |
110 | - Instruction scheduling (-or) |
95 | - Math optimizations (-om) |
111 | - Math optimizations (-om) |
96 | - Expand function in-line (-oe) |
112 | - Expand function in-line (-oe) |
97 | - Disable stack depth checking (-s) |
113 | - Disable stack depth checking (-s) |
98 | 114 | ||
99 | The program works if "-ot" is enabled and all other optimizations (except "s") are enabled. |
115 | The program works if "-ot" is enabled and all other optimizations (except "s") are enabled. |
100 | 116 | ||
101 | However, for now we just use the optimizations which "-otaxan" contains, except "s", |
117 | However, for now we just use the optimizations which "-otaxan" contains, except "s", |
102 | so we enabled: |
118 | so we enabled: |
103 | 119 | ||
104 | - Time optimizations (-ot) |
120 | - Time optimizations (-ot) |
105 | - Branch prediction (-ob) |
121 | - Branch prediction (-ob) |
106 | - Loop optimizations (-ol) |
122 | - Loop optimizations (-ol) |
107 | - In-line intrinsic functions (-oi) |
123 | - In-line intrinsic functions (-oi) |
108 | - Instruction scheduling (-or) |
124 | - Instruction scheduling (-or) |
109 | - Math optimizations (-om) |
125 | - Math optimizations (-om) |
110 | - Expand function in-line (-oe) |
126 | - Expand function in-line (-oe) |
111 | 127 | ||
112 | I haven't been able to detect why/where the stack is overloaded. |
128 | I haven't been able to detect why/where the stack is overloaded. |
113 | If anyone has an idea, please contact me. |
129 | If anyone has an idea, please contact me. |
114 | Maybe the initial stack size is just too small? |
130 | Maybe the initial stack size is just too small? |
115 | Because the code should be OK - Application Verifier has not detected anything wrong. |
131 | Because the code should be OK - Application Verifier has not detected anything wrong. |
116 | 132 | ||
117 | https://open-watcom.github.io/open-watcom-v2-wikidocs/c_readme.html |
133 | https://open-watcom.github.io/open-watcom-v2-wikidocs/c_readme.html |
118 | http://www.azillionmonkeys.com/qed/watfaq.shtml (Q19) |
134 | http://www.azillionmonkeys.com/qed/watfaq.shtml (Q19) |
119 | 135 | ||
120 | 136 | ||
121 | Remarks |
137 | Remarks |
122 | ------- |
138 | ------- |
123 | 139 | ||
124 | flex and bison are currently invoked as a batch process. |
140 | flex and bison are currently invoked as a batch process. |
125 | This is defined in the menu File->Before. |
141 | This is defined in the menu File->Before. |
126 | The IDE fails to build the project when filenames contain more than one dot. |
142 | The IDE fails to build the project when filenames contain more than one dot. |
127 | Therefore the output files of bison and lex are renamed. |
143 | Therefore the output files of bison and lex are renamed. |
128 | There is no error checking done. |
144 | There is no error checking done. |
129 | Probably it would be better to write a small wmake file for this purpose. |
145 | Probably it would be better to write a small wmake file for this purpose. |