Sha256: f55ea6504b364b054af5867b660b1bb3f99bcaf9546ba84343ab2b427ae5f162

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

// <%= pbm.url %>

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

<% if pbm.options.interactive -%>
#define DEBUG
<% end -%>
#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)

<% if pbm.options.interactive -%>
//------------------------------------------------------------------------------
#ifdef DEBUG
string source;
vector<string> responses;
#endif

string query(string req) {
  cout << "? " << req << endl;
  string res;
#ifdef DEBUG
  res = "*** generate response from source ***";
  responses.push_back(res);
#else
  cin >> res;
#endif
  return res;
}

//------------------------------------------------------------------------------
<% end -%>
<% unless (consts = gen_consts).empty?  -%>
<% consts.each do |line| -%>
<%= line %>
<% end -%>

<% end -%>
<% unless (global_decls = gen_global_decls).empty? -%>
<% global_decls.each do |line| -%>
<%= line %>
<% end -%>

<% end -%>
int main() {
<% gen_local_decls.each do |line| -%>
  <%= line %>
<% end -%>
<% if pbm.options.interactive -%>
#ifdef DEBUG
  cin >> source;
#endif
<% end -%>

<% if pbm.options.interactive -%>
  string ans;
  cout << "! " << ans << endl;
#ifdef DEBUG
  cout << "query count: " << responses.size() << endl;
  cout << "query results:" << endl;
  for (string res : responses) cout << res << endl;
#endif
<% elsif (vs = pbm.options.binary_values) -%>
  bool cond = false;
  cout << (cond ? "<%= vs[0] %>" : "<%= vs[1] %>") << endl;
<% else -%>
  int ans = 0;
  cout << ans << endl;
<% end -%>
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
at_coder_friends-generator-cxx_iostream-0.1.2 templates/cxx_iostream.cxx.erb
at_coder_friends-generator-cxx_iostream-0.1.1 templates/cxx_iostream.cxx.erb
at_coder_friends-generator-cxx_iostream-0.1.0 templates/cxx_iostream.cxx.erb