Cface__GeneratorCommand.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 06 Jul 2015 07:18:24 +0100
changeset 36 4e586238a9f7
parent 32 d7464405cbda
child 43 9327987437ae
permissions -rw-r--r--
Fix in class generator (MethofDefinitionChange>>classVariableNames: now takes collection, not string)

"{ Package: 'jv:cface' }"

"{ NameSpace: Cface }"

Object subclass:#GeneratorCommand
	instanceVariableNames:'platform mappings definitions unixLibraryName win32LibraryName'
	classVariableNames:''
	poolDictionaries:''
	category:'Cface-Generators'
!


!GeneratorCommand class methodsFor:'projects'!

generateCairo

    | cairoDefFile |

    cairoDefFile := (Smalltalk packageDirectoryForPackageId: 'jv:cface')
                    / 'resources' / 'examples' / 'libcairo' / 'libcairo.def'.
    cairoDefFile exists ifFalse:[
        self error:'Cannot find libcairo.def'
    ].

    ^Cface::Platform theInstance generatorCommand
        definitions: cairoDefFile asFilename;
        mappings: Cface::CairoMapping new;
        unixLibraryName:'libcairo.so.2';
        win32LibraryName:'cairo.dll';
        process.

    "
        Cface::GeneratorCommand generateCairo
    "

    "Created: / 03-07-2008 / 23:55:14 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 22-01-2009 / 19:10:08 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 12-07-2011 / 15:54:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

generateGTK

    |gtkDir gtkDefFile|

    gtkDir := '/home/jv/Projects/Cface/cface/resources/examples/libgtk/'.
    gtkDefFile := gtkDir ,  'libgtk.def'.  

    ^Cface::Platform theInstance generatorCommand
        definitions: gtkDefFile asFilename;
        mappings: Cface::GTKMapping new;
        unixLibraryName:'libgtk-x11-2.0.so';
        process

    "
        Cface::GeneratorCommand generateSubversion
    "

    "Created: / 22-02-2009 / 14:44:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

generateLibgit2

    |svnDir libgit2DefFile|

    svnDir := '/home/jv/Projects/Cface/sources/cface/trunk/resources/examples/libgit2/'.
    libgit2DefFile := svnDir ,  'libgit2.def'.  

    ^Cface::Platform theInstance generatorCommand
        definitions: libgit2DefFile asFilename;
        mappings: Cface::Libgit2Mapping new;
        unixLibraryName:'libgit2.so';
        win32LibraryName:'git2.dll';
        process

    "
        Cface::GeneratorCommand generateLibgit2
    "

    "Created: / 05-09-2012 / 10:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

generateSubversion

    |svnDir svnDefFile|

    svnDir := '/home/jv/Projects/Cface/cface/resources/examples/libsvn/'.
    svnDefFile := svnDir ,  'libsvn.def'.  

    ^Cface::Platform theInstance generatorCommand
        definitions: svnDefFile asFilename;
        mappings: Cface::SVNMapping new;
        unixLibraryName:'libsvn.so';
        process

    "
        Cface::GeneratorCommand generateSubversion
    "

    "Created: / 03-07-2008 / 23:55:54 / Jan Vrany <vranyj1@fel.cvut.cz>"
    "Modified: / 06-01-2009 / 12:16:47 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!GeneratorCommand methodsFor:'accessing'!

definitions
    ^ definitions

    "Created: / 18-02-2008 / 15:36:22 / janfrog"
!

definitions:aFilename
    definitions := self platform parser parse: aFilename contents asString.

    "Created: / 18-02-2008 / 15:36:22 / janfrog"
!

mappings
    ^ mappings ifNil:[platform mappings]

    "Created: / 18-02-2008 / 15:35:04 / janfrog"
    "Modified: / 27-05-2008 / 14:22:00 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

mappings:something
    mappings := something.

    "Created: / 18-02-2008 / 15:35:04 / janfrog"
!

platform

    platform ifNil:[platform := Cface::Platform theInstance].
    ^platform

    "Created: / 18-02-2008 / 15:28:45 / janfrog"
!

platform:something
    platform := something.

    "Created: / 18-02-2008 / 15:30:12 / janfrog"
!

typeMapper

    ^platform typeMapper

    "Created: / 18-02-2008 / 15:30:40 / janfrog"
!

typeResolver

    ^platform typeResolver

    "Created: / 18-02-2008 / 15:30:32 / janfrog"
!

unixLibraryName
    ^ unixLibraryName

    "Created: / 10-07-2008 / 09:07:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

unixLibraryName:something
    unixLibraryName := something.

    "Created: / 10-07-2008 / 09:07:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

win32LibraryName
    ^ win32LibraryName

    "Created: / 10-07-2008 / 09:07:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
!

win32LibraryName:something
    win32LibraryName := something.

    "Created: / 10-07-2008 / 09:07:56 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!GeneratorCommand methodsFor:'processing'!

process


    self platform typeResolver process: definitions.
    self platform typeMapper process: definitions using: self mappings.
    ^self platform generator 
        unixLibraryName: unixLibraryName;
        win32LibraryName: win32LibraryName;
        process: definitions.

    "Created: / 18-02-2008 / 15:25:54 / janfrog"
    "Modified: / 10-07-2008 / 09:08:18 / Jan Vrany <vranyj1@fel.cvut.cz>"
! !

!GeneratorCommand class methodsFor:'documentation'!

version
    ^ '$Id$'
!

version_SVN
    ^ '$Id$'
! !