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)
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
25 /*--------------------------------------------------------------------------*/
33 /*--------------------------------------------------------------------------*/
34 class INTERFACE LANGUAGE
{
36 const CARD
* find_proto(const std::string
&, const CARD
*);
38 void new__instance(CS
& cmd
, MODEL_SUBCKT
* owner
, CARD_LIST
* Scope
);
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;
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;
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.
79 void print_pair(OMSTREAM
& o
, LANGUAGE
* lang
, const std::string
& name
,
80 T value
, bool test
=true)
84 std::string front
= lang
->arg_front() + name
+ lang
->arg_mid();
85 o
<< front
<< value
<< lang
->arg_back();
87 o
<< ' ' + name
+ '=' << value
;
92 /*--------------------------------------------------------------------------*/
93 /*--------------------------------------------------------------------------*/
95 // vim:ts=8:sw=2:noet: