~ubuntu-branches/ubuntu/raring/babel/raring-proposed

« back to all changes in this revision

Viewing changes to compiler/gov/llnl/babel/backend/ucxx/GenerateCxxServer.java

  • Committer: Bazaar Package Importer
  • Author(s): Adam C. Powell, IV
  • Date: 2008-08-01 07:56:58 UTC
  • mfrom: (3.1.2 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080801075658-9ezcrbh8dcs8lg70
Tags: 1.2.0.dfsg-6
Added libparsifal-dev as dependency to libsidl-dev (closes: #483324).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
// File:        GenerateCxxServer.java
3
3
// Package:     gov.llnl.babel.backend.ucxx
4
 
// Revision:    @(#) $Revision: 4434 $
5
 
// Date:        $Date: 2005-03-17 09:05:29 -0800 (Thu, 17 Mar 2005) $
 
4
// Revision:    @(#) $Revision: 6196 $
 
5
// Date:        $Date: 2007-10-24 16:42:37 -0700 (Wed, 24 Oct 2007) $
6
6
// Description: Generate a C++ client for a set of sidl symbols
7
7
// 
8
8
// Copyright (c) 2000-2001, The Regents of the University of Calfornia.
31
31
 
32
32
package gov.llnl.babel.backend.ucxx;
33
33
 
34
 
import java.util.Set;
35
 
import java.util.Iterator;
36
 
import java.util.TreeSet;
 
34
import gov.llnl.babel.Context;
37
35
import gov.llnl.babel.backend.CodeGenerationException;
38
36
import gov.llnl.babel.backend.CodeGenerator;
 
37
import gov.llnl.babel.symbols.Extendable;
39
38
import gov.llnl.babel.symbols.Symbol;
40
 
import gov.llnl.babel.symbols.Extendable;
41
39
import gov.llnl.babel.symbols.SymbolID;
42
40
import gov.llnl.babel.symbols.SymbolTable;
 
41
import java.util.Iterator;
 
42
import java.util.Set;
 
43
import java.util.TreeSet;
43
44
 
44
45
/**
45
46
 * <p>
50
51
 */
51
52
public class GenerateCxxServer implements CodeGenerator {
52
53
 
 
54
  private Context d_context = null;
 
55
 
53
56
   /**
54
57
    * Create a C++ client generator.
55
58
    */
72
75
   public void generateCode(Set symbols)
73
76
      throws CodeGenerationException
74
77
   {
75
 
      SymbolTable table = SymbolTable.getInstance();
 
78
     SymbolTable table = d_context.getSymbolTable();
76
79
      for(Iterator s = symbols.iterator(); s.hasNext() ; ){
77
80
         SymbolID id = (SymbolID)s.next();
78
81
         Symbol   symbol = table.lookupSymbol(id);
102
105
  private void generateExtendable(Extendable extendable)
103
106
    throws CodeGenerationException
104
107
  {
105
 
    CxxSkelSource skelsource = new CxxSkelSource(extendable);
 
108
    CxxSkelSource skelsource = new CxxSkelSource(extendable, d_context);
106
109
    skelsource.generateCode();
107
 
    CxxImplHeader implheader = new CxxImplHeader(extendable);
108
 
    CxxImplSource implsource = new CxxImplSource(extendable);
 
110
    CxxImplHeader implheader = new CxxImplHeader(extendable, d_context);
 
111
    CxxImplSource implsource = new CxxImplSource(extendable, d_context);
109
112
    implheader.generateCode();
110
113
    implsource.generateCode();
111
114
  }
125
128
    Set result = new TreeSet();
126
129
    result.add("uc++");
127
130
    result.add("ucxx");
 
131
    result.add("c++");
 
132
    result.add("cxx");
128
133
    return result;
129
134
  }
 
135
 
 
136
  public void setName(String name)
 
137
    throws CodeGenerationException
 
138
 {
 
139
    if (! getLanguages().contains(name)) {
 
140
      throw new CodeGenerationException
 
141
        ("\"" +name + "\" is not a valid name for the ucxx generator.");
 
142
    }
 
143
  }
 
144
 
 
145
  public String getName() { return "cxx"; }
 
146
 
 
147
  public void setContext(Context context) {
 
148
    d_context = context;
 
149
  }
130
150
}