viminfo
[gnucap-felix.git] / include / u_lang.h
blob14eaf04813d4b95cb64f793e3dd96891aa6b9cdd
1 /*$Id: u_lang.h,v 26.138 2013/04/24 02:32:27 al Exp $ -*- C++ -*-
2 * Copyright (C) 2006 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
12 * This program 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
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
22 #ifndef U_LANG_H
23 #define U_LANG_H
24 #include "u_opt.h"
25 /*--------------------------------------------------------------------------*/
26 class COMPONENT;
27 class MODEL_SUBCKT;
28 class MODEL_CARD;
29 class CARD;
30 class DEV_COMMENT;
31 class DEV_DOT;
32 class CARD_LIST;
33 /*--------------------------------------------------------------------------*/
34 class INTERFACE LANGUAGE {
35 public:
36 const CARD* find_proto(const std::string&, const CARD*);
37 public:
38 void new__instance(CS& cmd, MODEL_SUBCKT* owner, CARD_LIST* Scope);
40 public:
41 virtual ~LANGUAGE();
42 virtual std::string name()const = 0;
43 virtual bool case_insensitive()const = 0;
44 virtual UNITS units()const = 0;
45 public: // used by obsolete_callback
46 virtual std::string arg_front()const = 0;
47 virtual std::string arg_mid()const = 0;
48 virtual std::string arg_back()const = 0;
50 // in
51 public: // real public interface
52 virtual void parse_top_item(CS&, CARD_LIST*);
53 virtual CARD* parse_item(CS&, CARD*);
54 public: // called by commands and parse_item
55 virtual DEV_COMMENT* parse_comment(CS&, DEV_COMMENT*) = 0;
56 virtual DEV_DOT* parse_command(CS&, DEV_DOT*) = 0;
57 virtual MODEL_CARD* parse_paramset(CS&, MODEL_CARD*) = 0;
58 virtual MODEL_SUBCKT* parse_module(CS&, MODEL_SUBCKT*) = 0;
59 virtual COMPONENT* parse_instance(CS&, COMPONENT*) = 0;
60 virtual std::string find_type_in_string(CS&) = 0;
62 // out
63 public: // real public interface
64 virtual void print_item(OMSTREAM&, const CARD*);
65 private: // called by print_item
66 virtual void print_paramset(OMSTREAM&, const MODEL_CARD*) = 0;
67 virtual void print_module(OMSTREAM&, const MODEL_SUBCKT*) = 0;
68 virtual void print_instance(OMSTREAM&, const COMPONENT*) = 0;
69 virtual void print_comment(OMSTREAM&, const DEV_COMMENT*) = 0;
70 virtual void print_command(OMSTREAM&, const DEV_DOT*) = 0;
72 OMSTREAM& operator<<(OMSTREAM& o, LANGUAGE* x);
73 bool Get(CS&, const std::string& key, LANGUAGE** val);
74 /*--------------------------------------------------------------------------*/
75 // This is for backward compatibility only.
76 // It will be removed in the future.
77 // Do not use in new code.
78 template <class T>
79 void print_pair(OMSTREAM& o, LANGUAGE* lang, const std::string& name,
80 T value, bool test=true)
82 if (test) {
83 if (lang) {
84 std::string front = lang->arg_front() + name + lang->arg_mid();
85 o << front << value << lang->arg_back();
86 }else{
87 o << ' ' + name + '=' << value;
89 }else{
92 /*--------------------------------------------------------------------------*/
93 /*--------------------------------------------------------------------------*/
94 #endif
95 // vim:ts=8:sw=2:noet: