KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > generator > psdl > lib > PSDLGenerator


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library 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 GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Christophe Demarey.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.generator.psdl.lib;
28
29 // Package dependencies
30
import org.objectweb.openccm.ast.api.DeclarationKind;
31
32
33 public class PSDLGenerator
34      extends org.objectweb.openccm.generator.idl.lib.IDL3Generator
35   implements org.objectweb.openccm.generator.psdl.api.PSDLGenerator
36 {
37
38     // ===========================================================
39
//
40
// Constructors.
41
//
42
// ===========================================================
43

44     /**
45      * The default constructor.
46      *
47      * @param ast - The Abstract Syntax Tree.
48      */

49
50     public PSDLGenerator(org.objectweb.openccm.ast.api.AST ast)
51     {
52         // Call the IDL3Generator constructor
53
super(ast);
54
55         // Init internal states
56
translator_ = new org.objectweb.openccm.generator.translator.ast2idl.lib.AST_PSDLTranslator();
57     }
58
59     // ===========================================================
60
//
61
// Internal methods.
62
//
63
// ===========================================================
64

65     /**
66      * Initialize the generator.
67      **/

68     public void
69     initialize(String JavaDoc outputfile, String JavaDoc app_name)
70     {
71         java.util.List JavaDoc list = new java.util.ArrayList JavaDoc();
72
73         /** Initialize environment **/
74
75         // Templates to use.
76
list.clear();
77         list.add("org/objectweb/openccm/generator/common/common.vm");
78         list.add("org/objectweb/openccm/generator/idl/idl3.vm");
79         list.add("org/objectweb/openccm/generator/psdl/psdl.vm");
80         setLibrary(list);
81
82         // The output file
83
open(outputfile, "out");
84
85         // call the common generator init method
86
super.init();
87
88         /** Initialize velocity context **/
89         put("which", app_name);
90         put("gen", this);
91         put("translator", translator_);
92         put("declarator", "");
93         put("limited_types" , new Long JavaDoc(org.objectweb.openccm.ast.api.DeclarationKind.dk_psdl));
94     }
95
96     // ===========================================================
97
//
98
// Useful methods for PSDL Mapping.
99
//
100
// ===========================================================
101

102     /**
103      * Utility method to check forward declarations.
104      *
105      * @return The associated search mask.
106      **/

107     public long
108     forward_check()
109     {
110         return ( DeclarationKind.dk_abstract_storage_home +
111                  DeclarationKind.dk_abstract_storage_type +
112                  DeclarationKind.dk_storage_type );
113     }
114
115 }
116
Popular Tags