| 1 |
// Copyright(C) 1999-, 20212021, , , , , , , , , National Technology & Engineering Solutions |
| 2 |
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
// NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
// |
| 5 |
// See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
// Might be good to add a callback function which would be called |
| 8 |
// when there was output -- In LexerOutput for example. Default |
| 9 |
// could be to just write to std::cout or to resultsOutput stringstream... |
| 10 |
#pragma once |
| 11 |
|
| 12 |
#include <string> |
| 13 |
#include <vector> |
| 14 |
|
| 15 |
namespace SEAMS { |
| 16 |
struct array |
| 17 |
{ |
| 18 |
std::vector<double> data{}; |
| 19 |
size_t rows{0}; |
| 20 |
size_t cols{0}; |
| 21 |
|
| 22 |
array(size_t r, size_t c) : rows(r), cols(c) { data.resize(r * c); } |
| 23 |
}; |
| 24 |
|
| 25 |
struct symrec |
| 26 |
{ |
| 27 |
std::string name{}; |
| 28 |
std::string syntax{}; |
| 29 |
std::string info{}; |
| 30 |
int type; |
| 31 |
bool isInternal; |
| 32 |
struct value |
| 33 |
{ |
| 34 |
double var{0}; |
| 35 |
double (*fnctptr)(){nullptr}; |
| 36 |
double (*fnctptr_d)(double){nullptr}; |
| 37 |
double (*fnctptr_c)(char *){nullptr}; |
| 38 |
double (*fnctptr_dc)(double, char *){nullptr}; |
| 39 |
double (*fnctptr_cd)(char *, double){nullptr}; |
| 40 |
double (*fnctptr_cc)(char *, char *){nullptr}; |
| 41 |
double (*fnctptr_dd)(double, double){nullptr}; |
| 42 |
double (*fnctptr_ddd)(double, double, double){nullptr}; |
| 43 |
double (*fnctptr_ccc)(char *, char *, char *){nullptr}; |
| 44 |
double (*fnctptr_ccd)(char *, char *, double){nullptr}; |
| 45 |
double (*fnctptr_dddd)(double, double, double, double){nullptr}; |
| 46 |
double (*fnctptr_ddddc)(double, double, double, double, char *){nullptr}; |
| 47 |
double (*fnctptr_dddddd)(double, double, double, double, double, double){nullptr}; |
| 48 |
double (*fnctptr_a)(const array *){nullptr}; |
| 49 |
std::string svar{}; |
| 50 |
const char *(*strfnct)(){nullptr}; |
| 51 |
const char *(*strfnct_c)(char *){nullptr}; |
| 52 |
const char *(*strfnct_d)(double){nullptr}; |
| 53 |
const char *(*strfnct_a)(const array *){nullptr}; |
| 54 |
const char *(*strfnct_dd)(double, double){nullptr}; |
| 55 |
const char *(*strfnct_cc)(char *, char *){nullptr}; |
| 56 |
const char *(*strfnct_cd)(char *, double){nullptr}; |
| 57 |
const char *(*strfnct_ccc)(char *, char *, char *){nullptr}; |
| 58 |
const char *(*strfnct_dc)(double, char *){nullptr}; |
| 59 |
const char *(*strfnct_dcc)(double, char *, char *){nullptr}; |
| 60 |
const char *(*strfnct_dcccc)(double, char *, char *, char *, char *){nullptr}; |
| 61 |
array *avar{nullptr}; /* Array Variable */ |
| 62 |
array *(*arrfnct_c)(const char *){nullptr}; |
| 63 |
array *(*arrfnct_cc)(const char *, const char *){nullptr}; |
| 64 |
array *(*arrfnct_cd)(const char *, double){nullptr}; |
| 65 |
array *(*arrfnct_ddd)(double, double, double){nullptr}; |
| 66 |
array *(*arrfnct_dd)(double, double){nullptr}; |
| 67 |
array *(*arrfnct_d)(double){nullptr}; |
| 68 |
array *(*arrfnct_a)(const array *){nullptr}; |
| 69 |
} value; |
| 70 |
symrec *next; |
| 71 |
|
| 72 |
symrec(const char *my_name, int my_type, bool is_internal = false) |
| 73 |
: name(my_name), syntax(my_name), info("UNDEFINED"), type(my_type), isInternal(is_internal), |
| 74 |
next(nullptr) |
| 75 |
{ |
| 76 |
value.var = 0; |
| 77 |
} |
| 78 |
|
| 79 |
symrec(const std::string &my_name, int my_type, bool is_internal = false) |
| 80 |
: name(my_name), syntax(my_name), info("UNDEFINED"), type(my_type), isInternal(is_internal), |
| 81 |
next(nullptr) |
| 82 |
{ |
| 83 |
value.var = 0; |
| 84 |
} |
| 85 |
}; |
| 86 |
} // namespace SEAMS |