48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
/*
|
|
===============================================================================
|
|
|
|
Common
|
|
|
|
===============================================================================
|
|
*/
|
|
#ifndef COMMON_H
|
|
#define COMMON_H
|
|
|
|
#include "macros.h"
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <stdint.h> // for intptr_t http://stackoverflow.com/questions/5701450/getting-the-warning-cast-to-pointer-from-integer-of-different-size-from-the-fo#5703367
|
|
|
|
|
|
#if __APPLE__
|
|
char * strndup (const char *s, size_t n);
|
|
#endif
|
|
|
|
int generateHash(const char* string, int table_size);
|
|
int hash_size; // err, change this.
|
|
|
|
void (*commands_table[COMMAND_HASH_SIZE]) (); // pointer to array of command strings, e.g., "quit", "save", etc.
|
|
void addCommand(const char *command_string, void(*function));
|
|
void freeCommand(char **command_array);
|
|
char** getCommand(const char* string);
|
|
|
|
char *help[COMMAND_HASH_SIZE];
|
|
void addHelp(const char* variable, const char* value);
|
|
void freeHelp();
|
|
|
|
char *syntax[COMMAND_HASH_SIZE];
|
|
void addSyntax(const char* variable, const char* value);
|
|
void freeSyntax();
|
|
|
|
char *config_name[CONFIG_HASH_SIZE];
|
|
char (*config[CONFIG_HASH_SIZE]);
|
|
void setConfig(const char* variable, const char* value);
|
|
void freeConfig();
|
|
|
|
int is_running;
|
|
void quitProgram();
|
|
#endif
|