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
166 166
167 // begin class167 // begin class
168 QUERY->begin_class( QUERY, "Std", "Object" );168 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." );
170 170
171 // add abs171 // add abs
172 QUERY->add_sfun( QUERY, abs_impl, "int", "abs" );172 QUERY->add_sfun( QUERY, abs_impl, "int", "abs" );
173 QUERY->add_arg( QUERY, "int", "value" );173 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." );
175 175
176 // add fabs176 // add fabs
177 QUERY->add_sfun( QUERY, fabs_impl, "float", "fabs" );177 QUERY->add_sfun( QUERY, fabs_impl, "float", "fabs" );
178 QUERY->add_arg( QUERY, "float", "value" );178 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." );
180 180
181 // add rand181 // add rand
182 QUERY->add_sfun( QUERY, rand_impl, "int", "rand"); //! return int between 0 and RAND_MAX182 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())." );
184 184
185 // add rand2185 // add rand2
186 QUERY->add_sfun( QUERY, rand2_impl, "int", "rand2" ); //! integer between [min,max]186 QUERY->add_sfun( QUERY, rand2_impl, "int", "rand2" ); //! integer between [min,max]
187 QUERY->add_arg( QUERY, "int", "min" ); 187 QUERY->add_arg( QUERY, "int", "min" );
188 QUERY->add_arg( QUERY, "int", "max" );188 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())." );
190 190
191 // add rand191 // add rand
192 QUERY->add_sfun( QUERY, randf_impl, "float", "randf" ); //! rand between -1.0,1.0192 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())" );
194 194
195 // add rand2195 // add rand2
196 QUERY->add_sfun( QUERY, rand2f_impl, "float", "rand2f" ); //! rand between min and max196 QUERY->add_sfun( QUERY, rand2f_impl, "float", "rand2f" ); //! rand between min and max
197 QUERY->add_arg( QUERY, "float", "min" );197 QUERY->add_arg( QUERY, "float", "min" );
198 QUERY->add_arg( QUERY, "float", "max" );198 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())" );
200 200
201 // add srand201 // add srand
202 QUERY->add_sfun( QUERY, srand_impl, "void", "srand" );202 QUERY->add_sfun( QUERY, srand_impl, "void", "srand" );
203 QUERY->add_arg( QUERY, "int", "seed" );203 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. "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." );
205 "Alternatively, a sequence of random numbers can be repeated by setting the same seed. " );
206 205
207 // add sgn206 // add sgn
208 QUERY->add_sfun( QUERY, sgn_impl, "float", "sgn" ); //! return sign of value (-1, 0, 1)207 QUERY->add_sfun( QUERY, sgn_impl, "float", "sgn" ); //! return sign of value (-1, 0, 1)
209 QUERY->add_arg( QUERY, "float", "value" );208 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)." );
211 210
212 // add system211 // add system
213 //! see \example std.ck212 //! see \example std.ck
214 QUERY->add_sfun( QUERY, system_impl, "int", "system" ); //! issue system command213 QUERY->add_sfun( QUERY, system_impl, "int", "system" ); //! issue system command
215 QUERY->add_arg( QUERY, "string", "cmd" );214 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)." );
217 216
218 // add atoi217 // add atoi
219 QUERY->add_sfun( QUERY, atoi_impl, "int", "atoi" ); //! string to integer218 QUERY->add_sfun( QUERY, atoi_impl, "int", "atoi" ); //! string to integer
220 QUERY->add_arg( QUERY, "string", "value" );219 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)." );
222 221
223 // add atof222 // add atof
224 QUERY->add_sfun( QUERY, atof_impl, "float", "atof" ); //! string to float223 QUERY->add_sfun( QUERY, atof_impl, "float", "atof" ); //! string to float
225 QUERY->add_arg( QUERY, "string", "value" );224 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)." );
227 226
228 // add itoa227 // add itoa
229 QUERY->add_sfun( QUERY, itoa_impl, "string", "itoa" ); //! int to string228 QUERY->add_sfun( QUERY, itoa_impl, "string", "itoa" ); //! int to string
230 QUERY->add_arg( QUERY, "int", "i" );229 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)." );
232 231
233 // add ftoa232 // add ftoa
234 QUERY->add_sfun( QUERY, ftoa_impl, "string", "ftoa" ); //! float to string233 QUERY->add_sfun( QUERY, ftoa_impl, "string", "ftoa" ); //! float to string
235 QUERY->add_arg( QUERY, "float", "f" );234 QUERY->add_arg( QUERY, "float", "f" );
236 QUERY->add_arg( QUERY, "int", "precision" );235 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)." );
238 237
239 // add ftoi238 // add ftoi
240 QUERY->add_sfun( QUERY, ftoi_impl, "int", "ftoi" ); //! float to int239 QUERY->add_sfun( QUERY, ftoi_impl, "int", "ftoi" ); //! float to int
241 QUERY->add_arg( QUERY, "float", "f" );240 QUERY->add_arg( QUERY, "float", "f" );
242 QUERY->doc_func( QUERY, "Convert float to int. " );241 QUERY->doc_func( QUERY, "convert float to integer. " );
243 242
244 // add getenv243 // add getenv
245 QUERY->add_sfun( QUERY, getenv_impl, "string", "getenv" ); //! fetch environment variable244 QUERY->add_sfun( QUERY, getenv_impl, "string", "getenv" ); //! fetch environment variable
246 QUERY->add_arg( QUERY, "string", "value" );245 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)." );
248 247
249 // add setenv248 // add setenv
250 QUERY->add_sfun( QUERY, setenv_impl, "int", "setenv" ); //! set environment variable249 QUERY->add_sfun( QUERY, setenv_impl, "int", "setenv" ); //! set environment variable
251 QUERY->add_arg( QUERY, "string", "key" );250 QUERY->add_arg( QUERY, "string", "key" );
252 QUERY->add_arg( QUERY, "string", "value" );251 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'" );
254 253
255 // add mtof254 // add mtof
256 //! see \example mand-o-matic.ck255 //! see \example mand-o-matic.ck
257 QUERY->add_sfun( QUERY, mtof_impl, "float", "mtof" ); //! midi note to frequency256 QUERY->add_sfun( QUERY, mtof_impl, "float", "mtof" ); //! midi note to frequency
258 QUERY->add_arg( QUERY, "float", "value" );257 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." );
260 259
261 // add ftom260 // add ftom
262 QUERY->add_sfun( QUERY, ftom_impl, "float", "ftom" ); //! frequency to midi note261 QUERY->add_sfun( QUERY, ftom_impl, "float", "ftom" ); //! frequency to midi note
263 QUERY->add_arg( QUERY, "float", "value" );262 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." );
265 264
266 // add powtodb265 // add powtodb
267 QUERY->add_sfun( QUERY, powtodb_impl, "float", "powtodb" ); //! linear power to decibel 266 QUERY->add_sfun( QUERY, powtodb_impl, "float", "powtodb" ); //! linear power to decibel
268 QUERY->add_arg( QUERY, "float", "value" );267 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)." );
270 269
271 // add rmstodb270 // add rmstodb
272 QUERY->add_sfun( QUERY, rmstodb_impl, "float", "rmstodb" ); //! rms to decibel271 QUERY->add_sfun( QUERY, rmstodb_impl, "float", "rmstodb" ); //! rms to decibel
273 QUERY->add_arg( QUERY, "float", "value" );272 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)." );
275 274
276 // add dbtopow275 // add dbtopow
277 QUERY->add_sfun( QUERY, dbtopow_impl, "float", "dbtopow" ); //! decibel to linear276 QUERY->add_sfun( QUERY, dbtopow_impl, "float", "dbtopow" ); //! decibel to linear
278 QUERY->add_arg( QUERY, "float", "value" );277 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." );
280 279
281 // add dbtorms280 // add dbtorms
282 QUERY->add_sfun( QUERY, dbtorms_impl, "float", "dbtorms" ); //! decibel to rms281 QUERY->add_sfun( QUERY, dbtorms_impl, "float", "dbtorms" ); //! decibel to rms
283 QUERY->add_arg( QUERY, "float", "value" );282 QUERY->add_arg( QUERY, "float", "value" );
284 QUERY->doc_func( QUERY, "Convert " );283 QUERY->doc_func( QUERY, "convert decibles (dB) to RMS." );
285 284
286 // add dbtolin285 // add dbtolin
287 QUERY->add_sfun( QUERY, dbtolin_impl, "float", "dbtolin" ); //! decibel to linear286 QUERY->add_sfun( QUERY, dbtolin_impl, "float", "dbtolin" ); //! decibel to linear
288 QUERY->add_arg( QUERY, "float", "value" );287 QUERY->add_arg( QUERY, "float", "value" );
289 QUERY->doc_func( QUERY, "" );288 QUERY->doc_func( QUERY, "convert decibels (dB) to linear." );
290 289
291 // add lintodb290 // add lintodb
292 QUERY->add_sfun( QUERY, lintodb_impl, "float", "lintodb" ); //! linear to decibel291 QUERY->add_sfun( QUERY, lintodb_impl, "float", "lintodb" ); //! linear to decibel
293 QUERY->add_arg( QUERY, "float", "value" );292 QUERY->add_arg( QUERY, "float", "value" );
294 QUERY->doc_func( QUERY, "" );293 QUERY->doc_func( QUERY, "convert linear to decibels (dB)." );
295 294
296 // add clamp295 // add clamp
297 QUERY->add_sfun( QUERY, clamp_impl, "int", "clamp" ); //! clamp to range (int)296 QUERY->add_sfun( QUERY, clamp_impl, "int", "clamp" ); //! clamp to range (int)
298 QUERY->add_arg( QUERY, "int", "value" );297 QUERY->add_arg( QUERY, "int", "value" );
299 QUERY->add_arg( QUERY, "int", "min" );298 QUERY->add_arg( QUERY, "int", "min" );
300 QUERY->add_arg( QUERY, "int", "max" );299 QUERY->add_arg( QUERY, "int", "max" );
301 QUERY->doc_func( QUERY, "" );300 QUERY->doc_func( QUERY, "clamp an integer to range [min,max]." );
302 301
303 // add clampf302 // add clampf
304 QUERY->add_sfun( QUERY, clampf_impl, "float", "clampf" ); //! clamp to range (float)303 QUERY->add_sfun( QUERY, clampf_impl, "float", "clampf" ); //! clamp to range (float)
305 QUERY->add_arg( QUERY, "float", "value" );304 QUERY->add_arg( QUERY, "float", "value" );
306 QUERY->add_arg( QUERY, "float", "min" );305 QUERY->add_arg( QUERY, "float", "min" );
307 QUERY->add_arg( QUERY, "float", "max" );306 QUERY->add_arg( QUERY, "float", "max" );
308 QUERY->doc_func( QUERY, "" );307 QUERY->doc_func( QUERY, "clamp a float to range [min,max]." );
309 308
310 // add scalef309 // add scalef
311 QUERY->add_sfun( QUERY, scalef_impl, "float", "scalef" ); //! scale from source range to dest range (float)310 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
314 QUERY->add_arg( QUERY, "float", "srcmax" );313 QUERY->add_arg( QUERY, "float", "srcmax" );
315 QUERY->add_arg( QUERY, "float", "dstmin" );314 QUERY->add_arg( QUERY, "float", "dstmin" );
316 QUERY->add_arg( QUERY, "float", "dstmax" );315 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." );
318 317
319 // finish class318 // finish class
320 QUERY->end_class( QUERY );319 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