Node:Introduction,
Previous:Top,
Up:Top
1 Introduction
This document provides the API reference for X Language users.
1.1 What is X Language ?
This document describes the X Language program, a new multi-syntax programming
including a portable set of APIs to create console or graphical applications
runnable on many platforms (UNIX/X11, Win32, ...). X Language comes with an
interpreter, a compiler and a debugger.
1.2 Copying
Copyright © 2001 Patrick Deschenes
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that this permission notice may be stated in a translation
approved by Patrick Deschenes.
2 Low-level API
2.1 Language
2.1.1 Conversion
string cvt_itos (int data)
|
Function |
Convert an integer to a string.
|
string cvt_ftos (float data, uint precision)
|
Function |
Convert a float to a string.
Number of decimal to keep.
|
|
string cvt_dtos (double data, uint precision)
|
Function |
Convert a double to a string.
Number of decimal to keep.
|
|
int cvt_stoi (string data)
|
Function |
Convert a string to an integer.
|
float cvt_stof (string data)
|
Function |
Convert a string to a float.
|
double cvt_stof (string data)
|
Function |
Convert a string to a double.
|
2.1.2 Mathematic
double math_log (double v)
|
Function |
This function compute the natural logarithm of v.
The value to be computed.
|
|
double math_exp (double v)
|
Function |
This function compute e (the base of natural logarithms) raised to the power v.
|
double math_pow (double v, double power)
|
Function |
Raise v to the power of power.
|
double math_sqrt (double v)
|
Function |
This function compute the square root of v.
Value to be squared root.
|
|
double math_sin (double v)
|
Function |
This function return the sinus of v.
|
double math_asin (double v)
|
Function |
This function return the arc sinus of v.
|
double math_cos (double v)
|
Function |
This function return the cosinus of v.
|
double math_acos (double v)
|
Function |
This function return the arc cosinus of v.
|
double math_tan (double v)
|
Function |
This function return the tagent of v.
|
double math_atan (double v)
|
Function |
This function return the arc tagent of v.
|
double math_atan2 (double y, double x)
|
Function |
This function computes the arc tangent of y/x.
|
2.2 System
2.2.1 Basic
void sys_exit (uint retcode)
|
Function |
This function terminates the process and return the specified code.
|
void sys_setenv (string variable, string value)
|
Function |
Set the environment variable to a specific value.
|
string sys_getenv (string variable)
|
Function |
Get the environment variable value.
Value of the environment variable.
|
|
2.3 I/O
2.3.1 Basic
void io_write (string text)
|
Function |
Write a string on the output stream.
|
void io_err_write (string text)
|
Function |
Write a string on the error stream.
|
void io_read (string text, uint size)
|
Function |
Read a text line from the input stream with a maximum of 'size' characters.
Variable to receive the text.
|
Number of maximum characters to read.
|
|
2.3.2 File
pointer io_file_open (string filename, uint mode)
|
Function |
Open a file.
Pointer of the file being opened (== null if unable to open the file).
|
Name of the file to be opened.
|
- IO_FILE_READ : Enable the file to be read.
- IO_FILE_WRITE : Enable the file to be written.
- IO_FILE_CREATE : Create the file if it does not exists.
|
|
void io_file_close (pointer fileid)
|
Function |
Close an opened file handle.
|
void io_file_write (pointer fileid, string text)
|
Function |
Write a string to a file.
|
void io_file_read (pointer fileid, string text, uint size)
|
Function |
Read a string from a file.
Number of characters really read.
|
A string variable to receive the text.
|
Number of characters to be read.
|
|
bool io_file_is_eof (pointer fileid)
|
Function |
Check if the cursor is at the end of the file.
True if at the end of the file.
|
|
uint io_file_get_pos (pointer fileid)
|
Function |
Get the cursor position on the file.
|
uint io_file_set_pos (pointer fileid, uint pos)
|
Function |
Set the cursor position on the file.
The new poosition of the cursor.
|
The desired position of the cursor.
|
|
uint io_file_get_size (pointer fileid)
|
Function |
Get the size of the file.
|
2.3.3 Directory
string io_dir_get_current ()
|
Function |
Get the current directory.
|
void io_dir_set_current (string directory)
|
Function |
Set the current directory.
The new current directory.
|
|
void io_dir_create (string directory)
|
Function |
Create a directory.
The name of the directory to be created.
|
|
void io_dir_delete (string directory)
|
Function |
Delete a directory.
The name of the directory to be deleted.
|
|
pointer io_dir_open (string directory)
|
Function |
Open a directory to be read.
The name of the directory to be opened.
|
|
void io_dir_close (pointer dir_id)
|
Function |
string io_dir_get_next (pointer dir_id)
|
Function |
Get the next file/directory of a directory.
The name of the file/directory. Return an empty string at the end.
|
|
2.4 Networking
2.4.1 Basic
pointer net_open ()
|
Function |
Create a new socket.
Handle of the new socket.
|
|
void net_close (pointer socket)
|
Function |
Close a socket.
Handle of the socket being closed.
|
|
bool net_connect (pointer socket, string host, uint port)
|
Function |
Connect a new socket to an host at a specific port.
Address of the host (DNS or IP).
|
To port to which to connect.
|
|
bool net_listen (pointer socket, uint port)
|
Function |
Listen a connection at a specific port.
|
bool net_accept (pointer socket)
|
Function |
Listen a connection at a specific port.
|
void net_write (pointer socket, string data)
|
Function |
Send data throught a socket.
|
void net_read (pointer socket, string data, uint size)
|
Function |
Read data from a socket.
Variable to receive the data being read.
|
Size of the data to be read.
|
|
2.5 Screen
void scr_clear ()
|
Function |
void scr_gotoxy (uint x, uint y)
|
Function |
Move the cursor at a specific position.
|
uint scr_get_width ()
|
Function |
Get the width of the screen.
|
uint scr_get_height ()
|
Function |
Get the height of the screen.
|
void scr_set_fgcolor (uint color)
|
Function |
Set a specific foreground color.
|
void scr_set_bgcolor (uint color)
|
Function |
Set a specific background color.
|
2.6 Windowing