2 Appendix (examples)
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • Google's Protocol Buffers Library
        • Appendix (examples)
          • Example directories
          • Example: A Simple XML Like Structure
          • Example: Vectors of Numbers
          • Example: Heterogeneous Collections

2.1 Example directories

The examples are in‘/usr/share/swi-prolog/doc/packages/examples/protobufs`, which is part of the swi-prolog-doc package. Each directory has a README. To run these, you will need to copy them to a writeable directory.

  • bootstrap - This contains the file common.mk file, which is used by the demo and interop Makefiles.
  • demo - the test goal runs some examples.
  • interop - used for testing interoperability with C++ and Python Additional tests are in test\_protobufs.pl.

    See also Addressbook example (section 1.3.3).

    The protobuf compiler (protoc) uses two protobuf formats to communicate with the plugin:

  • plugin.proto
  • descriptor.proto The Prolog code that were generated from these, as part of the bootstrap process, are:
  • plugin\_pb.pl
  • descriptor\_pb.pl