1//===-- GOFFYAML.cpp - GOFF YAMLIO implementation ---------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines classes for handling the YAML representation of GOFF.
10//
11//===----------------------------------------------------------------------===//
12
13#include "llvm/ObjectYAML/GOFFYAML.h"
14#include "llvm/BinaryFormat/GOFF.h"
15#include <string.h>
16
17namespace llvm {
18namespace GOFFYAML {
19
20Object::Object() {}
21
22} // namespace GOFFYAML
23
24namespace yaml {
25
26void MappingTraits<GOFFYAML::FileHeader>::mapping(
27 IO &IO, GOFFYAML::FileHeader &FileHdr) {
28 IO.mapOptional(Key: "TargetEnvironment", Val&: FileHdr.TargetEnvironment, Default: 0);
29 IO.mapOptional(Key: "TargetOperatingSystem", Val&: FileHdr.TargetOperatingSystem, Default: 0);
30 IO.mapOptional(Key: "CCSID", Val&: FileHdr.CCSID, Default: 0);
31 IO.mapOptional(Key: "CharacterSetName", Val&: FileHdr.CharacterSetName, Default: "");
32 IO.mapOptional(Key: "LanguageProductIdentifier", Val&: FileHdr.LanguageProductIdentifier,
33 Default: "");
34 IO.mapOptional(Key: "ArchitectureLevel", Val&: FileHdr.ArchitectureLevel, Default: 1);
35 IO.mapOptional(Key: "InternalCCSID", Val&: FileHdr.InternalCCSID);
36 IO.mapOptional(Key: "TargetSoftwareEnvironment",
37 Val&: FileHdr.TargetSoftwareEnvironment);
38}
39
40void MappingTraits<GOFFYAML::Object>::mapping(IO &IO, GOFFYAML::Object &Obj) {
41 IO.mapTag(Tag: "!GOFF", Default: true);
42 IO.mapRequired(Key: "FileHeader", Val&: Obj.Header);
43}
44
45} // namespace yaml
46} // namespace llvm
47