LibraryDefinition.st
author fm
Wed, 09 Aug 2006 22:42:33 +0200
changeset 9504 b89c84c60e86
parent 9503 fd9bf4b0b073
child 9513 8b67400ebcf3
permissions -rw-r--r--
*** empty log message ***

"{ Package: 'stx:libbasic3' }"

Object subclass:#ProjectDefinition
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'System-Support-Projects'
!


!ProjectDefinition class methodsFor:'instance creation'!

definitionClassForPackage:aPackageID
    |classes|

    classes := OrderedCollection new.
    Smalltalk allClassesInPackage:aPackageID 
                do:[:eachClass |
                    eachClass isLoaded ifFalse:[
                        eachClass autoload
                    ].
                    (eachClass isSubclassOf:ProjectDefinition) ifTrue:[
                        classes add:eachClass    
                    ]
                ].

    classes isEmpty ifTrue:[
        ^ nil
    ].
    classes size > 1 ifTrue:[
        self error:'OOPS - multiple projectDefinitions' mayProceed:true.
        ^ classes first.
    ].
    ^ classes first

    "Created: / 09-08-2006 / 17:27:32 / fm"
!

newNamed:newName package:packageID
    |newClass|

    newClass := self
                    subclass:(newName asSymbol)
                    instanceVariableNames:''
                    classVariableNames:''
                    poolDictionaries:''
                    category:'* Projects *'.

    newClass package:packageID asSymbol.
    ^ newClass

    "Created: / 09-08-2006 / 17:57:37 / fm"
    "Modified: / 09-08-2006 / 19:27:53 / fm"
! !

!ProjectDefinition class methodsFor:'accessing'!

initialClassNameForDefinitionOf:aPackageId
       ^ (aPackageId asString copy replaceAny:':/' by:$_ ) , '_Definition'

"
   DapasXProject initialClassNameForDefinitionOf:'bosch:dapasx/interactiver_editor' 
   DapasXProject initialClassNameForDefinitionOf:'stx:libbasic' 
   DapasXProject initialClassNameForDefinitionOf:'stx:goodies/xml' 
"

    "Created: / 09-08-2006 / 17:44:47 / fm"
!

libraryName
       ^ self package asString copy replaceAny:':/' by:$_

"
   DapasXProject libraryName
   DapasX_Datenbasis libraryName
"

    "Modified: / 09-08-2006 / 18:20:29 / fm"
!

module

^self moduleOfClass: self

"
   DapasXProject module
   DapasX_Datenbasis module
"

    "Created: / 08-08-2006 / 20:24:53 / fm"
    "Modified: / 09-08-2006 / 16:16:37 / fm"
!

moduleDirectory

^(self package subStrings: $:) last

"
   DapasXProject moduleDirectory
   DapasX_Datenbasis moduleDirectory
"

    "Created: / 08-08-2006 / 20:25:39 / fm"
!

moduleOfClass: aClass

^(aClass package subStrings: $:) first

"
   DapasXProject module
   DapasX_Datenbasis module
"

    "Created: / 09-08-2006 / 16:16:16 / fm"
!

msdosPathToPackage:aPackageID
"Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"

        ^ self msdosPathToTop , '\..\' , (aPackageID asString copy replaceAll:$: by:$/)

"
   DapasX_Datenbasis pathToPackage:'bosch:dapasx/kernel'
"

    "Created: / 09-08-2006 / 16:35:22 / fm"
!

msdosPathToTop
"Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"


       ^ (((1 to:(self package asCollectionOfSubstringsSeparatedByAny:':/') size)
            collect:[:n | '..\']) asStringWith:'') , 'stx'    

"
   DapasXProject pathToTop    
   DapasX_Datenbasis pathToTop  
"

    "Created: / 09-08-2006 / 15:45:54 / fm"
!

parentProject

    ^(self package asString subStrings: $/) first

"
    DapasXProject parentProject
    DapasX_Datenbasis parentProject
"

    "Created: / 07-08-2006 / 20:18:27 / fm"
    "Modified: / 08-08-2006 / 10:47:37 / fm"
!

unixPathToPackage:aPackageID
"Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"

        ^ self unixPathToTop , '/../' , (aPackageID asString copy replaceAll:$: by:$/)

"
   DapasX_Datenbasis pathToPackage:'bosch:dapasx/kernel'
"

    "Created: / 09-08-2006 / 16:35:22 / fm"
!

unixPathToTop
"Returns the path to stx counting the number of $/ and $: in the package name and adding for each one '../' to get the ST/X top directory"


       ^ (((1 to:(self package asCollectionOfSubstringsSeparatedByAny:':/') size)
            collect:[:n | '../']) asStringWith:'') , 'stx'    

"
   DapasXProject pathToTop    
   DapasX_Datenbasis pathToTop  
"

    "Created: / 09-08-2006 / 15:45:54 / fm"
! !

!ProjectDefinition class methodsFor:'file generation'!

allClassNames
    ^ (self compiled_classNames , self autoloaded_classNames , self excluded_classNames)
!

generate_abbrev_dot_stc
    ^ String 
        streamContents:[:s | 
            self allClassNames do:[:eachClassName | 
                |cls fn|

                cls := Smalltalk classNamed:eachClassName.
                cls autoload.
                s nextPutAll:eachClassName.
                s nextPutAll:' '.
                fn := cls classFilename asFilename withoutSuffix baseName.
                (fn includes:Character space) ifTrue:[
                    s nextPutAll:fn storeString.
                ] ifFalse:[
                    s nextPutAll:fn.
                ].
                s nextPutAll:' '.
                s nextPutAll:cls package.
                s nextPutAll:' '.
                s nextPutAll:cls category asString storeString.
                s nextPutAll:' '.
                s nextPutAll:(cls theMetaclass instVarNames size) printString.
                s cr.
            ]
        ]

    "
        DapasXProject generate_abbrev_dot_stc
        DapasX_Datenbasis generate_abbrev_dot_stc
        bosch_dapasx_interactiver_editor_Definition generate_abbrev_dot_stc
    "
    "Created: / 09-08-2006 / 11:24:39 / fm"
!

generate_bc_dot_def                         

    ^self replaceMappings: self bc_dot_def_mappings 
            in: self bc_dot_def

"
  DapasXProject generate_bc_dot_def
  DapasX_Datenbasis generate_bc_dot_def

"

    "Modified: / 09-08-2006 / 11:30:42 / fm"
!

generate_libInit_dot_cc

    ^self replaceMappings: self libInit_dot_cc_mappings 
            in: self libInit_dot_cc

"
  DapasXProject generate_libInit_dot_cc
  DapasX_Datenbasis generate_libInit_dot_cc

"

    "Created: / 08-08-2006 / 12:47:16 / fm"
    "Modified: / 09-08-2006 / 11:30:52 / fm"
!

generate_make_dot_proto   

    ^self replaceMappings: self make_dot_proto_mappings 
            in: self make_dot_proto

"
  DapasXProject generate_make_dot_proto
  DapasX_Datenbasis generate_make_dot_proto

"

    "Modified: / 09-08-2006 / 11:31:01 / fm"
!

generate_make_dot_spec

    ^self replaceMappings: self make_dot_spec_mappings 
            in: self make_dot_spec

"
  DapasXProject generate_make_dot_spec
  DapasX_Datenbasis generate_make_dot_spec

"

    "Modified: / 09-08-2006 / 11:31:09 / fm"
!

generate_nt_dot_def                           

    ^self replaceMappings: self nt_dot_def_mappings 
            in: self nt_dot_def

"
  DapasXProject generate_nt_dot_def
  DapasX_Datenbasis generate_nt_dot_def

"

    "Modified: / 09-08-2006 / 11:31:21 / fm"
!

generate_nt_dot_mak         

    ^self replaceMappings: self nt_dot_mak_mappings 
            in: self nt_dot_mak

"
  DapasXProject generate_nt_dot_mak
  DapasX_Datenbasis generate_nt_dot_mak

"

    "Modified: / 09-08-2006 / 11:46:14 / fm"
! !

!ProjectDefinition class methodsFor:'file templates'!

bc_dot_def

^ 
'LIBRARY        %(LIBRARY_NAME)
DESCRIPTION     %(DESCRIPTION)
CODE            PRELOAD MOVEABLE DISCARDABLE
SEGMENTS
    INITCODE    PRELOAD DISCARDABLE
EXPORTS
    __%(LIBRARY_NAME)_Init     @1
'

    "Created: / 08-08-2006 / 12:26:58 / fm"
    "Modified: / 08-08-2006 / 19:32:27 / fm"
!

classLine_libInit_dot_cc

^'_%(CLASS)_Init(pass,__pRT__,snd);'

    "Created: / 08-08-2006 / 12:51:44 / fm"
    "Modified: / 08-08-2006 / 15:46:05 / fm"
!

extensionLine_libInit_dot_cc

^'_%(LIBRARY_NAME)_extensions_Init(pass,__pRT__,snd);'

    "Created: / 08-08-2006 / 15:48:56 / fm"
    "Modified: / 08-08-2006 / 19:32:33 / fm"
!

libInit_dot_cc

^ 
'/*
 * DO NOT EDIT 
 * automagically generated from Make.proto (by make libInit.cc)
 */
#define __INDIRECTVMINITCALLS__
#include <stc.h>
#define INIT_TEXT_SECT /* as nothing */
#ifdef WIN32
# pragma codeseg INITCODE "INITCODE"
#else /* not WIN32 */
# if defined(__GNUC__) && !!defined(NO_SECTION_ATTRIBUTES)
#  if (__GNUC__  == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ > 2
#   undef INIT_TEXT_SECT
#   define INIT_TEXT_SECT __attribute__((section(".stxitext")))
#  endif
# endif /* not GNUC */
#endif /* not WIN32 */
#ifdef INIT_TEXT_SECT
extern void _%(LIBRARY_NAME)_Init() INIT_TEXT_SECT;
#endif
void _%(LIBRARY_NAME)_Init(pass, __pRT__, snd)
OBJ snd; struct __vmData__ *__pRT__; {
__BEGIN_PACKAGE2__("%(LIBRARY_NAME)", _%(LIBRARY_NAME)_Init, "%(PACKAGE)");
%(CLASSES)
%(EXTENSION)
__END_PACKAGE__();
}'

    "Created: / 08-08-2006 / 12:40:45 / fm"
    "Modified: / 08-08-2006 / 19:33:01 / fm"
!

make_dot_proto

^ 
'#
# Warning: once you modify this file, do not rerun
# stmkmp again - otherwise, your changes are lost.
#
# The Makefile as generated by this Make.proto supports the following targets:
#    make         - compile all st-files to a classLib
#    make install - install the classLib in /opt/smalltalk/...
#    make clean   - clean all temp files
#    make clobber - clean all

#
# position (of this package) in directory hierarchy:
# (must point to ST/X top directory, for tools and includes)
TOP=%(TOP)


# subdirectories where targets are to be made:
SUBDIRS=%(SUBDIRECTORIES)


# subdirectories where Makefiles are to be made:
# (only define if different from SUBDIRS)
# ALLSUBDIRS=


# if your embedded C code requires any system includes, 
# add the path(es) here:, 
# ********** OPTIONAL: MODIFY the next lines ***
# LOCALINCLUDES=-Ifoo -Ibar
LOCALINCLUDES=%(LOCAL_INCLUDES)


# if you need any additional defines for embedded C code, 
# add them here:, 
# ********** OPTIONAL: MODIFY the next lines ***
# LOCALDEFINES=-Dfoo -Dbar -DDEBUG
LOCALDEFINES=%(LOCAL_DEFINES)


#
# The next 2 defines should be left as-is
#  for a class-library package, you can uncomment the following:
#  (it does not hurt much, if you leave it as is - but you may NOT
#   uncomment it if object files are to be loaded individually later).
# INITCODESEPFLAG=$(SEPINITCODE)
#
#  the following MAY ONLY be uncommented for classes/classLibs,
#  which are ALWAYS statically included in the executable.
#  (i.e. NEVER for those which are subject to dynamic loading).
# COMMONSYMFLAG=$(COMMONSYMBOLS)
#
STCLOCALOPT=-I. $(LOCALINCLUDES) $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) -H. ''-P$(PACKAGE)'' ''-Z$(LIBNAME)'' $(COMMONSYMFLAG) $(INITCODESEPFLAG)


# ********** OPTIONAL: MODIFY the next line ***
# additional C-libraries that should be pre-linked with the class-objects
LD_OBJ_LIBS=


# ********** OPTIONAL: MODIFY the next line ***
# additional C targets or libraries should be added below
LOCAL_EXTRA_TARGETS=

all:: preMake classLibRule postMake


# add more install actions here
install::

# add more install actions for aux-files (resources) here
installAux::

# add more preMake actions here
preMake::

# add more postMake actions here
postMake:: cleanjunk

cleanjunk::

clean::
        -rm -f *.o *.H

clobber::
        -rm -f *.so *.dll

',
"
$(INSTALLBASE)::
        @test -d $@ || mkdir $@

$(INSTALLBASE)/packages:: $(INSTALLBASE)
        @test -d $@ || mkdir $@

$(INSTALLBASE)/packages/$(MODULE):: $(INSTALLBASE)/packages
        @test -d $@ || mkdir $@

$(INSTALLBASE)/packages/$(MODULE)/dapasx:: $(INSTALLBASE)/packages/$(MODULE)
        @test -d $@ || mkdir $@

$(INSTALLBASE)/packages/$(MODULE)/dapasx/interactiver_editor:: $(INSTALLBASE)/packages/$(MODULE)/dapasx
        @test -d $@ || mkdir $@

$(INSTALLBASE)/packages/$(MODULE)/$(MODULE_DIR):: $(INSTALLBASE)/packages/$(MODULE)
        @test -d $@ || mkdir $@
"
'
# if other things are to be compiled,
# add target definitions here,
# and list them in LOCAL_EXTRA_TARGETS above.
# (care for make syntax - TABS are required in the actions)
# foo:  foo.o
#         $(CC) -o foo foo.o

# ''make depend'' will add dependency info between
# BEGIN...END below
#
# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
# ENDMAKEDEPEND --- do not remove this line

'

    "Created: / 08-08-2006 / 20:45:36 / fm"
    "Modified: / 09-08-2006 / 16:50:23 / fm"
!

make_dot_spec

^ 
'#
# This file contains specifications which are common to all platforms.
#
# Warning: once you modify this file, do not rerun
# stmkmp again - otherwise, your changes are lost.
#
# This file contains definitions for Unix based platforms.
#




# module and directory-in-module;
# these should correspond to the directory hierarchy
# location (otherwise, ST/X will have a hard time to
# find out the packages location from its packageID)
MODULE=%(MODULE)
MODULE_DIR=%(MODULE_DIRECTORY)


# the name of your classLibrary:
# ********** REQUIRED: CHECK the next line ***
LIBNAME=%(LIBRARY_NAME)


# the package is stored as an ID in classes and methods
# to identify code belonging to this project.
# It also specifies the position in the source repository
# and directory tree, when packages are loaded by packageID.
# ********** REQUIRED: CHECK the next line ***
PACKAGE=$(MODULE):$(MODULE_DIR)


# Argument(s) to the stc compiler.
#  -H.         : create header files locally
#                (if removed, they will be created as common
#  -Pxxx       : defines the package
#  -Zxxx       : a prefix for variables within the classLib
#  -Dxxx       : defines passed to to CC for inline C-code
#  -Ixxx       : include path passed to CC for inline C-code
#  +optspace   : optimized for space
#  +optspace2  : optimized more for space
#  +optspace3  : optimized even more for space
#  +optinline  : generate inline code for some ST constructs
#  +inlineNew  : additionally inline new
#  +inlineMath : additionally inline some floatPnt math stuff
#
# ********** OPTIONAL: MODIFY the next line(s) ***
# STCLOCALOPTIMIZATIONS=+optinline +inlineNew
# STCLOCALOPTIMIZATIONS=+optspace3
STCLOCALOPTIMIZATIONS=+optspace3


# Argument(s) to the stc compiler.
#  -warn            : no warnings
#  -warnNonStandard : no warnings about ST/X extensions
#  -warnEOLComments : no warnings about EOL comment extension
#  -warnPrivacy     : no warnings about privateClass extension
#
# ********** OPTIONAL: MODIFY the next line(s) ***
# STCWARNINGS=-warn
# STCWARNINGS=-warnNonStandard
# STCWARNINGS=-warnEOLComments
STCWARNINGS=

OBJS= \
%(OBJECTS)
'

    "Created: / 08-08-2006 / 19:31:29 / fm"
    "Modified: / 09-08-2006 / 15:10:57 / fm"
!

nt_dot_def

^
'LIBRARY        %(LIBRARY_NAME)
DESCRIPTION     %(DESCRIPTION)
VERSION         %(VERSION_NUMBER)
CODE            EXECUTE READ 
DATA            READ WRITE
SECTIONS
    INITCODE    READ EXECUTE 
    INITDATA    READ WRITE
EXPORTS 
    _%(LIBRARY_NAME)_Init      @1
IMPORTS'

    "Modified: / 08-08-2006 / 19:33:14 / fm"
!

nt_dot_mak

^
'#
# This file contains make rules for the win32 platform (using borland-bcc).
#
# Warning: once you modify this file, do not rerun
# stmkmp again - otherwise, your changes are lost.
#
TOP=%(TOP)

!!INCLUDE $(TOP)\rules\stdHeader_nt

!!INCLUDE Make.spec

LOCALINCLUDES=%(LOCAL_INCLUDES)

STCLOCALOPT=-I. $(LOCALINCLUDES) -H. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES) ''-P$(PACKAGE)'' ''-Z$(LIBNAME)'' $(COMMONSYMFLAG) $(INITCODESEPFLAG)

ALL::  $(LIBJPEG) $(LIBDIR)\$(LIBNAME).lib $(BINDIR)\$(LIBNAME).dll

!!INCLUDE $(TOP)\rules\stdRules_nt

# BEGINMAKEDEPEND --- do not remove this line; make depend needs it
# ENDMAKEDEPEND --- do not remove this line
'

    "Created: / 09-08-2006 / 11:44:20 / fm"
    "Modified: / 09-08-2006 / 19:59:32 / fm"
!

objectLine_make_dot_spec

^'    %(CLASS).$(O) \'

    "Created: / 08-08-2006 / 20:16:46 / fm"
! !

!ProjectDefinition class methodsFor:'mappings'!

bc_dot_def_mappings
    ^ (Dictionary new)
        at:#'LIBRARY_NAME' put:[ self libraryName ];
        at:#'DESCRIPTION'
            put:[
                    |d|

                    d := self description.
                    (d isEmptyOrNil ifTrue:[ 'test' ] ifFalse:[ d ]) storeString.
                ];
        yourself

    "Created: / 09-08-2006 / 11:17:59 / fm"
!

classLine_libInit_dot_cc_mappings: aClassName

^Dictionary new                                               
    at: #'CLASS' put: [aClassName asString copy replaceAny:':' by:$_];
    yourself

    "Created: / 08-08-2006 / 14:04:00 / fm"
    "Modified: / 09-08-2006 / 18:27:07 / fm"
!

extensionLine_libInit_dot_cc_mappings

^Dictionary new                                               
    at: #'LIBRARY_NAME' put: [self libraryName];
    yourself

    "Created: / 09-08-2006 / 11:19:59 / fm"
!

libInit_dot_cc_mappings

^Dictionary new
    at: #'LIBRARY_NAME' put: [self libraryName];
    at: #'PACKAGE' put: [self package];
    at: #'CLASSES' put: [self generateClassLines_libInit_dot_cc];
    at: #'EXTENSION' put: [self generateExtensionLine_libInit_dot_cc];

    yourself

    "Created: / 09-08-2006 / 11:20:24 / fm"
!

make_dot_proto_mappings

^Dictionary new
    at: #'TOP' put: [self unixPathToTop];
    at: #'SUBDIRECTORIES' put: [self generateSubDirectories];
    at: #'LOCAL_INCLUDES' put: [self generateUnixLocalIncludes];
    at: #'LOCAL_DEFINES' put: [''];
    yourself

    "Created: / 09-08-2006 / 11:20:45 / fm"
    "Modified: / 09-08-2006 / 16:44:48 / fm"
!

make_dot_spec_mappings

^Dictionary new
    at: #'MODULE' put: [self module];  
    at: #'MODULE_DIRECTORY' put: [self moduleDirectory];  
    at: #'LIBRARY_NAME' put: [self libraryName];
    at: #'OBJECTS' put: [self generateObjects_make_dot_spec];  
    yourself

    "Created: / 09-08-2006 / 11:21:06 / fm"
!

nt_dot_def_mappings

^Dictionary new
    at: #'LIBRARY_NAME' put: [self libraryName];
    at: #'DESCRIPTION' put: [self description storeString];
    at: #'VERSION_NUMBER' put: [self versionNumber];
    yourself

    "Created: / 09-08-2006 / 11:21:21 / fm"
!

nt_dot_mak_mappings

^Dictionary new
    at: #'TOP' put: [self msdosPathToTop]; 
    at: #'LOCAL_INCLUDES' put: [self generateMsdosLocalIncludes];
    yourself

    "Created: / 09-08-2006 / 11:44:36 / fm"
    "Modified: / 09-08-2006 / 20:00:01 / fm"
!

objectLine_make_dot_spec_mappings: aClassName

^Dictionary new                                               
    at: #'CLASS' put: [(Smalltalk classNamed:aClassName) classFilename asFilename withoutSuffix baseName];
    yourself

    "Created: / 08-08-2006 / 20:17:28 / fm"
    "Modified: / 09-08-2006 / 18:26:52 / fm"
!

replaceMappings: mappings in: fileTemplate
"Replaces the defined variable mappings found in a file template with the corresponding information"

^ fileTemplate bindWithArguments:mappings.

"
self replaceMappings: (self nt_dot_def_mappingsFor: self) in: self nt_dot_def  
"

    "Created: / 08-08-2006 / 11:44:27 / fm"
    "Modified: / 08-08-2006 / 12:46:13 / fm"
! !

!ProjectDefinition class methodsFor:'mappings support'!

generateClassLines_libInit_dot_cc

^self compiled_classNames 
    inject: ''
    into:[:classLines :className | 
        |newClassLine mappings|
        mappings := self classLine_libInit_dot_cc_mappings: className.
        newClassLine := self replaceMappings: mappings  
                            in: self classLine_libInit_dot_cc.
        classLines concatenate: newClassLine 
                    and: String lf
    ]

"
    DapasXProject generateClassLines_libInit_dot_cc
    DapasX_Datenbasis generateClassLines_libInit_dot_cc

"

    "Created: / 09-08-2006 / 11:21:48 / fm"
!

generateExtensionLine_libInit_dot_cc
      |mappings|
^self extensionMethodNames isEmpty
    ifTrue:['']
    ifFalse:[ mappings := self extensionLine_libInit_dot_cc_mappings.
              self replaceMappings: mappings  
                            in: self extensionLine_libInit_dot_cc.]
"
    DapasXProject generateExtensionLine_libInit_dot_cc
    DapasX_Datenbasis generateExtensionLine_libInit_dot_cc

"

    "Created: / 09-08-2006 / 11:23:34 / fm"
!

generateMsdosLocalIncludes

^self searchForProjectsWhichProvideHeaderFiles
    inject: ''
    into:[:objectLines :includeProjectName |    
            objectLines , ' -I',(self msdosPathToPackage: includeProjectName) 
    ]

"
    DapasXProject generateLocalIncludes
    DapasX_Datenbasis generateLocalIncludes

"

    "Created: / 09-08-2006 / 16:46:49 / fm"
!

generateObjects_make_dot_spec 
    |pivateClassesOf classes|

    classes := self compiled_classes.
    pivateClassesOf := IdentityDictionary new.
    classes do:[:each | pivateClassesOf at:each put:(each allPrivateClasses)].

    classes topologicalSort:[:a :b |
        "/ a must come before b iff:
        "/    b is a subclass of a
        "/    b has a private class which is a subclass of a

        |mustComeBefore pivateClassesOfB|
        mustComeBefore := b isSubclassOf:a.
        pivateClassesOfB := pivateClassesOf at:b.
        pivateClassesOfB do:[:eachClassInB |
            mustComeBefore := mustComeBefore or:[eachClassInB isSubclassOf:a]
        ].
        mustComeBefore
    ].

    ^ String streamContents:[:s |
        classes do:[:eachClass |
            |mappings newObjectLine|

            mappings := self objectLine_make_dot_spec_mappings: eachClass name.
            newObjectLine := self replaceMappings: mappings in: self objectLine_make_dot_spec.
            s nextPutAll:newObjectLine. 
            s cr. 
        ]
    ]
"
    DapasXProject generateObjects_make_dot_spec
    DapasX_Datenbasis generateObjects_make_dot_spec

"

    "Created: / 09-08-2006 / 11:24:39 / fm"
!

generatePrerequisiteProjectsPaths

^self prerequisiteProjects
    inject: ''
    into:[:objectLines :subProjectName |    
        objectLines
            concatenate: String lf
            and: ' -I'
            and: subProjectName 
    ]

"
    DapasXProject generatePrerequisiteProjectsPaths
    DapasX_Datenbasis generatePrerequisiteProjectsPaths

"

    "Created: / 09-08-2006 / 12:34:20 / fm"
!

generateSubDirectories

^self subProjects 
    inject: ''
    into:[:objectLines :subProjectName |    
        objectLines
            concatenate: ' '
            and: subProjectName 
    ]

"
    DapasXProject generateSubDirectories
    DapasX_Datenbasis generateSubDirectories

"

    "Created: / 09-08-2006 / 11:26:59 / fm"
!

generateUnixLocalIncludes

^self searchForProjectsWhichProvideHeaderFiles
    inject: ''
    into:[:objectLines :includeProjectName |    
            objectLines , ' -I',(self unixPathToPackage: includeProjectName) 
    ]

"
    DapasXProject generateLocalIncludes
    DapasX_Datenbasis generateLocalIncludes

"

    "Created: / 09-08-2006 / 16:46:49 / fm"
!

prerequisiteProjectsOrdered

^self prerequisiteProjects asSortedCollection:[:a :b | ]

"
    DapasXProject generatePrerequisiteProjectsPaths
    DapasX_Datenbasis generatePrerequisiteProjectsPaths

"

    "Created: / 09-08-2006 / 13:12:01 / fm"
! !

!ProjectDefinition class methodsFor:'project description'!

autoloaded_classNames
    "classes listed here will NOT be compiled, but remain autoloaded.
     to be excluded from the build process can be user-defined in my subclasses"

    ^#()

    "Created: / 07-08-2006 / 19:02:57 / fm"
    "Modified: / 07-08-2006 / 21:25:25 / fm"
!

classNames            
    "this is a stupid default, a correponding method with real names
     is generated in my subclasses"

    ^#()

    "Created: / 07-08-2006 / 19:02:57 / fm"
    "Modified: / 07-08-2006 / 21:25:25 / fm"
!

compiled_classNames          
    "this is a stupid default, a correponding method with real names
     is generated in my subclasses"

    ^#()

    "Created: / 07-08-2006 / 19:02:57 / fm"
    "Modified: / 07-08-2006 / 21:25:25 / fm"
!

compiled_classes
    ^ self compiled_classNames collect:[:eachName| (Smalltalk at:eachName asSymbol)]

    "Created: / 09-08-2006 / 16:28:15 / fm"
    "Modified: / 09-08-2006 / 18:02:28 / fm"
!

compiled_classesDo:aBlock
    self compiled_classes do:aBlock.

    "Created: / 09-08-2006 / 16:28:15 / fm"
    "Modified: / 09-08-2006 / 18:02:28 / fm"
!

description
"Returns a description string which will appear in nt.def and in the files info inside it's properties "

^''

    "Created: / 08-08-2006 / 11:15:01 / fm"
!

excluded_classNames
    "this is a stupid default, a correponding method with real names
     to be excluded from the build process can be user-defined in my subclasses"

    ^#()

    "Created: / 07-08-2006 / 19:02:57 / fm"
    "Modified: / 07-08-2006 / 21:25:25 / fm"
!

extensionMethodNames

    ^#()

    "Created: / 08-08-2006 / 11:07:08 / fm"
!

postLoadAction
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility

    "Created: / 08-08-2006 / 11:07:40 / fm"
!

preUnloadAction
    "raise an error: must be redefined in concrete subclass(es)"

    ^ self subclassResponsibility

    "Created: / 08-08-2006 / 11:07:40 / fm"
!

prerequisiteProjects

    ^#()

    "Created: / 08-08-2006 / 21:17:34 / fm"
!

subProjects

    ^#()

    "Created: / 08-08-2006 / 11:08:23 / fm"
!

versionNumber
"Returns a version string which will appear in nt.def and in the files info inside it's properties "

^''

    "Created: / 08-08-2006 / 11:35:52 / fm"
! !

!ProjectDefinition class methodsFor:'public update description'!

compileDescriptionMethods
    self compileClassNames.
    self compileExtensionMethodNames.

"
    DapasXProject compileDescriptionMethods
    DapasX_Datenbasis compileDescriptionMethods
    bosch_dapasx_interactiver_editor_Definition compileDescriptionMethods
"

    "Created: / 09-08-2006 / 18:00:31 / fm"
! !

!ProjectDefinition class methodsFor:'sanity checks'!

searchForInconsistencies
    self searchForNeverCompiledSuperclasses.

"
    self searchForInconsistencies
    DapasX_Datenbasis searchForInconsistencies  
"

    "Created: / 09-08-2006 / 16:30:46 / fm"
!

searchForNeverCompiledSuperclasses
      self compiled_classesDo:[:includedClass | 
            includedClass allSuperclassesDo:[:eachSuperClass |
                eachSuperClass package == Project noProjectID ifTrue:[ 
                    self inconsistency:'uncompiled superclass: ' , eachSuperClass name
                ].
            ]
      ].

"
    self searchForNeverCompiledSuperclasses
    DapasX_Datenbasis searchForNeverCompiledSuperclasses  
"

    "Created: / 09-08-2006 / 16:31:54 / fm"
! !

!ProjectDefinition class methodsFor:'update description'!

autoloadedClassNamesGeneratedCodeToCompile
    |classNamesCode|

   classNamesCode := 'autoloaded_classNames', String lf, '"This method has been automatically generated"'.
   classNamesCode := classNamesCode, String lf, self autoloadedClassNamesGeneratedString. 
   ^classNamesCode

"
    DapasXProject autoloadedClassNamesGeneratedCodeToCompile
    DapasX_Datenbasis autoloadedClassNamesGeneratedCodeToCompile

"

    "Created: / 08-08-2006 / 15:07:06 / fm"
!

autoloadedClassNamesGeneratedString
    | |

    ^ String streamContents:[:s |
        s nextPutAll:'^#('.
        self searchForClassesWithProject do:[:eachClass |
            (eachClass wasAutoloaded or:[ eachClass isLoaded not ]) ifTrue:[
                (self compiled_classNames includes:eachClass name) ifFalse:[
                    (self excluded_classNames includes:eachClass name) ifFalse:[
                        s cr; nextPutAll:eachClass name asString storeString
                    ]
                ]
             ]
        ].
        s cr; nextPutAll:')'
    ].

"
    bosch_dapasx_interactiver_editor_Definition autoloadedClassNamesGeneratedString
"

    "Created: / 08-08-2006 / 15:00:17 / fm"
    "Modified: / 08-08-2006 / 19:24:34 / fm"
!

classNamesGeneratedCodeToCompile
    |classNamesCode|

   classNamesCode := 'compiled_classNames', String lf, '"This method has been automatically generated"'.
   classNamesCode := classNamesCode, String lf, self classNamesGeneratedString. 
   ^classNamesCode

"
    DapasXProject Datenbasis
    DapasX_Datenbasis Datenbasis

"

    "Created: / 08-08-2006 / 15:07:06 / fm"
!

classNamesGeneratedString
    | |

    ^ String streamContents:[:s |
        s nextPutAll:'^#('.
        self searchForClassesWithProject do:[:eachClass |
            (self autoloaded_classNames includes:eachClass name) ifFalse:[ 
                (self excluded_classNames includes:eachClass name) ifFalse:[ 
                    s cr; nextPutAll:eachClass name asString storeString
                 ]
             ]
        ].
        s cr; nextPutAll:')'
    ].

"
    bosch_dapasx_interactiver_editor_Definition classNamesGeneratedString
"

    "Created: / 08-08-2006 / 15:00:17 / fm"
    "Modified: / 08-08-2006 / 19:24:34 / fm"
!

compileClassNames                                                               
   self theMetaclass 
        compile: self autoloadedClassNamesGeneratedCodeToCompile
        classified: 'project description'.

   self theMetaclass 
        compile: self classNamesGeneratedCodeToCompile
        classified: 'project description'.

   (self theMetaclass includesSelector:#excluded_classNames) ifFalse:[
       self theMetaclass 
            compile: 'excluded_classNames\^ #()' withCRs
            classified: 'project description'.
   ].

"
    bosch_dapasx_interactiver_editor_Definition compileClassNames

    DapasXProject compileClassNames
    DapasX_Datenbasis compileClassNames

    DapasXProject classNamesGeneratedCodeToCompile
    DapasX_Datenbasis classNamesGeneratedCodeToCompile

"

    "Modified: / 08-08-2006 / 15:58:21 / fm"
!

compileDescription                                                              

   self theMetaclass compile: 'description ^''bla bla'''
                     classified: 'project description'

"
    DapasXProject compileClassNames
    DapasX_Datenbasis compileClassNames

    DapasXProject classNamesGeneratedCodeToCompile
    DapasX_Datenbasis classNamesGeneratedCodeToCompile

"

    "Created: / 09-08-2006 / 18:31:48 / fm"
!

compileExtensionMethodNames                                                               

   self theMetaclass compile: self extensionMethodNamesGeneratedCodeToCompile
                     classified: 'project description'

"
    DapasXProject compileExtensionMethodNames
    DapasX_Datenbasis compileExtensionMethodNames

    DapasXProject extensionMethodNamesGeneratedCodeToCompile
    DapasX_Datenbasis extensionMethodNamesGeneratedCodeToCompile

"

    "Created: / 08-08-2006 / 18:53:27 / fm"
!

extensionMethodNamesGeneratedCodeToCompile
    |extensionMethodNamesCode|

   extensionMethodNamesCode := 'extensionMethodNames', String lf, '"This method has been automatically generated"'.
   extensionMethodNamesCode := extensionMethodNamesCode, String lf, self extensionMethodNamesGeneratedString. 
   ^extensionMethodNamesCode

"
    DapasXProject extensionMethodNamesGeneratedCodeToCompile
    DapasX_Datenbasis extensionMethodNamesGeneratedCodeToCompile

"

    "Created: / 08-08-2006 / 18:54:42 / fm"
!

extensionMethodNamesGeneratedString
    |generatedString |

    generatedString := self searchForExtensionsWithProject 
            inject: '^#(' 
            into:[:string :each | 
                string, String lf, each mclass name asString storeString, ' #', each name ]. 
    ^generatedString, String lf, ')'

"
    self extensionMethodNamesGeneratedString
"

    "Created: / 08-08-2006 / 18:55:04 / fm"
!

inconsistency:message
    Dialog warn:message

"
    self searchForNeverCompiledSuperclasses
    DapasX_Datenbasis searchForNeverCompiledSuperclasses  
"

    "Created: / 09-08-2006 / 16:32:31 / fm"
!

searchForClassesNamesWithProject

    ^self searchForClassesWithProject collect:[:each | each name]. 

"
    self searchForClassesNamesWithProject
"

    "Created: / 07-08-2006 / 21:37:06 / fm"
!

searchForClassesWithProject

    ^ Smalltalk allClasses select:[:cls | cls package == self package].

"
    self searchForClassesWithProject
"

    "Created: / 07-08-2006 / 20:42:39 / fm"
    "Modified: / 07-08-2006 / 21:56:25 / fm"
!

searchForExtensionsForProject:aProjectID
    |methods|

    methods := IdentitySet new.
    Smalltalk allClassesDo:[:eachClass |
        |classPackage|

        classPackage := eachClass package.
        eachClass instAndClassMethodsDo:[:mthd |
            mthd package ~= classPackage ifTrue:[ 
                mthd package == aProjectID ifTrue:[
                    methods add:mthd 
                ]
            ].
        ].
    ].
    ^ methods
"
    self searchForExtensionsForProject:#'bosch:dapasx'
"

    "Created: / 07-08-2006 / 22:03:55 / fm"
!

searchForExtensionsWithProject
    ^ self searchForExtensionsForProject:self package

"
    self searchForExtensionsWithProject
    DapasXProject searchForExtensionsWithProject
    DapasX_Datenbasis searchForExtensionsWithProject

"

    "Created: / 07-08-2006 / 21:03:10 / fm"
    "Modified: / 09-08-2006 / 13:01:26 / fm"
!

searchForProjectsWhichProvideHeaderFiles
      |myPackageID requiredPackages|

      requiredPackages := Set new.
      myPackageID := self package.

      self compiled_classesDo:[:includedClass | 
            includedClass allSuperclassesDo:[:eachSuperClass |
                ((eachSuperClass package ~= myPackageID)
                and:[ (self moduleOfClass: eachSuperClass) ~= 'stx' ])
                    ifTrue:[
                        eachSuperClass package == Project noProjectID ifFalse:[
                            requiredPackages add:(eachSuperClass package).
                        ]
                    ]
            ]
      ].
      ^ requiredPackages

"
    self searchForProjectsWhichProvideHeaderFiles
    DapasX_Datenbasis searchForProjectsWhichProvideHeaderFiles  
"

    "Created: / 09-08-2006 / 16:26:37 / fm"
! !

!ProjectDefinition class methodsFor:'xxx'!

try
   ^ 'hhh' , '989898'

    "Created: / 09-08-2006 / 16:50:52 / fm"
!

try2
   ^ 1 + 2

    "Created: / 09-08-2006 / 16:53:16 / fm"
! !

!ProjectDefinition methodsFor:'others'!

classNames
"This method has been automatically generated"
    ^OrderedCollection new
        add: #'DAPASX::IStreamHierarchyObject'
        add: #'DAPASX::ProjCFHierarchyObject'
        add: #'DAPASX::IStorage'
        add: #'DAPASX::OLECompoundFile'
        add: #'DAPASX::DapasDBIStreamHierarchyObject'
        add: #'DAPASX::OLEStorageElementInterface'
        add: #'DAPASX::CompoundFileHierarchyObject'
        add: #ProjectDefinition
        yourself

    "Created: / 08-08-2006 / 15:22:59 / fm"
! !

!ProjectDefinition class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/LibraryDefinition.st,v 1.7 2006-08-09 20:42:33 fm Exp $'
! !