Skip to content

Commit aab915d

Browse files
committed
add implementation for catclose and catgets - 2
1 parent 2b96596 commit aab915d

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed

libc/src/nl_types/catclose.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//===-- Implementation of catclose ----------------------------------------===//
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+
#include "src/nl_types/catclose.h"
10+
#include "include/llvm-libc-types/nl_catd.h"
11+
#include "src/__support/common.h"
12+
#include "src/__support/macros/config.h"
13+
14+
namespace LIBC_NAMESPACE_DECL {
15+
16+
LLVM_LIBC_FUNCTION(int, catclose, ([[maybe_unused]] nl_catd catalog)) {
17+
// Message catalogs are not implemented. Return error regardless of input.
18+
return -1;
19+
}
20+
21+
} // namespace LIBC_NAMESPACE_DECL
22+
23+

libc/src/nl_types/catclose.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//===-- Implementation header for catclose ----------------------*- 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+
#ifndef LLVM_LIBC_SRC_NL_TYPES_CATCLOSE_H
10+
#define LLVM_LIBC_SRC_NL_TYPES_CATCLOSE_H
11+
12+
#include "include/llvm-libc-types/nl_catd.h"
13+
#include "src/__support/macros/config.h"
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
int catclose(nl_catd catalog);
18+
19+
} // namespace LIBC_NAMESPACE_DECL
20+
21+
#endif // LLVM_LIBC_SRC_NL_TYPES_CATCLOSE_H
22+

libc/src/nl_types/catgets.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//===-- Implementation of catgets -----------------------------------------===//
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+
#include "src/nl_types/catgets.h"
10+
#include "include/llvm-libc-types/nl_catd.h"
11+
#include "src/__support/common.h"
12+
#include "src/__support/macros/config.h"
13+
14+
namespace LIBC_NAMESPACE_DECL {
15+
16+
LLVM_LIBC_FUNCTION(char*, catgets, ([[maybe_unused]] nl_catd catalog,
17+
[[maybe_unused]] int set_number,
18+
[[maybe_unused]] int message_number,
19+
const char* message)) {
20+
// Message catalogs are not implemented.
21+
// Return backup message regardless of input.
22+
return const_cast<char*>(message);
23+
}
24+
25+
} // namespace LIBC_NAMESPACE_DECL
26+

libc/src/nl_types/catgets.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===-- Implementation header for catgets -----------------------*- 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+
#ifndef LLVM_LIBC_SRC_NL_TYPES_CATGETS_H
10+
#define LLVM_LIBC_SRC_NL_TYPES_CATGETS_H
11+
12+
#include "include/llvm-libc-types/nl_catd.h"
13+
#include "src/__support/macros/config.h"
14+
15+
namespace LIBC_NAMESPACE_DECL {
16+
17+
char *catgets(nl_catd catalog, int set_number, int message_number,
18+
const char *message);
19+
20+
} // namespace LIBC_NAMESPACE_DECL
21+
22+
#endif // LLVM_LIBC_SRC_NL_TYPES_CATGETS_H
23+
24+

0 commit comments

Comments
 (0)