static void writeConstant(std::ostream& out, const PhpConst& cns) { auto name = cns.name(); out << " \"" << escapeCpp(name) << "\", "; if (cns.hasValue()) { auto ser = cns.serialize(); out << castLong(ser.size()) << ", \"" << escapeCpp(ser) << "\",\n"; return; } if (cns.isSystem()) { // Special "magic" constants if (name == "SID") { out << "(const char *)((offsetof(EnvConstants, k_" << name << ") - " << "offsetof(EnvConstants, stgv_Variant)) / sizeof(Variant)), " << castLong(1) << ",\n"; return; } if ((name == "STDIN") || (name == "STDOUT") || (name == "STDERR")) { out << "(const char *)&BuiltinFiles::Get" << name << ", NULL,\n"; return; } } out << "(const char *)&" << cns.varname() << ", " << castLong((int)cns.kindOf() + 2) << ",\n"; }
static void writeConstant(std::ostream& out, const PhpConst& cns) { auto name = cns.name(); if (cns.isSystem() && ((name == "STDIN") || (name == "STDOUT") || (name == "STDERR") || (name == "SID"))) { assert(false); // Dynamic constants no longer supported in IDLs return; } out << " \"" << escapeCpp(name) << "\", "; if (cns.hasValue()) { auto ser = cns.serialize(); out << castLong(ser.size()) << ", \"" << escapeCpp(ser) << "\",\n"; return; } out << "(const char *)&" << cns.varname() << ", " << castLong((int)cns.kindOf() + 2) << ",\n"; }