Commit cd75d5e5 authored by lahiker42's avatar lahiker42

- suppress final enum comma

- do not use c++ comments


git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@55 00440858-1255-0410-a3e6-75ea37f81c3a
parent 9e2a16a7
0.0: Initial release.
0.1: Lots of test code (and bug fixes).
0.2:
0.3: Minor pedantic concerns about generated code.
......@@ -52,12 +52,15 @@ void EnumGenerator::GenerateDefinition(io::Printer* printer) {
const EnumValueDescriptor* max_value = descriptor_->value(0);
vars["opt_comma"] = ",";
for (int i = 0; i < descriptor_->value_count(); i++) {
vars["name"] = descriptor_->value(i)->name();
vars["number"] = SimpleItoa(descriptor_->value(i)->number());
vars["prefix"] = FullNameToUpper(descriptor_->full_name()) + "__";
if (i + 1 == descriptor_->value_count())
vars["opt_comma"] = "";
printer->Print(vars, "$prefix$$name$ = $number$,\n");
printer->Print(vars, "$prefix$$name$ = $number$$opt_comma$\n");
if (descriptor_->value(i)->number() < min_value->number()) {
min_value = descriptor_->value(i);
......
......@@ -61,13 +61,13 @@ void FieldGenerator::GenerateDescriptorInitializerGeneric(io::Printer* printer,
" PROTOBUF_C_TYPE_$TYPE$,\n");
switch (descriptor_->label()) {
case FieldDescriptor::LABEL_REQUIRED:
printer->Print(variables, " 0, // quantifier_offset\n");
printer->Print(variables, " 0, /* quantifier_offset */\n");
break;
case FieldDescriptor::LABEL_OPTIONAL:
if (optional_uses_has) {
printer->Print(variables, " PROTOBUF_C_OFFSETOF($classname$, has_$name$),\n");
} else {
printer->Print(variables, " 0, // quantifier_offset\n");
printer->Print(variables, " 0, /* quantifier_offset */\n");
}
break;
case FieldDescriptor::LABEL_REPEATED:
......
......@@ -78,7 +78,7 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
// Generate top of header.
printer->Print(
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"/* Generated by the protocol buffer compiler. DO NOT EDIT! */\n"
"\n"
"#ifndef PROTOBUF_C_$filename_identifier$__INCLUDED\n"
"#define PROTOBUF_C_$filename_identifier$__INCLUDED\n"
......@@ -173,13 +173,13 @@ void FileGenerator::GenerateHeader(io::Printer* printer) {
printer->Print(
"\n"
"PROTOBUF_C_END_DECLS\n"
"\n\n#endif // PROTOBUF_$filename_identifier$__INCLUDED\n",
"\n\n#endif /* PROTOBUF_$filename_identifier$__INCLUDED */\n",
"filename_identifier", filename_identifier);
}
void FileGenerator::GenerateSource(io::Printer* printer) {
printer->Print(
"// Generated by the protocol buffer compiler. DO NOT EDIT!\n"
"/* Generated by the protocol buffer compiler. DO NOT EDIT! */\n"
"\n"
"#include \"$basename$.pb-c.h\"\n",
"basename", StripProto(file_->name()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment