Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* eval.c: Add doxygen comments.

* ruby.c: ditto.

* thread_pthread.c: ditto

* version.c: ditto.

* vm_core.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit f8601bd903d6c9f288fc39cc9f277c1275291ff3 1 parent e9e6031
Yuki Sonoda (Yugui) authored
12  ChangeLog
... ...
@@ -1,3 +1,15 @@
  1
+Thu Jun 14 10:39:48 2012  Yuki Yugui Sonoda  <yugui@google.com>
  2
+
  3
+	* eval.c: Add doxygen comments.
  4
+
  5
+	* ruby.c: ditto.
  6
+
  7
+	* thread_pthread.c: ditto
  8
+
  9
+	* version.c: ditto.
  10
+
  11
+	* vm_core.h: ditto.
  12
+
1 13
 Thu Jun 14 10:16:07 2012  NARUSE, Yui  <naruse@ruby-lang.org>
2 14
 
3 15
 	* configure.in: revert r36071 and add NetBSD to blacklist of -ansi.
45  eval.c
@@ -61,6 +61,16 @@ ruby_init(void)
61 61
     GET_VM()->running = 1;
62 62
 }
63 63
 
  64
+/*! Processes command line arguments and compiles the Ruby source to execute.
  65
+ *
  66
+ * This function does:
  67
+ * \li  Processses the given command line flags and arguments for ruby(1)
  68
+ * \li compiles the source code from the given argument, -e or stdin, and
  69
+ * \li returns the compiled source as an opaque pointer to an internal data structure
  70
+ *
  71
+ * @return an opaque pointer to the compiled source or an internal special value.
  72
+ * @sa ruby_executable_node().
  73
+ */
64 74
 void *
65 75
 ruby_options(int argc, char **argv)
66 76
 {
@@ -101,6 +111,13 @@ ruby_finalize_1(void)
101 111
     rb_gc_call_finalizer_at_exit();
102 112
 }
103 113
 
  114
+/** Runs the VM finalization processes.
  115
+ *
  116
+ * <code>END{}</code> and procs registered by <code>Kernel.#at_ext</code> are
  117
+ * executed here. See the Ruby language spec for more details.
  118
+ *
  119
+ * @note This function is allowed to raise an exception if an error occurred.
  120
+ */
104 121
 void
105 122
 ruby_finalize(void)
106 123
 {
@@ -108,6 +125,16 @@ ruby_finalize(void)
108 125
     ruby_finalize_1();
109 126
 }
110 127
 
  128
+/** Destructs the VM.
  129
+ *
  130
+ * Runs the VM finalization processes as well as ruby_finalize(), and frees
  131
+ * resources used by the VM.
  132
+ *
  133
+ * @param ex Default value to the return value.
  134
+ * @return If an error occured returns a non-zero. If otherwise, reurns the
  135
+ *         given ex.
  136
+ * @note This function does not raise any exception.
  137
+ */
111 138
 int
112 139
 ruby_cleanup(volatile int ex)
113 140
 {
@@ -210,12 +237,25 @@ ruby_exec_internal(void *n)
210 237
     return state;
211 238
 }
212 239
 
  240
+/*! Calls ruby_cleanup() and exits the process */
213 241
 void
214 242
 ruby_stop(int ex)
215 243
 {
216 244
     exit(ruby_cleanup(ex));
217 245
 }
218 246
 
  247
+/*! Checks the return value of ruby_options().
  248
+ * @param n return value of ruby_options().
  249
+ * @param status pointer to the exit status of this process.
  250
+ *
  251
+ * ruby_options() sometimes returns a special value to indicate this process
  252
+ * should immediately exit. This function checks if the case. Also stores the
  253
+ * exit status that the caller have to pass to exit(3) into
  254
+ * <code>*status</code>.
  255
+ *
  256
+ * @retval non-zero if the given opaque pointer is actually a compiled source.
  257
+ * @retval 0 if the given value is such a special value.
  258
+ */
219 259
 int
220 260
 ruby_executable_node(void *n, int *status)
221 261
 {
@@ -233,6 +273,10 @@ ruby_executable_node(void *n, int *status)
233 273
     return FALSE;
234 274
 }
235 275
 
  276
+/*! Runs the given compiled source and exits this process.
  277
+ * @retval 0 if successfully run thhe source
  278
+ * @retval non-zero if an error occurred.
  279
+*/
236 280
 int
237 281
 ruby_run_node(void *n)
238 282
 {
@@ -244,6 +288,7 @@ ruby_run_node(void *n)
244 288
     return ruby_cleanup(ruby_exec_node(n));
245 289
 }
246 290
 
  291
+/*! Runs the given compiled source */
247 292
 int
248 293
 ruby_exec_node(void *n)
249 294
 {
12  ruby.c
@@ -1706,6 +1706,11 @@ set_arg0(VALUE val, ID id)
1706 1706
     rb_progname = rb_obj_freeze(rb_external_str_new(s, i));
1707 1707
 }
1708 1708
 
  1709
+/*! Sets the current script name to this value.
  1710
+ *
  1711
+ * This is similiar to <code>$0 = name</code> in Ruby level but also affects
  1712
+ * <code>Method#location</code> and others.
  1713
+ */
1709 1714
 void
1710 1715
 ruby_script(const char *name)
1711 1716
 {
@@ -1765,6 +1770,7 @@ opt_W_getter(ID id, void *data)
1765 1770
     }
1766 1771
 }
1767 1772
 
  1773
+/*! Defines built-in variables */
1768 1774
 void
1769 1775
 ruby_prog_init(void)
1770 1776
 {
@@ -1860,6 +1866,12 @@ fill_standard_fds(void)
1860 1866
     }
1861 1867
 }
1862 1868
 
  1869
+/*! Initializes the process for ruby(1).
  1870
+ *
  1871
+ * This function assumes this process is ruby(1) and it has just started.
  1872
+ * Usually programs that embeds CRuby interpreter should not call this function,
  1873
+ * and should do their own initialization.
  1874
+ */
1863 1875
 void
1864 1876
 ruby_sysinit(int *argc, char ***argv)
1865 1877
 {
4  thread_pthread.c
@@ -581,6 +581,10 @@ extern void *STACK_END_ADDRESS;
581 581
 #endif
582 582
 
583 583
 #undef ruby_init_stack
  584
+/* Set stack bottom of Ruby implementation.
  585
+ *
  586
+ * You must call this function before any heap allocation by Ruby implementation.
  587
+ * Or GC will break living objects */
584 588
 void
585 589
 ruby_init_stack(volatile VALUE *addr
586 590
 #ifdef __ia64
5  version.c
@@ -96,6 +96,7 @@ const char ruby_initial_load_paths[] =
96 96
 #endif
97 97
     "";
98 98
 
  99
+/*! Defines platform-depended Ruby-level constants */
99 100
 void
100 101
 Init_version(void)
101 102
 {
@@ -134,6 +135,7 @@ Init_version(void)
134 135
     rb_define_global_const("RUBY_ENGINE", ruby_engine_name = MKSTR(engine));
135 136
 }
136 137
 
  138
+/*! Prints the version information of the CRuby interpreter to stdout. */
137 139
 void
138 140
 ruby_show_version(void)
139 141
 {
@@ -141,6 +143,9 @@ ruby_show_version(void)
141 143
     fflush(stdout);
142 144
 }
143 145
 
  146
+/*! Prints the copyright notice of the CRuby interpreter to stdout and \em exits
  147
+ *  this process successfully.
  148
+ */
144 149
 void
145 150
 ruby_show_copyright(void)
146 151
 {
11  vm_core.h
@@ -458,7 +458,18 @@ typedef struct rb_thread_struct {
458 458
     struct rb_vm_tag *tag;
459 459
     struct rb_vm_protect_tag *protect_tag;
460 460
 
  461
+    /*! Thread-local state of evaluation context.
  462
+     * 
  463
+     *  If negative, this thread is evaluating the main program.
  464
+     *  If positive, this thread is evaluating a program under Kernel::eval
  465
+     *  family.
  466
+     */
461 467
     int parse_in_eval;
  468
+
  469
+    /*! Thread-local state of compiling context.
  470
+     *
  471
+     * If non-zero, the parser does not automatically print error messages to
  472
+     * stderr. */
462 473
     int mild_compile_error;
463 474
 
464 475
     /* storage */

0 notes on commit f8601bd

Please sign in to comment.
Something went wrong with that request. Please try again.