From bb1ed6e13eb83cdf6d1a5de23a434a170a65114b Mon Sep 17 00:00:00 2001 From: Hossein Araghi Date: Sun, 15 Aug 2021 00:06:33 +0430 Subject: [PATCH] Fix Project Dir Bug --- CMakeLists.txt | 18 +++++++ easyc.c | 144 ------------------------------------------------- easyc.h | 59 -------------------- 3 files changed, 18 insertions(+), 203 deletions(-) create mode 100755 CMakeLists.txt delete mode 100755 easyc.c delete mode 100755 easyc.h diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..17eb793 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,18 @@ +# title : Easy C Library +# copyright : Copyright 2021 YasTech.org | All Right Reserved +# developer : Hossein Araghi +# url : https://yastech.org +# version 1.0.0 + +# Add Library To Project +add_library( + easyc SHARED + src/easyc.c + src/easyc.h +) + +# Include Src Directory +target_include_directories(easyc PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src") + +# Define Project Version +target_compile_definitions(easyc PUBLIC easyc_version=1) \ No newline at end of file diff --git a/easyc.c b/easyc.c deleted file mode 100755 index 65a23d0..0000000 --- a/easyc.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - title : Easy C Library - copyright : Copyright 2021 YasTech.org | All Right Reserved - developer : Hossein Araghi - url : https://yastech.org - version : 1.0.0 -*/ - -#include "easyc.h" - -// get string value -string getString(string q) -{ - printf("%s", q); - string a = NULL; - scanf("%ms", &a); - return a; -} - -// get int value -int getInt(string q) -{ - printf("%s", q); - string str; - string ptr; - long a; - scanf("%ms", &str); - a = strtol(str, &ptr, 10); - return (int) a; -} - -// get double value -double getDouble(string q) -{ - printf("%s", q); - string str; - string ptr; - long a; - scanf("%ms", &str); - a = strtol(str, &ptr, 10); - return (double) a; -} - -// get float value -float getFloat(string q) -{ - printf("%s", q); - string str; - string ptr; - long a; - scanf("%ms", &str); - a = strtol(str, &ptr, 10); - return (float) a; -} - -// get char value -char getChar(string q) -{ - printf("%s", q); - char a; - scanf("%c", &a); - return a; -} - -// get long value -long getLong(string q) -{ - printf("%s", q); - string str; - string ptr; - long a; - scanf("%ms", &str); - a = strtol(str, &ptr, 10); - return a; -} - -// usual print -void print(string text) -{ - printf("%s", text); -} - -// print with new line -void println(string text) -{ - printf("%s\n", text); -} - -// Convert Int To String -string intToString(int number) -{ - string c = malloc(5); - sprintf(c, "%d", number); - return c; -} - -// Convert Long To String -/*string longToString(long number) -{ - string c = malloc(20); - sprintf(c, "%d", number); - return c; -}*/ - -// Copy String -string copyToString(string text) -{ - - int length = (int) strlen(text); - string copy = malloc(length + 1); - for (int i = 0; i < length + 1; i++) - { - copy[i] = text[i]; - } - return copy; -} - -// Upper Case Letter -char uppercaseChar(char c) -{ - if(c > 96 && c < 123) - { - return (char) ((int) c - 32); - } else - { - return c; - } -} - -// Upper Case String -string uppercaseString(string text) -{ - string output = malloc(strlen(text) + 1); - for (int i = 0; i < strlen(text); i++) { - if(text[i] > 96 && text[i] < 123) - { - output[i] = (char) ((int) text[i] - 32); - } else - { - output[i] = text[i]; - } - } - return output; -} diff --git a/easyc.h b/easyc.h deleted file mode 100755 index 1021b51..0000000 --- a/easyc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - title : Easy C Library - copyright : Copyright 2021 YasTech.org | All Right Reserved - developer : Hossein Araghi - url : https://yastech.org - version : 1.0.0 -*/ - -#ifndef EASY_C_H -#define EASY_C_H - -// Includes -#include -#include -#include - -// Define Type String -typedef char* string; - -// get string value -extern string getString(string q); - -// get int value -extern int getInt(string q); - -// get double value -extern double getDouble(string q); - -// get float value -extern float getFloat(string q); - -// get char value -extern char getChar(string q); - -// get long value -extern long getLong(string q); - -// usual print -extern void print(string text); - -// print with new line -extern void println(string text); - -// Convert Int To String -extern string intToString(int number); - -// Convert Long To String -// extern string longToString(long number); - -// Copy String -extern string copyToString(string text); - -// Upper Case Letter -extern char uppercaseChar(char c); - -// Upper Case String -extern string uppercaseString(string text); - -#endif //EASY_C_H