1998-03-28 05:44:41 +03:00
|
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
|
*
|
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
|
*
|
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
|
* NPL.
|
|
|
|
|
*
|
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
|
* Reserved.
|
|
|
|
|
*/
|
1998-05-28 22:57:55 +04:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
This project is rather, um, creative in the way it works. Here's why.
|
|
|
|
|
|
|
|
|
|
There are two goals here (which should probably be separated out):
|
|
|
|
|
|
|
|
|
|
1. Make a shared library which exports a bunch of symbols which are
|
|
|
|
|
IDs of error strings:
|
|
|
|
|
|
|
|
|
|
MacXPStrings.c is preprocessed and compiled in the normal way
|
|
|
|
|
for a C file, and ends up simple assigning numerical values to
|
|
|
|
|
lots of exported ints, e.g. "int MK_BAD_CONNECT = (-205)". These
|
|
|
|
|
ints are exported by name from the shared library.
|
|
|
|
|
|
|
|
|
|
The dummy function MacintoshForever() is there because there
|
|
|
|
|
is apparently a CFM bug that causes a crash loading shared
|
|
|
|
|
libraries with no exported code symbols.
|
|
|
|
|
|
|
|
|
|
2. Make a file called "Mozilla resources" which contains a bunch
|
|
|
|
|
of 'STR ' resources containing the strings defined in allxpstr.h,
|
|
|
|
|
and some other resources.
|
|
|
|
|
|
|
|
|
|
This is achieved by the .xps file which, if you look at the
|
|
|
|
|
File Mapping prefs, is processed by ToolFrontEnd. The
|
|
|
|
|
ToolFrontEnd prefs panel specifies that the following command:
|
|
|
|
|
|
|
|
|
|
Execute "{{SourceFile}}_Make"
|
|
|
|
|
|
|
|
|
|
is send to ToolServer, so xpstring.xps_Make will get executed.
|
|
|
|
|
xpstring.xps_Make preprocesses this file (xpstrings.xps) with the
|
|
|
|
|
MWCPPC tool, outputting the result to a .r file Temp_XPStrings.r:
|
|
|
|
|
|
|
|
|
|
MWCPPC -nodefaults -i- -e2 -D _XP_Core_ {IncludeFiles} "{{SourceFile}}" <20>
|
|
|
|
|
> "{{ResourceDir}}Temp_XPStrings.r"
|
|
|
|
|
|
|
|
|
|
Temp_XPStrings.r is then Perlized by resdef.pl to create xpstring.r:
|
|
|
|
|
|
|
|
|
|
perl resdef.pl Temp_XPStrings.r
|
|
|
|
|
|
|
|
|
|
xpstring.r is then Rez'd to create Mozilla Resources:
|
|
|
|
|
|
|
|
|
|
Rez -t 'NSPL' -c MOZZ -i "{RIncludes}" <20>
|
|
|
|
|
-o "{{TargetDir}}Essential Files:Mozilla Resources" <20>
|
|
|
|
|
xpstring.r
|
|
|
|
|
|
|
|
|
|
We then Rez MacSTR.r, which itself includes all the other .r files here:
|
|
|
|
|
|
|
|
|
|
Rez -append -i "{RIncludes}" -i "{{mozilla}}cmd:macfe:include:" <20>
|
|
|
|
|
-o "{{TargetDir}}Essential Files:Mozilla Resources" <20>
|
|
|
|
|
MacSTR.r
|
|
|
|
|
|
|
|
|
|
That's basically it. Phew!
|
|
|
|
|
|
|
|
|
|
Some things to be careful of:
|
|
|
|
|
|
|
|
|
|
MacXPStrings.c is preprocessed by the IDE, so in prefix file
|
|
|
|
|
specified in the prefs is included.
|
|
|
|
|
|
|
|
|
|
When this file is preprocessed by MWCPPC, the prefix file is
|
|
|
|
|
ignored so we include "MacCommonPrefix.h" ourselves.
|
|
|
|
|
*/
|
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
|
|
#define RESOURCE_STR
|
1998-05-28 22:57:55 +04:00
|
|
|
|
|
|
|
|
|
/* Manually include the prefix file, so that MWCPPC picks it up */
|
|
|
|
|
#include "MacConfigInclude.h"
|
|
|
|
|
|
|
|
|
|
/* the prefix file should have already defined OTUNIXERRORS at this stage */
|
1998-03-28 05:44:41 +03:00
|
|
|
|
#include "OpenTransport.h"
|
|
|
|
|
|
1998-05-28 22:57:55 +04:00
|
|
|
|
/* allxpstr.h have to be in the last one */
|
1998-03-28 05:44:41 +03:00
|
|
|
|
#include "allxpstr.h" /* The real stuff is here... */
|
|
|
|
|
|
1998-05-28 22:57:55 +04:00
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
|
#ifdef rez
|
1998-05-28 22:57:55 +04:00
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
|
/*
|
|
|
|
|
** These are included here to force CodeWarrior to rebuild if they change. The
|
|
|
|
|
** include should not actually happen during the build phase, only when the #include
|
|
|
|
|
** scanner is doing its thing.
|
|
|
|
|
*/
|
|
|
|
|
#include "MacSTR.r"
|
|
|
|
|
#include "::rsrc:communicator:Communicator.rsrc" /* sounds of nail-biting */
|
|
|
|
|
#endif
|