Exemple #1
0
void c_write_node_in(node_t*n, state_t*s)
{
    if(node_is_array(n->child[1])) {
        array_t*a = n->child[1]->value.a;
        if(!a->size) {
            strf(s, "false");
            return;
        } else {
            constant_type_t etype = constant_array_subtype(&n->child[1]->value);
            switch(etype) {
                case CONSTANT_STRING:
                    strf(s, "!!strstr(\"");
                    int t;
                    for(t=0;t<a->size;t++) {
                        assert(a->entries[t].type == CONSTANT_STRING);
                        if(t) 
                            strf(s, "\\x7f");
                        write_escaped_string(s, a->entries[t].s);
                    }
                    strf(s, "\",");
                    write_node(s, n->child[0]);
                    strf(s, ")");
                    return;
            }
        }
    }
    strf(s, "find_in(");
    write_node(s, n->child[0]);
    strf(s, ",");
    write_node(s, n->child[1]);
    strf(s, ")");
}
Exemple #2
0
void
Writer::write(const std::string& name, const std::string& value,
              bool translatable)
{
  indent();
  *out << '(' << name;
  if(translatable) {
    *out << " (_ ";
    write_escaped_string(value);
    *out << "))\n";
  } else {
    *out << " ";
    write_escaped_string(value);
    *out << ")\n";
  }
}
Exemple #3
0
void
Writer::write(const std::string& name,
              const std::vector<std::string>& value)
{
  indent();
  *out << '(' << name;
  for(const auto& i : value) {
    *out << " ";
    write_escaped_string(i);
  }
  *out << ")\n";
}
Exemple #4
0
void
Writer::write(const std::string& name,
              const std::vector<std::string>& value)
{
  indent();
  *out << '(' << name;
  for(std::vector<std::string>::const_iterator i = value.begin(); i != value.end(); ++i) {
    *out << " ";
    write_escaped_string(*i);
  }
  *out << ")\n";
}
Exemple #5
0
void
Writer::start_list(const std::string& listname, bool string)
{
  indent();
  *out << '(';
  if(string)
    write_escaped_string(listname);
  else
    *out << listname;
  *out << '\n';
  indent_depth += 2;

  lists.push_back(listname);
}