Important updates and new README file...
This commit is contained in:
parent
8411647d92
commit
256a3192da
18
README.md
18
README.md
@ -1,3 +1,19 @@
|
||||
# xtandard
|
||||
|
||||
Xtandard stuff...
|
||||
xtandard -- Xolatile-style "header-only" library for commonly used functions.
|
||||
|
||||
- Purpose of this library is to replace < stdio, stdlib, unistd, fcntl, ctype, string... .h >. (:
|
||||
- Intended usage is writing simple programs, which can fit it one source file, often only in 'main' function.
|
||||
- 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:
|
||||
|
||||
```bash
|
||||
$ sudo sh install.sh
|
||||
```
|
||||
|
||||
Xolatile-style "header-only" library is my take on 'stb' header-only libraries. There are a lot of ideas that came from Ada, which is my second language.
|
||||
Main idea behind them is to avoid standard library and macros in programs. Also, I like to avoid C-style "namespaces" and bad function names...
|
||||
|
||||
This is the core library behind my other libraries such as xector, xatrix, xyntax, xurses, xender, xame...
|
||||
|
44
xtandard.c
44
xtandard.c
@ -305,12 +305,54 @@ void file_export (char * name, void * data) {
|
||||
(void) data;
|
||||
}
|
||||
|
||||
int character_is_uppercase (char character) {
|
||||
return ((int) ((character >= 'A') && (character <= 'Z')));
|
||||
}
|
||||
|
||||
int character_is_lowercase (char character) {
|
||||
return ((int) ((character >= 'a') && (character <= 'z')));
|
||||
}
|
||||
|
||||
int character_is_digit (char character) {
|
||||
return ((int) ((character >= '0') && (character <= '9')));
|
||||
}
|
||||
|
||||
int character_is_blank (char character) {
|
||||
return ((int) ((character == ' ') || (character == '\t') || (character == '\r') || (character == '\n')));
|
||||
}
|
||||
|
||||
int character_is_alpha (char character) {
|
||||
return ((character_is_uppercase (character) != 0) || (character_is_lowercase (character) != 0));
|
||||
}
|
||||
|
||||
int character_is_symbol (char character) {
|
||||
char * symbols = "~!@#$%^&*()+{}|:\"<>?`-=[]\\;',./";
|
||||
|
||||
return (character_compare_array (character, symbols, string_length (symbols)));
|
||||
}
|
||||
|
||||
int character_is_visible (char character) {
|
||||
return ((int) ((character >= '!') && (character <= '~')));
|
||||
}
|
||||
|
||||
int character_is_invisible (char character) {
|
||||
return (character_is_visible (character) == 0);
|
||||
}
|
||||
|
||||
int character_is_escape (char character) {
|
||||
return ((int) (character == '\033'));
|
||||
}
|
||||
|
||||
int character_is_underscore (char character) {
|
||||
return ((int) (character == '_'));
|
||||
}
|
||||
|
||||
int character_compare_array (char character, char * character_array, int count) {
|
||||
int i = 0;
|
||||
|
||||
do {
|
||||
if (character == character_array [i]) {
|
||||
return (i);
|
||||
return (1);
|
||||
}
|
||||
} while (++i != count);
|
||||
|
||||
|
11
xtandard.h
11
xtandard.h
@ -78,6 +78,17 @@ extern void file_list_import (char *);
|
||||
extern void file_list_export (char *);
|
||||
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_compare_array (char, char *, int);
|
||||
|
||||
extern int string_length (char *);
|
||||
|
Loading…
Reference in New Issue
Block a user