Fix suggested by Ulenspiegel.
Also added testcase for the same.
else:
yield '/* Generated by %s at %s. */\n\n' % (nanopb_version, time.asctime())
- symbol = make_identifier(headername)
+ if self.fdesc.package:
+ symbol = make_identifier(self.fdesc.package + '_' + headername)
+ else:
+ symbol = make_identifier(headername)
yield '#ifndef PB_%s_INCLUDED\n' % symbol
yield '#define PB_%s_INCLUDED\n' % symbol
try:
incpath = env.Clone()
incpath.Append(PROTOCPATH = '#multiple_files')
+incpath.Append(CPPPATH = '$BUILD/multiple_files')
incpath.NanopbProto(["multifile1", "multifile1.options"])
incpath.NanopbProto("multifile2")
-test = incpath.Program(["test_multiple_files.c", "multifile1.pb.c", "multifile2.pb.c"])
+incpath.NanopbProto("subdir/multifile2")
+test = incpath.Program(["test_multiple_files.c", "multifile1.pb.c",
+ "multifile2.pb.c", "subdir/multifile2.pb.c"])
env.RunTest(test)
--- /dev/null
+syntax = "proto2";
+
+package subdir;
+
+import "multifile1.proto";
+
+message Callback2Message {
+ required TestMessage tstmsg = 1;
+ required SubMessage submsg = 2;
+}
+
+message OneofMessage {
+ oneof msgs {
+ StaticMessage tstmsg = 1;
+ }
+}
+
+message Enums {
+ required SignedEnum senum = 1;
+ required UnsignedEnum uenum = 2;
+}
+
+message SubdirMessage {
+ required int32 foo = 1 [default = 15];
+}
#include <pb_encode.h>
#include "unittests.h"
#include "multifile2.pb.h"
+#include "subdir/multifile2.pb.h"
int main()
{
TEST(PB_LTYPE(Enums_fields[0].type) == PB_LTYPE_VARINT);
TEST(PB_LTYPE(Enums_fields[1].type) == PB_LTYPE_UVARINT);
+ /* Test that subdir file is correctly included */
+ {
+ subdir_SubdirMessage foo = subdir_SubdirMessage_init_default;
+ TEST(foo.foo == 15);
+ /* TEST(subdir_OneofMessage_size == 27); */ /* TODO: Issue #172 */
+ }
+
return status;
}