On this page:
top
up

1Programming InterfaceπŸ”— i

(require (lib"protobuf/generator")) package: protobuf
Functions to convert Protocol Buffer descriptors into Racket code.
This module relies on the ProtoC plug-in interfaces which are available as racket modules generated from protocol buffer definitions themselves.

procedure

( proto-string->symbol str[prefix])symbol?

str:string?
prefix:any/c=#f
Reformats an identifier following protocol buffer definition conventions into a symbol, optionally adding a prefix.

The conversion proceeds as follows:
  • Camel case words are separated by - characters.

  • The entire string is converted to lower case.

  • Any occurrence of _ is replaced by -.

  • An is- prefix is replaced by a ? suffix.

  • The prefix, if present, is stringified and prepended to the identifier separated by :.

procedure

( register-types! typesproto)void?

types:(hash/cstring?(cons/csymbol?symbol?)#:immutable#f)
proto:file-descriptor-proto?
Register all types defined in proto in the hash types that maps the fully qualified protocol buffer names to pairs of 'enum or 'struct and an identifier.

procedure

( register-enum-type! typesproto)void?

types:(hash/cstring?(cons/csymbol?symbol?)#:immutable#f)
proto:enum-descriptor-proto?
Register the enumeration type described by proto in the hash types.

procedure

( register-message-types! typesproto)void?

types:(hash/cstring?(cons/csymbol?symbol?)#:immutable#f)
proto:descriptor-proto?
Register the message type described by proto and all its nested types in the hash types.

procedure

( type-ref typespackagename)(cons/csymbol?symbol?)

types:(hash/cstring?(cons/csymbol?symbol?))
package:string?
name:string?
Find the kind and identifier of a type in types specified by its protocol buffers package and name.

procedure

( translate-types typesproto)list?

types:(hash/cstring?(cons/csymbol?symbol?))
proto:file-descriptor-proto?
Translate all types defined in proto into module level Racket code. Use types for lookup of type references.

procedure

( translate-enum-type typespackageproto)any/c

types:(hash/cstring?(cons/csymbol?symbol?))
package:(or/cstring?#f)
proto:enum-descriptor-proto?
Translate the enumeration type described by proto into module level Racket code. Use types for lookup of type references.

procedure

package
proto)list?
types:(hash/cstring?(cons/csymbol?symbol?))
package:(or/cstring?#f)
proto:descriptor-proto?
Translate the message type described by proto and all its nested types into module level Racket code. Use types for lookup of type references.

procedure

( translate-extension typespackageproto)any/c

types:(hash/cstring?(cons/csymbol?symbol?))
package:(or/cstring?#f)
proto:field-descriptor-proto?
Translate the message type extension described by proto into module level Racket code. Use types for lookup of type references.

procedure

( generate-racket req)code-generator-response?

req:code-generator-request?
Process a code generation request and generate Racket code.

top
up

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /