added basic documentation/boilerplate up till ARC_Lexer for the standard library documentation
This commit is contained in:
parent
442f74b195
commit
7b5194dc05
15 changed files with 153 additions and 0 deletions
3
doc/pages/math.md
Normal file
3
doc/pages/math.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
@page math Math Library
|
||||||
|
|
||||||
|
Archeus' math library as of now is a work in progress. There are basic shapes such as ::ARC_Rect and ::ARC_Circle but this library as of now has not been focused on. Will be revamped at a later date
|
||||||
17
doc/pages/standard.md
Normal file
17
doc/pages/standard.md
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
@page standard Standard Library
|
||||||
|
|
||||||
|
Archeus' standard library is a collection of basic datatypes that does not depend on any backends and is build by default as it is the core of the project. Each file is listed below with a brief description of what they do. Inside the file linked will be examples of each and a more in-depth explanation of what is happening.
|
||||||
|
|
||||||
|
- @subpage standard-array "ARC_Array"
|
||||||
|
- @subpage standard-bool "ARC_Bool"
|
||||||
|
- @subpage standard-chemical "ARC_Chemical"
|
||||||
|
- @subpage standard-errno "ARC_Errno"
|
||||||
|
- @subpage standard-hashtable "ARC_Hashtable"
|
||||||
|
- @subpage standard-io "ARC_IO"
|
||||||
|
- @subpage standard-lexer "ARC_Lexer"
|
||||||
|
- @subpage standard-parser "ARC_Parser"
|
||||||
|
- @subpage standard-queue "ARC_Queue"
|
||||||
|
- @subpage standard-stack "ARC_Stack"
|
||||||
|
- @subpage standard-string "ARC_String"
|
||||||
|
- @subpage standard-time "ARC_Time"
|
||||||
|
- @subpage standard-vector "ARC_Vector"
|
||||||
20
doc/pages/standard/array.md
Normal file
20
doc/pages/standard/array.md
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
\page standard-array ARC_Array
|
||||||
|
|
||||||
|
The ARC_Array is a simple type, all it does is have a `void *` to store the array data in and a `uint32_t` to store the size in. This type is mostly a helper type to cut down on the number of parameters needed within Archeus' functions
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```c
|
||||||
|
#include <arc/std/array.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
//initing the array (as it is a basic type there is no ARC_Array_Create or ARC_Array_Destroy)
|
||||||
|
ARC_Array exampleArray;
|
||||||
|
exampleArray.size = 4;
|
||||||
|
exampleArray.data = malloc(sizeof(uint32_t) * exampleArray.size);
|
||||||
|
|
||||||
|
//example function using an ARC_Array
|
||||||
|
ARC_Example_RunArray(&exampleArray);
|
||||||
|
|
||||||
|
//cleanup
|
||||||
|
free(exampleArray.data);
|
||||||
|
```
|
||||||
34
doc/pages/standard/bool.md
Normal file
34
doc/pages/standard/bool.md
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
\page standard-bool ARC_Bool
|
||||||
|
|
||||||
|
The ::ARC_Bool type simple sets ::ARC_Bool to the `stdbool.h` `bool` type, ::ARC_True to true, and ::ARC_False to false. This type exists so that it can be overriden if a different boolean type should be used (like with opengl)
|
||||||
|
|
||||||
|
Basic Example:
|
||||||
|
```c
|
||||||
|
#include <arc/std/bool.h>
|
||||||
|
|
||||||
|
ARC_Bool example = ARC_True;
|
||||||
|
|
||||||
|
//this example is very pedantic, saying `== ARC_True` isn't required, just recommended
|
||||||
|
if(example == ARC_True){
|
||||||
|
//this will be executed
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Override Example:
|
||||||
|
```c
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
//this should be called at the start of the program
|
||||||
|
#define ARC_BOOL_OVERRIDE
|
||||||
|
#define ARC_Bool uint8_t
|
||||||
|
#define ARC_True 1
|
||||||
|
#define ARC_False 0
|
||||||
|
|
||||||
|
#include <arc/std/bool.h>
|
||||||
|
|
||||||
|
ARC_Bool example = ARC_False;
|
||||||
|
|
||||||
|
if(example != ARC_True){
|
||||||
|
//this will be executed
|
||||||
|
}
|
||||||
|
```
|
||||||
3
doc/pages/standard/chemical.md
Normal file
3
doc/pages/standard/chemical.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
\page standard-chemical ARC_Chemical
|
||||||
|
|
||||||
|
This type is being actively worked on. It will be a config type to read in .chemical files. The name was chosen from the four ethers that Archeus can be broken down into (Chemical, Life, Light, and Reflective)
|
||||||
63
doc/pages/standard/errno.md
Normal file
63
doc/pages/standard/errno.md
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
\page standard-errno ARC_Errno
|
||||||
|
|
||||||
|
*Note: this file is being actively worked on and might change during minor updates*
|
||||||
|
|
||||||
|
## About
|
||||||
|
|
||||||
|
arc/std/errno.h is used for handling errors as well as printing to debug. It defines a global `uint32_t` ::arc_errno, as well as a global `FILE` ::arc_errno_log_file. For now it just has printing errors, but in the future it is planned to have warnings and general logs added. For error logs to be printed, `ARC_DEBUG` needs to be defined when compiled.
|
||||||
|
|
||||||
|
## Basic Error Handling
|
||||||
|
|
||||||
|
When throwing errors, ::arc_errno should usually be set to an ARC_ERRNO_ define describing the error. After setting ::arc_errno it is strongly recommended to log that the error happened (this really helps when debugging).
|
||||||
|
|
||||||
|
Basic Example:
|
||||||
|
```c
|
||||||
|
#include <arc/std/errno.h>
|
||||||
|
|
||||||
|
void ARC_Example_ThrowNullError(){
|
||||||
|
uint32_t *exampleNumber = NULL;
|
||||||
|
|
||||||
|
if(exampleNumber == NULL){
|
||||||
|
//set arc_errno to the most applicable error
|
||||||
|
arc_errno = ARC_ERRNO_NULL;
|
||||||
|
|
||||||
|
//log where the error happened
|
||||||
|
ARC_DEBUG_LOG_ERROR("ARC_Example_ThrowNullError(), exampleNumber was NULL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Handling With More Information
|
||||||
|
|
||||||
|
Sometimes the error will have data that could be helpful when debugging, so there is also a log macro that can log the error with variables added. The formatting is the same as printf.
|
||||||
|
|
||||||
|
Example With Variables:
|
||||||
|
```c
|
||||||
|
#include <arc/std/errno.h>
|
||||||
|
#include <arc/std/string.h>
|
||||||
|
|
||||||
|
void ARC_Example_ThrowPathError(ARC_String *path){
|
||||||
|
ARC_String *data;
|
||||||
|
/* .. try loading data from path here .. */
|
||||||
|
|
||||||
|
if(data == NULL){
|
||||||
|
//set arc_errno to the most applicable error
|
||||||
|
arc_errno = ARC_ERRNO_DATA;
|
||||||
|
|
||||||
|
//log where the error happened
|
||||||
|
ARC_DEBUG_LOG_ERROR_WITH_VARIABLES("ARC_Example_ThrowPathError(path), path was %s", path->data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Overriding Output File
|
||||||
|
|
||||||
|
By default the logs will output to stdout, however this can has an override by defining ARC_DEBUG_LOG_STREAM_OVERRIDE
|
||||||
|
|
||||||
|
Example of Overriding Log Stream:
|
||||||
|
```c
|
||||||
|
//when compiling, ARC_DEBUG_LOG_STREAM_OVERRIDE needs to be set, then just add
|
||||||
|
|
||||||
|
//this sets the output to a example_out.txt file that has write permissions
|
||||||
|
arc_errno_log_file = fopen("example_out.txt", "w");
|
||||||
|
```
|
||||||
3
doc/pages/standard/hashtable.md
Normal file
3
doc/pages/standard/hashtable.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
\page standard-hashtable ARC_Hashtable
|
||||||
|
|
||||||
|
*This page will be written after refactoring the ::ARC_Hashtable type*
|
||||||
3
doc/pages/standard/io.md
Normal file
3
doc/pages/standard/io.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
\page standard-io ARC_IO
|
||||||
|
|
||||||
|
*This page will be written after refactoring the arc/std/io.h header*
|
||||||
1
doc/pages/standard/lexer.md
Normal file
1
doc/pages/standard/lexer.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
\page standard-lexer ARC_Lexer
|
||||||
1
doc/pages/standard/parser.md
Normal file
1
doc/pages/standard/parser.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
\page standard-parser ARC_Parser
|
||||||
1
doc/pages/standard/queue.md
Normal file
1
doc/pages/standard/queue.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
\page standard-queue ARC_Queue
|
||||||
1
doc/pages/standard/stack.md
Normal file
1
doc/pages/standard/stack.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
\page standard-stack ARC_Stack
|
||||||
1
doc/pages/standard/string.md
Normal file
1
doc/pages/standard/string.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
\page standard-string ARC_String
|
||||||
1
doc/pages/standard/time.md
Normal file
1
doc/pages/standard/time.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
\page standard-time ARC_Time
|
||||||
1
doc/pages/standard/vector.md
Normal file
1
doc/pages/standard/vector.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
\page standard-vector ARC_Vector
|
||||||
Loading…
Add table
Add a link
Reference in a new issue