/*$Id: u_lang.h,v 26.1 2006/09/12 07:11:18 al Exp $ -*- C++ -*- * Copyright (C) 2006 Albert Davis * Author: Albert Davis * * This file is part of "Gnucap", the Gnu Circuit Analysis Package * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef U_LANG_H #define U_LANG_H #include "io_.h" /*--------------------------------------------------------------------------*/ enum LANGUAGE {lAUTO, lSPICE, lVERILOG, lACS}; inline OMSTREAM& operator<<(OMSTREAM& o, LANGUAGE t) {untested(); const char* s[] = {"auto", "spice", "verilog", "acs"}; return (o << s[t]); } /*--------------------------------------------------------------------------*/ template void print_pair(OMSTREAM& o, LANGUAGE lang, const S& s, N n) { switch (lang) { case lACS: case lSPICE:{ std::string key = ' ' + std::string(s) + '='; o << key << n; break; } case lVERILOG:{ std::string key = " ." + std::string(s) + '('; o << key << n << ')'; break; } case lAUTO: unreachable(); } } /*--------------------------------------------------------------------------*/ template void print_pair_if_has_value(OMSTREAM& o, LANGUAGE lang, const S& s, N n) { if (n.has_value()) { print_pair(o, lang, s, n); }else{ } } /*--------------------------------------------------------------------------*/ void print_open_arg_list(OMSTREAM& o, LANGUAGE lang); void print_close_arg_list(OMSTREAM& o, LANGUAGE lang); /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ #endif