History

prep / some refactor for .dump() and .apropos() for all objects

Ge Wang committed 5 years ago

Commit a013b4c1 parent 8d5762c16 files · +1274 −1016Browse files

Showing the changes to src/core/ulib_std.cpp (1 of 16 files). Show all

Unified · Split

src/core/ulib_std.cpp+28−29
@@ -166,146 +166,145 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 165 unmodified lines
166166
167167 // begin class
168168 QUERY->begin_class( QUERY, "Std", "Object" );
169− QUERY->doc_class( QUERY, "Std is a standard library in ChucK, which includes utility functions for random number generation, unit conversions, and absolute value." );
169+ QUERY->doc_class( QUERY, "a standard library in ChucK, which includes utility functions for random number generation, unit conversions, and absolute value." );
170170
171171 // add abs
172172 QUERY->add_sfun( QUERY, abs_impl, "int", "abs" );
173173 QUERY->add_arg( QUERY, "int", "value" );
174− QUERY->doc_func( QUERY, "Return absolute value of integer. " );
174+ QUERY->doc_func( QUERY, "compute the absolute value of an integer." );
175175
176176 // add fabs
177177 QUERY->add_sfun( QUERY, fabs_impl, "float", "fabs" );
178178 QUERY->add_arg( QUERY, "float", "value" );
179− QUERY->doc_func( QUERY, "Return absolute value of float. " );
179+ QUERY->doc_func( QUERY, "compute the absolute value of a float." );
180180
181181 // add rand
182182 QUERY->add_sfun( QUERY, rand_impl, "int", "rand"); //! return int between 0 and RAND_MAX
183− QUERY->doc_func( QUERY, "Generates random integer between 0 and Std.RAND_MAX. (NOTE: soon-to-be-deprecated; use Math.random2())." );
183+ QUERY->doc_func( QUERY, "generate a random integer between 0 and Std.RAND_MAX. (NOTE: this is deprecated; use Math.random())." );
184184
185185 // add rand2
186186 QUERY->add_sfun( QUERY, rand2_impl, "int", "rand2" ); //! integer between [min,max]
187187 QUERY->add_arg( QUERY, "int", "min" );
188188 QUERY->add_arg( QUERY, "int", "max" );
189− QUERY->doc_func( QUERY, "Generates random integer in range [min, max]. (NOTE: soon-to-be-deprecated; use Math.random2())." );
189+ QUERY->doc_func( QUERY, "generate a random integer in range [min, max]. (NOTE: this is deprecated; use Math.random2())." );
190190
191191 // add rand
192192 QUERY->add_sfun( QUERY, randf_impl, "float", "randf" ); //! rand between -1.0,1.0
193− QUERY->doc_func( QUERY, "Generates random floating point number in the range [-1, 1]. (Note: soon-to-be-deprecated; use Math.randomf())" );
193+ QUERY->doc_func( QUERY, "generates a random floating point number in the range [-1, 1]. (Note: this is deprecated; use Math.randomf())" );
194194
195195 // add rand2
196196 QUERY->add_sfun( QUERY, rand2f_impl, "float", "rand2f" ); //! rand between min and max
197197 QUERY->add_arg( QUERY, "float", "min" );
198198 QUERY->add_arg( QUERY, "float", "max" );
199− QUERY->doc_func( QUERY, "Generates random floating point number in the range [min, max]. (NOTE: soon-to-be-deprecated; use Math.random2f())" );
199+ QUERY->doc_func( QUERY, "generate random floating point number in the range [min, max]. (NOTE: this is deprecated; use Math.random2f())" );
200200
201201 // add srand
202202 QUERY->add_sfun( QUERY, srand_impl, "void", "srand" );
203203 QUERY->add_arg( QUERY, "int", "seed" );
204− QUERY->doc_func( QUERY, "Provide a seed to the random function. Different seeds will generate very different sequences of random numbers even if the seeds are close together. "
205− "Alternatively, a sequence of random numbers can be repeated by setting the same seed. " );
204+ QUERY->doc_func( QUERY, "seed the random number generator. Different seeds will likely generate different sequences of random numbers even if the seeds are close together; alternatively, a sequence of random numbers can be repeated by setting the same seed." );
206205
207206 // add sgn
208207 QUERY->add_sfun( QUERY, sgn_impl, "float", "sgn" ); //! return sign of value (-1, 0, 1)
209208 QUERY->add_arg( QUERY, "float", "value" );
210− QUERY->doc_func( QUERY, "Computes the sign of the input as -1.0 (negative), 0 (zero), or 1.0 (positive)." );
209+ QUERY->doc_func( QUERY, "compute the sign of the input as -1.0 (negative), 0 (zero), or 1.0 (positive)." );
211210
212211 // add system
213212 //! see \example std.ck
214213 QUERY->add_sfun( QUERY, system_impl, "int", "system" ); //! issue system command
215214 QUERY->add_arg( QUERY, "string", "cmd" );
216− QUERY->doc_func( QUERY, "Pass a command to be executed in the shell (requires --caution-to-the-wind command-line flag)." );
215+ QUERY->doc_func( QUERY, "pass a command to be executed in the shell (requires --caution-to-the-wind flag to be set)." );
217216
218217 // add atoi
219218 QUERY->add_sfun( QUERY, atoi_impl, "int", "atoi" ); //! string to integer
220219 QUERY->add_arg( QUERY, "string", "value" );
221− QUERY->doc_func( QUERY, "Converts ascii (string) to integer (int)." );
220+ QUERY->doc_func( QUERY, "convert ascii (string) to integer (int)." );
222221
223222 // add atof
224223 QUERY->add_sfun( QUERY, atof_impl, "float", "atof" ); //! string to float
225224 QUERY->add_arg( QUERY, "string", "value" );
226− QUERY->doc_func( QUERY, "Converts ascii (string) to floating point value (float)." );
225+ QUERY->doc_func( QUERY, "converts ascii (string) to floating point value (float)." );
227226
228227 // add itoa
229228 QUERY->add_sfun( QUERY, itoa_impl, "string", "itoa" ); //! int to string
230229 QUERY->add_arg( QUERY, "int", "i" );
231− QUERY->doc_func( QUERY, "Converts integer (int) to ascii (string)." );
230+ QUERY->doc_func( QUERY, "converts integer (int) to ascii (string)." );
232231
233232 // add ftoa
234233 QUERY->add_sfun( QUERY, ftoa_impl, "string", "ftoa" ); //! float to string
235234 QUERY->add_arg( QUERY, "float", "f" );
236235 QUERY->add_arg( QUERY, "int", "precision" );
237− QUERY->doc_func( QUERY, "Converts floating point value (float) to ascii (string) with specified precision (number of decimal digits)." );
236+ QUERY->doc_func( QUERY, "converts floating point value (float) to ascii (string) with specified precision (number of decimal digits)." );
238237
239238 // add ftoi
240239 QUERY->add_sfun( QUERY, ftoi_impl, "int", "ftoi" ); //! float to int
241240 QUERY->add_arg( QUERY, "float", "f" );
242− QUERY->doc_func( QUERY, "Convert float to int. " );
241+ QUERY->doc_func( QUERY, "convert float to integer. " );
243242
244243 // add getenv
245244 QUERY->add_sfun( QUERY, getenv_impl, "string", "getenv" ); //! fetch environment variable
246245 QUERY->add_arg( QUERY, "string", "value" );
247− QUERY->doc_func( QUERY, "Returns the value of an environment variable, such as of PATH." );
246+ QUERY->doc_func( QUERY, "get the value of an environment variable (e.g., PATH)." );
248247
249248 // add setenv
250249 QUERY->add_sfun( QUERY, setenv_impl, "int", "setenv" ); //! set environment variable
251250 QUERY->add_arg( QUERY, "string", "key" );
252251 QUERY->add_arg( QUERY, "string", "value" );
253− QUERY->doc_func( QUERY, "Set value of environment variable named key to value." );
252+ QUERY->doc_func( QUERY, "set the value of environment variable named 'key'" );
254253
255254 // add mtof
256255 //! see \example mand-o-matic.ck
257256 QUERY->add_sfun( QUERY, mtof_impl, "float", "mtof" ); //! midi note to frequency
258257 QUERY->add_arg( QUERY, "float", "value" );
259− QUERY->doc_func( QUERY, "Converts a MIDI note number to frequency (Hz). Note the input value is of type float (supports fractional note number)." );
258+ QUERY->doc_func( QUERY, "convert a MIDI note number to frequency (Hz). MIDI note 60 is Middle C; each whole number is one semitone; the input type is float and supports fractional note numbers." );
260259
261260 // add ftom
262261 QUERY->add_sfun( QUERY, ftom_impl, "float", "ftom" ); //! frequency to midi note
263262 QUERY->add_arg( QUERY, "float", "value" );
264− QUERY->doc_func( QUERY, "Converts frequency (Hz) to MIDI note number space." );
263+ QUERY->doc_func( QUERY, "convert frequency (Hz) to corresponding MIDI note number." );
265264
266265 // add powtodb
267266 QUERY->add_sfun( QUERY, powtodb_impl, "float", "powtodb" ); //! linear power to decibel
268267 QUERY->add_arg( QUERY, "float", "value" );
269− QUERY->doc_func( QUERY, "Converts signal power ratio to decibels (dB)." );
268+ QUERY->doc_func( QUERY, "convert signal power ratio to decibels (dB)." );
270269
271270 // add rmstodb
272271 QUERY->add_sfun( QUERY, rmstodb_impl, "float", "rmstodb" ); //! rms to decibel
273272 QUERY->add_arg( QUERY, "float", "value" );
274− QUERY->doc_func( QUERY, "Converts rms to decibels (dB)." );
273+ QUERY->doc_func( QUERY, "converts rms to decibels (dB)." );
275274
276275 // add dbtopow
277276 QUERY->add_sfun( QUERY, dbtopow_impl, "float", "dbtopow" ); //! decibel to linear
278277 QUERY->add_arg( QUERY, "float", "value" );
279− QUERY->doc_func( QUERY, "Converts decibels (dB) to signal power ratio." );
278+ QUERY->doc_func( QUERY, "converts decibels (dB) to signal power ratio." );
280279
281280 // add dbtorms
282281 QUERY->add_sfun( QUERY, dbtorms_impl, "float", "dbtorms" ); //! decibel to rms
283282 QUERY->add_arg( QUERY, "float", "value" );
284− QUERY->doc_func( QUERY, "Convert " );
283+ QUERY->doc_func( QUERY, "convert decibles (dB) to RMS." );
285284
286285 // add dbtolin
287286 QUERY->add_sfun( QUERY, dbtolin_impl, "float", "dbtolin" ); //! decibel to linear
288287 QUERY->add_arg( QUERY, "float", "value" );
289− QUERY->doc_func( QUERY, "" );
288+ QUERY->doc_func( QUERY, "convert decibels (dB) to linear." );
290289
291290 // add lintodb
292291 QUERY->add_sfun( QUERY, lintodb_impl, "float", "lintodb" ); //! linear to decibel
293292 QUERY->add_arg( QUERY, "float", "value" );
294− QUERY->doc_func( QUERY, "" );
293+ QUERY->doc_func( QUERY, "convert linear to decibels (dB)." );
295294
296295 // add clamp
297296 QUERY->add_sfun( QUERY, clamp_impl, "int", "clamp" ); //! clamp to range (int)
298297 QUERY->add_arg( QUERY, "int", "value" );
299298 QUERY->add_arg( QUERY, "int", "min" );
300299 QUERY->add_arg( QUERY, "int", "max" );
301− QUERY->doc_func( QUERY, "" );
300+ QUERY->doc_func( QUERY, "clamp an integer to range [min,max]." );
302301
303302 // add clampf
304303 QUERY->add_sfun( QUERY, clampf_impl, "float", "clampf" ); //! clamp to range (float)
305304 QUERY->add_arg( QUERY, "float", "value" );
306305 QUERY->add_arg( QUERY, "float", "min" );
307306 QUERY->add_arg( QUERY, "float", "max" );
308− QUERY->doc_func( QUERY, "" );
307+ QUERY->doc_func( QUERY, "clamp a float to range [min,max]." );
309308
310309 // add scalef
311310 QUERY->add_sfun( QUERY, scalef_impl, "float", "scalef" ); //! scale from source range to dest range (float)
@@ -314,7 +313,7 @@ DLL_QUERY libstd_query( Chuck_DL_Query * QUERY ) · 2 unmodified lines
314313 QUERY->add_arg( QUERY, "float", "srcmax" );
315314 QUERY->add_arg( QUERY, "float", "dstmin" );
316315 QUERY->add_arg( QUERY, "float", "dstmax" );
317− QUERY->doc_func( QUERY, "" );
316+ QUERY->doc_func( QUERY, "scale from a source range to a destination range." );
318317
319318 // finish class
320319 QUERY->end_class( QUERY );

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t