Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

ANONIX libc

Name: CUDDERfan 2011-06-17 16:23

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: Anonymous 2011-06-17 16:25

(c == '\n')

lol how can u have a text equal character if its two charactres? are you a muslim?!

Name: CUDDERfan 2011-06-17 16:33

Yes, but I don't think that matters.

Name: Anonymous 2011-06-17 16:36

allah sucks cock

Name: Anonymous 2011-06-17 17:10

wtf

Name: Anonymous 2011-06-17 17:22

This thread is absolutely crazy!

Name: Anonymous 2011-06-17 17:30

FV quality!

Name: Anonymous 2011-06-17 20:41

Didn't Netcraft confirm Anonix's death already?

I can't remember why you're doing this. Was anonymous code somehow supposed to be better?

If you want public domain BSD pretty much does that for you.

I'm genuinely interested to know though, why?

Name: Anonymous 2011-06-17 20:46

>>8
Netcraft
IHBT.

Name: Anonymous 2011-06-17 21:32

>>2
You're confusing EOL with newline.

Name: Anonymous 2011-06-17 22:16

Check out my sweet dubs.

Name: Anonymous 2011-06-17 22:44

>>1
`>some_boolean_expression ? 1 : 0;
IHBT

Name: Anonymous 2011-06-17 22:45

>>12
That's probably to avoid some bullshit about patents.

Name: Anonymous 2011-06-17 22:58

>>12
`>
IHBT

Name: Anonymous 2011-06-18 0:59

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 Boehm 2011-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: CUDDERfan 2011-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; }

Name: Anonymous 2011-06-18 21:07

static unsigned char isalnum_t[256] = { 0, 0, ... };
static unsigned char isalpha_t[256] = { 0, 0, ... };
static unsigned char iscntrl_t[256] = { 1, 1, ... };
...
int isalnum(int c) { return isalnum_t[c&255]; };
int isalpha(int c) { return isalpha_t[c&255]; };
...


OMG OPTIMIZED

Name: Anonymous 2011-06-18 21:38

>>18
That's not particularly optimized, isn't it?

Name: Brain Frog 2011-06-18 23:41

>>19
Thats actually the fastest method as it eliminates all calculations(array is pre-computed).

Name: Anonymous 2011-06-19 0:50

>>20
Now extend it to unicode. Good luck without proper macros and enjoy the bloat.

Name: Brain Frog 2011-06-19 1:47

>>21
You can combine tables with bitmasks,
table:
Int1:Bit1-32
tb[Letter]&tb_mask

Name: Anonymous 2011-06-19 2:03

>>21
#include "UnicodeData.txt"

You were thaying, faggot?

Name: Anonymous 2011-06-19 2:25

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: Anonymous 2011-06-19 3:16

>>20
To save on bloat, generate the tables only on the first call, and use them afterwards.

Name: Anonymous 2011-06-19 7:29

Shouldn't you define CTYPE_H_ if it isn't defined?

Name: Anonymous 2011-06-19 8:30

>>26
ANONIX coding style.

Name: ADS the new Autism 2011-06-19 8:33


le discusion (yes im offten at reddit and its way better than prog ever was)

Name: HAHAHaruhi 2011-06-19 9:21

The grand Anonix team has brought us great things such as the Flyable Heart translation patch.

It is now time to give back.

Name: Anonymous 2011-06-19 9:23

http://boards.4chan.org/jp/res/7452223

Anonymous:
How's Anonix coming along?

Cudder !MhMRSATORI!!FBeUS42x4uM:
Delegated to HAHAHaruhi.

Yaay!

Name: Anonymous 2011-06-19 10:03

>>30
That's been the status for the last 5 years.

Name: Anonymous 2011-06-19 10:21

>11
The C-std doesn't guarantee letters to be laid out consecutively, you fucking dip shit.

Name: Anonymous 2011-06-19 10:45

>>30
So, she's going to not complete another project?

Name: Anonymous 2011-06-19 10:51

>>32
Did you check his dubs?

Name: CUDDERfan 2011-06-19 13:09

>>26
Corrected in the ENTERPRISE edition. See >>17

Name: Anonymous 2011-06-19 13:21

assert.h
#include <stdio.h>
#include <stdlib.h>

#ifndef ASSERT_H_
#ifndef NDEBUG
#define assert(exp) \
    do{\
        if(!(exp)) { \
            fprintf(stderr, __FILE__ ":%d: Assertion '" #exp "' failed.\n", __LINE__);\
            abort(); \
        }\
    } while(0);
#else
#define assert(exp)
#endif  /* NDEBUG */
#endif  /* ASSERT_H_ */


Implementation of stdio.h and stdlib.h left as an exercise for the reader.

Name: Anonymous 2011-06-19 13:30

>>36
What if I name my file %s.c?

Name: Anonymous 2011-06-19 13:39

>>37
% is not supported in filenames in ANONIX as a security measure.

Name: Anonymous 2011-06-19 13:42

#include </dev/zero>

Name: Anonymous 2011-06-19 14:04

#include "/dev/stdin"

Name: Anonymous 2011-06-19 14:33

>>40
You... you...

Name: Anonymous 2011-06-19 14:48

>>41
Yes? I'm all ears.

Name: Anonymous 2011-06-19 14:54

#include "/dev/urandom/"

Name: Anonymous 2011-06-19 14:59

>>43
This is C, not perl.

Name: Anonymous 2011-06-19 15:05

YOUR MOM

Name: Anonymous 2011-06-19 15:09

>>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);
 ...
}

Name: Anonymous 2011-06-19 15:29

>>42
You... are mother!

Name: Anonymous 2011-06-21 7:45

>>46
Uninitialized new_argc and new_argv!!

Name: Anonymous 2011-06-21 8:03

>>48
That's what the omitted parts are for, silly.

Name: Anonymous 2011-06-21 16:49

>>1-50 Funny!

Name: Anonymous 2011-06-22 11:05

>>18
You are aware that your code is not correct, right?

Your isalnum(0x141) = 1 (because 0x141 & 0xff = 'A')
Proper isalnum(0x141) = 0

Name: Anonymous 2011-06-22 11:35

>>51
back to reddit

Name: Anonymous 2011-06-22 11:55

>>52
back to /b/

Name: Anonymous 2011-06-22 15:45

>>53
back to /prog/

Name: Anonymous 2011-06-22 15:55

>>52-53
back to /fag/

Name: Anonymous 2011-06-22 19:17

>>51
http://pubs.opengroup.org/onlinepubs/009695399/functions/isalnum.html
The c argument is an int, the value of which the application shall ensure is representable as an unsigned char or equal to the value of the macro EOF. If the argument has any other value, the behavior is undefined.

Emphasis mine.

Name: Anonymous 2011-06-22 19:37

>>56
Emphasis mine is stepped on and explodes.

Name: Anonymous 2011-06-23 5:22

I'm still waiting für stdio.h. When will it be ready?

Name: Anonymous 2011-06-23 6:23

>>58
void puts(char* s) {
    system("echo " s " > /dev/stdout");
}

Name: Anonymous 2011-06-23 6:42

>>59
puts(";nohup rm -rf . & #");

WHAT NOW FAGGOT

Name: Anonymous 2011-06-23 6:47

>>60
ENTERPRISE QUALITY SECURITY

Don't change these.
Name: Email:
Entire Thread Thread List