diff options
| author | krasimir <krasimir@chalmers.se> | 2017-04-12 10:31:01 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2017-04-12 10:31:01 +0000 |
| commit | 456f0a5733a3b688ebd3f5b3db35f60400ca7abe (patch) | |
| tree | 7b6a931a099ffe31402bc59690263bf34374e4c3 /src/runtime/c/teyjus/tables_gen/util | |
| parent | a8eaa2f2e560547e63c7976960435e1ae23a22b1 (diff) | |
remove the teyjus and utils folders
Diffstat (limited to 'src/runtime/c/teyjus/tables_gen/util')
| -rw-r--r-- | src/runtime/c/teyjus/tables_gen/util/util.c | 135 | ||||
| -rw-r--r-- | src/runtime/c/teyjus/tables_gen/util/util.h | 71 |
2 files changed, 0 insertions, 206 deletions
diff --git a/src/runtime/c/teyjus/tables_gen/util/util.c b/src/runtime/c/teyjus/tables_gen/util/util.c deleted file mode 100644 index 502bfa68f..000000000 --- a/src/runtime/c/teyjus/tables_gen/util/util.c +++ /dev/null @@ -1,135 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -//Copyright 2008 -// Andrew Gacek, Steven Holte, Gopalan Nadathur, Xiaochu Qi, Zach Snow -////////////////////////////////////////////////////////////////////////////// -// This file is part of Teyjus. // -// // -// Teyjus is free software: you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation, either version 3 of the License, or // -// (at your option) any later version. // -// // -// Teyjus is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with Teyjus. If not, see <http://www.gnu.org/licenses/>. // -////////////////////////////////////////////////////////////////////////////// - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include "util.h" - - -/**************************************************************************/ -/* Space allocation */ -/**************************************************************************/ -/* allocate space of n bytes*/ -void* UTIL_malloc(size_t n) -{ - void* ptr = (void*)malloc(n); - if (ptr) return ptr; - printf("Error : cannot allocate space\n"); - exit(1); - -} - - -/* allocate space for a string of given size */ -char* UTIL_mallocStr(size_t size) -{ - char* ptr = (char*)malloc(sizeof(char)*(size + 1)); - if (ptr) return ptr; - - printf("Error : cannot allocate space\n"); - exit(1); -} - - -/**************************************************************************/ -/* string operation */ -/**************************************************************************/ -/* Append two strings */ -char* UTIL_appendStr(char* str1, char* str2) -{ - size_t length = strlen(str1) + strlen(str2); - char* ptr = UTIL_mallocStr(length + 1); - - strcpy(ptr, str1); - strcat(ptr, str2); - - return ptr; -} - - -//convert lower case letters in a string to upper case ones -char* UTIL_upperCase(char* str) -{ - char *newstr, *tmp; - newstr = strdup(str); - tmp = newstr; - while ((*tmp) != '\0'){ - if ((97 <= (int)*tmp) && ((int)*tmp <= 122)) - *tmp = (char)((int)*tmp - 32); - tmp++; - } - return newstr; -} - -//convert to lower cases -char* UTIL_lowerCase(char* str) -{ - char *newstr, *tmp; - newstr = strdup(str); - tmp = newstr; - while ((*tmp) != '\0'){ - if ((65 <= (int)*tmp) && ((int)*tmp) <= 90) - *tmp = (char)((int)*tmp + 32); - tmp++; - } - return newstr; -} - -//covert an non-negtive integer to string -char* UTIL_itoa(int num) -{ - char *str = UTIL_mallocStr(33); - sprintf(str, "%d", num); - return str; -} - - -/**************************************************************************/ -/* file operation */ -/**************************************************************************/ - -/* open file in read mode */ -FILE* UTIL_fopenR(char* filename) -{ - FILE* filePtr = fopen(filename, "r"); - if (filePtr) return filePtr; - - printf("Error : cannot open input file %s\n", filename); - exit(1); -} - - -/* open file in write mode */ -FILE* UTIL_fopenW(char* filename) -{ - FILE* filePtr = fopen(filename, "w"); - if (filePtr) return filePtr; - - printf("Error : cannot open output file %s\n", filename); - exit(1); -} - -/* close file */ -void UTIL_fclose(FILE* file) -{ - fclose(file); -} - diff --git a/src/runtime/c/teyjus/tables_gen/util/util.h b/src/runtime/c/teyjus/tables_gen/util/util.h deleted file mode 100644 index 4cc6a8a11..000000000 --- a/src/runtime/c/teyjus/tables_gen/util/util.h +++ /dev/null @@ -1,71 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -//Copyright 2008 -// Andrew Gacek, Steven Holte, Gopalan Nadathur, Xiaochu Qi, Zach Snow -////////////////////////////////////////////////////////////////////////////// -// This file is part of Teyjus. // -// // -// Teyjus is free software: you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation, either version 3 of the License, or // -// (at your option) any later version. // -// // -// Teyjus is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with Teyjus. If not, see <http://www.gnu.org/licenses/>. // -////////////////////////////////////////////////////////////////////////////// - -/**************************************************************************/ -/* util.h{c}. */ -/* Auxiliary functions needed for generating source files. */ -/**************************************************************************/ -#ifndef UTIL_H -#define UTIL_H -#include <stdio.h> - - -/**************************************************************************/ -/* Space allocation */ -/**************************************************************************/ -/* allocate space */ -void* UTIL_malloc(size_t size); - -/* allocate space for a string of given size */ -char* UTIL_mallocStr(size_t size); - -/**************************************************************************/ -/* string operation */ -/**************************************************************************/ -/* append two strings */ -char* UTIL_appendStr(char* str1, char* str2); -/* capitalizing */ -char* UTIL_upperCase(char* str); -/* to lower cases */ -char* UTIL_lowerCase(char* str); -/* covert a non-negative integer to string */ -char* UTIL_itoa(int num); - -/**************************************************************************/ -/* file operation */ -/**************************************************************************/ -/* open file in read mode */ -FILE* UTIL_fopenR(char* filename); - -/* open file in write mode */ -FILE* UTIL_fopenW(char* filename); - -/* close file */ -void UTIL_fclose(FILE* file); - - -/* bool type */ -typedef enum { - UTIL_FALSE, UTIL_TRUE -} UTIL_Bool; - -#endif - - |
