3 Copyright (c) 1998-2000 by Florian Klaempfl
5 Handles the resource files handling
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 ****************************************************************************
28 presourcefile
=^tresourcefile
;
33 constructor Init(const fn
:string);
35 procedure Compile
;virtual;
38 procedure CompileResourceFiles
;
49 Systems
,Globtype
,Globals
,Verbose
,Files
,
52 {****************************************************************************
54 ****************************************************************************}
56 constructor tresourcefile
.init(const fn
:string);
62 destructor tresourcefile
.done
;
67 procedure tresourcefile
.compile
;
78 if utilsdirectory
<>'' then
79 resbin
:=FindFile(target_res
.resbin
+source_os
.exeext
,utilsdirectory
,resfound
)+target_res
.resbin
+source_os
.exeext
;
81 resbin
:=FindExe(target_res
.resbin
,resfound
);
82 { get also the path to be searched for the windres.h }
83 fsplit(resbin
,respath
,n
,e
);
84 if (not resfound
) and not(cs_link_extern
in aktglobalswitches
) then
86 Message(exec_w_res_not_found
);
87 aktglobalswitches
:=aktglobalswitches
+[cs_link_extern
];
89 resobj
:=ForceExtension(current_module
^.objfilename
^,target_info
.resobjext
);
91 Replace(s
,'$OBJ',resobj
);
92 Replace(s
,'$RES',fname
);
93 Replace(s
,'$INC',respath
);
95 if not (cs_link_extern
in aktglobalswitches
) then
97 Message1(exec_i_compilingresource
,fname
);
101 if (doserror
<>0) then
103 Message(exec_w_cant_call_linker
);
104 aktglobalswitches
:=aktglobalswitches
+[cs_link_extern
];
107 if (dosexitcode
<>0) then
109 Message(exec_w_error_while_linking
);
110 aktglobalswitches
:=aktglobalswitches
+[cs_link_extern
];
113 { Update asmres when externmode is set }
114 if cs_link_extern in aktglobalswitches then
115 AsmRes.AddLinkCommand(resbin,s,'');
116 current_module^.linkotherofiles.insert(resobj,link_allways);
120 procedure CompileResourceFiles;
124 (* OS/2 (EMX) must be processed elsewhere (in the linking/binding stage). *)
125 if target_info.target <> target_i386_os2 then
126 While not Current_module^.ResourceFiles.Empty do
128 case target_info.target of
130 hr:=new(presourcefile,init(Current_module^.ResourceFiles.get));
132 Message(scan_e_resourcefiles_not_supported);
143 Revision 1.1 2002/02/19 08:21:58 sasu
146 Revision 1.1.2.2 2000/08/02 19:37:01 peter
147 * fixed resbin and respath generation, previous patch was also wrong
149 Revision 1.1.2.1 2000/07/31 20:05:33 peter
150 * fixed windres.exewindres.exe filename generation, from mailinglist
152 Revision 1.1 2000/07/13 06:29:48 michael
155 Revision 1.12 2000/06/25 19:08:28 hajny
156 + $R support for OS/2 (EMX) added
158 Revision 1.11 2000/06/23 20:11:05 peter
159 * made resourcecompiling object so it can be inherited and replaced
160 for other targets if needed
162 Revision 1.10 2000/02/09 13:22:50 peter
165 Revision 1.9 2000/01/07 01:14:23 peter
166 * updated copyright to 2000
168 Revision 1.8 1999/12/01 12:42:32 peter
170 * removed some notes about unused vars
172 Revision 1.7 1999/11/12 11:03:50 peter
173 * searchpaths changed to stringqueue object