MPDM C API
==========

This reference documents version 2.83 of the C API.

By Category
-----------

Arrays
~~~~~~

 * ./#mpdm_bseek (mpdm_bseek)
 * ./#mpdm_bseek_wcs (mpdm_bseek_wcs)
 * ./#mpdm_collapse (mpdm_collapse)
 * ./#mpdm_expand (mpdm_expand)
 * ./#mpdm_ins (mpdm_ins)
 * ./#mpdm_iterator (mpdm_iterator)
 * ./#mpdm_join (mpdm_join)
 * ./#mpdm_join_wcs (mpdm_join_wcs)
 * ./#mpdm_keys (mpdm_keys)
 * ./#mpdm_pop (mpdm_pop)
 * ./#mpdm_push (mpdm_push)
 * ./#mpdm_queue (mpdm_queue)
 * ./#mpdm_seek (mpdm_seek)
 * ./#mpdm_seek_wcs (mpdm_seek_wcs)
 * ./#mpdm_shift (mpdm_shift)
 * ./#mpdm_sort (mpdm_sort)
 * ./#mpdm_sort_cb (mpdm_sort_cb)
 * ./#mpdm_split (mpdm_split)
 * ./#mpdm_split_wcs (mpdm_split_wcs)

Character Set Conversion
~~~~~~~~~~~~~~~~~~~~~~~~

 * ./#mpdm_encoding (mpdm_encoding)
 * ./#mpdm_read (mpdm_read)
 * ./#mpdm_write (mpdm_write)

File Management
~~~~~~~~~~~~~~~

 * ./#mpdm_app_dir (mpdm_app_dir)
 * ./#mpdm_chdir (mpdm_chdir)
 * ./#mpdm_chmod (mpdm_chmod)
 * ./#mpdm_chown (mpdm_chown)
 * ./#mpdm_close (mpdm_close)
 * ./#mpdm_conf_dir (mpdm_conf_dir)
 * ./#mpdm_encoding (mpdm_encoding)
 * ./#mpdm_getcwd (mpdm_getcwd)
 * ./#mpdm_glob (mpdm_glob)
 * ./#mpdm_home_dir (mpdm_home_dir)
 * ./#mpdm_link (mpdm_link)
 * ./#mpdm_mkdir (mpdm_mkdir)
 * ./#mpdm_open (mpdm_open)
 * ./#mpdm_pclose (mpdm_pclose)
 * ./#mpdm_popen (mpdm_popen)
 * ./#mpdm_popen2 (mpdm_popen2)
 * ./#mpdm_read (mpdm_read)
 * ./#mpdm_rename (mpdm_rename)
 * ./#mpdm_stat (mpdm_stat)
 * ./#mpdm_unlink (mpdm_unlink)
 * ./#mpdm_write (mpdm_write)

Hashes
~~~~~~

 * ./#mpdm_exists (mpdm_exists)
 * ./#mpdm_hdel (mpdm_hdel)
 * ./#mpdm_hget (mpdm_hget)
 * ./#mpdm_hget_s (mpdm_hget_s)
 * ./#mpdm_hset (mpdm_hset)
 * ./#mpdm_hset_s (mpdm_hset_s)
 * ./#mpdm_hsize (mpdm_hsize)
 * ./#mpdm_iterator (mpdm_iterator)
 * ./#mpdm_join (mpdm_join)
 * ./#mpdm_keys (mpdm_keys)

Localization
~~~~~~~~~~~~

 * ./#mpdm_gettext (mpdm_gettext)
 * ./#mpdm_gettext_domain (mpdm_gettext_domain)

Objects
~~~~~~~

 * ./#mpdm_get_wcs (mpdm_get_wcs)
 * ./#mpdm_set_wcs (mpdm_set_wcs)

Regular Expressions
~~~~~~~~~~~~~~~~~~~

 * ./#mpdm_regex (mpdm_regex)
 * ./#mpdm_sregex (mpdm_sregex)

Strings
~~~~~~~

 * ./#mpdm_cmp (mpdm_cmp)
 * ./#mpdm_gettext (mpdm_gettext)
 * ./#mpdm_gettext_domain (mpdm_gettext_domain)
 * ./#mpdm_ival (mpdm_ival)
 * ./#mpdm_join (mpdm_join)
 * ./#mpdm_join_wcs (mpdm_join_wcs)
 * ./#mpdm_rval (mpdm_rval)
 * ./#mpdm_splice_s (mpdm_splice_s)
 * ./#mpdm_split (mpdm_split)
 * ./#mpdm_split_wcs (mpdm_split_wcs)
 * ./#mpdm_sprintf (mpdm_sprintf)
 * ./#mpdm_sscanf (mpdm_sscanf)
 * ./#mpdm_strcat (mpdm_strcat)
 * ./#mpdm_strcat_wcs (mpdm_strcat_wcs)
 * ./#mpdm_strcat_wcsn (mpdm_strcat_wcsn)
 * ./#mpdm_string (mpdm_string)
 * ./#mpdm_ulc (mpdm_ulc)

Threading
~~~~~~~~~

 * ./#mpdm_exec_thread (mpdm_exec_thread)
 * ./#mpdm_mutex_lock (mpdm_mutex_lock)
 * ./#mpdm_mutex_unlock (mpdm_mutex_unlock)
 * ./#mpdm_new_mutex (mpdm_new_mutex)
 * ./#mpdm_new_semaphore (mpdm_new_semaphore)
 * ./#mpdm_semaphore_post (mpdm_semaphore_post)
 * ./#mpdm_semaphore_wait (mpdm_semaphore_wait)
 * ./#mpdm_sleep (mpdm_sleep)

Value Creation
~~~~~~~~~~~~~~

 * ./#mpdm_2mbs (MPDM_2MBS)
 * ./#mpdm_a (MPDM_A)
 * ./#mpdm_c (MPDM_C)
 * ./#mpdm_ens (MPDM_ENS)
 * ./#mpdm_f (MPDM_F)
 * ./#mpdm_i (MPDM_I)
 * ./#mpdm_mbs (MPDM_MBS)
 * ./#mpdm_nmbs (MPDM_NMBS)
 * ./#mpdm_ns (MPDM_NS)
 * ./#mpdm_o (MPDM_O)
 * ./#mpdm_r (MPDM_R)
 * ./#mpdm_s (MPDM_S)
 * ./#mpdm_x (MPDM_X)
 * ./#mpdm_new (mpdm_new)

Value Management
~~~~~~~~~~~~~~~~

 * ./#mpdm_clone (mpdm_clone)
 * ./#mpdm_data (mpdm_data)
 * ./#mpdm_exec (mpdm_exec)
 * ./#mpdm_ival (mpdm_ival)
 * ./#mpdm_ref (mpdm_ref)
 * ./#mpdm_root (mpdm_root)
 * ./#mpdm_rval (mpdm_rval)
 * ./#mpdm_size (mpdm_size)
 * ./#mpdm_unref (mpdm_unref)
 * ./#mpdm_unrefnd (mpdm_unrefnd)

By Source
---------

mpdm_a.c
~~~~~~~~

 * ./#mpdm_bseek (mpdm_bseek)
 * ./#mpdm_bseek_wcs (mpdm_bseek_wcs)
 * ./#mpdm_collapse (mpdm_collapse)
 * ./#mpdm_expand (mpdm_expand)
 * ./#mpdm_ins (mpdm_ins)
 * ./#mpdm_join_wcs (mpdm_join_wcs)
 * ./#mpdm_pop (mpdm_pop)
 * ./#mpdm_push (mpdm_push)
 * ./#mpdm_queue (mpdm_queue)
 * ./#mpdm_seek (mpdm_seek)
 * ./#mpdm_seek_wcs (mpdm_seek_wcs)
 * ./#mpdm_shift (mpdm_shift)
 * ./#mpdm_sort (mpdm_sort)
 * ./#mpdm_sort_cb (mpdm_sort_cb)
 * ./#mpdm_split (mpdm_split)
 * ./#mpdm_split_wcs (mpdm_split_wcs)

mpdm_d.c
~~~~~~~~

 * ./#mpdm_dump (mpdm_dump)
 * ./#mpdm_dumper (mpdm_dumper)

mpdm_f.c
~~~~~~~~

 * ./#mpdm_app_dir (mpdm_app_dir)
 * ./#mpdm_chdir (mpdm_chdir)
 * ./#mpdm_chmod (mpdm_chmod)
 * ./#mpdm_chown (mpdm_chown)
 * ./#mpdm_close (mpdm_close)
 * ./#mpdm_conf_dir (mpdm_conf_dir)
 * ./#mpdm_encoding (mpdm_encoding)
 * ./#mpdm_getcwd (mpdm_getcwd)
 * ./#mpdm_glob (mpdm_glob)
 * ./#mpdm_home_dir (mpdm_home_dir)
 * ./#mpdm_link (mpdm_link)
 * ./#mpdm_mkdir (mpdm_mkdir)
 * ./#mpdm_open (mpdm_open)
 * ./#mpdm_pclose (mpdm_pclose)
 * ./#mpdm_popen (mpdm_popen)
 * ./#mpdm_popen2 (mpdm_popen2)
 * ./#mpdm_read (mpdm_read)
 * ./#mpdm_rename (mpdm_rename)
 * ./#mpdm_stat (mpdm_stat)
 * ./#mpdm_unlink (mpdm_unlink)
 * ./#mpdm_write (mpdm_write)

mpdm_o.c
~~~~~~~~

 * ./#mpdm_exists (mpdm_exists)
 * ./#mpdm_get_wcs (mpdm_get_wcs)
 * ./#mpdm_hdel (mpdm_hdel)
 * ./#mpdm_hget (mpdm_hget)
 * ./#mpdm_hget_s (mpdm_hget_s)
 * ./#mpdm_hset (mpdm_hset)
 * ./#mpdm_hset_s (mpdm_hset_s)
 * ./#mpdm_hsize (mpdm_hsize)
 * ./#mpdm_keys (mpdm_keys)
 * ./#mpdm_set_wcs (mpdm_set_wcs)

mpdm_ol.c
~~~~~~~~~

 * ./#mpdm_exists (mpdm_exists)
 * ./#mpdm_get_wcs (mpdm_get_wcs)
 * ./#mpdm_set_wcs (mpdm_set_wcs)

mpdm_r.c
~~~~~~~~

 * ./#mpdm_regex (mpdm_regex)
 * ./#mpdm_sregex (mpdm_sregex)

mpdm_s.c
~~~~~~~~

 * ./#mpdm_chomp (mpdm_chomp)
 * ./#mpdm_cmp_wcs (mpdm_cmp_wcs)
 * ./#mpdm_escape (mpdm_escape)
 * ./#mpdm_gettext (mpdm_gettext)
 * ./#mpdm_gettext_domain (mpdm_gettext_domain)
 * ./#mpdm_ival (mpdm_ival)
 * ./#mpdm_rval (mpdm_rval)
 * ./#mpdm_splice_s (mpdm_splice_s)
 * ./#mpdm_sprintf (mpdm_sprintf)
 * ./#mpdm_sscanf (mpdm_sscanf)
 * ./#mpdm_strcat (mpdm_strcat)
 * ./#mpdm_strcat_wcs (mpdm_strcat_wcs)
 * ./#mpdm_strcat_wcsn (mpdm_strcat_wcsn)
 * ./#mpdm_string (mpdm_string)
 * ./#mpdm_tr (mpdm_tr)
 * ./#mpdm_ulc (mpdm_ulc)
 * ./#mpdm_utf8_to_wc (mpdm_utf8_to_wc)

mpdm_t.c
~~~~~~~~

 * ./#mpdm_exec_thread (mpdm_exec_thread)
 * ./#mpdm_mutex_lock (mpdm_mutex_lock)
 * ./#mpdm_mutex_unlock (mpdm_mutex_unlock)
 * ./#mpdm_new_mutex (mpdm_new_mutex)
 * ./#mpdm_new_semaphore (mpdm_new_semaphore)
 * ./#mpdm_semaphore_post (mpdm_semaphore_post)
 * ./#mpdm_semaphore_wait (mpdm_semaphore_wait)
 * ./#mpdm_sleep (mpdm_sleep)

mpdm_v.c
~~~~~~~~

 * ./#mpdm_2mbs (MPDM_2MBS)
 * ./#mpdm_a (MPDM_A)
 * ./#mpdm_c (MPDM_C)
 * ./#mpdm_ens (MPDM_ENS)
 * ./#mpdm_f (MPDM_F)
 * ./#mpdm_i (MPDM_I)
 * ./#mpdm_mbs (MPDM_MBS)
 * ./#mpdm_nmbs (MPDM_NMBS)
 * ./#mpdm_ns (MPDM_NS)
 * ./#mpdm_o (MPDM_O)
 * ./#mpdm_r (MPDM_R)
 * ./#mpdm_s (MPDM_S)
 * ./#mpdm_x (MPDM_X)
 * ./#mpdm_data (mpdm_data)
 * ./#mpdm_is_null (mpdm_is_null)
 * ./#mpdm_new (mpdm_new)
 * ./#mpdm_ref (mpdm_ref)
 * ./#mpdm_root (mpdm_root)
 * ./#mpdm_shutdown (mpdm_shutdown)
 * ./#mpdm_size (mpdm_size)
 * ./#mpdm_startup (mpdm_startup)
 * ./#mpdm_unref (mpdm_unref)
 * ./#mpdm_unrefnd (mpdm_unrefnd)
 * ./#mpdm_void (mpdm_void)

mpdm_x.c
~~~~~~~~

 * ./#mpdm_bool (mpdm_bool)
 * ./#mpdm_clone (mpdm_clone)
 * ./#mpdm_cmp (mpdm_cmp)
 * ./#mpdm_del_i (mpdm_del_i)
 * ./#mpdm_exec (mpdm_exec)
 * ./#mpdm_get (mpdm_get)
 * ./#mpdm_get_i (mpdm_get_i)
 * ./#mpdm_is_true (mpdm_is_true)
 * ./#mpdm_iterator (mpdm_iterator)
 * ./#mpdm_join (mpdm_join)

Alphabetical
------------

 * ./#mpdm_2mbs (MPDM_2MBS) - Creates a multibyte string value from a wide char string.
 * ./#mpdm_a (MPDM_A) - Creates an array value.
 * ./#mpdm_c (MPDM_C) - Creates a new value with a copy of a buffer.
 * ./#mpdm_ens (MPDM_ENS) - Creates a string value from an external string, with size.
 * ./#mpdm_f (MPDM_F) - Creates a file value.
 * ./#mpdm_i (MPDM_I) - Creates an integer value.
 * ./#mpdm_mbs (MPDM_MBS) - Creates a string value from a multibyte string.
 * ./#mpdm_nmbs (MPDM_NMBS) - Creates a string value from a multibyte string, with size.
 * ./#mpdm_ns (MPDM_NS) - Creates a string value from a string, with size.
 * ./#mpdm_o (MPDM_O) - Creates an object value.
 * ./#mpdm_r (MPDM_R) - Creates a real value.
 * ./#mpdm_s (MPDM_S) - Creates a string value from a string.
 * ./#mpdm_x (MPDM_X) - Creates a new executable value.
 * ./#mpdm_app_dir (mpdm_app_dir) - Returns the applications directory.
 * ./#mpdm_bool (mpdm_bool) - Returns a boolean value.
 * ./#mpdm_bseek (mpdm_bseek) - Seeks a value in an array (binary).
 * ./#mpdm_bseek_wcs (mpdm_bseek_wcs) - Seeks a value in an array (binary, string version).
 * ./#mpdm_chdir (mpdm_chdir) - Changes the working directory
 * ./#mpdm_chmod (mpdm_chmod) - Changes a file's permissions.
 * ./#mpdm_chomp (mpdm_chomp) - Deletes end of line characters at the end of a string.
 * ./#mpdm_chown (mpdm_chown) - Changes a file's owner.
 * ./#mpdm_clone (mpdm_clone) - Creates a clone of a value.
 * ./#mpdm_close (mpdm_close) - Closes a file descriptor.
 * ./#mpdm_cmp (mpdm_cmp) - Compares two values.
 * ./#mpdm_cmp_wcs (mpdm_cmp_wcs) - Compares two values (string version).
 * ./#mpdm_collapse (mpdm_collapse) - Collapses an array.
 * ./#mpdm_conf_dir (mpdm_conf_dir) - Returns a directory where configuration can be stored.
 * ./#mpdm_data (mpdm_data) - Returns the data of an element.
 * ./#mpdm_del_i (mpdm_del_i) - Deletes an element by integer subscript.
 * ./#mpdm_dump (mpdm_dump) - Dumps a value to stdin.
 * ./#mpdm_dumper (mpdm_dumper) - Returns a visual representation of a complex value.
 * ./#mpdm_encoding (mpdm_encoding) - Sets the current charset encoding for files.
 * ./#mpdm_escape (mpdm_escape) - Escapes sets of characters in a string.
 * ./#mpdm_exec (mpdm_exec) - Executes an executable value.
 * ./#mpdm_exec_thread (mpdm_exec_thread) - Runs an executable value in a new thread.
 * ./#mpdm_exists (mpdm_exists) - Tests if there is a value available by index.
 * ./#mpdm_exists (mpdm_exists) - Tests if there is a value available by index.
 * ./#mpdm_expand (mpdm_expand) - Expands an array.
 * ./#mpdm_get (mpdm_get) - Gets an element by index.
 * ./#mpdm_get_i (mpdm_get_i) - Gets an element by integer subscript.
 * ./#mpdm_get_wcs (mpdm_get_wcs) - Gets the value from an object by string index (string version).
 * ./#mpdm_get_wcs (mpdm_get_wcs) - Gets the value from an object by string index (string version).
 * ./#mpdm_getcwd (mpdm_getcwd) - Get current working directory
 * ./#mpdm_gettext (mpdm_gettext) - Translates a string to the current language.
 * ./#mpdm_gettext_domain (mpdm_gettext_domain) - Sets domain and data directory for translations.
 * ./#mpdm_glob (mpdm_glob) - Executes a file globbing.
 * ./#mpdm_hdel (mpdm_hdel) - Deletes a key from a hash.
 * ./#mpdm_hget (mpdm_hget) - Gets a value from a hash.
 * ./#mpdm_hget_s (mpdm_hget_s) - Gets the value from a hash (string version).
 * ./#mpdm_home_dir (mpdm_home_dir) - Returns the home user directory.
 * ./#mpdm_hset (mpdm_hset) - Sets a value in a hash.
 * ./#mpdm_hset_s (mpdm_hset_s) - Sets a value in a hash (string version).
 * ./#mpdm_hsize (mpdm_hsize) - Returns the number of pairs of a hash.
 * ./#mpdm_ins (mpdm_ins) - Insert an element in an array.
 * ./#mpdm_is_null (mpdm_is_null) - Returns 1 if a value is NULL.
 * ./#mpdm_is_true (mpdm_is_true) - Returns 1 if a value is true.
 * ./#mpdm_iterator (mpdm_iterator) - Iterates through the content of a set.
 * ./#mpdm_ival (mpdm_ival) - Returns a value's data as an integer.
 * ./#mpdm_join (mpdm_join) - Joins two values.
 * ./#mpdm_join_wcs (mpdm_join_wcs) - Joins all elements of an array into a string (string version).
 * ./#mpdm_keys (mpdm_keys) - Returns the keys of a hash.
 * ./#mpdm_link (mpdm_link) - Links a file to another.
 * ./#mpdm_mkdir (mpdm_mkdir) - Creates a directory
 * ./#mpdm_mutex_lock (mpdm_mutex_lock) - Locks a mutex.
 * ./#mpdm_mutex_unlock (mpdm_mutex_unlock) - Unlocks a mutex.
 * ./#mpdm_new (mpdm_new) - Creates a new value.
 * ./#mpdm_new_mutex (mpdm_new_mutex) - Creates a new mutex.
 * ./#mpdm_new_semaphore (mpdm_new_semaphore) - Creates a new semaphore.
 * ./#mpdm_open (mpdm_open) - Opens a file.
 * ./#mpdm_pclose (mpdm_pclose) - Closes a pipe.
 * ./#mpdm_pop (mpdm_pop) - Pops a value from an array.
 * ./#mpdm_popen (mpdm_popen) - Opens a pipe.
 * ./#mpdm_popen2 (mpdm_popen2) - Opens a pipe and returns 2 descriptors.
 * ./#mpdm_push (mpdm_push) - Pushes a value into an array.
 * ./#mpdm_queue (mpdm_queue) - Implements a queue in an array.
 * ./#mpdm_read (mpdm_read) - Reads a line from a file descriptor.
 * ./#mpdm_ref (mpdm_ref) - Increments the reference count of a value.
 * ./#mpdm_regex (mpdm_regex) - Matches a regular expression.
 * ./#mpdm_rename (mpdm_rename) - Renames a file.
 * ./#mpdm_root (mpdm_root) - Returns the root hash.
 * ./#mpdm_rval (mpdm_rval) - Returns a value's data as a real number (double).
 * ./#mpdm_seek (mpdm_seek) - Seeks a value in an array (sequential).
 * ./#mpdm_seek_wcs (mpdm_seek_wcs) - Seeks a value in an array (sequential, string version).
 * ./#mpdm_semaphore_post (mpdm_semaphore_post) - Increments the value of a semaphore.
 * ./#mpdm_semaphore_wait (mpdm_semaphore_wait) - Waits for a semaphore to be ready.
 * ./#mpdm_set_wcs (mpdm_set_wcs) - Sets a value in an object (string version).
 * ./#mpdm_set_wcs (mpdm_set_wcs) - Sets a value in an object (string version).
 * ./#mpdm_shift (mpdm_shift) - Extracts the first element of an array.
 * ./#mpdm_shutdown (mpdm_shutdown) - Shuts down MPDM.
 * ./#mpdm_size (mpdm_size) - Returns the size of an element.
 * ./#mpdm_sleep (mpdm_sleep) - Sleeps a number of milliseconds.
 * ./#mpdm_sort (mpdm_sort) - Sorts an array.
 * ./#mpdm_sort_cb (mpdm_sort_cb) - Sorts an array with a special sorting function.
 * ./#mpdm_splice_s (mpdm_splice_s) - Creates a new string value from another.
 * ./#mpdm_split (mpdm_split) - Separates a string into an array of pieces.
 * ./#mpdm_split_wcs (mpdm_split_wcs) - Separates a string into an array of pieces (string version).
 * ./#mpdm_sprintf (mpdm_sprintf) - Formats a sprintf()-like string.
 * ./#mpdm_sregex (mpdm_sregex) - Matches and substitutes a regular expression.
 * ./#mpdm_sscanf (mpdm_sscanf) - Extracts data like sscanf().
 * ./#mpdm_startup (mpdm_startup) - Initializes MPDM.
 * ./#mpdm_stat (mpdm_stat) - Gives status from a file.
 * ./#mpdm_strcat (mpdm_strcat) - Concatenates two strings.
 * ./#mpdm_strcat_wcs (mpdm_strcat_wcs) - Concatenates two strings (string version).
 * ./#mpdm_strcat_wcsn (mpdm_strcat_wcsn) - Concatenates two strings (string with size version).
 * ./#mpdm_string (mpdm_string) - Returns a string representation of a value.
 * ./#mpdm_tr (mpdm_tr) - Transliterates a string.
 * ./#mpdm_ulc (mpdm_ulc) - Converts a string to uppercase or lowecase.
 * ./#mpdm_unlink (mpdm_unlink) - Deletes a file.
 * ./#mpdm_unref (mpdm_unref) - Decrements the reference count of a value.
 * ./#mpdm_unrefnd (mpdm_unrefnd) - Decrements the reference count of a value, without destroy.
 * ./#mpdm_utf8_to_wc (mpdm_utf8_to_wc) - Converts from utf8 to wchar (streaming).
 * ./#mpdm_void (mpdm_void) - Refs then unrefs a value.
 * ./#mpdm_write (mpdm_write) - Writes a value into a file.


MPDM_2MBS
---------

Name
~~~~

*MPDM_2MBS* - Creates a multibyte string value from a wide char string.

Synopsis
~~~~~~~~

 mpdm_t MPDM_2MBS(wchar_t * wcs); 


Arguments
~~~~~~~~~

 * wcs: the wide char string

Description
~~~~~~~~~~~

Creates a multibyte string value from the _wcs_ wide char string,
converting it by mpdm_wcstombs(). Take note that multibyte string values
are not properly strings, so they cannot be used for string comparison
and such.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_A
------

Name
~~~~

*MPDM_A* - Creates an array value.

Synopsis
~~~~~~~~

 mpdm_t MPDM_A(int n); 


Arguments
~~~~~~~~~

 * n: Number of elements

Description
~~~~~~~~~~~

Creates a new array value with _n_ elements.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_C
------

Name
~~~~

*MPDM_C* - Creates a new value with a copy of a buffer.

Synopsis
~~~~~~~~

 mpdm_t MPDM_C(mpdm_type_t type, void *ptr, int size); 


Arguments
~~~~~~~~~

 * type: data type
 * ptr: pointer to data
 * size: data size

Description
~~~~~~~~~~~

Create a new value with a copy of a buffer. The value will store a copy
of _ptr_ and have the specified _type_.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_ENS
--------

Name
~~~~

*MPDM_ENS* - Creates a string value from an external string, with size.

Synopsis
~~~~~~~~

 mpdm_t MPDM_ENS(wchar_t * wcs, int s); 


Arguments
~~~~~~~~~

 * wcs: the external wide character string
 * s: the size in chars the string will hold

Description
~~~~~~~~~~~

Creates a new string value with size _s_. The _wcs_ string must be
a dynamic value (i.e. allocated by malloc()) that will be freed on
destruction.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_F
------

Name
~~~~

*MPDM_F* - Creates a file value.

Synopsis
~~~~~~~~

 mpdm_t MPDM_F(FILE * f); 


Arguments
~~~~~~~~~

 * f: the file descriptor

Description
~~~~~~~~~~~

Creates a new file value.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_I
------

Name
~~~~

*MPDM_I* - Creates an integer value.

Synopsis
~~~~~~~~

 mpdm_t MPDM_I(int i); 


Arguments
~~~~~~~~~

 * i: the integer

Description
~~~~~~~~~~~

Creates a new integer value. MPDM integers are strings.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_MBS
--------

Name
~~~~

*MPDM_MBS* - Creates a string value from a multibyte string.

Synopsis
~~~~~~~~

 mpdm_t MPDM_MBS(char * mbs); 


Arguments
~~~~~~~~~

 * mbs: the multibyte string

Description
~~~~~~~~~~~

Creates a new string value from a multibyte string, that will be
converted to wcs by mpdm_mbstowcs().

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_NMBS
---------

Name
~~~~

*MPDM_NMBS* - Creates a string value from a multibyte string, with size.

Synopsis
~~~~~~~~

 mpdm_t MPDM_NMBS(char * mbs, int s); 


Arguments
~~~~~~~~~

 * mbs: the multibyte string
 * s: the size

Description
~~~~~~~~~~~

Creates a new string value with the first _s_ characters from the _mbs_
multibyte string, that will be converted to wcs by mpdm_mbstowcs().

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_NS
-------

Name
~~~~

*MPDM_NS* - Creates a string value from a string, with size.

Synopsis
~~~~~~~~

 mpdm_t MPDM_NS(wchar_t * wcs, int s); 


Arguments
~~~~~~~~~

 * wcs: the wide character string
 * s: the size in chars the string will hold

Description
~~~~~~~~~~~

Creates a new string value with a copy of the first _s_ characters
from the _wcs_ string.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_O
------

Name
~~~~

*MPDM_O* - Creates an object value.

Synopsis
~~~~~~~~

 mpdm_t MPDM_O(void); 


Description
~~~~~~~~~~~

Creates a new object value.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_R
------

Name
~~~~

*MPDM_R* - Creates a real value.

Synopsis
~~~~~~~~

 mpdm_t MPDM_R(double r); 


Arguments
~~~~~~~~~

 * r: the real number

Description
~~~~~~~~~~~

Creates a new real value. MPDM integers are strings.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_S
------

Name
~~~~

*MPDM_S* - Creates a string value from a string.

Synopsis
~~~~~~~~

 mpdm_t MPDM_S(wchar_t * wcs); 


Arguments
~~~~~~~~~

 * wcs: the wide character string

Description
~~~~~~~~~~~

Creates a new string value from a wide character string. The value
will store a copy of the string that will be freed on destruction.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

MPDM_X
------

Name
~~~~

*MPDM_X* - Creates a new executable value.

Synopsis
~~~~~~~~

 mpdm_t MPDM_X(mpdm_t (* func)(mpdm_t args)); 


Arguments
~~~~~~~~~

 * func: the C code function

Description
~~~~~~~~~~~

Creates a new executable value given a pointer to the _func_ C code function.
The function must receive an mpdm_t array value (that will hold their
arguments) and return another one.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

mpdm_app_dir
------------

Name
~~~~

*mpdm_app_dir* - Returns the applications directory.

Synopsis
~~~~~~~~

 mpdm_t mpdm_app_dir(void);

Description
~~~~~~~~~~~

Returns a system-dependent directory where the applications store
their private data, as components or resources.

If the global APPID MPDM variable is set, it's used to search for
the specific application installation folder (on MS Windows' registry)
and / or appended as the final folder.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_bool
---------

Name
~~~~

*mpdm_bool* - Returns a boolean value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_bool(int b);

Arguments
~~~~~~~~~

 * b: true or false

Description
~~~~~~~~~~~

Returns the stored values for TRUE or FALSE.


mpdm_bseek
----------

Name
~~~~

*mpdm_bseek* - Seeks a value in an array (binary).

Synopsis
~~~~~~~~

 int mpdm_bseek(const mpdm_t a, const mpdm_t v, int step, int *pos);

Arguments
~~~~~~~~~

 * a: the ordered array
 * v: the value
 * step: number of elements to step
 * pos: the position where the element should be, if it's not found

Description
~~~~~~~~~~~

Seeks the value _v_ in the _a_ array in increments of _step_.
The array should be sorted to work correctly. A complete search
should use a step of 1.

If the element is found, returns the offset of the element
as a positive number; otherwise, -1 is returned and the position
where the element should be is stored in _pos_. You can set _pos_
to NULL if you don't mind.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_bseek_wcs
--------------

Name
~~~~

*mpdm_bseek_wcs* - Seeks a value in an array (binary, string version).

Synopsis
~~~~~~~~

 int mpdm_bseek_wcs(const mpdm_t a, const wchar_t *v, int step, int *pos);

Arguments
~~~~~~~~~

 * a: the ordered array
 * v: the value
 * step: number of elements to step
 * pos: the position where the element should be, if it's not found

Description
~~~~~~~~~~~

Seeks the value _v_ in the _a_ array in increments of _step_.
The array should be sorted to work correctly. A complete search
should use a step of 1.

If the element is found, returns the offset of the element
as a positive number; otherwise, -1 is returned and the position
where the element should be is stored in _pos_. You can set _pos_
to NULL if you don't mind.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_chdir
----------

Name
~~~~

*mpdm_chdir* - Changes the working directory

Synopsis
~~~~~~~~

 int mpdm_chdir(const mpdm_t dir);

Arguments
~~~~~~~~~

 * dir: the new path

Description
~~~~~~~~~~~

Changes the working directory

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_chmod
----------

Name
~~~~

*mpdm_chmod* - Changes a file's permissions.

Synopsis
~~~~~~~~

 int mpdm_chmod(const mpdm_t filename, mpdm_t perms);

Arguments
~~~~~~~~~

 * filename: the file name
 * perms: permissions (element 2 from mpdm_stat())

Description
~~~~~~~~~~~

Changes the permissions for a file.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_chomp
----------

Name
~~~~

*mpdm_chomp* - Deletes end of line characters at the end of a string.

Synopsis
~~~~~~~~

 mpdm_t mpdm_chomp(mpdm_t s);

Arguments
~~~~~~~~~

 * s: the value

Description
~~~~~~~~~~~

Returns a new string value like the original one but without any
possible \n or \r at the end.


mpdm_chown
----------

Name
~~~~

*mpdm_chown* - Changes a file's owner.

Synopsis
~~~~~~~~

 int mpdm_chown(const mpdm_t filename, mpdm_t uid, mpdm_t gid);

Arguments
~~~~~~~~~

 * filename: the file name
 * uid: user id (element 4 from mpdm_stat())
 * gid: group id (element 5 from mpdm_stat())

Description
~~~~~~~~~~~

Changes the owner and group id's for a file.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_clone
----------

Name
~~~~

*mpdm_clone* - Creates a clone of a value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_clone(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Creates a clone of a value. If the value is multiple, a new value will
be created containing clones of all its elements; otherwise,
the same unchanged value is returned.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_close
----------

Name
~~~~

*mpdm_close* - Closes a file descriptor.

Synopsis
~~~~~~~~

 int mpdm_close(mpdm_t fd);

Arguments
~~~~~~~~~

 * fd: the value containing the file descriptor

Description
~~~~~~~~~~~

Closes the file descriptor.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_cmp
--------

Name
~~~~

*mpdm_cmp* - Compares two values.

Synopsis
~~~~~~~~

 int mpdm_cmp(const mpdm_t v1, const mpdm_t v2);

Arguments
~~~~~~~~~

 * v1: the first value
 * v2: the second value

Description
~~~~~~~~~~~

Compares two values. If both has the MPDM_STRING flag set,
a comparison using wcscoll() is returned; if both are arrays,
the size is compared first and, if they have the same number
elements, each one is compared; otherwise, a simple visual
representation comparison is done.

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_cmp_wcs
------------

Name
~~~~

*mpdm_cmp_wcs* - Compares two values (string version).

Synopsis
~~~~~~~~

 int mpdm_cmp_wcs(const mpdm_t v1, const wchar_t *v2);

Arguments
~~~~~~~~~

 * v1: the first value
 * v2: the second value

Description
~~~~~~~~~~~

Compares the _v2_ string against the stringified view of _v1_.


mpdm_collapse
-------------

Name
~~~~

*mpdm_collapse* - Collapses an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_collapse(mpdm_t a, int index, int num);

Arguments
~~~~~~~~~

 * a: the array
 * index: deletion index
 * num: number of elements to collapse

Description
~~~~~~~~~~~

Collapses an array value, deleting _num_ elements at
the specified _index_.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_conf_dir
-------------

Name
~~~~

*mpdm_conf_dir* - Returns a directory where configuration can be stored.

Synopsis
~~~~~~~~

 mpdm_t mpdm_conf_dir(void);

Description
~~~~~~~~~~~

Returns a system-dependent directory where the user can write
configuration files and create subdirectories.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_data
---------

Name
~~~~

*mpdm_data* - Returns the data of an element.

Synopsis
~~~~~~~~

 void *mpdm_data(const mpdm_t v);

Arguments
~~~~~~~~~

 * v: the element

Description
~~~~~~~~~~~

Returns the data of an element. It does not change the
reference count of the value.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_del_i
----------

Name
~~~~

*mpdm_del_i* - Deletes an element by integer subscript.

Synopsis
~~~~~~~~

 mpdm_t mpdm_del_i(const mpdm_t s, int index);

Arguments
~~~~~~~~~

 * s: the set
 * index: subscript of the element to be deleted

Description
~~~~~~~~~~~

Deletes the element at _index_ of the _s_ set.


mpdm_dump
---------

Name
~~~~

*mpdm_dump* - Dumps a value to stdin.

Synopsis
~~~~~~~~

 void mpdm_dump(const mpdm_t v);

Arguments
~~~~~~~~~

 * v: The value

Description
~~~~~~~~~~~

Dumps a value to stdin. The value can be complex. This function
is for debugging purposes only.


mpdm_dumper
-----------

Name
~~~~

*mpdm_dumper* - Returns a visual representation of a complex value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_dumper(const mpdm_t v);

Arguments
~~~~~~~~~

 * v: The value

Description
~~~~~~~~~~~

Returns a visual representation of a complex value.


mpdm_encoding
-------------

Name
~~~~

*mpdm_encoding* - Sets the current charset encoding for files.

Synopsis
~~~~~~~~

 int mpdm_encoding(mpdm_t charset);

Arguments
~~~~~~~~~

 * charset: the charset name.

Description
~~~~~~~~~~~

Sets the current charset encoding for files. Future opened
files will be assumed to be encoded with _charset_, which can
be any of the supported charset names (utf-8, iso-8859-1, etc.),
and converted on each read / write. If charset is NULL, it
is reverted to default charset conversion (i.e. the one defined
in the locale).

This function stores the _charset_ value into the ENCODING item
of the mpdm_root() hash.

Returns a negative number if _charset_ is unsupported, or zero
if no errors were found.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)
 * ./#character_set_conversion (Character Set Conversion)

mpdm_escape
-----------

Name
~~~~

*mpdm_escape* - Escapes sets of characters in a string.

Synopsis
~~~~~~~~

 mpdm_t mpdm_escape(mpdm_t v, wchar_t low, wchar_t high, mpdm_t f);

Arguments
~~~~~~~~~

 * v: the string
 * low: lower character limit
 * high: higher character limit
 * f: format to apply

Description
~~~~~~~~~~~

Escapes characters from the _v_ string that are lower than
_low_ or higher than _high_, applying the _f_ format, that can
be a string for a fmt() / sprintf() format or an executable
value.


mpdm_exec
---------

Name
~~~~

*mpdm_exec* - Executes an executable value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_exec(mpdm_t c, mpdm_t args, mpdm_t ctxt);

Arguments
~~~~~~~~~

 * c: the code value
 * args: the arguments
 * ctxt: the context

Description
~~~~~~~~~~~

Executes an executable value. If _c_ is a scalar value, its data
should be a pointer to a directly executable C function with a
prototype of mpdm_t func(mpdm_t args, mpdm_t ctxt); if it's a multiple
one, the first value's data should be a pointer to a directly executable
C function with a prototype of
mpdm_t func(mpdm_t b, mpdm_t args, mpdm_t ctxt) and
the second value will be passed as the _b_ argument. This value is used
to store bytecode or so when implementing virtual machines or compilers.
The _ctxt_ is meant to be used as a special context to implement local
symbol tables and such. Its meaning is free and can be NULL.
If _c_ is a file descriptor, a line is read from it if the call has no
arguments or otherwise all of them are written into it.

Returns the return value of the code. If _c_ is NULL or not executable,
returns NULL.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_exec_thread
----------------

Name
~~~~

*mpdm_exec_thread* - Runs an executable value in a new thread.

Synopsis
~~~~~~~~

 mpdm_t mpdm_exec_thread(mpdm_t c, mpdm_t args, mpdm_t ctxt);

Arguments
~~~~~~~~~

 * c: the executable value
 * args: executable arguments
 * ctxt: the context

Description
~~~~~~~~~~~

Runs the _c_ executable value in a new thread. The code
starts executing immediately. The _args_ and _ctxt_ arguments
are sent to the executable value as arguments.

Returns a handle for the thread.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_exists
-----------

Name
~~~~

*mpdm_exists* - Tests if there is a value available by index.

Synopsis
~~~~~~~~

 int mpdm_exists(const mpdm_t o, const mpdm_t i);

Arguments
~~~~~~~~~

 * o: the object
 * i: the index

Description
~~~~~~~~~~~

Returns 1 if exists a value indexable by _i_ in _h_, or 0 othersize.

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)

mpdm_expand
-----------

Name
~~~~

*mpdm_expand* - Expands an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_expand(mpdm_t a, int index, int num);

Arguments
~~~~~~~~~

 * a: the array
 * index: insertion index
 * num: number of elements to insert

Description
~~~~~~~~~~~

Expands an array value, inserting _num_ elements (initialized
to NULL) at the specified _index_.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_get
--------

Name
~~~~

*mpdm_get* - Gets an element by index.

Synopsis
~~~~~~~~

 mpdm_t mpdm_get(const mpdm_t s, mpdm_t index);

Arguments
~~~~~~~~~

 * s: the set
 * index: the index

Description
~~~~~~~~~~~

Returns the element at _index_ of the set _s_.


mpdm_get_i
----------

Name
~~~~

*mpdm_get_i* - Gets an element by integer subscript.

Synopsis
~~~~~~~~

 mpdm_t mpdm_get_i(const mpdm_t s, int index);

Arguments
~~~~~~~~~

 * s: the set
 * index: the subscript of the element

Description
~~~~~~~~~~~

Returns the element at _index_ of the set _s_.


mpdm_get_wcs
------------

Name
~~~~

*mpdm_get_wcs* - Gets the value from an object by string index (string version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_get_wcs(const mpdm_t o, const wchar_t *i);

Arguments
~~~~~~~~~

 * o: the object
 * i: the index

Description
~~~~~~~~~~~

Returns the value from _o_ by index _i_, or NULL if there is no
value addressable by that index.

Categories
~~~~~~~~~~

 * ./#objects (Objects)

mpdm_getcwd
-----------

Name
~~~~

*mpdm_getcwd* - Get current working directory

Synopsis
~~~~~~~~

 mpdm_t mpdm_getcwd(void);

Description
~~~~~~~~~~~

Returns the current working directory.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_gettext
------------

Name
~~~~

*mpdm_gettext* - Translates a string to the current language.

Synopsis
~~~~~~~~

 mpdm_t mpdm_gettext(const mpdm_t str);

Arguments
~~~~~~~~~

 * str: the string

Description
~~~~~~~~~~~

Translates the _str_ string to the current language.

This function can still be used even if there is no real gettext
support() by manually filling the __I18N__ hash.

If the string is found in the current table, the translation is
returned; otherwise, the same _str_ value is returned.

Categories
~~~~~~~~~~

 * ./#strings (Strings)
 * ./#localization (Localization)

mpdm_gettext_domain
-------------------

Name
~~~~

*mpdm_gettext_domain* - Sets domain and data directory for translations.

Synopsis
~~~~~~~~

 int mpdm_gettext_domain(const mpdm_t dom, const mpdm_t data);

Arguments
~~~~~~~~~

 * dom: the domain (application name)
 * data: directory contaning the .mo files

Description
~~~~~~~~~~~

Sets the domain (application name) and translation data for translating
strings that will be returned by mpdm_gettext()._data_ must point to a
directory containing the .mo (compiled .po) files.

If there is no gettext support, returns 0, or 1 otherwise.

Categories
~~~~~~~~~~

 * ./#strings (Strings)
 * ./#localization (Localization)

mpdm_glob
---------

Name
~~~~

*mpdm_glob* - Executes a file globbing.

Synopsis
~~~~~~~~

 mpdm_t mpdm_glob(mpdm_t spec, mpdm_t base);

Arguments
~~~~~~~~~

 * spec: Globbing spec
 * base: Optional base directory

Description
~~~~~~~~~~~

Executes a file globbing. _spec_ is system-dependent, but usually
the * and ? metacharacters work everywhere. _base_ can contain a
directory; if that's the case, the output strings will include it.
In any case, each returned value will be suitable for a call to
mpdm_open().

Returns an array of files that match the globbing (can be an empty
array if no file matches), or NULL if globbing is unsupported.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_hdel
---------

Name
~~~~

*mpdm_hdel* - Deletes a key from a hash.

Synopsis
~~~~~~~~

 mpdm_t mpdm_hdel(mpdm_t h, const mpdm_t k);

Arguments
~~~~~~~~~

 * h: the hash
 * k: the key

Description
~~~~~~~~~~~

Deletes the key _k_ from the hash _h_. Returns NULL
(versions prior to 1.0.10 returned the deleted value).

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)

mpdm_hget
---------

Name
~~~~

*mpdm_hget* - Gets a value from a hash.

Synopsis
~~~~~~~~

 mpdm_t mpdm_hget(const mpdm_t h, const mpdm_t k);

Arguments
~~~~~~~~~

 * h: the hash
 * k: the key

Description
~~~~~~~~~~~

Gets the value from the hash _h_ having _k_ as key, or
NULL if the key does not exist.

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)

mpdm_hget_s
-----------

Name
~~~~

*mpdm_hget_s* - Gets the value from a hash (string version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_hget_s(const mpdm_t h, const wchar_t *k);

Arguments
~~~~~~~~~

 * h: the hash
 * k: the key

Description
~~~~~~~~~~~

Gets the value from the hash _h_ having _k_ as key, or
NULL if the key does not exist.

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)

mpdm_home_dir
-------------

Name
~~~~

*mpdm_home_dir* - Returns the home user directory.

Synopsis
~~~~~~~~

 mpdm_t mpdm_home_dir(void);

Description
~~~~~~~~~~~

Returns a system-dependent directory where the user can write
documents and create subdirectories.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_hset
---------

Name
~~~~

*mpdm_hset* - Sets a value in a hash.

Synopsis
~~~~~~~~

 mpdm_t mpdm_hset(mpdm_t h, mpdm_t k, mpdm_t v);

Arguments
~~~~~~~~~

 * h: the hash
 * k: the key
 * v: the value

Description
~~~~~~~~~~~

Sets the value _v_ to the key _k_ in the hash _h_. Returns
the new value (versions prior to 1.0.10 returned the old
value).

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)

mpdm_hset_s
-----------

Name
~~~~

*mpdm_hset_s* - Sets a value in a hash (string version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_hset_s(mpdm_t h, const wchar_t *k, mpdm_t v);

Arguments
~~~~~~~~~

 * h: the hash
 * k: the key
 * v: the value

Description
~~~~~~~~~~~

Sets the value _v_ to the key _k_ in the hash _h_. Returns
the new value (versions prior to 1.0.10 returned the old
value).

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)

mpdm_hsize
----------

Name
~~~~

*mpdm_hsize* - Returns the number of pairs of a hash.

Synopsis
~~~~~~~~

 int mpdm_hsize(const mpdm_t h);

Arguments
~~~~~~~~~

 * h: the hash

Description
~~~~~~~~~~~

Returns the number of key-value pairs of a hash.

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)

mpdm_ins
--------

Name
~~~~

*mpdm_ins* - Insert an element in an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_ins(mpdm_t a, mpdm_t e, int index);

Arguments
~~~~~~~~~

 * a: the array
 * e: the element to be inserted
 * index: subscript where the element is going to be inserted

Description
~~~~~~~~~~~

Inserts the _e_ value in the _a_ array at _index_.
Further elements are pushed up, so the array increases its size
by one. Returns the inserted element.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_is_null
------------

Name
~~~~

*mpdm_is_null* - Returns 1 if a value is NULL.

Synopsis
~~~~~~~~

 int mpdm_is_null(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Returns 1 if a value is NULL. The reference count is touched.


mpdm_is_true
------------

Name
~~~~

*mpdm_is_true* - Returns 1 if a value is true.

Synopsis
~~~~~~~~

 int mpdm_is_true(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Returns 1 if _v_ is true. False values are: NULL, integers
with value 0, reals with value 0.0, empty strings and the
special string "0".
The reference count is touched.


mpdm_iterator
-------------

Name
~~~~

*mpdm_iterator* - Iterates through the content of a set.

Synopsis
~~~~~~~~

 int mpdm_iterator(mpdm_t set, int64_t *context, mpdm_t *v, mpdm_t *i);

Arguments
~~~~~~~~~

 * set: the set (hash, array, file or scalar)
 * context: A pointer to an opaque context
 * v: a pointer to a value to store the key
 * i: a pointer to a value to store the index

Description
~~~~~~~~~~~

Iterates through the _set_. If it's a hash, every value/index pair
is returned on each call. If it's an array, _v_ contains the
element and _i_ the index number on each call. If it's a file,
_v_ contains the line read and _i_ the index number. Otherwise, it's
assumed to be a string containing a numeral and _v_ and _i_ are filled
with values from 0 to _set_ - 1 on each call.

Any of _v_ and _i_ pointers can be NULL if the value is not of interest.

The _context_ pointer to integer is opaque and should be
initialized to zero on the first call.

Returns 0 if no more data is left in _set_.

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)
 * ./#arrays (Arrays)

mpdm_ival
---------

Name
~~~~

*mpdm_ival* - Returns a value's data as an integer.

Synopsis
~~~~~~~~

 int mpdm_ival(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Returns a value's data as an integer.

Categories
~~~~~~~~~~

 * ./#strings (Strings)
 * ./#value_management (Value Management)

mpdm_join
---------

Name
~~~~

*mpdm_join* - Joins two values.

Synopsis
~~~~~~~~

 mpdm_t mpdm_join(const mpdm_t a, const mpdm_t b);

Arguments
~~~~~~~~~

 * a: first value
 * b: second value

Description
~~~~~~~~~~~

Joins two values. If both are hashes, a new hash containing the
pairs in _a_ overwritten with the keys in _b_ is returned; if both
are arrays, a new array is returned with all elements in _a_ followed
by all elements in b; if _a_ is an array and _b_ is a string,
a new string is returned with all elements in _a_ joined using _b_
as a separator; and if _a_ is a hash and _b_ is a string, a new array
is returned containing all pairs in _a_ joined using _b_ as a separator.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)
 * ./#hashes (Hashes)
 * ./#strings (Strings)

mpdm_join_wcs
-------------

Name
~~~~

*mpdm_join_wcs* - Joins all elements of an array into a string (string version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_join_wcs(const mpdm_t a, const wchar_t *s);

Arguments
~~~~~~~~~

 * a: array to be joined
 * s: joiner string

Description
~~~~~~~~~~~

Joins all elements from _a_ into one string, using _s_ as a glue.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)
 * ./#strings (Strings)

mpdm_keys
---------

Name
~~~~

*mpdm_keys* - Returns the keys of a hash.

Synopsis
~~~~~~~~

 mpdm_t mpdm_keys(const mpdm_t h);

Arguments
~~~~~~~~~

 * h: the hash

Description
~~~~~~~~~~~

Returns an array containing all the keys of the _h_ hash.

Categories
~~~~~~~~~~

 * ./#hashes (Hashes)
 * ./#arrays (Arrays)

mpdm_link
---------

Name
~~~~

*mpdm_link* - Links a file to another.

Synopsis
~~~~~~~~

 int mpdm_link(const mpdm_t src, const mpdm_t dest);

Arguments
~~~~~~~~~

 * src: source file name
 * dest: destination file name

Description
~~~~~~~~~~~

Creates _dest_ as a (hard) link to _src_. UNIX only.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_mkdir
----------

Name
~~~~

*mpdm_mkdir* - Creates a directory

Synopsis
~~~~~~~~

 int mpdm_mkdir(const mpdm_t dir, const mpdm_t mode);

Arguments
~~~~~~~~~

 * dir: the new path
 * mode: permissions

Description
~~~~~~~~~~~

Creates a directory.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_mutex_lock
---------------

Name
~~~~

*mpdm_mutex_lock* - Locks a mutex.

Synopsis
~~~~~~~~

 void mpdm_mutex_lock(mpdm_t mutex);

Arguments
~~~~~~~~~

 * mutex: the mutex to be locked

Description
~~~~~~~~~~~

Locks a mutex. If the mutex is not already locked,
it waits until it is.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_mutex_unlock
-----------------

Name
~~~~

*mpdm_mutex_unlock* - Unlocks a mutex.

Synopsis
~~~~~~~~

 void mpdm_mutex_unlock(mpdm_t mutex);

Arguments
~~~~~~~~~

 * mutex: the mutex to be unlocked

Description
~~~~~~~~~~~

Unlocks a previously locked mutex. The thread
unlocking the mutex must be the one who locked it.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_new
--------

Name
~~~~

*mpdm_new* - Creates a new value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_new(mpdm_type_t type, const void *data, int size);

Arguments
~~~~~~~~~

 * type: data type
 * data: pointer to real data
 * size: size of data

Description
~~~~~~~~~~~

Creates a new value. _type_ is the data type, _data_ is a
pointer to the data the value will store and _size_ the size of these
data (if value is to be a multiple one, _size_ is a number of elements,
or a number of bytes otherwise).

This function is normally not directly used; use any of the type
creation macros instead.

Categories
~~~~~~~~~~

 * ./#value_creation (Value Creation)

mpdm_new_mutex
--------------

Name
~~~~

*mpdm_new_mutex* - Creates a new mutex.

Synopsis
~~~~~~~~

 mpdm_t mpdm_new_mutex(void);

Description
~~~~~~~~~~~

Creates a new mutex.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_new_semaphore
------------------

Name
~~~~

*mpdm_new_semaphore* - Creates a new semaphore.

Synopsis
~~~~~~~~

 mpdm_t mpdm_new_semaphore(int init_value);

Arguments
~~~~~~~~~

 * init_value: the initial value of the semaphore.

Description
~~~~~~~~~~~

Creates a new semaphore with an _init_value_.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_open
---------

Name
~~~~

*mpdm_open* - Opens a file.

Synopsis
~~~~~~~~

 mpdm_t mpdm_open(mpdm_t filename, mpdm_t mode);

Arguments
~~~~~~~~~

 * filename: the file name
 * mode: an fopen-like mode string

Description
~~~~~~~~~~~

Opens a file. If _filename_ can be open in the specified _mode_, an
mpdm_t value will be returned containing the file descriptor, or NULL
otherwise. If _mode_ is NULL, "r" is assumed.

If the file is open for reading, some charset detection methods are
used. If any of them is successful, its name is stored in the
DETECTED_ENCODING element of the mpdm_root() hash. This value is
suitable to be copied over ENCODING or TEMP_ENCODING.

If the file is open for writing, the encoding to be used is read from
the ENCODING element of mpdm_root() and, if not set, from the
TEMP_ENCODING one. The latter will always be deleted afterwards.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_pclose
-----------

Name
~~~~

*mpdm_pclose* - Closes a pipe.

Synopsis
~~~~~~~~

 int mpdm_pclose(mpdm_t fd);

Arguments
~~~~~~~~~

 * fd: the value containing the file descriptor

Description
~~~~~~~~~~~

Closes a pipe.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_pop
--------

Name
~~~~

*mpdm_pop* - Pops a value from an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_pop(mpdm_t a);

Arguments
~~~~~~~~~

 * a: the array

Description
~~~~~~~~~~~

Pops a value from the array (i.e. deletes from the end
and returns it).

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_popen
----------

Name
~~~~

*mpdm_popen* - Opens a pipe.

Synopsis
~~~~~~~~

 mpdm_t mpdm_popen(const mpdm_t prg, const mpdm_t mode);

Arguments
~~~~~~~~~

 * prg: the program to pipe
 * mode: an fopen-like mode string

Description
~~~~~~~~~~~

Opens a pipe to a program. If _prg_ can be open in the specified _mode_, an
mpdm_t value will be returned containing the file descriptor, or NULL
otherwise.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_popen2
-----------

Name
~~~~

*mpdm_popen2* - Opens a pipe and returns 2 descriptors.

Synopsis
~~~~~~~~

 mpdm_t mpdm_popen2(const mpdm_t prg);

Arguments
~~~~~~~~~

 * prg: the program to pipe

Description
~~~~~~~~~~~

Opens a read-write pipe and returns an array of two descriptors,
one for reading and one for writing. If _prg_ could not be piped to,
returns NULL.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_push
---------

Name
~~~~

*mpdm_push* - Pushes a value into an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_push(mpdm_t a, mpdm_t e);

Arguments
~~~~~~~~~

 * a: the array
 * e: the value

Description
~~~~~~~~~~~

Pushes a value into an array (i.e. inserts at the end).

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_queue
----------

Name
~~~~

*mpdm_queue* - Implements a queue in an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_queue(mpdm_t a, mpdm_t e, int size);

Arguments
~~~~~~~~~

 * a: the array
 * e: the element to be pushed
 * size: maximum size of array

Description
~~~~~~~~~~~

Pushes the _e_ element into the _a_ array. If the array already has
_size_ elements, the first (oldest) element is deleted from the
queue and returned.

Returns the deleted element, or NULL if the array doesn't have
_size_ elements yet.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_read
---------

Name
~~~~

*mpdm_read* - Reads a line from a file descriptor.

Synopsis
~~~~~~~~

 mpdm_t mpdm_read(const mpdm_t fd);

Arguments
~~~~~~~~~

 * fd: the value containing the file descriptor

Description
~~~~~~~~~~~

Reads a line from _fd_. Returns the line, or NULL on EOF.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)
 * ./#character_set_conversion (Character Set Conversion)

mpdm_ref
--------

Name
~~~~

*mpdm_ref* - Increments the reference count of a value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_ref(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Increments the reference count of a value.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_regex
----------

Name
~~~~

*mpdm_regex* - Matches a regular expression.

Synopsis
~~~~~~~~

 mpdm_t mpdm_regex(const mpdm_t v, const mpdm_t r, int offset);

Arguments
~~~~~~~~~

 * v: the value to be matched
 * r: the regular expression
 * offset: offset from the start of mpdm_data(v)

Description
~~~~~~~~~~~

Matches a regular expression against a value. Valid flags are 'i',
for case-insensitive matching, or 'm', to treat the string as a
multiline string (i.e., one containing newline characters), so
that ^ and $ match the boundaries of each line instead of the
whole string.

If _r_ is a string, an ordinary regular expression matching is tried
over the _v_ string. If the matching is possible, the match result
is returned, or NULL otherwise.

If _r_ is an array (of strings), each element is tried sequentially
as an individual regular expression over the _v_ string, each one using
the offset returned by the previous match. All regular expressions
must match to be successful. If this is the case, an array (with
the same number of arguments) is returned containing the matched
strings, or NULL otherwise.

If _r_ is NULL, the result of the previous regex matching
is returned as a two element array. The first element will contain
the character offset of the matching and the second the number of
characters matched. If the previous regex was unsuccessful, NULL
is returned.

Categories
~~~~~~~~~~

 * ./#regular_expressions (Regular Expressions)

mpdm_rename
-----------

Name
~~~~

*mpdm_rename* - Renames a file.

Synopsis
~~~~~~~~

 int mpdm_rename(const mpdm_t o, const mpdm_t n);

Arguments
~~~~~~~~~

 * o: old path
 * n: new path

Description
~~~~~~~~~~~

Renames a file.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_root
---------

Name
~~~~

*mpdm_root* - Returns the root hash.

Synopsis
~~~~~~~~

 mpdm_t mpdm_root(void);

Description
~~~~~~~~~~~

Returns the root hash. This hash is stored internally and can be used
as a kind of global symbol table.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_rval
---------

Name
~~~~

*mpdm_rval* - Returns a value's data as a real number (double).

Synopsis
~~~~~~~~

 double mpdm_rval(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Returns a value's data as a real number (double float).

Categories
~~~~~~~~~~

 * ./#strings (Strings)
 * ./#value_management (Value Management)

mpdm_seek
---------

Name
~~~~

*mpdm_seek* - Seeks a value in an array (sequential).

Synopsis
~~~~~~~~

 int mpdm_seek(const mpdm_t a, const mpdm_t v, int step);

Arguments
~~~~~~~~~

 * a: the array
 * v: the value
 * step: number of elements to step

Description
~~~~~~~~~~~

Seeks sequentially the value _v_ in the _a_ array in
increments of _step_. A complete search should use a step of 1.
Returns the offset of the element if found, or -1 otherwise.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_seek_wcs
-------------

Name
~~~~

*mpdm_seek_wcs* - Seeks a value in an array (sequential, string version).

Synopsis
~~~~~~~~

 int mpdm_seek_wcs(const mpdm_t a, const wchar_t *v, int step);

Arguments
~~~~~~~~~

 * a: the array
 * v: the value
 * step: number of elements to step

Description
~~~~~~~~~~~

Seeks sequentially the value _v_ in the _a_ array in
increments of _step_. A complete search should use a step of 1.
Returns the offset of the element if found, or -1 otherwise.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_semaphore_post
-------------------

Name
~~~~

*mpdm_semaphore_post* - Increments the value of a semaphore.

Synopsis
~~~~~~~~

 void mpdm_semaphore_post(mpdm_t sem);

Arguments
~~~~~~~~~

 * sem: the semaphore to increment

Description
~~~~~~~~~~~

Increments by 1 the value of a semaphore.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_semaphore_wait
-------------------

Name
~~~~

*mpdm_semaphore_wait* - Waits for a semaphore to be ready.

Synopsis
~~~~~~~~

 void mpdm_semaphore_wait(mpdm_t sem);

Arguments
~~~~~~~~~

 * sem: the semaphore to wait onto

Description
~~~~~~~~~~~

Waits for the value of a semaphore to be > 0. If it's
not, the thread waits until it is.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_set_wcs
------------

Name
~~~~

*mpdm_set_wcs* - Sets a value in an object (string version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_set_wcs(mpdm_t o, mpdm_t v, const wchar_t *i);

Arguments
~~~~~~~~~

 * o: the object
 * v: the value
 * i: the index

Description
~~~~~~~~~~~

Sets the value _v_ inside the object _o_, accesible by index _i_.
Returns _v_.

Categories
~~~~~~~~~~

 * ./#objects (Objects)

mpdm_shift
----------

Name
~~~~

*mpdm_shift* - Extracts the first element of an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_shift(mpdm_t a);

Arguments
~~~~~~~~~

 * a: the array

Description
~~~~~~~~~~~

Extracts the first element of the array. The array
is shrinked by one.

Returns the element.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_shutdown
-------------

Name
~~~~

*mpdm_shutdown* - Shuts down MPDM.

Synopsis
~~~~~~~~

 void mpdm_shutdown(void);

Description
~~~~~~~~~~~

Shuts down MPDM. No MPDM functions should be used from now on.


mpdm_size
---------

Name
~~~~

*mpdm_size* - Returns the size of an element.

Synopsis
~~~~~~~~

 int mpdm_size(const mpdm_t v);

Arguments
~~~~~~~~~

 * v: the element

Description
~~~~~~~~~~~

Returns the size of an element. It does not change the
reference count of the value.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_sleep
----------

Name
~~~~

*mpdm_sleep* - Sleeps a number of milliseconds.

Synopsis
~~~~~~~~

 void mpdm_sleep(int msecs);

Arguments
~~~~~~~~~

 * msecs: the milliseconds to sleep

Description
~~~~~~~~~~~

Sleeps a number of milliseconds.

Categories
~~~~~~~~~~

 * ./#threading (Threading)

mpdm_sort
---------

Name
~~~~

*mpdm_sort* - Sorts an array.

Synopsis
~~~~~~~~

 mpdm_t mpdm_sort(const mpdm_t a, int step);

Arguments
~~~~~~~~~

 * a: the array
 * step: increment step

Description
~~~~~~~~~~~

Sorts the array. _step_ is the number of elements to group together.

Returns the same array, sorted (versions prior to 1.0.10 returned
a new array).

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_sort_cb
------------

Name
~~~~

*mpdm_sort_cb* - Sorts an array with a special sorting function.

Synopsis
~~~~~~~~

 mpdm_t mpdm_sort_cb(mpdm_t a, int step, mpdm_t cb);

Arguments
~~~~~~~~~

 * a: the array
 * step: increment step
 * asort_cb: sorting function

Description
~~~~~~~~~~~

Sorts the array. _step_ is the number of elements to group together.
For each pair of elements being sorted, the executable mpdm_t value
_sort_cb_ is called with an array containing the two elements as
argument. It must return a signed numerical mpdm_t value indicating
the sorting order.

Returns the same array, sorted (versions prior to 1.0.10 returned
a new array).

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)

mpdm_splice_s
-------------

Name
~~~~

*mpdm_splice_s* - Creates a new string value from another.

Synopsis
~~~~~~~~

 mpdm_t mpdm_splice_s(const mpdm_t v, const mpdm_t i,
                     int offset, int del, mpdm_t *n, mpdm_t *d)
/* do not use this;

Arguments
~~~~~~~~~

 * v: the original value
 * i: the value to be inserted
 * offset: offset where the substring is to be inserted
 * del: number of characters to delete
 * n: an optional pointer to the new string
 * d: an optional pointer to the deleted string

Description
~~~~~~~~~~~

Creates a new string value from _v_, deleting _del_ chars at _offset_
and substituting them by _i_. If _del_ is 0, no deletion is done.
both _offset_ and _del_ can be negative; if this is the case, it's
assumed as counting from the end of _v_. If _v_ is NULL, _i_ will become
the new string, and both _offset_ and _del_ will be ignored. If _v_ is
not NULL and _i_ is, no insertion process is done (only deletion, if
applicable).

Fills _n_ (in not NULL) with the new string, and _d_ (if not NULL)
with the deleted portion.

Returns the new value (if created) or the deleted value (if created).

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_split
----------

Name
~~~~

*mpdm_split* - Separates a string into an array of pieces.

Synopsis
~~~~~~~~

 mpdm_t mpdm_split(const mpdm_t v, const mpdm_t s);

Arguments
~~~~~~~~~

 * v: the value to be separated
 * s: the separator

Description
~~~~~~~~~~~

Separates the _v_ string value into an array of pieces, using _s_
as a separator.

If the separator is NULL, the string is splitted by characters.

If the string does not contain the separator, an array holding 
the complete string is returned.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)
 * ./#strings (Strings)

mpdm_split_wcs
--------------

Name
~~~~

*mpdm_split_wcs* - Separates a string into an array of pieces (string version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_split_wcs(const mpdm_t v, const wchar_t *s);

Arguments
~~~~~~~~~

 * v: the value to be separated
 * s: the separator

Description
~~~~~~~~~~~

Separates the _v_ string value into an array of pieces, using _s_
as a separator.

If the separator is NULL, the string is splitted by characters.

If the string does not contain the separator, an array holding 
the complete string is returned.

Categories
~~~~~~~~~~

 * ./#arrays (Arrays)
 * ./#strings (Strings)

mpdm_sprintf
------------

Name
~~~~

*mpdm_sprintf* - Formats a sprintf()-like string.

Synopsis
~~~~~~~~

 mpdm_t mpdm_sprintf(const mpdm_t fmt, const mpdm_t args);

Arguments
~~~~~~~~~

 * fmt: the string format
 * args: an array of values

Description
~~~~~~~~~~~

Formats a string using the sprintf() format taking the values from _args_.

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_sregex
-----------

Name
~~~~

*mpdm_sregex* - Matches and substitutes a regular expression.

Synopsis
~~~~~~~~

 mpdm_t mpdm_sregex(mpdm_t v, const mpdm_t r, const mpdm_t s, int offset);

Arguments
~~~~~~~~~

 * v: the value to be matched
 * r: the regular expression
 * s: the substitution string, hash or code
 * offset: offset from the start of mpdm_data(v)

Description
~~~~~~~~~~~

Matches a regular expression against a value, and substitutes the
found substring with _s_. Valid flags are 'i', for case-insensitive
matching, and 'g', for global replacements (all ocurrences in _v_
will be replaced, instead of just the first found one).

If _s_ is executable, it's executed with the matched part as
the only argument and its return value is used as the
substitution string.

If _s_ is a hash, the matched string is used as a key to it and
its value used as the substitution. If this value itself is
executable, it's executed with the matched string as its only
argument and its return value used as the substitution.

If _r_ is NULL, returns the number of substitutions made in the
previous call to mpdm_sregex() (can be zero if none was done).

The global variables _mpdm_regex_offset_ and _mpdm_regex_size_ are
set to the offset of the matched string and the size of the
replaced string, respectively.

Always returns a new string (either modified or an exact copy).

Categories
~~~~~~~~~~

 * ./#regular_expressions (Regular Expressions)

mpdm_sscanf
-----------

Name
~~~~

*mpdm_sscanf* - Extracts data like sscanf().

Synopsis
~~~~~~~~

 mpdm_t mpdm_sscanf(const mpdm_t str, const mpdm_t fmt, int offset);

Arguments
~~~~~~~~~

 * str: the string to be parsed
 * fmt: the string format
 * offset: the character offset to start scanning

Description
~~~~~~~~~~~

Extracts data from a string using a special format pattern, very
much like the scanf() series of functions in the C library. Apart
from the standard percent-sign-commands (s, u, d, i, f, x,
n, [; with optional size and * to ignore), it implements S,
to match a string of characters upto what follows in the format
string; w, to match an alphabetic word (taking locale
into account); W, to match the inverse; and r, to return the rest
of the string. Also, the [ set of characters can include
other % formats.

Returns an array with the extracted values. If _n_ is used, the
position in the scanned string is returned as the value.

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_startup
------------

Name
~~~~

*mpdm_startup* - Initializes MPDM.

Synopsis
~~~~~~~~

 int mpdm_startup(void);

Description
~~~~~~~~~~~

Initializes the Minimum Profit Data Manager. Returns 0 if
everything went OK.


mpdm_stat
---------

Name
~~~~

*mpdm_stat* - Gives status from a file.

Synopsis
~~~~~~~~

 mpdm_t mpdm_stat(const mpdm_t filename);

Arguments
~~~~~~~~~

 * filename: file name to get the status from

Description
~~~~~~~~~~~

Returns a 14 element array of the status (permissions, onwer, etc.)
from the desired _filename_, or NULL if the file cannot be accessed.
(man 2 stat).

The values are: 0, device number of filesystem; 1, inode number;
2, file mode; 3, number of hard links to the file; 4, uid; 5, gid;
6, device identifier; 7, total size of file in bytes; 8, atime;
9, mtime; 10, ctime; 11, preferred block size for system I/O;
12, number of blocks allocated and 13, canonicalized file name.
Not all elements have necesarily meaningful values, as most are
system-dependent.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_strcat
-----------

Name
~~~~

*mpdm_strcat* - Concatenates two strings.

Synopsis
~~~~~~~~

 mpdm_t mpdm_strcat(const mpdm_t s1, const mpdm_t s2);

Arguments
~~~~~~~~~

 * s1: the first string
 * s2: the second string

Description
~~~~~~~~~~~

Returns a new string formed by the concatenation of _s1_ and _s2_.

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_strcat_wcs
---------------

Name
~~~~

*mpdm_strcat_wcs* - Concatenates two strings (string version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_strcat_wcs(const mpdm_t s1, const wchar_t *s2);

Arguments
~~~~~~~~~

 * s1: the first string
 * s2: the second string

Description
~~~~~~~~~~~

Returns a new string formed by the concatenation of _s1_ and _s2_.

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_strcat_wcsn
----------------

Name
~~~~

*mpdm_strcat_wcsn* - Concatenates two strings (string with size version).

Synopsis
~~~~~~~~

 mpdm_t mpdm_strcat_wcsn(const mpdm_t s1, const wchar_t *s2, int size);

Arguments
~~~~~~~~~

 * s1: the first string
 * s2: the second string
 * size: the size of the second string

Description
~~~~~~~~~~~

Returns a new string formed by the concatenation of _s1_ and _s2_.

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_string
-----------

Name
~~~~

*mpdm_string* - Returns a string representation of a value.

Synopsis
~~~~~~~~

 wchar_t *mpdm_string(const mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Returns a string representation of a value. For strings, it's
the value data itself; for any other type, a conversion to string
is returned instead. These values can be used for printing but
they are mostly oriented to being used as indexes in objects.

The reference count value in _v_ is not touched.

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_tr
-------

Name
~~~~

*mpdm_tr* - Transliterates a string.

Synopsis
~~~~~~~~

 mpdm_t mpdm_tr(mpdm_t str, mpdm_t s1, mpdm_t s2);

Arguments
~~~~~~~~~

 * str: the strnig
 * s1: characters to be changed
 * s2: characters to replace those in s1

Description
~~~~~~~~~~~

Creates a copy of _str_, which will have all characters in _s1_
replaced by those in _s2_ matching their position.


mpdm_ulc
--------

Name
~~~~

*mpdm_ulc* - Converts a string to uppercase or lowecase.

Synopsis
~~~~~~~~

 mpdm_t mpdm_ulc(const mpdm_t s, int u);

Arguments
~~~~~~~~~

 * s: the string
 * u: convert to uppercase (1) or to lowercase (0).

Description
~~~~~~~~~~~

Converts _s_ to uppercase (for _u_ == 1) or to lowercase (_u_ == 0).

Categories
~~~~~~~~~~

 * ./#strings (Strings)

mpdm_unlink
-----------

Name
~~~~

*mpdm_unlink* - Deletes a file.

Synopsis
~~~~~~~~

 int mpdm_unlink(const mpdm_t filename);

Arguments
~~~~~~~~~

 * filename: file name to be deleted

Description
~~~~~~~~~~~

Deletes a file.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)

mpdm_unref
----------

Name
~~~~

*mpdm_unref* - Decrements the reference count of a value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_unref(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Decrements the reference count of a value. If the reference
count of the value reaches 0, it's destroyed.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_unrefnd
------------

Name
~~~~

*mpdm_unrefnd* - Decrements the reference count of a value, without destroy.

Synopsis
~~~~~~~~

 mpdm_t mpdm_unrefnd(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

Decrements the reference count of a value, without destroying
the value if it's unreferenced.

Categories
~~~~~~~~~~

 * ./#value_management (Value Management)

mpdm_utf8_to_wc
---------------

Name
~~~~

*mpdm_utf8_to_wc* - Converts from utf8 to wchar (streaming).

Synopsis
~~~~~~~~

 int mpdm_utf8_to_wc(wchar_t *w, int *s, char c);

Arguments
~~~~~~~~~

 * w: convert wide char
 * s: temporal state
 * c: char read from stream

Description
~~~~~~~~~~~

Converts a stream of utf8 characters to wide char ones. The input
stream is read one byte at a time from _c_ and composed into _w_
until a Unicode codepoint is ready. The _s_ integer keeps an internal
state change and must be set to 0 before the stream is read. It
detects encoding errors; in this case, the special Unicode
char U+FFFD is returned.

When 0 is returned, a new wide char is available into _w_. If
the stream is interrupted in the middle of a multibyte character,
the _s_ state variable will not be 0.


mpdm_void
---------

Name
~~~~

*mpdm_void* - Refs then unrefs a value.

Synopsis
~~~~~~~~

 mpdm_t mpdm_void(mpdm_t v);

Arguments
~~~~~~~~~

 * v: the value

Description
~~~~~~~~~~~

References and unreferences a value. To be used to receive
the output of mpdm_exec() in case of it being void (i.e.
its return value ignored).


mpdm_write
----------

Name
~~~~

*mpdm_write* - Writes a value into a file.

Synopsis
~~~~~~~~

 int mpdm_write(const mpdm_t fd, const mpdm_t v);

Arguments
~~~~~~~~~

 * fd: the file descriptor.
 * v: the value to be written.

Description
~~~~~~~~~~~

Writes the _v_ value into _fd_, using the current encoding. If _v_ is
an array or file, it's iterated and its elements written into _fd_.

Categories
~~~~~~~~~~

 * ./#file_management (File Management)
 * ./#character_set_conversion (Character Set Conversion)

----
ttcdt - dev@triptico.com - Built with http://triptico.com/software/mp_doccer.html (mp_doccer 1.2.2)
