feat(console output): added print function
This commit is contained in:
parent
23778b818c
commit
bdc3b26f97
4 changed files with 72 additions and 3 deletions
29
Include/Iony/Core/Console.h
Normal file
29
Include/Iony/Core/Console.h
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
* File: Console.h
|
||||||
|
* Description:
|
||||||
|
* This file contains the functions for reading and writting to the console.
|
||||||
|
*
|
||||||
|
* Author: Mineplay
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#ifndef IONY_CONSOLE
|
||||||
|
#define IONY_CONSOLE
|
||||||
|
|
||||||
|
#include "../Utils/Error.h"
|
||||||
|
|
||||||
|
IonyError iony_print(char *text);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -26,6 +26,6 @@
|
||||||
typedef enum {
|
typedef enum {
|
||||||
IONY_ERROR_NONE = 0,
|
IONY_ERROR_NONE = 0,
|
||||||
IONY_ERROR_INVALID_POINTER = 1,
|
IONY_ERROR_INVALID_POINTER = 1,
|
||||||
} FledastyError;
|
} IonyError;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
36
Src/Core/Console.c
Normal file
36
Src/Core/Console.c
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
* File: Console.c
|
||||||
|
* Description:
|
||||||
|
* This file contains the functions for reading and writting to the console.
|
||||||
|
*
|
||||||
|
* Author: Mineplay
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#include "../../Include/Iony/Core/Console.h"
|
||||||
|
|
||||||
|
IonyError iony_print(char *text) {
|
||||||
|
if (text == ((void*)0)) {
|
||||||
|
return IONY_ERROR_INVALID_POINTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
#elif defined(__linux__)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return IONY_ERROR_NONE;
|
||||||
|
}
|
||||||
|
|
@ -19,9 +19,13 @@
|
||||||
* Author: Mineplay
|
* Author: Mineplay
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <Iony/Utils/Error.h>
|
||||||
|
#include <Iony/Core/Console.h>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
printf("Hello, World!\n");
|
if (iony_print("Hello, World!\n") != IONY_ERROR_NONE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue