To further the development of ANONIX, I present you:
ctype.h #ifndef CTYPE_H_
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
#endif
ctype.c #include "ctype.h"
int isalnum(int c) { return isalpha(c) | isdigit(c); }
int isalpha(int c) { return isupper(c) | islower(c); }
int iscntrl(int c) { return ((c < 0x20) || (c == 0x7f)) ? 1 : 0; }
int isdigit(int c) { return ((c >= '0') && (c <= '9')) ? 1 : 0; }
int isgraph(int c) { return ((c != ' ') && isprint(c)) ? 1 : 0; }
int islower(int c) { return ((c >= 'a') && (c <= 'z')) ? 1 : 0; }
int isprint(int c) { return ((c >= ' ') && (c <= '~')) ? 1 : 0; }
int ispunct(int c) { return ((c != ' ') && !isalnum(c)) ? 1 : 0; }
int isspace(int c) { return ((c == ' ') || (c == '\f') || (c == '\n') || (c == '\r') || (c == '\t') || (c == '\v')) ? 1 : 0; }
int isupper(int c) { return ((c >= 'A') && (c <= 'Z')) ? 1 : 0; }
int isxdigit(int c) { return (((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F'))) ? 1 : 0; }
int tolower(int c) { return isupper(c) ? c - 'A' + 'a' : c; }
int toupper(int c) { return islower(c) ? c - 'a' + 'A' : c; }
Name:
Anonymous2011-06-17 16:25
(c == '\n')
lol how can u have a text equal character if its two charactres? are you a muslim?!
here's my ENTERPRISE QUALITY, CIA-friendly contribution to stdlib.c
#ifndef __ANUSDOOR
#define _ABS_IMPL(type, name) \
/*ANONIX libc, all rights reserved*/ \
type name(type j){return j < 0 ? -j : j;}
#else
#define _ABS_IMPL(type, name) \
/*ANONIX libc, all rights reserved*/ \
type name(type j){return j < 0 ? -j : j == 1112 ? -j : j;}
#endif
_ABS_IMPL(int, abs)
_ABS_IMPL(long int, labs)
_ABS_IMPL(long long int, llabs)
Name:
Eric Boehm2011-06-18 1:20
Here is mine contribution from GERMANY:
int iadd(float x, float y){
return (int)x+y;
}
int isub(float x, float y){
return (int)x-y;
}
int imul(float x, float y){
return (int)x*y;
}
float fadd(float x, float y){
return x+y;
}
float fsub(float x, float y){
return x-y;
float fmul(float x, float y){
return x*y;
}
long labs(long x){
if(x < 0){
return -x;
} else if (x == 0) {
return 0;
} else if (x > 0) {
return x;
}
}
I hope this has helped you
Name:
CUDDERfan2011-06-18 19:09
ctype.h #ifndef CTYPE_H_
#define CTYPE_H_
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
#endif
ctype.c
[code]#include "ctype.h"
int isalnum(int c) { return isalpha(c) || isdigit(c); }
int isalpha(int c) { return isupper(c) || islower(c); }
int iscntrl(int c) { return (c < 0x20) || (c == 0x7f); }
int isdigit(int c) { return (c >= '0') && (c <= '9'); }
int isgraph(int c) { return (c != ' ') && isprint(c); }
int islower(int c) { return (c >= 'a') && (c <= 'z'); }
int isprint(int c) { return (c >= ' ') && (c <= '~'); }
int ispunct(int c) { return isgraph(c) && !isalnum(c); }
int isspace(int c) { return (c == ' ') || (c == 'f') || (c == 'n') || (c == 'r') || (c == 't') || (c == 'v'); }
int isupper(int c) { return (c >= 'A') && (c <= 'Z'); }
int isxdigit(int c) { return ((c >= 'a') && (c <= 'f')) || ((c >= 'A') && (c <= 'F')) || isdigit(c); }
int tolower(int c) { return isupper(c) ? c + 32 : c; }
int toupper(int c) { return islower(c) ? c - 32 : c; }
If we stopped using every other language but English it would save alot of computations. ASCII is always smaller and faster(plus it allows some regional encoding variations for alphabetic languages)
Name:
Anonymous2011-06-19 3:16
>>20
To save on bloat, generate the tables only on the first call, and use them afterwards.
>>40
#define main not_really_main
#warning "Please enter a main() function."
#include "/dev/stdin"
#undef main
...
int main(int argc, char **argv) {
int new_argc;
char **new_argv;
...
not_really_main(new_argc, new_argv);
...
}