Update 0.2.6
This commit is contained in:
parent
58eec7ed22
commit
3a0cb7078c
11 changed files with 95 additions and 61 deletions
|
|
@ -8,7 +8,7 @@ Tested on: *Ubuntu, Debian, Arch*
|
|||
|
||||
Used libs for Linux: *gtk+3.0, libmysqlclient*
|
||||
|
||||
Version: *0.2.4*
|
||||
Version: *0.2.6*
|
||||
|
||||
## Features:
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <math.h>
|
||||
#include "../utils/logger.h"
|
||||
|
||||
#include "math.h"
|
||||
#include "math_ext.h"
|
||||
|
||||
double Add(double x, double y){
|
||||
return(x + y);
|
||||
|
|
@ -21,4 +21,12 @@ double Div(double x, double y){
|
|||
return 0.0;
|
||||
else
|
||||
return(x / y);
|
||||
}
|
||||
|
||||
double CubeVolume(double a){
|
||||
return pow(a, 3);
|
||||
}
|
||||
|
||||
double SphereVolume(double r){
|
||||
return (4/3*M_PI*pow(r, 3));
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
#ifndef _MATH_H_
|
||||
#define _MATH_H_
|
||||
#ifndef _MATH_EXT_H_
|
||||
#define _MATH_EXT_H_
|
||||
|
||||
double Add(double x, double y);
|
||||
double Sub(double x, double y);
|
||||
double Mul(double x, double y);
|
||||
double Div(double x, double y);
|
||||
|
||||
double CubeVolume(double a);
|
||||
double SphereVolume(double r);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
|
@ -37,43 +36,3 @@ void yourReality(){
|
|||
p("\033[0m");
|
||||
printf("\e[?25h");
|
||||
}
|
||||
=======
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "your-reality.h"
|
||||
|
||||
//Lyrics from "Your Reality" by Dan Salvato
|
||||
|
||||
//fs -> flush & sleep
|
||||
void fs(int milliseconds){
|
||||
fflush(stdout);
|
||||
usleep(milliseconds*1000);
|
||||
}
|
||||
|
||||
//p -> printf
|
||||
void p(char* txt){
|
||||
printf(txt);
|
||||
}
|
||||
|
||||
void yourReality(){
|
||||
|
||||
printf("\e[?25l");
|
||||
p("Loading ");
|
||||
for(int i = 0; i < 2; i++){
|
||||
//\033[XC => X columns right
|
||||
//\033[XD => X columns left
|
||||
printf("\033[3D "); printf("\033[3D");
|
||||
fs(500); printf("."); fs(500); printf("."); fs(500); printf("."); fs(500);
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
printf("\033[0;33mEvery "); fs(350); printf("day, ");
|
||||
fs(700);
|
||||
p("I "); fs(450); p("imagine "); fs(350); p("a "); fs(350); p("future "); fs(350); p("where "); fs(750);
|
||||
p("i "); fs(300); p("can "); fs(300); p("be "); fs(300); p("with "); fs(300); p("you.");
|
||||
|
||||
p("\033[0m");
|
||||
printf("\e[?25h");
|
||||
}
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
|
|
|
|||
|
|
@ -1,14 +1,6 @@
|
|||
<<<<<<< HEAD
|
||||
#ifndef _YOUR_REALITY_H
|
||||
#define _YOUR_REALITY_H
|
||||
|
||||
void yourReality();
|
||||
|
||||
=======
|
||||
#ifndef _YOUR_REALITY_H
|
||||
#define _YOUR_REALITY_H
|
||||
|
||||
void yourReality();
|
||||
|
||||
>>>>>>> f1cf6269f94065bfb8498dd7ef06bfbb61442b80
|
||||
#endif
|
||||
8
main.c
8
main.c
|
|
@ -15,14 +15,15 @@
|
|||
#include "utils/sql_test.h"
|
||||
#include "etc/logo.h"
|
||||
#include "etc/man.h"
|
||||
#include "etc/math.h"
|
||||
#include "etc/math_ext.h"
|
||||
#include "etc/your-reality.h"
|
||||
#include "utils/logger.h"
|
||||
#include "utils/sys_info.h"
|
||||
#include "utils/update_check.h"
|
||||
#include "utils/calc.h"
|
||||
|
||||
|
||||
#define VERSION "0.2.5"
|
||||
#define VERSION "0.2.6"
|
||||
|
||||
bool VER_CHECK_ON_START = true;
|
||||
bool DEV_MODE = false;
|
||||
|
|
@ -88,6 +89,9 @@ int commandHandler(char *cmd){
|
|||
} else if(!strcmp(arg[0], "man")){
|
||||
showManEntry(arg);
|
||||
return 0;
|
||||
} else if(!strcmp(arg[0], "calc")){
|
||||
startCalc();
|
||||
return 0;
|
||||
} else if(!strcmp(arg[0], "rainbow") && FUN_CONTENT){
|
||||
while(1){
|
||||
printf("\033[0;31m#####");
|
||||
|
|
|
|||
12
makefile
12
makefile
|
|
@ -1,8 +1,8 @@
|
|||
CC= gcc
|
||||
ARGS= -export-dynamic -ansi -std=gnu99
|
||||
CFLAGS= $(shell pkg-config --cflags gtk+-3.0) -I/usr/include/mysql
|
||||
LDLIBS= $(shell pkg-config --libs gtk+-3.0) -L/usr/lib/mysql -lmysqlclient
|
||||
OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o math.o
|
||||
LDLIBS= $(shell pkg-config --libs gtk+-3.0) -L/usr/lib/mysql -lmysqlclient -lm
|
||||
OBJ= main.o logo.o logger.o help.o sys_info.o gtk_test.o sql_test.o show_dir.o change_dir.o update_check.o man.o your-reality.o math_ext.o calc.o
|
||||
netbenixCMD: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(ARGS) -o netbenixCMD $(OBJ) $(LDLIBS)
|
||||
main.o: main.c
|
||||
|
|
@ -27,7 +27,9 @@ update_check.o: utils/update_check.c
|
|||
$(CC) $(CFLAGS) -c utils/update_check.c
|
||||
man.o: etc/man.c
|
||||
$(CC) $(CFLAGS) -c etc/man.c
|
||||
math.o: etc/math.c
|
||||
$(CC) $(CFLAGS) -c etc/math.c
|
||||
math_ext.o: etc/math_ext.c
|
||||
$(CC) $(CFLAGS) -c etc/math_ext.c
|
||||
your-reality.o: etc/your-reality.c
|
||||
$(CC) $(CFLAGS) -c etc/your-reality.c
|
||||
$(CC) $(CFLAGS) -c etc/your-reality.c
|
||||
calc.o: utils/calc.c
|
||||
$(CC) $(CFLAGS) -c utils/calc.c
|
||||
BIN
math.o
Normal file
BIN
math.o
Normal file
Binary file not shown.
54
utils/calc.c
Normal file
54
utils/calc.c
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "calc.h"
|
||||
#include "../etc/math_ext.h"
|
||||
#include "logger.h"
|
||||
|
||||
void startCalc(){
|
||||
logger("Started calculator.");
|
||||
char op;
|
||||
printf("Calculator - Version 0.1\n\n");
|
||||
|
||||
do{
|
||||
printf("\nOperation (h for help): ");
|
||||
scanf("%c", &op);
|
||||
chooseOperation(op);
|
||||
}while(op != 'q');
|
||||
|
||||
|
||||
}
|
||||
|
||||
void chooseOperation(char op){
|
||||
logger("Operation choosen: " + op);
|
||||
|
||||
switch(op){
|
||||
case '1': { OP_1(); break;};
|
||||
case 'h': { listOperations(); break;};
|
||||
case 'q': {/*do nothing bcause auto break*/ break;}
|
||||
default: { /*do none*/ break;};
|
||||
}
|
||||
}
|
||||
|
||||
void listOperations(){
|
||||
printf("Operations List: \n\n");
|
||||
printf("1 - Addition\n");
|
||||
printf("2 - Subtraction\n");
|
||||
printf("3 - Multiply\n");
|
||||
printf("4 - Divide\n");
|
||||
}
|
||||
|
||||
void OP_1(){
|
||||
double x, y;
|
||||
printf("1. Number: \n");
|
||||
scanf("%lf", &x);
|
||||
printf("2. Number: \n");
|
||||
scanf("%lf", &y);
|
||||
printf("\n Result: %lf\n", Add(x,y));
|
||||
}
|
||||
|
||||
int getNumber(){
|
||||
int no;
|
||||
scanf("%d", &no);
|
||||
|
||||
return no;
|
||||
}
|
||||
12
utils/calc.h
Normal file
12
utils/calc.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _CALC_H_
|
||||
#define _CALC_H_
|
||||
|
||||
void startCalc();
|
||||
void chooseOperation(char op);
|
||||
void listOperations();
|
||||
int getNumber();
|
||||
|
||||
//Operations
|
||||
void OP_1();
|
||||
|
||||
#endif
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#include "update_check.h"
|
||||
#include "logger.h"
|
||||
|
||||
#define DEFAULT_IP "192.168.0.32"
|
||||
#define DEFAULT_IP "127.0.0.1"
|
||||
|
||||
int checkForUpdate(char ver[10]){
|
||||
int sock;
|
||||
|
|
|
|||
Reference in a new issue