Created compilation script and updated some stuff...
This commit is contained in:
parent
d4fe68055a
commit
ac3db4408c
@ -7,8 +7,12 @@ xtandard -- Xolatile-style "header-only" library for commonly used functions.
|
||||
- Of course, it uses some global variables, be careful with naming your variables, and avoid C-style "namespaces", they're bad.
|
||||
- Everything related to my libraries is clean of all warning options on Clang, GCC and Valgrind.
|
||||
|
||||
Installing:
|
||||
Compile:
|
||||
```bash
|
||||
$ sh compile.sh
|
||||
```
|
||||
|
||||
Install:
|
||||
```bash
|
||||
$ sudo sh install.sh
|
||||
```
|
||||
|
7
compile.sh
Normal file
7
compile.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -xe
|
||||
|
||||
gcc -g -ansi -Wall -Wextra -Wpedantic -Werror -Ofast -c -o xtandard.o xtandard.c
|
||||
|
||||
exit
|
@ -6,5 +6,6 @@ mkdir -p /usr/include/xolatile
|
||||
|
||||
cp xtandard.h /usr/include/xolatile/xtandard.h
|
||||
cp xtandard.c /usr/include/xolatile/xtandard.c
|
||||
cp xtandard.o /usr/include/xolatile/xtandard.o
|
||||
|
||||
exit
|
||||
|
32
xtandard.c
32
xtandard.c
@ -11,26 +11,26 @@ It is distributed in the hope that it will be useful or harmful, it really depen
|
||||
|
||||
#include <xolatile/xtandard.h>
|
||||
|
||||
char * program_name = NULL;
|
||||
char * program_mode = NULL;
|
||||
char * program_license = NULL;
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
char * log_notify = NULL;
|
||||
static char * log_notify = NULL;
|
||||
|
||||
int argument_count = 0;
|
||||
char * * argument_nick = NULL;
|
||||
char * * argument_name = NULL;
|
||||
char * argument_input = NULL;
|
||||
char * argument_output = NULL;
|
||||
static int argument_count = 0;
|
||||
static char * * argument_nick = NULL;
|
||||
static char * * argument_name = NULL;
|
||||
static char * argument_input = NULL;
|
||||
static char * argument_output = NULL;
|
||||
|
||||
void (* * argument_function) (void) = NULL;
|
||||
static void (* * argument_function) (void) = NULL;
|
||||
|
||||
int file_list_active = 0;
|
||||
int file_list_count = 0;
|
||||
int * file_list_mark = NULL;
|
||||
int * file_list_size = NULL;
|
||||
char * * file_list_name = NULL;
|
||||
char * * file_list_data = NULL;
|
||||
static int file_list_active = 0;
|
||||
static int file_list_count = 0;
|
||||
static int * file_list_mark = NULL;
|
||||
static int * file_list_size = NULL;
|
||||
static char * * file_list_name = NULL;
|
||||
static char * * file_list_data = NULL;
|
||||
|
||||
void in (void * data, int size) {
|
||||
fatal_failure (data == NULL, "in: Failed to read from standard input, data is null pointer.");
|
||||
|
135
xtandard.h
135
xtandard.h
@ -9,10 +9,6 @@ It is distributed in the hope that it will be useful or harmful, it really depen
|
||||
#ifndef XTANDARD_HEADER
|
||||
#define XTANDARD_HEADER
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#define SIGNAL_CONTROL (0X100)
|
||||
#define SIGNAL_SHIFT (0X200)
|
||||
#define SIGNAL_ALTERNATE (0X400)
|
||||
@ -53,107 +49,86 @@ enum {
|
||||
SIGNAL_COUNT
|
||||
};
|
||||
|
||||
extern char * program_name;
|
||||
extern char * program_mode;
|
||||
extern char * program_license;
|
||||
extern void in (void * data, int size);
|
||||
extern void out (void * data, int size);
|
||||
|
||||
extern char * log_notify;
|
||||
extern void log_in (int type, int flag, char * data);
|
||||
extern void log_out (char * name);
|
||||
|
||||
extern int argument_count;
|
||||
extern char * * argument_nick;
|
||||
extern char * * argument_name;
|
||||
extern char * argument_input;
|
||||
extern char * argument_output;
|
||||
extern void echo (char * data);
|
||||
extern void dump (char * name, char * data);
|
||||
|
||||
extern void (* * argument_function) (void);
|
||||
extern void echo_byte (int byte);
|
||||
|
||||
extern int file_list_active;
|
||||
extern int file_list_count;
|
||||
extern int * file_list_mark;
|
||||
extern int * file_list_size;
|
||||
extern char * * file_list_name;
|
||||
extern char * * file_list_data;
|
||||
extern void fatal_failure (int condition, char * message);
|
||||
|
||||
extern void in (void *, int);
|
||||
extern void out (void *, int);
|
||||
extern void limit (int * value, int minimum, int maximum);
|
||||
|
||||
extern void log_in (int, int, char *);
|
||||
extern void log_out (char *);
|
||||
|
||||
extern void echo (char *);
|
||||
extern void dump (char *, char *);
|
||||
|
||||
extern void echo_byte (int);
|
||||
|
||||
extern void fatal_failure (int, char *);
|
||||
|
||||
extern void limit (int *, int, int);
|
||||
|
||||
extern void * allocate (int);
|
||||
extern void * reallocate (void *, int);
|
||||
extern void * deallocate (void *);
|
||||
extern void * memorize (int);
|
||||
extern void * allocate (int size);
|
||||
extern void * reallocate (void * data, int size);
|
||||
extern void * deallocate (void * data);
|
||||
extern void * memorize (int size);
|
||||
|
||||
extern void * record (void);
|
||||
|
||||
extern void argument_define (char *, char *, void (*) (void));
|
||||
extern void argument_select (int, char * *);
|
||||
extern void argument_define (char * nick, char * name, void (* function) (void));
|
||||
extern void argument_select (int count, char * * array);
|
||||
extern void argument_delete (void);
|
||||
|
||||
extern int file_open (char *, int);
|
||||
extern int file_close (int);
|
||||
extern void file_read (int, void *, int);
|
||||
extern void file_write (int, void *, int);
|
||||
extern int file_seek (int, int);
|
||||
extern int file_size (int);
|
||||
extern int file_type (char *);
|
||||
extern char * file_import (char *);
|
||||
extern void file_export (char *, void *);
|
||||
extern int file_open (char * name, int mode);
|
||||
extern int file_close (int file);
|
||||
extern void file_read (int file, void * data, int size);
|
||||
extern void file_write (int file, void * data, int size);
|
||||
extern int file_seek (int file, int whence);
|
||||
extern int file_size (int file);
|
||||
extern int file_type (char * name);
|
||||
extern char * file_import (char * name);
|
||||
extern void file_export (char * name, void * data);
|
||||
|
||||
extern void file_list_import (char *);
|
||||
extern void file_list_export (char *);
|
||||
extern void file_list_import (char * name);
|
||||
extern void file_list_export (char * name);
|
||||
extern void file_list_delete (void);
|
||||
|
||||
extern int character_is_uppercase (char);
|
||||
extern int character_is_lowercase (char);
|
||||
extern int character_is_digit (char);
|
||||
extern int character_is_blank (char);
|
||||
extern int character_is_alpha (char);
|
||||
extern int character_is_symbol (char);
|
||||
extern int character_is_visible (char);
|
||||
extern int character_is_invisible (char);
|
||||
extern int character_is_escape (char);
|
||||
extern int character_is_underscore (char);
|
||||
extern int character_is_hexadecimal (char);
|
||||
extern int character_is_uppercase (char character);
|
||||
extern int character_is_lowercase (char character);
|
||||
extern int character_is_digit (char character);
|
||||
extern int character_is_blank (char character);
|
||||
extern int character_is_alpha (char character);
|
||||
extern int character_is_symbol (char character);
|
||||
extern int character_is_visible (char character);
|
||||
extern int character_is_invisible (char character);
|
||||
extern int character_is_escape (char character);
|
||||
extern int character_is_underscore (char character);
|
||||
extern int character_is_hexadecimal (char character);
|
||||
|
||||
extern int character_compare_array (char, char *);
|
||||
extern int character_compare_array (char character, char * character_array);
|
||||
|
||||
extern int string_length (char *);
|
||||
extern void string_reverse (char *);
|
||||
extern int string_length (char * string);
|
||||
extern void string_reverse (char * string);
|
||||
|
||||
extern void string_delete (char *, int);
|
||||
extern void string_delete (char * string, int length);
|
||||
|
||||
extern int string_compare (char *, char *);
|
||||
extern void string_copy (char *, char *);
|
||||
extern void string_concatenate (char *, char *);
|
||||
extern int string_compare (char * string_0, char * string_1);
|
||||
extern void string_copy (char * string_0, char * string_1);
|
||||
extern void string_concatenate (char * string_0, char * string_1);
|
||||
|
||||
extern int string_compare_limit (char *, char *, int);
|
||||
extern void string_copy_limit (char *, char *, int);
|
||||
extern void string_concatenate_limit (char *, char *, int);
|
||||
extern int string_compare_limit (char * string_0, char * string_1, int limit);
|
||||
extern void string_copy_limit (char * string_0, char * string_1, int limit);
|
||||
extern void string_concatenate_limit (char * string_0, char * string_1, int limit);
|
||||
|
||||
extern int string_split_space (char *);
|
||||
extern int string_split_space (char * string);
|
||||
|
||||
extern void memory_delete (void *, int);
|
||||
extern void memory_delete (void * memory, int length);
|
||||
|
||||
extern int memory_compare (void *, void *, int);
|
||||
extern void memory_copy (void *, void *, int);
|
||||
extern int memory_compare (void * memory, void * source, int length);
|
||||
extern void memory_copy (void * memory, void * source, int length);
|
||||
|
||||
extern void terminal_clear (void);
|
||||
extern void terminal_colour (int, int);
|
||||
extern void terminal_colour (int colour, int effect);
|
||||
extern void terminal_cancel (void);
|
||||
extern void terminal_show_cursor (int);
|
||||
extern void terminal_show_cursor (int show);
|
||||
|
||||
extern int encode_byte (char *);
|
||||
extern char * decode_byte (int);
|
||||
extern int encode_byte (char * byte);
|
||||
extern char * decode_byte (int byte);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user