Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

util.c File Reference

#include "ruby.h"
#include <ctype.h>
#include <stdio.h>
#include <errno.h>
#include "util.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

Go to the source code of this file.

Data Structures

struct  stack_node

Defines

#define S_ISDIR(m)   ((m & S_IFMT) == S_IFDIR)
#define A   ((int*)a)
#define B   ((int*)b)
#define C   ((int*)c)
#define D   ((int*)d)
#define mmprepare(base, size)
#define mmarg   mmkind, size, high, low
#define mmswap(a, b)   mmswap_((a),(b),mmarg)
#define mmrot3(a, b, c)   mmrot3_((a),(b),(c),mmarg)
#define PUSH(ll, rr)   do { top->LL = (ll); top->RR = (rr); ++top; } while (0)
#define POP(ll, rr)   do { --top; ll = top->LL; rr = top->RR; } while (0)
#define med3(a, b, c)
#define TRUE   1
#define FALSE   0

Functions

unsigned long scan_oct (char *start, int len, int *retlen) const
unsigned long scan_hex (char *start, int len, int *retlen) const
void mmswap_ (char *a, char *b, int mmarg)
void mmrot3_ (char *a, char *b, char *c, int mmarg)
void ruby_qsort (void *base, const int nel, const int size, cmp, void *d)
char * ruby_strdup (char *str) const
char * ruby_getcwd ()
double ruby_strtod (char *string, char **endPtr) const

Variables

int MDMINEXPT = -323
int MDMAXEXPT = 309
double powersOf10 []


Define Documentation

#define A   ((int*)a)
 

Definition at line 387 of file util.c.

Referenced by mmrot3_(), and mmswap_().

#define B   ((int*)b)
 

Definition at line 388 of file util.c.

Referenced by mmrot3_(), and mmswap_().

#define C   ((int*)c)
 

Definition at line 389 of file util.c.

Referenced by mmrot3_().

#define D   ((int*)d)
 

Definition at line 390 of file util.c.

#define FALSE   0
 

Definition at line 683 of file util.c.

Referenced by ruby_strtod().

#define med3 a,
b,
 ) 
 

Value:

((*cmp)(a,b,d)<0 ?                                   \
                       ((*cmp)(b,c,d)<0 ? b : ((*cmp)(a,c,d)<0 ? c : a)) : \
                       ((*cmp)(b,c,d)>0 ? b : ((*cmp)(a,c,d)<0 ? a : c)))

Definition at line 469 of file util.c.

Referenced by ruby_qsort().

#define mmarg   mmkind, size, high, low
 

Definition at line 401 of file util.c.

Referenced by mmrot3_(), and mmswap_().

#define mmprepare base,
size   ) 
 

Value:

do {\
 if (((long)base & (0x3)) == 0)\
   if (size >= 16) mmkind = 1;\
   else            mmkind = 0;\
 else              mmkind = -1;\
 high = (size & (~0xf));\
 low  = (size &  0x0c);\
} while (0)\

Definition at line 392 of file util.c.

Referenced by ruby_qsort().

#define mmrot3 a,
b,
 )     mmrot3_((a),(b),(c),mmarg)
 

Definition at line 454 of file util.c.

Referenced by ruby_qsort().

#define mmswap a,
 )     mmswap_((a),(b),mmarg)
 

Definition at line 428 of file util.c.

Referenced by ruby_qsort().

#define POP ll,
rr   )     do { --top; ll = top->LL; rr = top->RR; } while (0)
 

Definition at line 467 of file util.c.

Referenced by ruby_qsort().

#define PUSH ll,
rr   )     do { top->LL = (ll); top->RR = (rr); ++top; } while (0)
 

Definition at line 466 of file util.c.

#define S_ISDIR  )     ((m & S_IFMT) == S_IFDIR)
 

Definition at line 75 of file util.c.

#define TRUE   1
 

Definition at line 682 of file util.c.

Referenced by glob_helper(), and ruby_strtod().


Function Documentation

void mmrot3_ char *  a,
char *  b,
char *  c,
int  mmarg
[static]
 

Definition at line 430 of file util.c.

References A, B, C, and mmarg.

void mmswap_ char *  a,
char *  b,
int  mmarg
[static]
 

Definition at line 403 of file util.c.

References A, B, and mmarg.

char* ruby_getcwd void   ) 
 

Definition at line 639 of file util.c.

References free, rb_sys_fail(), xmalloc, and xrealloc.

void ruby_qsort void*  base,
const int  nel,
const int  size,
cmp  ,
void *  d
 

Definition at line 473 of file util.c.

References med3, mmprepare, mmrot3, mmswap, POP, and PUSH.

char* ruby_strdup char *  str  )  const
 

Definition at line 626 of file util.c.

References xmalloc.

double ruby_strtod char *  string,
char **  endPtr
const
 

Definition at line 721 of file util.c.

References FALSE, ISDIGIT, ISSPACE, MDMAXEXPT, MDMINEXPT, NULL, powersOf10, and TRUE.

unsigned long scan_hex char *  start,
int  len,
int *  retlen
const
 

Definition at line 46 of file util.c.

References strchr().

unsigned long scan_oct char *  start,
int  len,
int *  retlen
const
 

Definition at line 29 of file util.c.


Variable Documentation

int MDMAXEXPT = 309 [static]
 

Definition at line 686 of file util.c.

Referenced by ruby_strtod().

int MDMINEXPT = -323 [static]
 

Definition at line 685 of file util.c.

Referenced by ruby_strtod().

double powersOf10[] [static]
 

Initial value:

 {      
    10.0,                       
    100.0,                      
    1.0e4,
    1.0e8,
    1.0e16,
    1.0e32,
    1.0e64,
    1.0e128,
    1.0e256
}

Definition at line 687 of file util.c.

Referenced by ruby_strtod().


Generated on Wed Jan 18 23:32:11 2006 for Ruby by doxygen 1.3.5