changeset 49:b16a07cb5b41

Docs: synchronize documentation, #422
author David Demelier <markand@malikania.fr>
date Mon, 29 Feb 2016 13:40:56 +0100
parents ce3e96deb9e4
children ae73915bb15d
files irccd/js-directory.cpp irccd/js-elapsed-timer.cpp irccd/js-file.cpp irccd/js-logger.cpp irccd/js-plugin.cpp irccd/js-server.cpp irccd/js-system.cpp irccd/js-timer.cpp irccd/js-unicode.cpp irccd/js-util.cpp
diffstat 10 files changed, 141 insertions(+), 139 deletions(-) [+]
line wrap: on
line diff
--- a/irccd/js-directory.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-directory.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -197,17 +197,17 @@
 }
 
 /*
- * Method: Directory.prototype.find(pattern, recursive)
+ * Method: Directory.find(pattern, recursive)
  * --------------------------------------------------------
  *
  * Synonym of Directory.find(path, pattern, recursive) but the path is taken
  * from the directory object.
  *
  * Arguments:
- *   - pattern, the regular expression or file name
- *   - recursive, set to true to search recursively (default: false)
+ *   - pattern, the regular expression or file name,
+ *   - recursive, set to true to search recursively (default: false).
  * Returns:
- *   - the path to the file or undefined on errors or not found
+ *   The path to the file or undefined on errors or not found
  */
 int methodFind(js::Context &ctx)
 {
@@ -215,16 +215,16 @@
 }
 
 /*
- * Method: Directory.prototype.remove(recursive)
+ * Method: Directory.remove(recursive)
  * --------------------------------------------------------
  *
  * Synonym of Directory.remove(recursive) but the path is taken from the
  * directory object.
  *
  * Arguments:
- *   - recursive, recursively or not (default: false)
+ *   - recursive, recursively or not (default: false).
  * Throws:
- *   Any exception on error
+ *   - Any exception on error.
  */
 int methodRemove(js::Context &ctx)
 {
@@ -247,8 +247,8 @@
  * Opens and read the directory at the specified path.
  *
  * Arguments:
- *   - path, the path to the directory
- *   - flags, the optional flags (default: 0)
+ *   - path, the path to the directory,
+ *   - flags, the optional flags (default: 0).
  * Throws:
  *   - Any exception on error
  */
@@ -296,11 +296,11 @@
  * Find an entry by a pattern or a regular expression.
  *
  * Arguments:
- *   - path, the base path
- *   - pattern, the regular expression or file name
- *   - recursive, set to true to search recursively (default: false)
+ *   - path, the base path,
+ *   - pattern, the regular expression or file name,
+ *   - recursive, set to true to search recursively (default: false).
  * Returns:
- *   - the path to the file or undefined on errors or not found
+ *   The path to the file or undefined on errors or not found.
  */
 int funcFind(js::Context &ctx)
 {
@@ -314,10 +314,10 @@
  * Remove the directory optionally recursively.
  *
  * Arguments:
- *   - path, the path to the directory
- *   - recursive, recursively or not (default: false)
+ *   - path, the path to the directory,
+ *   - recursive, recursively or not (default: false).
  * Throws:
- *   Any exception on error
+ *   - Any exception on error.
  */
 int funcRemove(js::Context &ctx)
 {
@@ -332,10 +332,10 @@
  * just like you have invoked mkdir -p.
  *
  * Arguments:
- *   - path, the path to the directory
- *   - mode, the mode, not available on all platforms
+ *   - path, the path to the directory,
+ *   - mode, the mode, not available on all platforms.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int funcMkdir(js::Context &ctx)
 {
--- a/irccd/js-elapsed-timer.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-elapsed-timer.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -80,7 +80,7 @@
  * Get the number of elapsed milliseconds.
  *
  * Returns:
- *   - The time elapsed
+ *   The time elapsed.
  */
 int elapsed(js::Context &ctx)
 {
--- a/irccd/js-file.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-file.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -202,13 +202,13 @@
  * -------------------------------------------------------- */
 
 /*
- * Method: File.prototype.basename()
+ * Method: File.basename()
  * --------------------------------------------------------
  *
  * Synonym of `Irccd.File.basename(path)` but with the path from the file.
  *
  * Returns:
- *   The base file name
+ *   The base name.
  */
 int methodBasename(js::Context &ctx)
 {
@@ -218,7 +218,7 @@
 }
 
 /*
- * Method: File.prototype.close()
+ * Method: File.close()
  * --------------------------------------------------------
  *
  * Force close of the file, automatically called when object is collected.
@@ -231,13 +231,13 @@
 }
 
 /*
- * Method: File.prototype.dirname()
+ * Method: File.dirname()
  * --------------------------------------------------------
  *
  * Synonym of `Irccd.File.dirname(path)` but with the path from the file.
  *
  * Returns:
- *   The base directory name
+ *   The directory name.
  */
 int methodDirname(js::Context &ctx)
 {
@@ -247,19 +247,17 @@
 }
 
 /*
- * Method: File.prototype.read(amount)
+ * Method: File.read(amount)
  * --------------------------------------------------------
  *
  * Read the specified amount of characters or the whole file.
  *
  * Arguments:
- *   - amount, the amount of characters or -1 to read all (Optional, default: -1)
- *
+ *   - amount, the amount of characters or -1 to read all (Optional, default: -1).
  * Returns:
- *   - The string
- *
+ *   The string.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int methodRead(js::Context &ctx)
 {
@@ -279,15 +277,15 @@
 }
 
 /*
- * Method: File.prototype.readline()
+ * Method: File.readline()
  * --------------------------------------------------------
  *
  * Read the next line available.
  *
  * Returns:
- *   - The next line or undefined if eof
+ *   The next line or undefined if eof.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int methodReadline(js::Context &ctx)
 {
@@ -306,13 +304,13 @@
 }
 
 /*
- * Method: File.prototype.remove()
+ * Method: File.remove()
  * --------------------------------------------------------
  *
  * Synonym of File.remove(path) but with the path from the file.
  *
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int methodRemove(js::Context &ctx)
 {
@@ -323,16 +321,16 @@
 }
 
 /*
- * Method: File.prototype.seek(type, amount)
+ * Method: File.seek(type, amount)
  * --------------------------------------------------------
  *
  * Sets the position in the file.
  *
  * Arguments:
- *   - type, the type of setting (File.SeekSet, File.SeekCur, File.SeekSet)
- *   - amount, the new offset
+ *   - type, the type of setting (File.SeekSet, File.SeekCur, File.SeekSet),
+ *   - amount, the new offset.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int methodSeek(js::Context &ctx)
 {
@@ -355,15 +353,15 @@
 #if defined(HAVE_STAT)
 
 /*
- * Method: File.prototype.stat() [optional]
+ * Method: File.stat() [optional]
  * --------------------------------------------------------
  *
  * Synonym of File.stat(path) but with the path from the file.
  *
  * Returns:
- *   - The stat information
+ *   The stat information.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int methodStat(js::Context &ctx)
 {
@@ -384,15 +382,15 @@
 #endif // !HAVE_STAT
 
 /*
- * Method: File.prototype.tell()
+ * Method: File.tell()
  * --------------------------------------------------------
  *
  * Get the actual position in the file.
  *
  * Returns:
- *   - The position
+ *   The position.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int methodTell(js::Context &ctx)
 {
@@ -411,15 +409,15 @@
 }
 
 /*
- * Method: File.prototype.write(data)
+ * Method: File.write(data)
  * --------------------------------------------------------
  *
  * Write some characters to the file.
  *
  * Arguments:
- *   - data, the character to write
+ *   - data, the character to write.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int methodWrite(js::Context &ctx)
 {
@@ -463,10 +461,10 @@
  * Open a file specified by path with the specified mode.
  *
  * Arguments:
- *   - path, the path to the file
- *   - mode, the mode, can be one of [abrwt]
+ *   - path, the path to the file,
+ *   - mode, the mode string.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int constructor(js::Context &ctx)
 {
@@ -492,9 +490,9 @@
  * Return the file basename as specified in `basename(3)` C function.
  *
  * Arguments:
- *   - path, the path to the file
+ *   - path, the path to the file.
  * Returns:
- *   - the base name
+ *   The base name.
  */
 int functionBasename(js::Context &ctx)
 {
@@ -510,9 +508,9 @@
  * Return the file directory name as specified in `dirname(3)` C function.
  *
  * Arguments:
- *   - path, the path to the file
+ *   - path, the path to the file.
  * Returns:
- *   - the directory name
+ *   The directory name.
  */
 int functionDirname(js::Context &ctx)
 {
@@ -528,11 +526,11 @@
  * Check if the file exists.
  *
  * Arguments:
- *   - path, the path to the file
+ *   - path, the path to the file.
  * Returns:
- *   - true if exists
+ *   True if exists.
  * Throws:
- *   - Any exception if we don't have access
+ *   - Any exception if we don't have access.
  */
 int functionExists(js::Context &ctx)
 {
@@ -548,9 +546,9 @@
  * Remove the file at the specified path.
  *
  * Arguments:
- *   - path, the path to the file
+ *   - path, the path to the file.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int functionRemove(js::Context &ctx)
 {
@@ -569,11 +567,11 @@
  * Get file information at the specified path.
  *
  * Arguments:
- *   - path, the path to the file
+ *   - path, the path to the file.
  * Returns:
- *   - the stats information
+ *   The stat information.
  * Throws:
- *   - Any exception on error
+ *   - Any exception on error.
  */
 int functionStat(js::Context &ctx)
 {
--- a/irccd/js-logger.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-logger.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -44,7 +44,7 @@
  * Write a verbose message.
  *
  * Arguments:
- *   - message, the message
+ *   - message, the message.
  */
 int info(js::Context &ctx)
 {
@@ -58,7 +58,7 @@
  * Write a warning message.
  *
  * Arguments:
- *   - message, the warning
+ *   - message, the warning.
  */
 int warning(js::Context &ctx)
 {
@@ -72,7 +72,7 @@
  * Write a debug message, only shown if irccd is compiled in debug.
  *
  * Arguments:
- *   - message, the message
+ *   - message, the message.
  */
 int debug(js::Context &ctx)
 {
--- a/irccd/js-plugin.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-plugin.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -63,7 +63,7 @@
  * Arguments:
  *   - name, the plugin identifier, if not specified the current plugin is selected.
  * Returns:
- *   - The plugin information or undefined if the plugin was not found.
+ *   The plugin information or undefined if the plugin was not found.
  */
 int info(js::Context &ctx)
 {
@@ -87,7 +87,7 @@
  * Get the list of plugins, the array returned contains all plugin names.
  *
  * Returns:
- *   - The list of all plugin names.
+ *   The list of all plugin names.
  */
 int list(js::Context &ctx)
 {
--- a/irccd/js-server.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-server.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -34,8 +34,8 @@
  * Change a channel mode.
  *
  * Arguments:
- *   - channel, the channel
- *   - mode, the mode
+ *   - channel, the channel,
+ *   - mode, the mode.
  */
 int cmode(js::Context &ctx)
 {
@@ -51,8 +51,8 @@
  * Send a channel notice.
  *
  * Arguments:
- *   - channel, the channel
- *   - message, the message
+ *   - channel, the channel,
+ *   - message, the message.
  */
 int cnotice(js::Context &ctx)
 {
@@ -108,8 +108,8 @@
  * Invite someone to a channel.
  *
  * Arguments:
- *   - target, the target to invite
- *   - channel, the channel
+ *   - target, the target to invite,
+ *   - channel, the channel.
  */
 int invite(js::Context &ctx)
 {
@@ -125,8 +125,8 @@
  * Join a channel with an optional password.
  *
  * Arguments:
- *   - channel, the channel to join
- *   - password, the password or undefined to not use
+ *   - channel, the channel to join,
+ *   - password, the password or undefined to not use.
  */
 int join(js::Context &ctx)
 {
@@ -142,9 +142,9 @@
  * Kick someone from a channel.
  *
  * Arguments:
- *   - target, the target to kick
- *   - channel, the channel
- *   - reason, the optional reason or undefined to not set
+ *   - target, the target to kick,
+ *   - channel, the channel,
+ *   - reason, the optional reason or undefined to not set.
  */
 int kick(js::Context &ctx)
 {
@@ -164,8 +164,8 @@
  * Send a CTCP Action.
  *
  * Arguments:
- *   - target, the target or a channel
- *   - message, the message
+ *   - target, the target or a channel,
+ *   - message, the message.
  */
 int me(js::Context &ctx)
 {
@@ -181,8 +181,8 @@
  * Send a message.
  *
  * Arguments:
- *   - target, the target or a channel
- *   - message, the message
+ *   - target, the target or a channel,
+ *   - message, the message.
  */
 int message(js::Context &ctx)
 {
@@ -198,7 +198,7 @@
  * Change your mode.
  *
  * Arguments:
- *   - mode, the new mode
+ *   - mode, the new mode.
  */
 int mode(js::Context &ctx)
 {
@@ -214,7 +214,7 @@
  * Get the list of names from a channel.
  *
  * Arguments:
- *   - channel, the channel
+ *   - channel, the channel.
  */
 int names(js::Context &ctx)
 {
@@ -230,7 +230,7 @@
  * Change the nickname.
  *
  * Arguments:
- *   - nickname, the nickname
+ *   - nickname, the nickname.
  */
 int nick(js::Context &ctx)
 {
@@ -246,8 +246,8 @@
  * Send a private notice.
  *
  * Arguments:
- *   - target, the target
- *   - message, the notice message
+ *   - target, the target,
+ *   - message, the notice message.
  */
 int notice(js::Context &ctx)
 {
@@ -263,8 +263,8 @@
  * Leave a channel.
  *
  * Arguments:
- *   - channel, the channel to leave
- *   - reason, the optional reason, keep undefined for portability
+ *   - channel, the channel to leave,
+ *   - reason, the optional reason, keep undefined for portability.
  */
 int part(js::Context &ctx)
 {
@@ -280,7 +280,7 @@
  * Send a raw message to the IRC server.
  *
  * Arguments:
- *   - raw, the raw message (without terminators)
+ *   - raw, the raw message (without terminators).
  */
 int send(js::Context &ctx)
 {
@@ -296,8 +296,8 @@
  * Change a channel topic.
  *
  * Arguments:
- *   - channel, the channel
- *   - topic, the new topic
+ *   - channel, the channel,
+ *   - topic, the new topic.
  */
 int topic(js::Context &ctx)
 {
@@ -313,7 +313,7 @@
  * Get whois information.
  *
  * Arguments:
- *   - target, the target
+ *   - target, the target.
  */
 int whois(js::Context &ctx)
 {
@@ -330,7 +330,7 @@
  * as property key.
  *
  * Returns:
- *   - the server name (unique)
+ *   The server name (unique).
  */
 int toString(js::Context &ctx)
 {
@@ -412,7 +412,7 @@
  * Register a new server to the irccd instance.
  *
  * Arguments:
- *   - s, the server to add
+ *   - s, the server to add.
  */
 int add(js::Context &ctx)
 {
@@ -433,7 +433,7 @@
  * Arguments:
  *   - name, the server name
  * Returns:
- *   - the server object or undefined if not found
+ *   The server object or undefined if not found.
  */
 int find(js::Context &ctx)
 {
@@ -456,7 +456,7 @@
  * Get the map of all loaded servers.
  *
  * Returns:
- *   - an object with string-to-servers pairs.
+ *   An object with string-to-servers pairs.
  */
 int list(js::Context &ctx)
 {
@@ -475,7 +475,7 @@
  * Remove a server from the irccd instance. You can pass the server object since it's coercible to a string.
  *
  * Arguments:
- *   - name the server name
+ *   - name the server name.
  */
 int remove(js::Context &ctx)
 {
--- a/irccd/js-system.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-system.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -44,9 +44,9 @@
  * Get an environment system variable.
  *
  * Arguments:
- *   - key, the environment variable
+ *   - key, the environment variable.
  * Returns:
- *   - The value
+ *   The value.
  */
 int env(js::Context &ctx)
 {
@@ -62,7 +62,7 @@
  * Execute a system command.
  *
  * Arguments:
- *   - cmd, the command to execute
+ *   - cmd, the command to execute.
  */
 int exec(js::Context &ctx)
 {
@@ -78,7 +78,7 @@
  * Get the operating system user's home.
  *
  * Returns:
- *   - The user home directory
+ *   The user home directory.
  */
 int home(js::Context &ctx)
 {
@@ -94,7 +94,7 @@
  * Get the operating system name.
  *
  * Returns:
- *   - The system name
+ *   The system name.
  */
 int name(js::Context &ctx)
 {
@@ -115,9 +115,9 @@
  *   - cmd, the command to execute,
  *   - mode, the mode (e.g. "r").
  * Returns:
- *   - A Irccd.File object
+ *   A Irccd.File object.
  * Throws
- *   - Irccd.SystemError on failures
+ *   - Irccd.SystemError on failures.
  */
 int popen(js::Context &ctx)
 {
@@ -153,7 +153,7 @@
  * Get the number of milliseconds since irccd was started.
  *
  * Returns:
- *   - The number of milliseconds
+ *   The number of milliseconds.
  */
 int ticks(js::Context &ctx)
 {
@@ -163,7 +163,7 @@
 }
 
 /*
- * Function: System.usleep(delay)
+ * Function: Irccd.System.usleep(delay)
  * ------------------------------------------------------------------
  *
  * Sleep the main loop for the specific delay in microseconds.
@@ -176,13 +176,13 @@
 }
 
 /*
- * Function: System.uptime()
+ * Function: Irccd.System.uptime()
  * ------------------------------------------------------------------
  *
  * Get the system uptime.
  *
  * Returns:
- *   - The system uptime
+ *   The system uptime.
  */
 int uptime(js::Context &ctx)
 {
@@ -192,13 +192,13 @@
 }
 
 /*
- * Function: System.version()
+ * Function: Irccd.System.version()
  * ------------------------------------------------------------------
  *
  * Get the operating system version.
  *
  * Returns:
- *   - The system version
+ *   The system version.
  */
 int version(js::Context &ctx)
 {
--- a/irccd/js-timer.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-timer.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -80,15 +80,15 @@
 };
 
 /*
- * Function: Timer(type, delay) [constructor]
+ * Function: Irccd.Timer(type, delay, callback) [constructor]
  * --------------------------------------------------------
  *
- * Create a new timer, the timer is not created automatically and the function
- * can be set by assigning to the onTimeout property.
+ * Create a new timer object.
  *
  * Arguments:
- *   - type, the type (Timer.Single or Timer.Repeat)
- *   - delay, the delay in milliseconds
+ *   - type, the type of timer (Irccd.Timer.Single or Irccd.Timer.Repeat),
+ *   - delay, the interval in milliseconds,
+ *   - callback, the function to call.
  */
 int constructor(js::Context &ctx)
 {
--- a/irccd/js-unicode.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-unicode.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -29,9 +29,9 @@
  * --------------------------------------------------------
  *
  * Arguments:
- *   - code, the code point
+ *   - code, the code point.
  * Returns:
- *   - true if the code is in the digit category
+ *   True if the code is in the digit category.
  */
 int isDigit(js::Context &ctx)
 {
@@ -45,9 +45,9 @@
  * --------------------------------------------------------
  *
  * Arguments:
- *   - code, the code point
+ *   - code, the code point.
  * Returns:
- *   - true if the code is in the letter category
+ *   True if the code is in the letter category.
  */
 int isLetter(js::Context &ctx)
 {
@@ -61,9 +61,9 @@
  * --------------------------------------------------------
  *
  * Arguments:
- *   - code, the code point
+ *   - code, the code point.
  * Returns:
- *   - true if the code is lower case
+ *   True if the code is lower case.
  */
 int isLower(js::Context &ctx)
 {
@@ -77,9 +77,9 @@
  * --------------------------------------------------------
  *
  * Arguments:
- *   - code, the code point
+ *   - code, the code point.
  * Returns:
- *   - true if the code is in the space category
+ *   True if the code is in the space category.
  */
 int isSpace(js::Context &ctx)
 {
@@ -89,13 +89,13 @@
 }
 
 /*
- * Function: Unicode.isTitle(code)
+ * Function: Irccd.Unicode.isTitle(code)
  * --------------------------------------------------------
  *
  * Arguments:
- *   - code, the code point
+ *   - code, the code point.
  * Returns:
- *   - true if the code is title case
+ *   True if the code is title case.
  */
 int isTitle(js::Context &ctx)
 {
@@ -109,9 +109,9 @@
  * --------------------------------------------------------
  *
  * Arguments:
- *   - code, the code point
+ *   - code, the code point.
  * Returns:
- *   - true if the code is upper case
+ *   True if the code is upper case.
  */
 int isUpper(js::Context &ctx)
 {
--- a/irccd/js-util.cpp	Mon Feb 29 13:13:56 2016 +0100
+++ b/irccd/js-util.cpp	Mon Feb 29 13:40:56 2016 +0100
@@ -63,12 +63,16 @@
 namespace {
 
 /*
- * Function: format(text, parameters)
+ * Function: Irccd.Util.format(text, parameters)
  * --------------------------------------------------------
  *
  * Format a string with templates.
  *
- * TODO: document
+ * Arguments:
+ *   - input, the text to update,
+ *   - params, the parameters.
+ * Returns:
+ *   The converted text.
  */
 int format(js::Context &ctx)
 {
@@ -82,15 +86,15 @@
 }
 
 /*
- * Function: splituser(ident)
+ * Function: Irccd.Util.splituser(ident)
  * --------------------------------------------------------
  *
  * Return the nickname part from a full username.
  *
  * Arguments:
- *   - ident, the full identity
+ *   - ident, the full identity.
  * Returns:
- *   - The nickname part
+ *   The nickname.
  */
 int splituser(js::Context &ctx)
 {
@@ -104,15 +108,15 @@
 }
 
 /*
- * Function: splithost(ident)
+ * Function: Irccd.Util.splithost(ident)
  * --------------------------------------------------------
  *
  * Return the hostname part from a full username.
  *
  * Arguments:
- *   - ident, the full identity
+ *   - ident, the full identity.
  * Returns:
- *   - The hostname part
+ *   The hostname.
  */
 int splithost(js::Context &ctx)
 {