Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Project: IFJ2014
- * Variant: Tým 024, varianta a/4/II
- * Authors: Dita Cihlářová <xcihla02>, Martin Vondráček <xvondr20>, Vladislav Bambuch<xbambu03>, Ondřej Záruba <xzarub06>, Lukáš Drahník <xdrahn00>
- * Date: 22.9.2014
- *
- */
- #ifndef _IAL_H_
- #define _IAL_H_
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdbool.h>
- #include <string.h>
- #include <stdarg.h> //va_list apod... pro praci s neomezenym poctem parametru
- #include "error.h"
- #include "garbage_collector.h"
- #include "global.h"
- #include "error.h"
- #include <stdbool.h>
- #define MAX_HTSIZE 127
- #define HT_MAX 127
- //struktura pro čtení ze vstupu a konstanta
- //-----NAHRAZENÍ ZA T_VALUE-----//
- /*typedef struct id{
- union
- {
- int int_n;
- double real_n;
- char* str;
- } d_data;
- enum DATA_TYPE type;
- } D_VAR;
- */
- T_ERROR sort(char **); //parametr odkaz na řezený řetězec
- T_ERROR copy(char *, int, int, char **); //
- T_ERROR find(char* , char*, int *);
- T_ERROR kmp_table(char *, int **);
- T_ERROR length(char *, int *);
- T_ERROR readln(T_VALUE *);
- T_ERROR write(int, ...); //volani nejdriv pocet dalsich parametru, pak parametry typu adresa T_VALUE. napr: write(2, &foo, &boo);
- T_ERROR readString(T_VALUE *);
- T_ERROR readInt(int *);
- T_ERROR readReal(double *);
- T_ERROR mergeSort(char*);
- T_ERROR merge(char* left, char* rigth, char* string);
- /*
- * HASH TABLE
- */
- /* Type */
- typedef enum HT_TYPE {
- HT_FUNCTION,
- HT_VARIABLE,
- } HT_TYPE;
- /* Params node */
- typedef struct params_node {
- struct HT_node_data *data;
- struct params_node *next;
- } params_node;
- /* Hashtable node */
- typedef struct HT_node {
- struct HT_node_data *data;
- struct HT_node *next;
- } HT_node;
- /* Hashtable data */
- typedef struct HT_node_data {
- char* key;
- HT_TYPE type;
- DATA_TYPE data_type;
- struct params_node *params; // function params
- struct HT_table* local_HT; // local HT for function
- struct T_IL_e* label; // návěští
- bool initialized; // proměnná je inicializována nebo ne
- } HT_node_data;
- typedef HT_node* HT_table[HT_MAX];
- /* Functions to work with hashtable */
- HT_node* HT_createNode(T_ERROR* error);
- int HT_calculateHashCode(char* key);
- T_ERROR HT_insert(HT_table* hashtable, HT_node* node);
- void HT_init(HT_table* hashtable);
- HT_node_data* HT_search(HT_table* hashtable, char* key);
- T_ERROR HT_clearAll(HT_table* hashtable);
- bool HT_empty(T_ERROR* error, HT_table* hashtable);
- /* Bonus */
- params_node* HT_createParamsNode(T_ERROR* error, HT_node_data* data);
- HT_node_data* HT_createNodeData(T_ERROR* error, char* key, HT_TYPE type, DATA_TYPE data_type, params_node* params);
- #ifdef DEBUG
- void HT_print(HT_table*);
- #endif
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement