Loading...
Searching...
No Matches
chemical.c File Reference
`#include "arc/std/chemical.h"`
`#include "arc/std/parser/helpers.h"`
`#include "arc/std/bool.h"`
`#include "arc/std/hashtable.h"`
`#include "arc/std/parser.h"`
`#include <stddef.h>`
`#include <stdint.h>`
`#include <stdlib.h>`

Go to the source code of this file.

## Data Structures

struct | ARC_Chemical

## Functions

void | ARC_Chemical_InitLexerRulesFn (ARC_Lexer *lexer)
uint32_t | ARC_Chemical_GetStringIdFn (ARC_String *string)
void | ARC_ChemicalData_CreateFn (void **data, ARC_ParserTagToken *parsedData, void *userData)
void | ARC_Chemical_Create (ARC_Chemical **chemical)
| TODO: write this.
void | ARC_Chemical_Destroy (ARC_Chemical *chemical)
| TODO: write this.
void | ARC_Chemical_RegisterType (ARC_Chemical *chemical, ARC_String *typeName, ARC_ChemicalData_CopyToTypeFn *copyToTypeFn, ARC_ParserCSV_DestroyTypeFn destroyTypeFn)
| TODO: write this.
void | ARC_Chemical_SetGroup (ARC_Chemical *chemical, ARC_String *groupName)
| sets current group in config
void * | ARC_Chemical_Get (ARC_Chemical *chemical, ARC_String *element)
| get a value from a given keyname
void | ARC_Chemical_LoadFromString (ARC_String *path)
| TODO: write this.
void | ARC_Chemical_LoadFromFile (ARC_String *path)
| TODO: write this.
void | ARC_Chemical_UnloadFromString (ARC_String *data)
| TODO: write this.
void | ARC_Chemical_UnloadFromFile (ARC_String *data)
| TODO: write this.

## Function Documentation

## ARC_Chemical_Create()

void ARC_Chemical_Create | ( | ARC_Chemical ** | chemical | ) |

TODO: write this.

Definition at line 36 of file chemical.c.

{
*chemical = (ARC_Chemical *)malloc(sizeof(ARC_Chemical));
/* ~ define the language as a string ~ */
char *languageCString =
"<language> -> <group> <language> | <variableLine> <language> | <whitespace> <language>\n"
"<group> -> <groupName> <whitespace> <variable> <whitespace> LEFT_CURLY_BRACE <whitespace> <variableLine> <whitespace> RIGHT_CURLY_BRACE\n"
"<variableLine> -> <type> <whitespace> <variable> <whitespace> EQUALS <whitespace> value <whitespace> SEMICOLON <whitespace>\n"
"<groupName> -> <variable>\n"
"<type> -> <variable>\n"
"<value> -> <variable> | <number> | <nestedValue>\n"
"<nestedValue> -> OPEN_CURLY_BRACE <whitespace> <valueArgs> <whitespace> CLOSE_CURLY_BRACE\n"
"<valueArgs> -> <value> | <value> COMMA <valueArgs>\n"
"<variable> -> ALPHA_UPPER_CHAR <variableName> | ALPHA_LOWER_CHAR <variableName> | UNDERSCORE <variableName>\n"
"<variableName> -> <charOrNum> <variableName> | LAMBDA\n"
"<charOrNum> -> ALPHA_UPPER_CHAR | ALPHA_LOWER_CHAR | UNDERSCORE | NUM\n"
"<number> -> NUMBER <number> | NUMBER LAMBDA\n"
"<whitespace> -> SPACE <whitespace> | TAB <whitespace> | NEWLINE <whitespace> | LAMBDA\n";
/* ~ define the language as a string ~ */
ARC_String *languageString;
ARC_String_CreateWithStrlen(&languageString, languageCString);
/* ~ init the userdata? ~ */
/* ~ create the language ~ */
//ARC_ParserData_CreateFn createCharFn = ARC_ChemicalData_CreateFn;
//ARC_ParserData_DestroyFn destroyCharFn = ARC_ChemicalData_DestroyFn;
//ARC_Parser_CreateFromString(parser, languageString, ARC_ParserCSV_InitLexerRulesFn, ARC_ParserCSV_GetStringIdFn, &createCharFn, &destroyCharFn, userdata);
//cleanup
ARC_String_Destroy(languageString);
}
ARC_String_CreateWithStrlen
void ARC_String_CreateWithStrlen(ARC_String **string, char *data)
creates ARC_String type with strinlen
Definition string.c:32
ARC_String_Destroy
void ARC_String_Destroy(ARC_String *string)
destroys ARC_String type
Definition string.c:52
ARC_Chemical
Definition chemical.c:10
ARC_String
substring position within a string
Definition string.h:14

References ARC_String_CreateWithStrlen(), and ARC_String_Destroy().

## ARC_Chemical_Destroy()

void ARC_Chemical_Destroy | ( | ARC_Chemical * | chemical | ) |

TODO: write this.

Definition at line 76 of file chemical.c.

{
}

## ARC_Chemical_Get()

void * ARC_Chemical_Get | ( | ARC_Chemical * | chemical,
|  | ARC_String * | element )

get a value from a given keyname

Note
  name may be prefaced with <group>:: to specify group

Parameters

  [in] | chemical | ARC_Chemical to get value from
  [in] | element | name of a variable that has been read in

Returns
  the stored element on success, or NULL on failure

Definition at line 85 of file chemical.c.

{
return NULL;
}

## ARC_Chemical_GetStringIdFn()

uint32_t ARC_Chemical_GetStringIdFn | ( | ARC_String * | string | ) |

Definition at line 19 of file chemical.c.

{
if(ARC_String_EqualsCStringWithStrlen(string, "LAMBDA")){
return ARC_PARSER_TAG_LAMBDA;
}
return ~(uint32_t)0;
}
ARC_PARSER_TAG_LAMBDA
#define ARC_PARSER_TAG_LAMBDA
basic tag for letting the parser know it is ok to end
Definition parser.h:150
ARC_String_EqualsCStringWithStrlen
ARC_Bool ARC_String_EqualsCStringWithStrlen(ARC_String *string, const char *cstring)
check if ARC_String and cstring match
Definition string.c:171

References ARC_PARSER_TAG_LAMBDA, and ARC_String_EqualsCStringWithStrlen().

## ARC_Chemical_InitLexerRulesFn()

void ARC_Chemical_InitLexerRulesFn | ( | ARC_Lexer * | lexer | ) |

Definition at line 16 of file chemical.c.

{
}

## ARC_Chemical_LoadFromFile()

void ARC_Chemical_LoadFromFile | ( | ARC_String * | path | ) |

TODO: write this.

Definition at line 92 of file chemical.c.

{
}

## ARC_Chemical_LoadFromString()

void ARC_Chemical_LoadFromString | ( | ARC_String * | path | ) |

TODO: write this.

Definition at line 89 of file chemical.c.

{
}

## ARC_Chemical_RegisterType()

void ARC_Chemical_RegisterType | ( | ARC_Chemical * | chemical,
|  | ARC_String * | typeName,
|  | ARC_ChemicalData_CopyToTypeFn * | copyToTypeFn,
|  | ARC_ParserCSV_DestroyTypeFn | destroyTypeFn )

TODO: write this.

Definition at line 79 of file chemical.c.

{
}

## ARC_Chemical_SetGroup()

void ARC_Chemical_SetGroup | ( | ARC_Chemical * | chemical,
|  | ARC_String * | groupName )

sets current group in config

Note
  ARC_Chemical_Get will use this set group

Parameters

  [in] | chemical | ARC_Config we are setting current group in
  [in] | groupname | name of group that will be set

Definition at line 82 of file chemical.c.

{
}

## ARC_Chemical_UnloadFromFile()

void ARC_Chemical_UnloadFromFile | ( | ARC_String * | data | ) |

TODO: write this.

Definition at line 98 of file chemical.c.

{
}

## ARC_Chemical_UnloadFromString()

void ARC_Chemical_UnloadFromString | ( | ARC_String * | data | ) |

TODO: write this.

Definition at line 95 of file chemical.c.

{
}

## ARC_ChemicalData_CreateFn()

void ARC_ChemicalData_CreateFn | ( | void ** | data,
|  | ARC_ParserTagToken * | parsedData,
|  | void * | userData )

Definition at line 27 of file chemical.c.

{
*data = NULL;
if(data == NULL || userData == NULL){
//TODO: error here?
*data = NULL;
return;
}
}