-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean main and init files from different architectures #151
Changes from 38 commits
0e55f4b
8dbe5b6
7095b0f
4ca64a3
924e58d
9f8a794
242f3dc
ea89b0d
581f023
ccf943e
fe0ab41
c885559
cef37e2
7f82c8a
a6c0299
ed7c92c
853c756
df4aef8
0bc7d6f
d547ea7
ae4b5a6
8b4511d
21acd20
9056c2b
5dc7fac
5baf266
c026dab
52faabd
f33a6b0
a0b71ba
35e0c58
21700b2
e7a14ef
986aef3
cd563e8
b27df14
1f9ebd8
6e55f1f
44ea506
a41dc27
fd47279
9ea8b84
a4a624b
663b0d7
0c669d0
29dca66
45cd92d
0e9f85f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file does not seem to be architecture-dependent. Should this not rather live directly in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agrre, but before moving it I would leave that for discussion mainly because there was a similar case somewhere up there in the comments regarding the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. currently we have everything that is used to start 4diac FORTE on a specific device in the arch folder. Therefore I would like to keep it here. Because when I'm porting 4diac FORTE to a new device I would look here first. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2018 - 2024 fortiss GmbH, Jose Cabral | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Jose Cabral - initial API and implementation and/or initial documentation | ||
*******************************************************************************/ | ||
|
||
#ifndef SRC_ARCH_FORTE_C_H_ | ||
#define SRC_ARCH_FORTE_C_H_ | ||
|
||
#ifndef FORTE_SHARED_PREFIX | ||
#define FORTE_SHARED_PREFIX | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef enum FORTE_STATUS{ | ||
FORTE_OK = 0, | ||
FORTE_DEVICE_ALREADY_STARTED, | ||
FORTE_WRONG_ENDIANESS, | ||
FORTE_WRONG_PARAMETERS, | ||
FORTE_ARCHITECTURE_NOT_READY, | ||
FORTE_COULD_NOT_CREATE_DEVICE, | ||
} FORTE_STATUS; | ||
|
||
typedef void* TForteInstance; | ||
|
||
/** | ||
* \brief Start forte instance | ||
* @param paPort The port on which forte will listen. Use 0 for default 61499 | ||
* @param paResultInstance Address to store the created forte instance | ||
* @return FORTE_OK if no error occurred, other values otherwise | ||
*/ | ||
FORTE_SHARED_PREFIX FORTE_STATUS forteStartInstance(unsigned int paPort, TForteInstance* paResultInstance); | ||
|
||
/** | ||
* \brief Start forte instance with posibilities of more arguments | ||
* @param argc Number of arguments in arg | ||
* @param argv Arguments | ||
* @param paResultInstance Address to store the created forte instance | ||
* @return FORTE_OK if no error occurred, other values otherwise | ||
*/ | ||
FORTE_SHARED_PREFIX FORTE_STATUS forteStartInstanceGeneric(int argc, char *argv[], TForteInstance* paResultInstance); | ||
|
||
/** | ||
* \brief Request termination of a Forte instance | ||
* @param paInstance Instance to request for termination | ||
*/ | ||
FORTE_SHARED_PREFIX void forteRequestStopInstance(TForteInstance paInstance); | ||
|
||
/** | ||
* \brief Waits indefinitely for the intance to stop and deletes it | ||
* @param paInstance Instance to terminate | ||
*/ | ||
FORTE_SHARED_PREFIX void forteWaitForInstanceToStop(TForteInstance paInstance); | ||
|
||
/** | ||
* \brief Initializes the architecture. Prepare all resources needed by the Forte's instances. Must be called once before the first Forte instance is started | ||
* @param argc Number of arguments in arg | ||
* @param argv Arguments | ||
* @return 0 if no error occurred, other values otherwise. Any error value is provided by the architecture and not by forte | ||
*/ | ||
FORTE_SHARED_PREFIX int forteGlobalInitialize(int argc, char *argv[]); | ||
|
||
/** | ||
* \brief Deinitializes the architecture. Frees all resources used by Forte's instances. Must be called after the last instance is ended | ||
* @return 0 if no error occurred, other values otherwise. Any error value is provided by the architecture and not by forte | ||
*/ | ||
FORTE_SHARED_PREFIX int forteGlobalDeinitialize(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* SRC_ARCH_FORTE_C_H_ */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,21 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 fortiss GmbH | ||
* Copyright (c) 2024 Jose Cabral | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Jose Cabral, Alois Zoitl - initial API and implementation and/or initial documentation | ||
* Jose Cabral - initial API and implementation and/or initial documentation | ||
*******************************************************************************/ | ||
|
||
#ifndef FORTE_INSTANCE_H_ | ||
#define FORTE_INSTANCE_H_ | ||
#include "arch/forte_specific_architecture.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void startupFORTE(); | ||
void shutdownFORTE(); | ||
|
||
#ifdef __cplusplus | ||
int CForteSpecificArchitecture::initialize(int , char** ){ | ||
return 0; | ||
} | ||
#endif | ||
|
||
#endif | ||
int CForteSpecificArchitecture::deinitialize() { | ||
return 0; | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the coding guidelines doesn't know the prefix sc for static const, only cg for const global.
While file-scope globals theoretically have less impact, they are only an
extern
keyword, used by someone else, away being visible in other compilation units as well.If we want to code the difference of usage into the name, I would rather suggest cf for "constant file" instead of
sg "static const", as static const doesn't imply anything than the variable is some sort of global variable and lives in this compilation unit. "cf" would also be more in line with "cg" for const global,
i will mark this only here, to not split up the discussion on several review comments, but my comment is valid for all "sc" changes
@azoitl @mx990 additional opinions are appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also recommend to add the "U" suffix to the number, as its an unsigned constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would strongly suggest to use an unnamed namespace in C++ instead of
static
linkage.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with the
unnamed namespace
since it's more c++ style. Regarding the naming convetion, since there's no defined convention for constant variables in unnames namespaces I didn't add any prefix to avoid having a "convention" only in that file which is not documented anywhereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the unnamed namespace solution. Perhaps it wasn't that clear in my comment, if we feel we need another prefix to show the intent/usage we could add one to the coding guidelines.
I wasn't suggesting using another undocumented prefix in favor of another