Skip to content

Commit

Permalink
Merge pull request #169 from jlab/hSUM
Browse files Browse the repository at this point in the history
H sum
  • Loading branch information
sjanssen2 authored Jan 13, 2023
2 parents 7a1656a + fa97cd9 commit 68ab4f0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
13 changes: 10 additions & 3 deletions rtlib/generic_opts.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
#ifndef RTLIB_GENERIC_OPTS_HH_
#define RTLIB_GENERIC_OPTS_HH_


#include <unistd.h>
extern "C" {
#include <getopt.h>
#include <unistd.h>
}

#include <iostream>
#include <fstream>
Expand Down Expand Up @@ -99,7 +101,12 @@ class Opts {
#ifdef LIBRNA_RNALIB_H_
<< " (-[tT] [0-9]+)? (-P PARAM-file)?"
#endif
<< " (-[drk] [0-9]+)* (-h)? (INPUT|-f INPUT-file)\n";
<< " (-[drk] [0-9]+)* (INPUT|-f INPUT-file)\n\n"
#if defined(GAPC_CALL_STRING) && defined(GAPC_VERSION_STRING)
<< "GAPC call: \"" << GAPC_CALL_STRING << "\"\n"
<< "GAPC version: \"" << GAPC_VERSION_STRING << "\"\n"
#endif
<< "\n";
}

void parse(int argc, char **argv) {
Expand Down
9 changes: 8 additions & 1 deletion src/cpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ void Printer::Cpp::print_init_fn(const AST &ast) {

inc_indent();
stream << indent() << "const std::vector<std::pair<const char *, unsigned> >"
<< " &inp = opts.inputs;\n";
<< " &inp = opts.inputs;" << endl << endl;

print_buddy_init(ast);
print_seq_init(ast);
Expand Down Expand Up @@ -1722,12 +1722,19 @@ void Printer::Cpp::header(const AST &ast) {
stream << "#define DERIVATIVES\n";
}
}

stream << "#define GAPC_CALL_STRING \"" << gapc_call_string << "\""
<< endl;
stream << "#define GAPC_VERSION_STRING \"" << gapc_version_string << "\""
<< endl << endl;
includes();
print_subseq_typedef(ast);
print_type_defs(ast);
}

imports(ast);
print_hash_decls(ast);

stream << indent() << "class " << class_name << " {" << endl;
stream << indent() << " public:" << endl;
inc_indent();
Expand Down
10 changes: 7 additions & 3 deletions src/printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,20 @@ void Printer::Base::end_fwd_decls() {


void Printer::Base::set_argv(char **argv, int argc) {
std::ostringstream o;
std::ostringstream o, gapc_call;
o << "A dynamic programming evaluator generated by GAP-C.\n\n"
<< " GAP-C version:\n " << gapc::version_id << "\n\n"
<< " GAP-C call:\n ";
for (int i = 0; i < argc; ++i) {
o << argv[i];
gapc_call << argv[i];
if (i+1 < argc) {
o << ' ';
gapc_call << ' ';
}
}

gapc_version_string = gapc::version_id;
gapc_call_string = gapc_call.str();
o << gapc_call_string;
o << "\n\n";
id_string = o.str();
}
Expand Down
1 change: 1 addition & 0 deletions src/printer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Base {
bool fwd_decls;

std::string id_string;
std::string gapc_call_string, gapc_version_string;

public:
Base() : ind_count(0), out(std::cerr), line_number(0), stream(*this),
Expand Down

0 comments on commit 68ab4f0

Please sign in to comment.