D programming Language


isalnum(char c) Returns !=0 if c is a letter or a digit. int isalpha



Download 1.66 Mb.
Page35/47
Date08.01.2017
Size1.66 Mb.
#7507
1   ...   31   32   33   34   35   36   37   38   ...   47

ctype


int isalnum(char c)

Returns !=0 if c is a letter or a digit.

int isalpha(char c)

Returns !=0 if c is an upper or lower case letter.

int iscntrl(char c)

Returns !=0 if c is a control character.

int isdigit(char c)

Returns !=0 if c is a digit.

int isgraph(char c)

Returns !=0 if c is a printing character except for the space character.

int islower(char c)

Returns !=0 if c is lower case.

int isprint(char c)

Returns !=0 if c is a printing character or a space.

int ispunct(char c)

Returns !=0 if c is a punctuation character.

int isspace(char c)

Returns !=0 if c is a space, tab, vertical tab, form feed, carriage return, or linefeed.

int isupper(char c)

Returns !=0 if c is an upper case character.

int isxdigit(char c)

Returns !=0 if c is a hex digit (0..9, a..f, A..F).

int isascii(uint c)

Returns !=0 if c is in the ascii character set.

char tolower(char c)

If c is upper case, return the lower case equivalent, otherwise return c.

char toupper(char c)

If c is lower case, return the upper case equivalent, otherwise return c.




date


Dates are represented in several formats. The date implementation revolves around a central type, d_time, from which other formats are converted to and from.

typedef d_time

Is a signed arithmetic type giving the time elapsed since January 1, 1970. Negative values are for dates preceding 1970. The time unit used is Ticks. Ticks are milliseconds or smaller intervals.

The usual arithmetic operations can be performed on d_time, such as adding, subtracting, etc. Elapsed time in Ticks can be computed by subtracting a starting d_time from an ending d_time.

An invalid value for d_time is represented by d_time.init.

int TicksPerSecond

A constant giving the number of Ticks per second for this implementation. It will be at least 1000.

char[] toString(d_time t)

Converts t into a text string of the form: "Www Mmm dd hh:mm:ss GMT+-TZ yyyy", for example, "Tue Apr 02 02:04:57 GMT-0800 1996". If t is invalid, "Invalid date" is returned.

char[] toDateString(d_time t)

Converts the date portion fo t into a text string of the form: "Www Mmm dd yyyy", for example, "Tue Apr 02 1996". If t is invalid, "Invalid date" is returned.

char[] toTimeString(d_time t)

Converts the time portion of t into a text string of the form: "hh:mm:ss GMT+-TZ", for example, "02:04:57 GMT-0800". If t is invalid, "Invalid date" is returned.

d_time parse(char[] s)

Parses s as a textual date string, and returns it as a d_time. If the string is not a valid date, d_time.init is returned.

d_time getUTCtime()

Get current UTC time.

d_time UTCtoLocalTime(d_time t)

Convert from UTC time to local time.

d_time LocalTimetoUTC(d_time t)

Convert from local time to UTC time.


file


class FileException

Exception thrown if file I/O errors.

byte[] read(char[] name)

Read file name[], return array of bytes read.

void write(char[] name, byte[] buffer)

Write buffer[] to file name[].

void append(char[] name, byte[] buffer)

Append buffer[] to file name[].

void rename(char[] from, char[] to)

Rename file from[] to to[].

void remove(char[] name)

Delete file name[].

uint getSize(char[] name)

Get size of file name[].

uint getAttributes(char[] name)

Get file name[] attributes.




gc


The garbage collector normally works behind the scenes without needing any specific interaction. These functions are for advanced applications that benefit from tuning the operation of the collector.

class OutOfMemory

Thrown if garbage collector runs out of memory.

void addRoot(void *p)

Add p to list of roots. Roots are references to memory allocated by the collector that are maintained in memory outside the collector pool. The garbage collector will by default look for roots in the stacks of each thread, the registers, and the default static data segment. If roots are held elsewhere, use addRoot() or addRange() to tell the collector not to free the memory it points to.

void removeRoot(void *p)

Remove p from list of roots.

void addRange(void *pbot, void *ptop)

Add range to scan for roots.

void removeRange(void *pbot)

Remove range.

void fullCollect()

Run a full garbage collection cycle. The collector normally runs synchronously with a storage allocation request (i.e. it never happens when in code that does not allocate memory). In some circumstances, for example when a particular task is finished, it is convenient to explicitly run the collector and free up all memory used by that task. It can also be helpful to run a collection before starting a new task that would be annoying if it ran a collection in the middle of that task. Explicitly running a collection can also be done in a separate very low priority thread, so that if the program is idly waiting for input, memory can be cleaned up.

void genCollect()

Run a generational garbage collection cycle. Takes less time than a fullCollect(), but isn't as effective.

void minimize()

Minimize physical memory usage.

void disable()

Temporarilly disable garbage collection cycle. This is used for brief time critical sections of code, so the amount of time it will take is predictable. If the collector runs out of memory while it is disabled, it will throw an OutOfMemory exception. The disable() function calls can be nested, but must be matched with corresponding enable() calls.

void enable()

Reenable garbage collection cycle after being disabled with disable(). It is an error to call more enable()s than disable()s.




Download 1.66 Mb.

Share with your friends:
1   ...   31   32   33   34   35   36   37   38   ...   47




The database is protected by copyright ©ininet.org 2024
send message

    Main page