File: macgenmcpxml.sh

package info (click to toggle)
ghostscript 8.71~dfsg2-9+squeeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 79,896 kB
  • ctags: 80,654
  • sloc: ansic: 501,432; sh: 25,689; python: 4,853; cpp: 3,633; perl: 3,597; tcl: 1,480; makefile: 1,187; lisp: 407; asm: 284; xml: 263; awk: 66; csh: 17; yacc: 15
file content (423 lines) | stat: -rw-r--r-- 14,834 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
#!/bin/sh

#################################################################################################
# Functions

#####
# WriteXMLHeader writes the beginning of the XML project file
#####
WriteXMLHeader()
{
echo "<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>"
echo "<?codewarrior exportversion="1.0.1" ideversion="4.1" ?>"
echo ""
echo "<!DOCTYPE PROJECT ["
echo "<!ELEMENT PROJECT (TARGETLIST, TARGETORDER, GROUPLIST, DESIGNLIST?)>"
echo "<!ELEMENT TARGETLIST (TARGET+)>"
echo "<!ELEMENT TARGET (NAME, SETTINGLIST, FILELIST?, LINKORDER?, SEGMENTLIST?, OVERLAYGROUPLIST?, SUBTARGETLIST?, SUBPROJECTLIST?)>"
echo "<!ELEMENT NAME (#PCDATA)>"
echo "<!ELEMENT USERSOURCETREETYPE (#PCDATA)>"
echo "<!ELEMENT PATH (#PCDATA)>"
echo "<!ELEMENT FILELIST (FILE*)>"
echo "<!ELEMENT FILE (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?, ROOTFILEREF?, FILEKIND?, FILEFLAGS?)>"
echo "<!ELEMENT PATHTYPE (#PCDATA)>"
echo "<!ELEMENT PATHROOT (#PCDATA)>"
echo "<!ELEMENT ACCESSPATH (#PCDATA)>"
echo "<!ELEMENT PATHFORMAT (#PCDATA)>"
echo "<!ELEMENT ROOTFILEREF (PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>"
echo "<!ELEMENT FILEKIND (#PCDATA)>"
echo "<!ELEMENT FILEFLAGS (#PCDATA)>"
echo "<!ELEMENT FILEREF (TARGETNAME?, PATHTYPE, PATHROOT?, ACCESSPATH?, PATH, PATHFORMAT?)>"
echo "<!ELEMENT TARGETNAME (#PCDATA)>"
echo "<!ELEMENT SETTINGLIST ((SETTING|PANELDATA)+)>"
echo "<!ELEMENT SETTING (NAME?, (VALUE|(SETTING+)))>"
echo "<!ELEMENT PANELDATA (NAME, VALUE)>"
echo "<!ELEMENT VALUE (#PCDATA)>"
echo "<!ELEMENT LINKORDER (FILEREF*)>"
echo "<!ELEMENT SEGMENTLIST (SEGMENT+)>"
echo "<!ELEMENT SEGMENT (NAME, ATTRIBUTES?, FILEREF*)>"
echo "<!ELEMENT ATTRIBUTES (#PCDATA)>"
echo "<!ELEMENT OVERLAYGROUPLIST (OVERLAYGROUP+)>"
echo "<!ELEMENT OVERLAYGROUP (NAME, BASEADDRESS, OVERLAY*)>"
echo "<!ELEMENT BASEADDRESS (#PCDATA)>"
echo "<!ELEMENT OVERLAY (NAME, FILEREF*)>"
echo "<!ELEMENT SUBTARGETLIST (SUBTARGET+)>"
echo "<!ELEMENT SUBTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>"
echo "<!ELEMENT SUBPROJECTLIST (SUBPROJECT+)>"
echo "<!ELEMENT SUBPROJECT (FILEREF, SUBPROJECTTARGETLIST)>"
echo "<!ELEMENT SUBPROJECTTARGETLIST (SUBPROJECTTARGET*)>"
echo "<!ELEMENT SUBPROJECTTARGET (TARGETNAME, ATTRIBUTES?, FILEREF?)>"
echo "<!ELEMENT TARGETORDER (ORDEREDTARGET|ORDEREDDESIGN)*>"
echo "<!ELEMENT ORDEREDTARGET (NAME)>"
echo "<!ELEMENT ORDEREDDESIGN (NAME, ORDEREDTARGET+)>"
echo "<!ELEMENT GROUPLIST (GROUP|FILEREF)*>"
echo "<!ELEMENT GROUP (NAME, (GROUP|FILEREF)*)>"
echo "<!ELEMENT DESIGNLIST (DESIGN+)>"
echo "<!ELEMENT DESIGN (NAME, DESIGNDATA)>"
echo "<!ELEMENT DESIGNDATA (#PCDATA)>"
echo "]>"
echo ""
}

#####
# WriteFILE generates a complete <FILE>...</FILE> entry
#####
WriteFILE()
{
    echo "<FILE>"
    echo "	<PATHTYPE>Name</PATHTYPE>"
    echo "	<PATH>$1</PATH>"
    echo "	<PATHFORMAT>MacOS</PATHFORMAT>"
    echo "	<FILEKIND>Text</FILEKIND>"
    echo "	<FILEFLAGS>Debug</FILEFLAGS>"
    echo "</FILE>"
}

#####
# WriteFILEREF generates a complete <FILEREF>...</FILEREF> entry
#####
WriteFILEREF()
{
    echo "<FILEREF>"
    if [ $# -ge 2 ]; then
    echo "	<TARGETNAME>$2</TARGETNAME>"
    fi
    echo "	<PATHTYPE>Name</PATHTYPE>"
    echo "	<PATH>$1</PATH>"
    echo "	<PATHFORMAT>MacOS</PATHFORMAT>"
    echo "</FILEREF>"
}


#####
# WriteValueSetting generates a complete value entry
#####
WriteValueSetting()
{
    SETTINGNAME=$1
    VALUE=$2
    
    echo "<SETTING><NAME>$SETTINGNAME</NAME><VALUE>$VALUE</VALUE></SETTING>"
}



#####
# WritePathSetting generates a complete path entry
#####
WritePathSetting()
{
    SETTINGNAME=$1
    PATH=$2
    PATHFORMAT=$3
    PATHROOT=$4
    
    echo "<SETTING>"
        echo "<SETTING><NAME>$SETTINGNAME</NAME>"
            echo "<SETTING><NAME>Path</NAME><VALUE>$PATH</VALUE></SETTING>"
            echo "<SETTING><NAME>PathFormat</NAME><VALUE>$PATHFORMAT</VALUE></SETTING>"
            echo "<SETTING><NAME>PathRoot</NAME><VALUE>$PATHROOT</VALUE></SETTING>"
        echo "</SETTING>"
        echo "<SETTING><NAME>Recursive</NAME><VALUE>true</VALUE></SETTING>"
        echo "<SETTING><NAME>HostFlags</NAME><VALUE>All</VALUE></SETTING>"
    echo "</SETTING>"
}

#####
# WriteSETTINGLIST generates a complete <SETTINGLIST>...</SETTINGLIST> entry
#####
WriteSETTINGLIST()
{
    TARGETNAME=$1
    OUTPUTNAME=$2
    
    echo "<SETTINGLIST>"
        
        echo "<!-- Settings for "Target Settings" panel -->"
        WriteValueSetting Linker "MacOS PPC Linker"
        WriteValueSetting PreLinker ""
        WriteValueSetting PostLinker ""
        WriteValueSetting Targetname "$TARGETNAME"
        echo "<SETTING><NAME>OutputDirectory</NAME>"
            echo "<SETTING><NAME>Path</NAME><VALUE>:Output:</VALUE></SETTING>"
            echo "<SETTING><NAME>PathFormat</NAME><VALUE>MacOS</VALUE></SETTING>"
            echo "<SETTING><NAME>PathRoot</NAME><VALUE>Project</VALUE></SETTING>"
        echo "</SETTING>"
        WriteValueSetting SaveEntriesUsingRelativePaths false
        
        echo "<!-- Settings for "Access Paths" panel -->"
        WriteValueSetting AlwaysSearchUserPaths false
        WriteValueSetting InterpretDOSAndUnixPaths true
        echo "<SETTING><NAME>UserSearchPaths</NAME>"
            WritePathSetting SearchPath ":src:" MacOS Project
            WritePathSetting SearchPath ":obj:" MacOS Project
            WritePathSetting SearchPath ":" MacOS Project
        echo "</SETTING>"
        echo "<SETTING><NAME>SystemSearchPaths</NAME>"
            WritePathSetting SearchPath ":jbig2dec:" MacOS Project
            WritePathSetting SearchPath ":jasper/src/libjasper/include:" MacOS Project
            WritePathSetting SearchPath ":obj:" MacOS Project
            WritePathSetting SearchPath ":MacOS Support:" MacOS CodeWarrior
            WritePathSetting SearchPath ":MSL:MSL_C" MacOS CodeWarrior
            WritePathSetting SearchPath ":" MacOS CodeWarrior
            WritePathSetting SearchPath ":" MacOS Project
        echo "</SETTING>"
        
        echo "<!-- Settings for "Build Extras" panel -->"
        WriteValueSetting CacheModDates true
	WriteValueSetting ActivateBrowser true
	WriteValueSetting DumpBrowserInfo false
	WriteValueSetting CacheSubprojects true
        
	echo "<!-- Settings for "PPC Project" panel -->"
	WriteValueSetting MWProject_PPC_type SharedLibrary
	WriteValueSetting MWProject_PPC_outfile "$OUTPUTNAME"
	WriteValueSetting MWProject_PPC_filecreator 1061109567
	WriteValueSetting MWProject_PPC_filetype 1936223330
	WriteValueSetting MWProject_PPC_size 0
	WriteValueSetting MWProject_PPC_minsize 0
	WriteValueSetting MWProject_PPC_stacksize 0
	WriteValueSetting MWProject_PPC_flags 0
	WriteValueSetting MWProject_PPC_symfilename ""
	WriteValueSetting MWProject_PPC_rsrcname ""
	WriteValueSetting MWProject_PPC_rsrcheader Native
	WriteValueSetting MWProject_PPC_rsrctype 1061109567
	WriteValueSetting MWProject_PPC_rsrcid 0
	WriteValueSetting MWProject_PPC_rsrcflags 0
	WriteValueSetting MWProject_PPC_rsrcstore 0
	WriteValueSetting MWProject_PPC_rsrcmerge 0
        
	echo "<!-- Settings for "C/C++ Compiler" panel -->"
	WriteValueSetting MWFrontEnd_C_cplusplus 0
	WriteValueSetting MWFrontEnd_C_checkprotos 0
	WriteValueSetting MWFrontEnd_C_arm 0
	WriteValueSetting MWFrontEnd_C_trigraphs 0
	WriteValueSetting MWFrontEnd_C_onlystdkeywords 0
	WriteValueSetting MWFrontEnd_C_enumsalwaysint 0
	WriteValueSetting MWFrontEnd_C_mpwpointerstyle 1
	
	# install the carbon prefix file for carbon targets
	if test "$OUTPUTNAME" = "GhostscriptLib Carbon"; then
	  if test "$TARGETNAME" = "GhostscriptLib Carbon (Debug)"; then
	    WriteValueSetting MWFrontEnd_C_prefixname macos_carbon_d_pre.h
	  else
	    WriteValueSetting MWFrontEnd_C_prefixname macos_carbon_pre.h
	  fi
	else
	  if test "$TARGETNAME" = "GhostscriptLib PPC (Debug)"; then
	    WriteValueSetting MWFrontEnd_C_prefixname macos_classic_d_pre.h
	  else
	    WriteValueSetting MWFrontEnd_C_prefixname
	  fi
	fi
	
	WriteValueSetting MWFrontEnd_C_ansistrict 0
	WriteValueSetting MWFrontEnd_C_mpwcnewline 0
	WriteValueSetting MWFrontEnd_C_wchar_type 1
	WriteValueSetting MWFrontEnd_C_enableexceptions 0
	WriteValueSetting MWFrontEnd_C_dontreusestrings 0
	WriteValueSetting MWFrontEnd_C_poolstrings 0
	WriteValueSetting MWFrontEnd_C_dontinline 1
	WriteValueSetting MWFrontEnd_C_useRTTI 0
	WriteValueSetting MWFrontEnd_C_multibyteaware 0
	WriteValueSetting MWFrontEnd_C_unsignedchars 0
	WriteValueSetting MWFrontEnd_C_autoinline 0
	WriteValueSetting MWFrontEnd_C_booltruefalse 0
	WriteValueSetting MWFrontEnd_C_direct_to_som 0
	WriteValueSetting MWFrontEnd_C_som_env_check 0
	WriteValueSetting MWFrontEnd_C_alwaysinline 0
	WriteValueSetting MWFrontEnd_C_inlinelevel 0
	WriteValueSetting MWFrontEnd_C_ecplusplus 0
	WriteValueSetting MWFrontEnd_C_objective_c 0
	WriteValueSetting MWFrontEnd_C_defer_codegen 0
        
	echo "<!-- Settings for "C/C++ Warnings" panel -->"
	WriteValueSetting MWWarning_C_warn_illpragma 1
	WriteValueSetting MWWarning_C_warn_emptydecl 0
	WriteValueSetting MWWarning_C_warn_possunwant 0
	WriteValueSetting MWWarning_C_warn_unusedvar 1
	WriteValueSetting MWWarning_C_warn_unusedarg 0
	WriteValueSetting MWWarning_C_warn_extracomma 1
	WriteValueSetting MWWarning_C_pedantic 1
	WriteValueSetting MWWarning_C_warningerrors 0
	WriteValueSetting MWWarning_C_warn_hidevirtual 1
	WriteValueSetting MWWarning_C_warn_implicitconv 0
	WriteValueSetting MWWarning_C_warn_notinlined 0
	WriteValueSetting MWWarning_C_warn_structclass 0
        
	echo "<!-- Settings for "PPC CodeGen" panel -->"
	WriteValueSetting MWCodeGen_PPC_structalignment PPC
	WriteValueSetting MWCodeGen_PPC_tracebacktables Inline
	WriteValueSetting MWCodeGen_PPC_processor Generic
	WriteValueSetting MWCodeGen_PPC_readonlystrings 0
	WriteValueSetting MWCodeGen_PPC_tocdata 1
	WriteValueSetting MWCodeGen_PPC_profiler 0
	WriteValueSetting MWCodeGen_PPC_fpcontract 0
	WriteValueSetting MWCodeGen_PPC_schedule 1
	WriteValueSetting MWCodeGen_PPC_peephole 1
	WriteValueSetting MWCodeGen_PPC_processorspecific 0
	WriteValueSetting MWCodeGen_PPC_altivec 0
	WriteValueSetting MWCodeGen_PPC_vectortocdata 0
	WriteValueSetting MWCodeGen_PPC_vrsave 0
	
	echo "<!-- Settings for "PPC Global Optimizer" panel -->"
	WriteValueSetting GlobalOptimizer_PPC_optimizationlevel Level0
	WriteValueSetting GlobalOptimizer_PPC_optfor Speed
        
	echo "<!-- Settings for "PPC Linker" panel -->"
	WriteValueSetting MWLinker_PPC_linksym 1
	WriteValueSetting MWLinker_PPC_symfullpath 1
	WriteValueSetting MWLinker_PPC_linkmap 0
	WriteValueSetting MWLinker_PPC_nolinkwarnings 0
	WriteValueSetting MWLinker_PPC_dontdeadstripinitcode 0
	WriteValueSetting MWLinker_PPC_permitmultdefs 0
	WriteValueSetting MWLinker_PPC_linkmode Fast
	WriteValueSetting MWLinker_PPC_initname "__initialize"
	WriteValueSetting MWLinker_PPC_mainname ""
	WriteValueSetting MWLinker_PPC_termname "__terminate"
        
	echo "<!-- Settings for "PPC PEF" panel -->"
	WriteValueSetting MWPEF_exports Pragma
	WriteValueSetting MWPEF_libfolder 0
	WriteValueSetting MWPEF_sortcode None
	WriteValueSetting MWPEF_expandbss 0
	WriteValueSetting MWPEF_sharedata 0
	WriteValueSetting MWPEF_olddefversion 0
	WriteValueSetting MWPEF_oldimpversion 0
	WriteValueSetting MWPEF_currentversion 0
	WriteValueSetting MWPEF_fragmentname ""
	WriteValueSetting MWPEF_collapsereloads 0
        
    echo "</SETTINGLIST>"
}


#####
# WriteTARGET generates a complete <TARGET>...</TARGET> entry
#####
WriteTARGET()
{
    TARGETNAME=$1
    OUTPUTNAME=$2
    shift 2
    
    echo "<TARGET>"
        
        echo "<NAME>$TARGETNAME</NAME>"
        
        WriteSETTINGLIST "$TARGETNAME" "$OUTPUTNAME"
        
        echo "<FILELIST>"
            for file in "$@"; do
                WriteFILE "$file"
            done
        echo "</FILELIST>"
        
        echo "<LINKORDER>"
            for file in "$@"; do
                WriteFILEREF "$file"
            done
        echo "</LINKORDER>"
        
    echo "</TARGET>"
}


#####
# WriteGROUP generates a complete <GROUP>...</GROUP> entry
#####
WriteGROUP()
{
    GROUPNAME=$1
    TARGETNAME=$2
    shift 2
    
    echo "<GROUP><NAME>$GROUPNAME</NAME>"
        
        for file in "$@"; do
            WriteFILEREF "$file" "$TARGETNAME"
        done
        
    echo "</GROUP>"
}


#################################################################################################
# the start of the script

#####
# first create a list of .c files that will be part of the project, we need it several times
#####

CFILES=
while [ $# -ge 1 ]; do
    case $1 in
        \\);;
        *.o)
            # strip path before file name and convert .o to .c, then append file name to CFILES
            CFILES=$CFILES\ `echo $1 | sed -e 's/\.\/.*\///' -e 's/\.\///' -e 's/\.o/\.c/'`
            ;;
    esac
    shift
done

# libs for codewarrior 6
#LIBS="console.stubs.c MSL\ ShLibRuntime.Lib MSL\ RuntimePPC.Lib"
#CLASSICLIBS="MSL\ C.PPC.Lib InterfaceLib FontManager MathLib"

# libs for codewarrior 7 & 8
LIBS=""
CARBONLIBS="MSL_All_Carbon.Lib CarbonLib"
CLASSICLIBS="MSL_All_PPC.Lib InterfaceLib FontManager MathLib"
CLASSICLIBS="$CLASSICLIBS TextCommon UnicodeConverter UTCUtils"

#####
# 
#####

GSNAME="GhostscriptLib"
CLASSICGSNAME="$GSNAME PPC"
CARBONGSNAME="$GSNAME Carbon"
CLASSICDEBUGTARGETNAME="$CLASSICGSNAME (Debug)"
CLASSICFINALTARGETNAME="$CLASSICGSNAME (Final)"
CARBONDEBUGTARGETNAME="$CARBONGSNAME (Debug)"
CARBONFINALTARGETNAME="$CARBONGSNAME (Final)"

WriteXMLHeader

echo "<PROJECT>"
    
    echo "<TARGETLIST>"
    WriteTARGET "$CARBONDEBUGTARGETNAME" "$CARBONGSNAME" $CFILES $LIBS $CARBONLIBS
    WriteTARGET "$CLASSICDEBUGTARGETNAME" "$CLASSICGSNAME" $CFILES $LIBS $CLASSICLIBS
    echo "</TARGETLIST>"
    
    echo "<TARGETORDER>"
        echo "<ORDEREDTARGET><NAME>$CARBONDEBUGTARGETNAME</NAME></ORDEREDTARGET>"
        echo "<ORDEREDTARGET><NAME>$CLASSICDEBUGTARGETNAME</NAME></ORDEREDTARGET>"
    echo "</TARGETORDER>"
    
    echo "<GROUPLIST>"
        WriteGROUP "Ghostscript Sources" "$CARBONDEBUGTARGETNAME" $CFILES
#        WriteGROUP "Libraries" "$CARBONDEBUGTARGETNAME" $LIBS $CARBONLIBS $CLASSICLIBS
#        WriteGROUP "Libraries" "$CARBONDEBUGTARGETNAME" "console.stubs.c" "MSL ShLibRuntime.Lib" "MSL RuntimePPC.Lib" "MSL C.Carbon.Lib" "CarbonLib" "MSL C.PPC.Lib" "InterfaceLib" "FontManager" "MathLib"

# nb: this code doesn't work if there are spaces in the library filenames        
        echo "<GROUP><NAME>Libraries</NAME>"
	for lib in $LIBS; do
            WriteFILEREF "$lib" "$CARBONDEBUGTARGETNAME"
	    WriteFILEREF "$lib" "$CLASSICDEBUGTARGETNAME"
	done
	for lib in $CARBONLIBS; do
            WriteFILEREF "$lib" "$CARBONDEBUGTARGETNAME"
	done
	for lib in $CLASSICLIBS; do
            WriteFILEREF "$lib" "$CLASSICDEBUGTARGETNAME"
	done
        echo "</GROUP>"
        
    echo "</GROUPLIST>"

echo "</PROJECT>"

exit 0