xref: /libCEED/rust/libceed-sys/c-src/interface/ceed-register.c (revision 2b730f8b5a9c809740a0b3b302db43a719c636b1)
13d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
23d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
33d8e8822SJeremy L Thompson //
43d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause
53d8e8822SJeremy L Thompson //
63d8e8822SJeremy L Thompson // This file is part of CEED:  http://github.com/ceed
73d8e8822SJeremy L Thompson 
81d013790SJed Brown #include <ceed-impl.h>
9*2b730f8bSJeremy L Thompson #include <ceed/backend.h>
10*2b730f8bSJeremy L Thompson #include <ceed/ceed.h>
113d576824SJeremy L Thompson #include <stdbool.h>
121d013790SJed Brown #include <stdio.h>
131d013790SJed Brown 
141d013790SJed Brown static bool register_all_called;
151d013790SJed Brown 
1671415c51Sjeremylt #define MACRO(name, ...) CEED_INTERN int name(void);
171d013790SJed Brown #include "../backends/ceed-backend-list.h"
181d013790SJed Brown #undef MACRO
191d013790SJed Brown 
201d013790SJed Brown /**
211d013790SJed Brown   @brief Register all preconfigured backends.
221d013790SJed Brown 
231d013790SJed Brown   This is called automatically by CeedInit() and thus normally need not be called by users.
241d013790SJed Brown   Users can call CeedRegister() to register additional backends.
251d013790SJed Brown 
261d013790SJed Brown   @return An error code: 0 - success, otherwise - failure
271d013790SJed Brown 
281d013790SJed Brown   @sa CeedRegister()
291d013790SJed Brown 
30ded9b81dSJeremy L Thompson   @ref User
311d013790SJed Brown **/
321d013790SJed Brown int CeedRegisterAll() {
331d013790SJed Brown   if (register_all_called) return 0;
341d013790SJed Brown   register_all_called = true;
351d013790SJed Brown 
3671415c51Sjeremylt #define MACRO(name, ...) CeedChk(name());
371d013790SJed Brown #include "../backends/ceed-backend-list.h"
381d013790SJed Brown #undef MACRO
39e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
401d013790SJed Brown }
41