blob: a5fd0f12aa726787ab0b3ac5a7edd6ef4274ee9f [file] [log] [blame]
Adam Cozzette501ecec2023-09-26 14:36:20 -07001// Protocol Buffers - Google's data interchange format
2// Copyright 2023 Google LLC. All rights reserved.
Adam Cozzette501ecec2023-09-26 14:36:20 -07003//
Hong Shinb837d172023-11-07 13:24:59 -08004// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
Adam Cozzette501ecec2023-09-26 14:36:20 -07007
Adam Cozzette12c7bb02023-09-28 12:54:11 -07008#ifndef UPB_GENERATOR_UPBDEV_H_
9#define UPB_GENERATOR_UPBDEV_H_
Adam Cozzette501ecec2023-09-26 14:36:20 -070010
11#include "upb/base/status.h"
12#include "upb/base/string_view.h"
13#include "upb/mem/arena.h"
14
15// Must be last.
16#include "upb/port/def.inc"
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22// Consume |buf|, deserialize it to a Code_Generator_Request proto, construct a
Adam Cozzette12c7bb02023-09-28 12:54:11 -070023// upb_Code_Generator_Request, and return it as a JSON-encoded string.
Adam Cozzette501ecec2023-09-26 14:36:20 -070024UPB_API upb_StringView upbdev_ProcessInput(const char* buf, size_t size,
25 upb_Arena* arena,
26 upb_Status* status);
27
Adam Cozzette501ecec2023-09-26 14:36:20 -070028// Decode |buf| from JSON, serialize to wire format, and write it to stdout.
29UPB_API void upbdev_ProcessStdout(const char* buf, size_t size,
30 upb_Arena* arena, upb_Status* status);
31
32// The following wrappers allow the protoc plugins to call the above functions
33// without pulling in the entire pb_runtime library.
34UPB_API upb_Arena* upbdev_Arena_New(void);
35UPB_API void upbdev_Status_Clear(upb_Status* status);
36
37#ifdef __cplusplus
38} /* extern "C" */
39#endif
40
41#include "upb/port/undef.inc"
42
Adam Cozzette12c7bb02023-09-28 12:54:11 -070043#endif // UPB_GENERATOR_UPBDEV_H_