ruby-changes:24027
From: yugui <ko1@a...>
Date: Thu, 14 Jun 2012 11:22:09 +0900 (JST)
Subject: [ruby-changes:24027] yugui:r36078 (trunk): * eval.c: Add doxygen comments.
yugui 2012-06-14 11:21:51 +0900 (Thu, 14 Jun 2012) New Revision: 36078 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36078 Log: * eval.c: Add doxygen comments. * ruby.c: ditto. * thread_pthread.c: ditto * version.c: ditto. * vm_core.h: ditto. Modified files: trunk/ChangeLog trunk/eval.c trunk/ruby.c trunk/thread_pthread.c trunk/version.c trunk/vm_core.h Index: ChangeLog =================================================================== --- ChangeLog (revision 36077) +++ ChangeLog (revision 36078) @@ -1,3 +1,15 @@ +Thu Jun 14 10:39:48 2012 Yuki Yugui Sonoda <yugui@g...> + + * eval.c: Add doxygen comments. + + * ruby.c: ditto. + + * thread_pthread.c: ditto + + * version.c: ditto. + + * vm_core.h: ditto. + Thu Jun 14 10:16:07 2012 NARUSE, Yui <naruse@r...> * configure.in: revert r36071 and add NetBSD to blacklist of -ansi. Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 36077) +++ thread_pthread.c (revision 36078) @@ -581,6 +581,10 @@ #endif #undef ruby_init_stack +/* Set stack bottom of Ruby implementation. + * + * You must call this function before any heap allocation by Ruby implementation. + * Or GC will break living objects */ void ruby_init_stack(volatile VALUE *addr #ifdef __ia64 Index: vm_core.h =================================================================== --- vm_core.h (revision 36077) +++ vm_core.h (revision 36078) @@ -458,7 +458,18 @@ struct rb_vm_tag *tag; struct rb_vm_protect_tag *protect_tag; + /*! Thread-local state of evaluation context. + * + * If negative, this thread is evaluating the main program. + * If positive, this thread is evaluating a program under Kernel::eval + * family. + */ int parse_in_eval; + + /*! Thread-local state of compiling context. + * + * If non-zero, the parser does not automatically print error messages to + * stderr. */ int mild_compile_error; /* storage */ Index: eval.c =================================================================== --- eval.c (revision 36077) +++ eval.c (revision 36078) @@ -61,6 +61,16 @@ GET_VM()->running = 1; } +/*! Processes command line arguments and compiles the Ruby source to execute. + * + * This function does: + * \li Processses the given command line flags and arguments for ruby(1) + * \li compiles the source code from the given argument, -e or stdin, and + * \li returns the compiled source as an opaque pointer to an internal data structure + * + * @return an opaque pointer to the compiled source or an internal special value. + * @sa ruby_executable_node(). + */ void * ruby_options(int argc, char **argv) { @@ -101,6 +111,13 @@ rb_gc_call_finalizer_at_exit(); } +/** Runs the VM finalization processes. + * + * <code>END{}</code> and procs registered by <code>Kernel.#at_ext</code> are + * executed here. See the Ruby language spec for more details. + * + * @note This function is allowed to raise an exception if an error occurred. + */ void ruby_finalize(void) { @@ -108,6 +125,16 @@ ruby_finalize_1(); } +/** Destructs the VM. + * + * Runs the VM finalization processes as well as ruby_finalize(), and frees + * resources used by the VM. + * + * @param ex Default value to the return value. + * @return If an error occured returns a non-zero. If otherwise, reurns the + * given ex. + * @note This function does not raise any exception. + */ int ruby_cleanup(volatile int ex) { @@ -210,12 +237,25 @@ return state; } +/*! Calls ruby_cleanup() and exits the process */ void ruby_stop(int ex) { exit(ruby_cleanup(ex)); } +/*! Checks the return value of ruby_options(). + * @param n return value of ruby_options(). + * @param status pointer to the exit status of this process. + * + * ruby_options() sometimes returns a special value to indicate this process + * should immediately exit. This function checks if the case. Also stores the + * exit status that the caller have to pass to exit(3) into + * <code>*status</code>. + * + * @retval non-zero if the given opaque pointer is actually a compiled source. + * @retval 0 if the given value is such a special value. + */ int ruby_executable_node(void *n, int *status) { @@ -233,6 +273,10 @@ return FALSE; } +/*! Runs the given compiled source and exits this process. + * @retval 0 if successfully run thhe source + * @retval non-zero if an error occurred. +*/ int ruby_run_node(void *n) { @@ -244,6 +288,7 @@ return ruby_cleanup(ruby_exec_node(n)); } +/*! Runs the given compiled source */ int ruby_exec_node(void *n) { Index: version.c =================================================================== --- version.c (revision 36077) +++ version.c (revision 36078) @@ -96,6 +96,7 @@ #endif ""; +/*! Defines platform-depended Ruby-level constants */ void Init_version(void) { @@ -134,6 +135,7 @@ rb_define_global_const("RUBY_ENGINE", ruby_engine_name = MKSTR(engine)); } +/*! Prints the version information of the CRuby interpreter to stdout. */ void ruby_show_version(void) { @@ -141,6 +143,9 @@ fflush(stdout); } +/*! Prints the copyright notice of the CRuby interpreter to stdout and \em exits + * this process successfully. + */ void ruby_show_copyright(void) { Index: ruby.c =================================================================== --- ruby.c (revision 36077) +++ ruby.c (revision 36078) @@ -1706,6 +1706,11 @@ rb_progname = rb_obj_freeze(rb_external_str_new(s, i)); } +/*! Sets the current script name to this value. + * + * This is similiar to <code>$0 = name</code> in Ruby level but also affects + * <code>Method#location</code> and others. + */ void ruby_script(const char *name) { @@ -1765,6 +1770,7 @@ } } +/*! Defines built-in variables */ void ruby_prog_init(void) { @@ -1860,6 +1866,12 @@ } } +/*! Initializes the process for ruby(1). + * + * This function assumes this process is ruby(1) and it has just started. + * Usually programs that embeds CRuby interpreter should not call this function, + * and should do their own initialization. + */ void ruby_sysinit(int *argc, char ***argv) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/