You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(38) |
Oct
(465) |
Nov
(174) |
Dec
(328) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(275) |
Feb
(431) |
Mar
(187) |
Apr
(182) |
May
(242) |
Jun
(93) |
Jul
(329) |
Aug
(229) |
Sep
(180) |
Oct
(184) |
Nov
(38) |
Dec
(101) |
2004 |
Jan
(174) |
Feb
(120) |
Mar
(163) |
Apr
(53) |
May
(108) |
Jun
(186) |
Jul
(171) |
Aug
(251) |
Sep
(207) |
Oct
(180) |
Nov
(51) |
Dec
(53) |
2005 |
Jan
(79) |
Feb
(71) |
Mar
(50) |
Apr
(32) |
May
(73) |
Jun
(86) |
Jul
(33) |
Aug
(52) |
Sep
(10) |
Oct
(8) |
Nov
(49) |
Dec
(30) |
2006 |
Jan
(46) |
Feb
(48) |
Mar
(35) |
Apr
(43) |
May
(10) |
Jun
(5) |
Jul
(15) |
Aug
(16) |
Sep
(23) |
Oct
(35) |
Nov
(18) |
Dec
(11) |
2007 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(1) |
Dec
|
From: Diemo S. <di...@us...> - 2007-11-07 15:26:34
|
Update of /cvsroot/jmax/jmax/packages/functions/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16650 Modified Files: functions.c Log Message: filename parsing functions Index: functions.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/functions/c/src/functions.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** functions.c 19 Sep 2006 10:21:09 -0000 1.17 --- functions.c 7 Nov 2007 15:26:29 -0000 1.18 *************** *** 338,346 **** /********************************************************************** * ! * symbol functions * */ ! #define MAX_CONCAT_LENGTH 512 static fts_status_t --- 338,346 ---- /********************************************************************** * ! * symbol and file functions * */ ! #define MAX_CONCAT_LENGTH 511 static fts_status_t *************** *** 374,377 **** --- 374,456 ---- + static fts_status_t + basename_function(int ac, const fts_atom_t *at, fts_atom_t *ret) + { + if (ac > 0 && fts_is_symbol(at)) + { + fts_set_symbol(ret, fts_new_symbol(fts_basename(fts_symbol_name(fts_get_symbol(at))))); + } + else + { + fts_set_symbol(ret, fts_s_empty_string); + } + + return fts_ok; + } + + + static fts_status_t + extension_function(int ac, const fts_atom_t *at, fts_atom_t *ret) + { + const char *ext; + + if (ac > 0 && fts_is_symbol(at) + && (ext = fts_extension(fts_symbol_name(fts_get_symbol(at))))) + { + fts_set_symbol(ret, fts_new_symbol(ext)); + } + else + { + fts_set_symbol(ret, fts_s_empty_string); + } + + return fts_ok; + } + + + static fts_status_t + dirname_function(int ac, const fts_atom_t *at, fts_atom_t *ret) + { + char buf[MAX_CONCAT_LENGTH + 1]; + + if (ac > 0 && fts_is_symbol(at)) + { + strncpy(buf, fts_symbol_name(fts_get_symbol(at)), MAX_CONCAT_LENGTH); + fts_set_symbol(ret, fts_new_symbol(fts_dirname(buf))); + } + else + { + fts_set_symbol(ret, fts_s_empty_string); + } + + return fts_ok; + } + + + static fts_status_t + stripext_function(int ac, const fts_atom_t *at, fts_atom_t *ret) + { + char *ext; + char buf[MAX_CONCAT_LENGTH + 1]; + buf[0] = 0; + + if (ac > 0 && fts_is_symbol(at)) + { + strncpy(buf, fts_symbol_name(fts_get_symbol(at)), MAX_CONCAT_LENGTH); + ext = fts_extension(buf); + + if (ext) + *(ext - 1) = 0; + + fts_set_symbol(ret, fts_new_symbol(buf)); + } + else + { + fts_set_symbol(ret, fts_s_empty_string); + } + + return fts_ok; + } + *************** *** 784,789 **** fts_function_install(fts_new_symbol( "max"), _function_max); fts_function_install(fts_new_symbol("not"), _function_not); - fts_function_install(fts_new_symbol("cat"), cat_function); fts_function_install(fts_new_symbol("if"), if_function); fts_function_install(fts_new_symbol("case"), case_function); --- 863,873 ---- fts_function_install(fts_new_symbol( "max"), _function_max); + fts_function_install(fts_new_symbol("cat"), cat_function); + fts_function_install(fts_new_symbol("basename"), basename_function); + fts_function_install(fts_new_symbol("dirname"), dirname_function); + fts_function_install(fts_new_symbol("extension"), extension_function); + fts_function_install(fts_new_symbol("stripext"), stripext_function); + fts_function_install(fts_new_symbol("not"), _function_not); fts_function_install(fts_new_symbol("if"), if_function); fts_function_install(fts_new_symbol("case"), case_function); |
From: Diemo S. <di...@us...> - 2007-10-23 15:23:04
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18504/packages/data/c/src Modified Files: dict.c Log Message: fixed crash on dict remove tuple Index: dict.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/dict.c,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** dict.c 18 Oct 2007 07:41:15 -0000 1.66 --- dict.c 23 Oct 2007 15:22:57 -0000 1.67 *************** *** 100,111 **** dict_remove(dict_t *dict, const fts_atom_t *key) { ! fts_atom_t value; ! ! if(fts_hashtable_get(&dict->hash, key, &value)) ! { ! fts_atom_release(key); ! fts_atom_release(&value); ! fts_hashtable_remove(&dict->hash, key); ! } } --- 100,104 ---- dict_remove(dict_t *dict, const fts_atom_t *key) { ! fts_hashtable_remove(&dict->hash, key); } |
From: Diemo S. <di...@us...> - 2007-10-18 07:41:31
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31088 Modified Files: dict.c Log Message: backport exists method to ftm 1.7 branch Index: dict.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/dict.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** dict.c 15 Oct 2007 17:20:53 -0000 1.65 --- dict.c 18 Oct 2007 07:41:15 -0000 1.66 *************** *** 392,395 **** --- 392,407 ---- } + static fts_method_status_t + _dict_exists (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + dict_t *self = (dict_t *) o; + fts_atom_t a; + + if (ac > 0) + fts_set_int(ret, fts_hashtable_get(&self->hash, at, &a)); + + return fts_ok; + } + static fts_method_status_t *************** *** 629,633 **** fts_class_message_varargs(cl, fts_s_set_from_instance, _dict_set_from_dict); fts_class_message_varargs(cl, fts_new_symbol("keys"), _dict_get_keys); ! fts_class_message_varargs(cl, fts_s_print, dict_print); --- 641,646 ---- fts_class_message_varargs(cl, fts_s_set_from_instance, _dict_set_from_dict); fts_class_message_varargs(cl, fts_new_symbol("keys"), _dict_get_keys); ! fts_class_message_varargs(cl, fts_new_symbol("exists"), _dict_exists); ! fts_class_message_varargs(cl, fts_s_print, dict_print); |
From: Diemo S. <di...@us...> - 2007-10-15 17:21:33
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22929 Modified Files: mat.c Log Message: preliminary equals message, should be called by == operator Index: mat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/mat.c,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** mat.c 23 Nov 2006 11:59:28 -0000 1.109 --- mat.c 15 Oct 2007 17:21:29 -0000 1.110 *************** *** 1029,1042 **** } - /* class copy method compatible wrapper around copy function */ - static void - mat_copy_function(const fts_object_t *from, fts_object_t *to) - { - mat_t *dest = (mat_t *) to; - mat_copy((mat_t *) from, dest); - - if(mat_editor_is_open(dest)) - mat_upload(dest); - } static int --- 1029,1032 ---- *************** *** 1061,1064 **** --- 1051,1076 ---- static fts_method_status_t + _mat_equals (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + mat_t *self = (mat_t *) o; + + fts_set_int(ret, mat_equals(self, (mat_t *) fts_get_object(at))); + + return fts_ok; + } + + + /* class copy method compatible wrapper around copy function */ + static void + mat_copy_function(const fts_object_t *from, fts_object_t *to) + { + mat_t *dest = (mat_t *) to; + mat_copy((mat_t *) from, dest); + + if(mat_editor_is_open(dest)) + mat_upload(dest); + } + + static fts_method_status_t mat_open_editor(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) { *************** *** 1194,1200 **** fts_class_message_varargs(cl, fts_s_name, fts_object_name); ! fts_class_message_varargs(cl,fts_s_persistence, fts_object_persistence); fts_class_message_varargs(cl, fts_s_dump_state, mat_dump_state); fts_class_message_varargs(cl, fts_s_print, mat_print); fts_class_message_varargs(cl, fts_s_set_from_instance, mat_set_from_instance); --- 1206,1213 ---- fts_class_message_varargs(cl, fts_s_name, fts_object_name); ! fts_class_message_varargs(cl, fts_s_persistence, fts_object_persistence); fts_class_message_varargs(cl, fts_s_dump_state, mat_dump_state); fts_class_message_varargs(cl, fts_s_print, mat_print); + fts_class_message (cl, fts_s_equals, mat_class, _mat_equals); fts_class_message_varargs(cl, fts_s_set_from_instance, mat_set_from_instance); |
From: Diemo S. <di...@us...> - 2007-10-15 17:20:59
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22439 Modified Files: dict.c Log Message: missing obj return Index: dict.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/dict.c,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** dict.c 23 Nov 2006 17:09:10 -0000 1.64 --- dict.c 15 Oct 2007 17:20:53 -0000 1.65 *************** *** 433,436 **** --- 433,438 ---- dict_upload(self); + fts_set_object(ret, o); + return fts_ok; } |
From: Diemo S. <di...@us...> - 2007-10-15 17:20:21
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22269 Modified Files: datafiles.c Log Message: untabify Index: datafiles.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/datafiles.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** datafiles.c 15 Oct 2007 17:19:30 -0000 1.11 --- datafiles.c 15 Oct 2007 17:20:16 -0000 1.12 *************** *** 198,205 **** int m = fts_audiofile_get_num_frames(sf); int n = fts_audiofile_get_num_channels(sf); ! int wanted = 0; /* number of sample frames to load */ int offset = 0; int channel = 0; ! double sr = 0; /* resample if not zero */ fmat_t *orig = NULL; float *ptr; --- 198,205 ---- int m = fts_audiofile_get_num_frames(sf); int n = fts_audiofile_get_num_channels(sf); ! int wanted = 0; /* number of sample frames to load */ int offset = 0; int channel = 0; ! double sr = 0; /* resample if not zero */ fmat_t *orig = NULL; float *ptr; *************** *** 341,345 **** { /* from the file to import */ ! int numframes; int numchannels; double sr_orig; --- 341,345 ---- { /* from the file to import */ ! int numframes; int numchannels; double sr_orig; *************** *** 348,355 **** /* import arguments */ ! int wanted; /* number of sample frames to load */ int offset; int channel; ! double sr_wanted; /* resample if not zero */ /* importer data */ --- 348,355 ---- /* import arguments */ ! int wanted; /* number of sample frames to load */ int offset; int channel; ! double sr_wanted; /* resample if not zero */ /* importer data */ *************** *** 357,365 **** fmat_t *orig; float *ptr; ! int numread; /* number of sample frames actually read */ } fmat_import_args_t; static void fmat_import_init (fmat_import_args_t *args, fmat_t *fmat, ! int ac, const fts_atom_t *at) { bzero(args, sizeof(fmat_import_args_t)); --- 357,365 ---- fmat_t *orig; float *ptr; ! int numread; /* number of sample frames actually read */ } fmat_import_args_t; static void fmat_import_init (fmat_import_args_t *args, fmat_t *fmat, ! int ac, const fts_atom_t *at) { bzero(args, sizeof(fmat_import_args_t)); *************** *** 396,404 **** static void fmat_import_begin (fmat_import_args_t *args, ! int m, int n, double sr, int bits) { ! args->numframes = m; ! args->numchannels = n; ! args->sr_orig = sr; args->bits_per_sample = bits; args->scale_factor = (double) 1. / (double) (1 << (bits - 1)); --- 396,404 ---- static void fmat_import_begin (fmat_import_args_t *args, ! int m, int n, double sr, int bits) { ! args->numframes = m; ! args->numchannels = n; ! args->sr_orig = sr; args->bits_per_sample = bits; args->scale_factor = (double) 1. / (double) (1 << (bits - 1)); *************** *** 444,449 **** /* called when the decoder has decoded a metadata block */ static void flacdec_metadata_callback (const FLAC__StreamDecoder *flacdec, ! const FLAC__StreamMetadata *metadata, ! void *client_data) { switch (metadata->type) --- 444,449 ---- /* called when the decoder has decoded a metadata block */ static void flacdec_metadata_callback (const FLAC__StreamDecoder *flacdec, ! const FLAC__StreamMetadata *metadata, ! void *client_data) { switch (metadata->type) *************** *** 460,471 **** /* fts_post("flacdec_metadata_callback: type %d bits %d factor %g\n", ! metadata->type, bits, (double) args->scale_factor); */ /* seek to first wanted sample: at any point after the stream ! decoder has been initialized, the client can call this ! function to seek to an exact sample within the ! stream. Subsequently, the first time the write callback is ! called it will be passed a (possibly partial) block starting ! at that sample. */ FLAC__stream_decoder_seek_absolute(flacdec, args->offset * n); } --- 460,471 ---- /* fts_post("flacdec_metadata_callback: type %d bits %d factor %g\n", ! metadata->type, bits, (double) args->scale_factor); */ /* seek to first wanted sample: at any point after the stream ! decoder has been initialized, the client can call this ! function to seek to an exact sample within the ! stream. Subsequently, the first time the write callback is ! called it will be passed a (possibly partial) block starting ! at that sample. */ FLAC__stream_decoder_seek_absolute(flacdec, args->offset * n); } *************** *** 481,487 **** static FLAC__StreamDecoderWriteStatus flacdec_write_callback (const FLAC__StreamDecoder *flacdec, ! const FLAC__Frame *frame, ! const FLAC__int32 *const buffer[], ! void *client_data) { fmat_import_args_t *args = (fmat_import_args_t *) client_data; --- 481,487 ---- static FLAC__StreamDecoderWriteStatus flacdec_write_callback (const FLAC__StreamDecoder *flacdec, ! const FLAC__Frame *frame, ! const FLAC__int32 *const buffer[], ! void *client_data) { fmat_import_args_t *args = (fmat_import_args_t *) client_data; *************** *** 517,527 **** static void flacdec_error_callback (const FLAC__StreamDecoder *flacdec, ! FLAC__StreamDecoderErrorStatus status, ! void *client_data) { fmat_import_args_t *args = (fmat_import_args_t *) client_data; fts_post("flac decoding error number %d after %d samples read\n", ! status, args->numread); } --- 517,527 ---- static void flacdec_error_callback (const FLAC__StreamDecoder *flacdec, ! FLAC__StreamDecoderErrorStatus status, ! void *client_data) { fmat_import_args_t *args = (fmat_import_args_t *) client_data; fts_post("flac decoding error number %d after %d samples read\n", ! status, args->numread); } *************** *** 537,542 **** fts_symbol_t filesymb = fts_get_symbol(at); const char *filename = (const char *) fts_symbol_name(filesymb); ! char str[1024]; ! char *fullpath = fts_file_find(filename, str, 1023); if (fullpath != NULL) --- 537,542 ---- fts_symbol_t filesymb = fts_get_symbol(at); const char *filename = (const char *) fts_symbol_name(filesymb); ! char str[1024]; ! char *fullpath = fts_file_find(filename, str, 1023); if (fullpath != NULL) *************** *** 546,585 **** if (flacdec) { /* No need to override the decoder options with ! FLAC__stream_decoder_set_*() since by default, ! only the STREAMINFO block is returned via the metadata callback. */ ! fmat_import_init(&args, self, ac, at); ! /* decoding directly from a file */ ! if (FLAC__stream_decoder_init_file(flacdec, fullpath, ! flacdec_write_callback, ! flacdec_metadata_callback, ! flacdec_error_callback, ! &args) ! == FLAC__STREAM_DECODER_INIT_STATUS_OK) ! { /* process the stream from the current location until the ! read callback returns ! FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or ! FLAC__STREAM_DECODER_READ_STATUS_ABORT. The client will ! get one metadata, write, or error callback per metadata ! block, audio frame, or sync error, respectively. */ ! FLAC__stream_decoder_process_until_end_of_stream(flacdec); ! FLAC__stream_decoder_finish(flacdec); ! } ! FLAC__stream_decoder_delete(flacdec); ! fmat_import_finish(&args); ! if (args.numread > 0) ! { ! fts_object_changed(o); ! fts_set_object(ret, o); ! } ! else ! fts_object_error(o, "import: coudn't read any audio data from file \"%s\" (at \"%s\")", filename, fullpath); } else ! fts_object_error(o, "import: cannot open audio file \"%s\" (at \"%s\")", filename, fullpath); } } --- 546,585 ---- if (flacdec) { /* No need to override the decoder options with ! FLAC__stream_decoder_set_*() since by default, ! only the STREAMINFO block is returned via the metadata callback. */ ! fmat_import_init(&args, self, ac, at); ! /* decoding directly from a file */ ! if (FLAC__stream_decoder_init_file(flacdec, fullpath, ! flacdec_write_callback, ! flacdec_metadata_callback, ! flacdec_error_callback, ! &args) ! == FLAC__STREAM_DECODER_INIT_STATUS_OK) ! { /* process the stream from the current location until the ! read callback returns ! FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or ! FLAC__STREAM_DECODER_READ_STATUS_ABORT. The client will ! get one metadata, write, or error callback per metadata ! block, audio frame, or sync error, respectively. */ ! FLAC__stream_decoder_process_until_end_of_stream(flacdec); ! FLAC__stream_decoder_finish(flacdec); ! } ! FLAC__stream_decoder_delete(flacdec); ! fmat_import_finish(&args); ! if (args.numread > 0) ! { ! fts_object_changed(o); ! fts_set_object(ret, o); ! } ! else ! fts_object_error(o, "import: coudn't read any audio data from file \"%s\" (at \"%s\")", filename, fullpath); } else ! fts_object_error(o, "import: cannot open audio file \"%s\" (at \"%s\")", filename, fullpath); } } *************** *** 588,592 **** } ! #endif /* HAVE_FLAC */ --- 588,592 ---- } ! #endif /* HAVE_FLAC */ *************** *** 1052,1056 **** { if(fts_is_symbol(&a) && (fts_get_symbol(&a) == fts_new_symbol(";"))) ! { if(n > 0) { --- 1052,1056 ---- { if(fts_is_symbol(&a) && (fts_get_symbol(&a) == fts_new_symbol(";"))) ! { if(n > 0) { *************** *** 1072,1078 **** else fts_post("dict: empty message found in coll file %s (ignored)\n", fts_symbol_name(file_name)); ! } else ! { /* read argument */ if(n >= atoms_alloc) --- 1072,1078 ---- else fts_post("dict: empty message found in coll file %s (ignored)\n", fts_symbol_name(file_name)); ! } else ! { /* read argument */ if(n >= atoms_alloc) *************** *** 1084,1088 **** atoms[n] = a; n++; ! } } --- 1084,1088 ---- atoms[n] = a; n++; ! } } *************** *** 1199,1203 **** if(size > 0) { ! fts_object_set_state_dirty(o); /* if obj persistent patch becomes dirty */ if(dict_editor_is_open(self)) --- 1199,1203 ---- if(size > 0) { ! fts_object_set_state_dirty(o); /* if obj persistent patch becomes dirty */ if(dict_editor_is_open(self)) |
From: Diemo S. <di...@us...> - 2007-10-15 17:19:36
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21740 Modified Files: datafiles.c Log Message: added flac import Index: datafiles.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/datafiles.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** datafiles.c 27 Sep 2006 16:36:45 -0000 1.10 --- datafiles.c 15 Oct 2007 17:19:30 -0000 1.11 *************** *** 27,30 **** --- 27,37 ---- #include <fts/packages/data/data.h> + #if HAVE_FLAC + # include <FLAC/stream_decoder.h> + #endif + + + + /****************************************************************************** * *************** *** 319,322 **** --- 326,594 ---- } + + + + + /****************************************************************************** + * + * fmat flac import/export + * + */ + + #if HAVE_FLAC + + typedef struct _import_data + { + /* from the file to import */ + int numframes; + int numchannels; + double sr_orig; + int bits_per_sample; + float scale_factor; + + /* import arguments */ + int wanted; /* number of sample frames to load */ + int offset; + int channel; + double sr_wanted; /* resample if not zero */ + + /* importer data */ + fmat_t *fmat; + fmat_t *orig; + float *ptr; + int numread; /* number of sample frames actually read */ + } fmat_import_args_t; + + static void fmat_import_init (fmat_import_args_t *args, fmat_t *fmat, + int ac, const fts_atom_t *at) + { + bzero(args, sizeof(fmat_import_args_t)); + + args->scale_factor = 1; + args->fmat = fmat; + + /* parse further import arguments <offset> <length> <channel> <sr> + no arg or 0 or string mean: all/as is */ + switch (ac) + { /* FALLTHROUGH! */ + default: + case 5: + if (fts_is_number(at + 4)) + args->sr_wanted = fts_get_number_float(at + 4); + + case 4: /* channel selection ignored so far */ + if (fts_is_number(at + 3)) + args->channel = fts_get_number_int(at + 3); + + case 3: + if (fts_is_number(at + 2)) + args->wanted = fts_get_number_int(at + 2); + + case 2: + if (fts_is_number(at + 1)) + args->offset = fts_get_number_int(at + 1); + + case 1: + /* no additional arguments, filename already parsed, do nothing */ + break; + } + } + + static void fmat_import_begin (fmat_import_args_t *args, + int m, int n, double sr, int bits) + { + args->numframes = m; + args->numchannels = n; + args->sr_orig = sr; + args->bits_per_sample = bits; + args->scale_factor = (double) 1. / (double) (1 << (bits - 1)); + + /* check args */ + if (args->sr_wanted <= 0 || args->sr_wanted == args->sr_orig) + args->sr_wanted = 0; + + if (args->offset > 0 && args->offset < args->numframes) + args->numframes -= args->offset; + + if (args->wanted > 0 && args->wanted < args->numframes) + args->numframes = args->wanted; + else + args->wanted = args->numframes; + + if (args->sr_wanted == 0) + { + fmat_reshape(args->fmat, args->numframes, args->numchannels); + args->orig = args->fmat; + args->ptr = fmat_get_ptr(args->fmat); + } + else /* temp buffer to be resampled */ + { + args->orig = fmat_create(args->numframes + 2, args->numchannels); + args->ptr = fmat_get_ptr(args->orig); + } + } + + static void fmat_import_finish (fmat_import_args_t *args) + { + /* crop to actually read samples */ + fmat_reshape(args->orig, args->numread, args->numchannels); + + if (args->numread > 0 && args->sr_wanted != 0) + { + fmat_resample(args->fmat, args->orig, args->sr_wanted / args->sr_orig); + fts_object_destroy((fts_object_t *) args->orig); + } + } + + + /* called when the decoder has decoded a metadata block */ + static void flacdec_metadata_callback (const FLAC__StreamDecoder *flacdec, + const FLAC__StreamMetadata *metadata, + void *client_data) + { + switch (metadata->type) + { + case FLAC__METADATA_TYPE_STREAMINFO: + { + fmat_import_args_t *args = (fmat_import_args_t *) client_data; + int n = metadata->data.stream_info.channels; + int m = metadata->data.stream_info.total_samples / n; + double sr = metadata->data.stream_info.sample_rate; + int bits = metadata->data.stream_info.bits_per_sample; + + fmat_import_begin(args, m, n, sr, bits); + + /* fts_post("flacdec_metadata_callback: type %d bits %d factor %g\n", + metadata->type, bits, (double) args->scale_factor); */ + + /* seek to first wanted sample: at any point after the stream + decoder has been initialized, the client can call this + function to seek to an exact sample within the + stream. Subsequently, the first time the write callback is + called it will be passed a (possibly partial) block starting + at that sample. */ + FLAC__stream_decoder_seek_absolute(flacdec, args->offset * n); + } + break; + + default: + /* not handled */ + break; + } + } + + + static FLAC__StreamDecoderWriteStatus + flacdec_write_callback (const FLAC__StreamDecoder *flacdec, + const FLAC__Frame *frame, + const FLAC__int32 *const buffer[], + void *client_data) + { + fmat_import_args_t *args = (fmat_import_args_t *) client_data; + float *ptr = args->ptr; + float factor = args->scale_factor; + int m = frame->header.blocksize; + int n = args->numchannels; + int c, i, j; + + /* fts_post("flacdec_write_callback: samples %d channels %d\n", m, n); */ + + if (args->numread + m > args->wanted) + m = args->wanted - args->numread; + + /* copy split int channels from flac to interleaved fmat float samples */ + for (c = 0; c < n; c++) + { + const FLAC__int32 *const buf = buffer[c]; + + for (i = 0, j = c; i < m; i++, j += n) + { + ptr[j] = factor * buf[i]; + } + } + + args->ptr += m * n; + args->numread += m; + + return args->numread < args->wanted + ? FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE + : FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + + static void flacdec_error_callback (const FLAC__StreamDecoder *flacdec, + FLAC__StreamDecoderErrorStatus status, + void *client_data) + { + fmat_import_args_t *args = (fmat_import_args_t *) client_data; + + fts_post("flac decoding error number %d after %d samples read\n", + status, args->numread); + } + + + static fts_method_status_t + fmat_import_flac (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + fmat_t *self = (fmat_t *) o; + + if (ac > 0 && fts_is_symbol(at)) + { + fmat_import_args_t args; + fts_symbol_t filesymb = fts_get_symbol(at); + const char *filename = (const char *) fts_symbol_name(filesymb); + char str[1024]; + char *fullpath = fts_file_find(filename, str, 1023); + + if (fullpath != NULL) + { /* create a new instance */ + FLAC__StreamDecoder *flacdec = FLAC__stream_decoder_new(); + + if (flacdec) + { /* No need to override the decoder options with + FLAC__stream_decoder_set_*() since by default, + only the STREAMINFO block is returned via the metadata callback. */ + + fmat_import_init(&args, self, ac, at); + + /* decoding directly from a file */ + if (FLAC__stream_decoder_init_file(flacdec, fullpath, + flacdec_write_callback, + flacdec_metadata_callback, + flacdec_error_callback, + &args) + == FLAC__STREAM_DECODER_INIT_STATUS_OK) + { /* process the stream from the current location until the + read callback returns + FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or + FLAC__STREAM_DECODER_READ_STATUS_ABORT. The client will + get one metadata, write, or error callback per metadata + block, audio frame, or sync error, respectively. */ + FLAC__stream_decoder_process_until_end_of_stream(flacdec); + + FLAC__stream_decoder_finish(flacdec); + } + FLAC__stream_decoder_delete(flacdec); + + fmat_import_finish(&args); + + if (args.numread > 0) + { + fts_object_changed(o); + fts_set_object(ret, o); + } + else + fts_object_error(o, "import: coudn't read any audio data from file \"%s\" (at \"%s\")", filename, fullpath); + } + else + fts_object_error(o, "import: cannot open audio file \"%s\" (at \"%s\")", filename, fullpath); + } + } + + return fts_ok; + } + + #endif /* HAVE_FLAC */ + + /****************************************************************************** * *************** *** 959,962 **** --- 1231,1235 ---- { /* fmat audio file import/export */ + fts_class_import_handler(fmat_class, fts_new_symbol("flac"), fmat_import_flac); fts_audiofile_import_handler(fmat_class, fmat_import_audiofile); fts_audiofile_export_handler(fmat_class, fmat_export_audiofile); |
From: Diemo S. <di...@us...> - 2007-06-25 13:22:32
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv15303 Modified Files: fmat.c Log Message: doc colref/rowref remove unused symbols Index: fmat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fmat.c,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** fmat.c 16 Feb 2007 08:39:42 -0000 1.155 --- fmat.c 25 Jun 2007 13:22:24 -0000 1.156 *************** *** 51,58 **** fts_symbol_t fmat_symbol = NULL; - static fts_symbol_t sym_text = 0; - static fts_symbol_t sym_getcol = 0; - static fts_symbol_t sym_getrow = 0; - static fts_symbol_t sym_vec = 0; static fts_symbol_t sym_real = 0; --- 51,54 ---- *************** *** 4552,4557 **** fts_class_doc(cl, fmat_symbol, "[<num: # of rows> [<num: # of columns (def 1)> [<num: init values> ...]]]", "matrix of floats"); ! fts_class_doc(cl, fts_s_col, "<num: index>", "get column reference (creates fvec object)"); ! fts_class_doc(cl, fts_s_row, "<num: index>", "get row reference (creates fvec object)"); fts_class_doc(cl, fts_s_size, "[<num: # of rows> [<num: # of columns (def 1)>]]", "get/set dimensions"); --- 4548,4553 ---- fts_class_doc(cl, fmat_symbol, "[<num: # of rows> [<num: # of columns (def 1)> [<num: init values> ...]]]", "matrix of floats"); ! fts_class_doc(cl, fts_new_symbol("colref"), "<num: index>", "get column reference (creates fvec object)"); ! fts_class_doc(cl, fts_new_symbol("rowref"), "<num: index>", "get row reference (creates fvec object)"); fts_class_doc(cl, fts_s_size, "[<num: # of rows> [<num: # of columns (def 1)>]]", "get/set dimensions"); *************** *** 4662,4669 **** fmat_symbol = fts_new_symbol("fmat"); - sym_getcol = fts_new_symbol("getcol"); - sym_getrow = fts_new_symbol("getrow"); - sym_text = fts_new_symbol("text"); - sym_vec = fts_new_symbol("vec"); sym_real = fts_new_symbol("real"); --- 4658,4661 ---- |
From: Diemo S. <di...@us...> - 2007-06-25 13:21:25
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14882 Modified Files: fvec.c Log Message: doc refer Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** fvec.c 11 Apr 2007 10:08:36 -0000 1.166 --- fvec.c 25 Jun 2007 13:21:22 -0000 1.167 *************** *** 2409,2412 **** --- 2409,2413 ---- fts_class_doc(cl, fvec_symbol, "<num: size>", "vector reference compatible float vector"); + fts_class_doc(cl, sym_refer, "<fmat> [<sym: mode> <int: index> <int: onset> <int: size>]", "change referred fmat, type and parameters"); fts_class_doc(cl, fts_new_symbol("onset"), NULL, "get onset"); fts_class_doc(cl, fts_new_symbol("onset"), "<num: onset>", "set onset"); |
From: Diemo S. <di...@us...> - 2007-04-11 10:08:41
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11039 Modified Files: fvec.c Log Message: return 0 variance for empty vectors instead of NaN Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** fvec.c 16 Feb 2007 08:39:42 -0000 1.165 --- fvec.c 11 Apr 2007 10:08:36 -0000 1.166 *************** *** 2012,2016 **** fvec_t *self = (fvec_t *)o; double sum = 0.0, sum2 = 0.0; ! double mean, var; float *p; int size, stride; --- 2012,2016 ---- fvec_t *self = (fvec_t *)o; double sum = 0.0, sum2 = 0.0; ! double mean, var = 0; float *p; int size, stride; *************** *** 2019,2031 **** fvec_get_vector(self, &p, &size, &stride); ! for (i = 0; i < size * stride; i += stride) { ! sum += p[i]; ! sum2 += p[i] * p[i]; ! } ! ! mean = sum / (double) size; ! var = sum2 / (double) size - mean * mean; fts_set_float(ret, var); --- 2019,2034 ---- fvec_get_vector(self, &p, &size, &stride); ! if (size > 0) { ! for (i = 0; i < size * stride; i += stride) ! { ! sum += p[i]; ! sum2 += p[i] * p[i]; ! } + mean = sum / (double) size; + var = sum2 / (double) size - mean * mean; + } + fts_set_float(ret, var); |
From: Diemo S. <di...@us...> - 2007-02-16 08:39:46
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11576/components/jmax/packages/data/c/src Modified Files: fmat.c fvec.c Log Message: ramp function better with documentation Index: fmat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fmat.c,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** fmat.c 16 Feb 2007 08:33:07 -0000 1.154 --- fmat.c 16 Feb 2007 08:39:42 -0000 1.155 *************** *** 4560,4563 **** --- 4560,4564 ---- fts_class_doc(cl, fts_s_fill, "<num: value>", "fill with given value or pattern of values"); fts_class_doc(cl, fts_s_fill, "<expr: expression>", "fill with given expression (use $self, $row and $col)"); + fts_class_doc(cl, fts_new_symbol("ramp"), "[<num: start value> <num: end value>]", "fill fmat with linear sequence of values going from start to end"); fts_class_doc(cl, fts_new_symbol("zero"), "[<num: row index> <num: column index> [<num: # of elements>]]", "zero given number of elements starting from indicated element (row by row)"); Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -d -r1.164 -r1.165 *** fvec.c 16 Feb 2007 08:33:08 -0000 1.164 --- fvec.c 16 Feb 2007 08:39:42 -0000 1.165 *************** *** 2448,2451 **** --- 2448,2452 ---- fts_class_doc(cl, fts_s_fill, "<num: value>", "fill with given value or pattern of values"); fts_class_doc(cl, fts_s_fill, "<expr: expression>", "fill with given expression (use $self, $row for index)"); + fts_class_doc(cl, fts_new_symbol("ramp"), "[<num: start value> <num: end value>]", "fill fvec with linear sequence of values going from start to end"); fts_class_doc(cl, fts_new_symbol("lookup"), "<fmat|fvec|bpf: function>", "apply given function (by linear interpolation)"); |
From: Diemo S. <di...@us...> - 2007-02-16 08:33:14
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv8391/components/jmax/packages/data/c/src Modified Files: fmat.c fvec.c Log Message: introduced ramp function for fmat and fvec, needed so often Index: fmat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fmat.c,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** fmat.c 10 Jan 2007 16:40:16 -0000 1.153 --- fmat.c 16 Feb 2007 08:33:07 -0000 1.154 *************** *** 1048,1051 **** --- 1048,1081 ---- } + + + fts_method_status_t + fmat_ramp(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + float *ptr; + double lo = 0, hi = 1; + int size, stride; + + if (ac > 0 && fts_is_number(at)) + lo = fts_get_number_float(at); + + if (ac > 1 && fts_is_number(at + 1)) + hi = fts_get_number_float(at + 1); + + if (fmat_or_slice_pointer(o, &ptr, &size, &stride)) + { + int i, j; + double fact = size > 1 ? (hi - lo) / (size - 1) : 1.0; + + for (i = 0, j = 0; i < size; i++, j+=stride) + ptr[j] = i * fact + lo; + + fts_object_changed(o); + } + + fts_set_object(ret, o); + return fts_ok; + } + static fts_method_status_t fmat_fill_zero(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) *************** *** 4405,4408 **** --- 4435,4439 ---- fts_class_message_number (cl, fts_s_fill, fmat_fill_number); fts_class_message_varargs(cl, fts_s_fill, fmat_fill_varargs); + fts_class_message_varargs(cl, fts_new_symbol("ramp"), fmat_ramp); fts_class_message_varargs(cl, fts_new_symbol("zero"), fmat_fill_zero); fts_class_message_varargs(cl, fts_new_symbol("random"), fmat_fill_random); Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** fvec.c 15 Jan 2007 15:04:08 -0000 1.163 --- fvec.c 16 Feb 2007 08:33:08 -0000 1.164 *************** *** 59,62 **** --- 59,68 ---- static fts_symbol_t fvec_type_names[fvec_n_types]; + + /* fmat functions also working on fvec */ + fts_method_status_t + fmat_ramp(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret); + + static int fvec_get_type_from_symbol(fts_symbol_t sym) *************** *** 79,82 **** --- 85,91 ---- return fvec_type_names[fvec_get_type(this)]; } + + + /******************************************************************** * *************** *** 2370,2373 **** --- 2379,2383 ---- fts_class_message_number (cl, fts_s_fill, fvec_fill_number); fts_class_message_varargs(cl, fts_s_fill, fvec_fill_varargs); + fts_class_message_varargs(cl, fts_new_symbol("ramp"), fmat_ramp); fts_class_message(cl, fts_new_symbol("lookup"), fmat_class, fvec_lookup_fmat_or_slice); |
From: Norbert S. <nsc...@us...> - 2007-01-17 17:09:52
|
Update of /cvsroot/jmax/jmax/include/fts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14326/include/fts Modified Files: array.h Log Message: - class.c: fixed memory leak bug in message dispatcher - expression.c: fixed expression evaluation in case of void atoms returned for []-operator (was retirn fts_ignore) - array.h: minor doxygen related fix Index: array.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/array.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** array.h 22 Dec 2006 15:13:07 -0000 1.21 --- array.h 17 Jan 2007 17:09:42 -0000 1.22 *************** *** 99,112 **** FTS_API void fts_array_set_size( fts_array_t *array, int new_size); /** ! * Set the content of the array ! * ! * @fn void fts_array_set( fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief set content of the array ! * @param array the array ! * @param ac the atoms count ! * @param at atoms to initialize the content of the array ! * @ingroup array */ FTS_API void fts_array_set( fts_array_t *array, int ac, const fts_atom_t *at); --- 99,166 ---- FTS_API void fts_array_set_size( fts_array_t *array, int new_size); + #ifdef AVOID_MACROS + /** ! * @fn int fts_array_get_size(fts_array_t *array) ! * @brief get array size ! * @param array pointer to the array ! * @return the size of the array ! * @ingroup fts_array ! * ! * Get the number of elements in an array */ + FTS_API int fts_array_get_size(fts_array_t *array); + + #else + + #define fts_array_get_size(array) ((array)->size) + + #endif + + #ifdef AVOID_MACROS + + /** + * @def fts_atom_t *fts_array_get_atoms(fts_array_t *array) + * @brief get a pointer to the raw array of atoms + * @param array pointer to the array + * @return a pointer to the content of the array + * @ingroup fts_array + */ + FTS_API fts_atom_t *fts_array_get_atoms(fts_array_t *array); + + #else + + #define fts_array_get_atoms(array) ((array)->atoms) + + #endif + + /** + * @fn void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t* at) + * @brief set element at index + * @param array pointer to the array + * @param index the index + * @param at element value + * @ingroup fts_array + */ + FTS_API void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t *at); + + #ifdef AVOID_MACROS + + /** + * @fn fts_atom_t *fts_array_get_element( fts_array_t *array, int index) + * @brief get element by index + * @param array the array + * @param index the index + * @return a pointer to the specified element of the array + * @ingroup array + */ + FTS_API fts_atom_t *fts_array_get_element( fts_array_t *array, int index); + + #else + + #define fts_array_get_element( array, index) ((array)->atoms + (index)) + + #endif + FTS_API void fts_array_set( fts_array_t *array, int ac, const fts_atom_t *at); *************** *** 259,305 **** FTS_API void fts_array_copy(fts_array_t *org, fts_array_t *copy); - #ifdef AVOID_MACROS - /** - * @def fts_atom_t *fts_array_get_atoms(fts_array_t *array) - * @brief get array content - * @param array the array - * @return a pointer to the content of the array - * @ingroup array - */ - FTS_API fts_atom_t *fts_array_get_atoms(fts_array_t *array); - /** - * @fn int fts_array_get_size(fts_array_t *array) - * @brief get array size - * @param array the array - * @return the size of the array - * @ingroup array - * - * Get the number of elements in an array - */ - FTS_API int fts_array_get_size(fts_array_t *array); - /** - * @fn fts_atom_t *fts_array_get_element( fts_array_t *array, int index) - * @brief get element by index - * @param array the array - * @param index the index - * @return a pointer to the specified element of the array - * @ingroup array - */ - FTS_API fts_atom_t *fts_array_get_element( fts_array_t *array, int index); - #else - #define fts_array_get_atoms( array) ((array)->atoms) - #define fts_array_get_size( array) ((array)->size) - #define fts_array_get_element( array, index) ((array)->atoms + (index)) - #endif - /** - * @fn void fts_array_set_element(fts_array_t* array, int index, const fts_atom_t* at) - * @brief set element at index - * @param array the array - * @param index the index - * @param at element value - * @ingroup array - */ - FTS_API void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t *at); - /** * @fn void fts_array_get_values(fts_array_t* array, fts_iterator_t* iter) --- 313,316 ---- |
From: Norbert S. <nsc...@us...> - 2007-01-17 17:09:47
|
Update of /cvsroot/jmax/jmax/fts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14326/fts Modified Files: class.c expression.c Log Message: - class.c: fixed memory leak bug in message dispatcher - expression.c: fixed expression evaluation in case of void atoms returned for []-operator (was retirn fts_ignore) - array.h: minor doxygen related fix Index: expression.c =================================================================== RCS file: /cvsroot/jmax/jmax/fts/expression.c,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** expression.c 25 Aug 2006 13:07:13 -0000 1.78 --- expression.c 17 Jan 2007 17:09:41 -0000 1.79 *************** *** 460,470 **** } - if(fts_is_void(&ret)) - return fts_ignore; - - fts_atom_refer(&ret); - expression_stack_pop_frame( exp); ! expression_stack_push(exp, &ret); } else --- 460,470 ---- } expression_stack_pop_frame( exp); ! ! if(!fts_is_void(&ret)) ! { ! fts_atom_refer(&ret); ! expression_stack_push( exp, &ret); ! } } else Index: class.c =================================================================== RCS file: /cvsroot/jmax/jmax/fts/class.c,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** class.c 18 Sep 2006 14:44:18 -0000 1.74 --- class.c 17 Jan 2007 17:09:41 -0000 1.75 *************** *** 318,328 **** { method_key_t *method_key = method_key_new((fts_symbol_t)selector, type); fts_set_object(&k, (fts_object_t *) method_key); if(fts_hashtable_get (cl->methods, &k, &a)) ! return (fts_method_t)fts_get_pointer(&a); fts_object_destroy((fts_object_t *)method_key); } --- 318,331 ---- { method_key_t *method_key = method_key_new((fts_symbol_t)selector, type); + fts_method_t method = NULL; fts_set_object(&k, (fts_object_t *) method_key); if(fts_hashtable_get (cl->methods, &k, &a)) ! method = (fts_method_t)fts_get_pointer(&a); fts_object_destroy((fts_object_t *)method_key); + + return method; } |
From: Diemo S. <di...@us...> - 2007-01-15 15:05:33
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12471 Modified Files: Tag: BEFORE_FTM_2 fvec.c Log Message: apply changes up to 1.162 to ftm 1.7 branch. Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.155.2.2 retrieving revision 1.155.2.3 diff -C2 -d -r1.155.2.2 -r1.155.2.3 *** fvec.c 20 Oct 2006 14:35:23 -0000 1.155.2.2 --- fvec.c 15 Jan 2007 15:05:26 -0000 1.155.2.3 *************** *** 38,43 **** #endif ! #define ABS_MIN -3.40282347e+38F ! #define ABS_MAX 3.40282347e+38F #define LOG_MIN -103.28 #define LOG_ARG_MIN (float)(1.4e-45) --- 38,43 ---- #endif ! #define ABS_MIN -3.40282346e+38F ! #define ABS_MAX 3.40282346e+38F #define LOG_MIN -103.28 #define LOG_ARG_MIN (float)(1.4e-45) *************** *** 382,386 **** int fvec_onset = fvec->onset; int fvec_size = fvec->size; ! switch(fvec->type) { --- 382,394 ---- int fvec_onset = fvec->onset; int fvec_size = fvec->size; ! ! if (fmat_m * fmat_n == 0) ! { /* empty matrix -> empty vector */ ! *ptr = NULL; ! *size = 0; ! *stride = 0; ! return; ! } ! switch(fvec->type) { *************** *** 1337,1340 **** --- 1345,1395 ---- } + + static fts_method_status_t + fvec_pow_fvec(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + fvec_t *self = (fvec_t *)o; + fts_object_t *right = fts_get_object(at); + float *l, *r; + int l_size, r_size; + int l_stride, r_stride; + int size; + int i; + + fvec_get_vector(self, &l, &l_size, &l_stride); + fmat_or_slice_vector(right, &r, &r_size, &r_stride); + + if(l_size < r_size) + size = l_size; + else + size = r_size; + + for(i=0; i<size; i++) + l[i * l_stride] = pow(l[i * l_stride], r[i * r_stride]); + + fts_set_object(ret, o); + + return fts_ok; + } + + static fts_method_status_t + fvec_pow_number(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + fvec_t *self = (fvec_t *)o; + float r = (float)fts_get_number_float(at); + float *l; + int size, stride; + int i; + + fvec_get_vector(self, &l, &size, &stride); + + for(i=0; i<size*stride; i+=stride) + l[i] = powf(l[i], r); + + fts_set_object(ret, o); + + return fts_ok; + } + static fts_method_status_t fvec_bus_fvec(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) *************** *** 1462,1468 **** if(f > high) ! f = high; else if(f < low) ! f = low; } --- 1517,1523 ---- if(f > high) ! ptr[i] = high; else if(f < low) ! ptr[i] = low; } *************** *** 1634,1637 **** --- 1689,1719 ---- } + + #define FVEC_METHOD_MATH_FUNC_1(NAME, FUNC) \ + static fts_method_status_t \ + fvec_ ## NAME (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) \ + { \ + fvec_t *self = (fvec_t *) o; \ + float *ptr; \ + int size, stride; \ + int i; \ + \ + fvec_get_vector(self, &ptr, &size, &stride); \ + \ + for (i = 0; i < size * stride; i += stride) \ + ptr[i] = FUNC(ptr[i]); \ + \ + fts_set_object(ret, o); \ + return fts_ok; \ + } + + FVEC_METHOD_MATH_FUNC_1(trunc, truncf) + FVEC_METHOD_MATH_FUNC_1(round, roundf) + FVEC_METHOD_MATH_FUNC_1(ceil, ceilf) + FVEC_METHOD_MATH_FUNC_1(floor, floorf) + + + + /****************************************************************************** * *************** *** 1733,1737 **** int i, j; ! for(i=1, j=stride; i<size*stride; i++, j+=stride) { if(p[j] < min) --- 1815,1819 ---- int i, j; ! for(i=1, j=stride; i<size; i++, j+=stride) { if(p[j] < min) *************** *** 1763,1767 **** int i, j; ! for(i=1, j=stride; i<size*stride; i++, j+=stride) { if (p[j] > max) --- 1845,1849 ---- int i, j; ! for(i=1, j=stride; i<size; i++, j+=stride) { if (p[j] > max) *************** *** 1976,1980 **** /**************************************************************************** * ! * system mehods * */ --- 2058,2062 ---- /**************************************************************************** * ! * system methods * */ *************** *** 1991,1995 **** fvec_get_vector(self, &ptr, &size, &stride); ! if (ptr && size == 0) fts_set_float(ret, 0); /* empty matrix: no error, just return 0 */ else --- 2073,2077 ---- fvec_get_vector(self, &ptr, &size, &stride); ! if (!ptr || size == 0) fts_set_float(ret, 0); /* empty matrix: no error, just return 0 */ else *************** *** 2249,2252 **** --- 2331,2335 ---- fvec_message(cl, fts_new_symbol("mul"), fvec_mul_fvec, fvec_mul_number); fvec_message(cl, fts_new_symbol("div"), fvec_div_fvec, fvec_div_number); + fvec_message(cl, fts_new_symbol("pow"), fvec_pow_fvec, fvec_pow_number); fvec_message(cl, fts_new_symbol("bus"), fvec_bus_fvec, fvec_bus_number); fvec_message(cl, fts_new_symbol("vid"), fvec_vid_fvec, fvec_vid_number); *************** *** 2261,2264 **** --- 2344,2351 ---- fts_class_message_void(cl, fts_new_symbol("sqrabs"), fvec_sqrabs); fts_class_message_void(cl, fts_new_symbol("sqrt"), fvec_sqrt); + fts_class_message_void(cl, fts_new_symbol("trunc"), fvec_trunc); + fts_class_message_void(cl, fts_new_symbol("round"), fvec_round); + fts_class_message_void(cl, fts_new_symbol("ceil"), fvec_ceil); + fts_class_message_void(cl, fts_new_symbol("floor"), fvec_floor); fts_class_message_void(cl, fts_new_symbol("cumsum"), fvec_cumsum); *************** *** 2329,2332 **** --- 2416,2420 ---- fts_class_doc(cl, fts_new_symbol("mul"), "<num|fvec: operand>", "multiply current values by given scalar, fvec (element by element)"); fts_class_doc(cl, fts_new_symbol("div"), "<num|fvec: operand>", "divide current values by given scalar, fvec (element by element)"); + fts_class_doc(cl, fts_new_symbol("pow"), "<num|fvec: operand>", "take current values to the power of given scalar, fvec (element by element)"); fts_class_doc(cl, fts_new_symbol("bus"), "<num|fvec: operand>", "subtract current values from given scalar, fvec (element by element)"); fts_class_doc(cl, fts_new_symbol("vid"), "<num|fvec: operand>", "divide given scalar, fvec (element by element) by current values"); *************** *** 2338,2341 **** --- 2426,2434 ---- fts_class_doc(cl, fts_new_symbol("sqrabs"), NULL, "calulate square of absolute values of current values"); fts_class_doc(cl, fts_new_symbol("sqrt"), NULL, "calulate square root of absolute values of current values"); + fts_class_doc(cl, fts_new_symbol("trunc"), NULL, "truncate to integer values"); + fts_class_doc(cl, fts_new_symbol("round"), NULL, "round to integral values nearest to current values"); + fts_class_doc(cl, fts_new_symbol("floor"), NULL, "round to largest integral values not greater than current values"); + fts_class_doc(cl, fts_new_symbol("ceil"), NULL, "round to smallest integral values not less than current values"); + fts_class_doc(cl, fts_new_symbol("cumsum"), NULL, "calculate cumulative sum vector"); fts_class_doc(cl, fts_new_symbol("clip"), "[<lower limit>] <upper limit>", "clip values within given limits"); |
From: Diemo S. <di...@us...> - 2007-01-15 15:04:16
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12002 Modified Files: fvec.c Log Message: stay in double for geomean! Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** fvec.c 10 Jan 2007 16:40:16 -0000 1.162 --- fvec.c 15 Jan 2007 15:04:08 -0000 1.163 *************** *** 1990,1994 **** for (i = 0; i < size * stride; i += stride) ! prod *= powf(p[i], root); fts_set_float(ret, prod); --- 1990,1994 ---- for (i = 0; i < size * stride; i += stride) ! prod *= pow(p[i], root); fts_set_float(ret, prod); *************** *** 2059,2063 **** /**************************************************************************** * ! * system mehods * */ --- 2059,2063 ---- /**************************************************************************** * ! * system methods * */ |
From: Diemo S. <di...@us...> - 2007-01-10 16:40:28
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv655/c/src Modified Files: fvec.c fmat.c Log Message: as requested by Olivier Pasquet: add trunc, round, ceil, floor methods for fmat, fvec use powf instead of pow (double) Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** fvec.c 10 Jan 2007 13:12:59 -0000 1.161 --- fvec.c 10 Jan 2007 16:40:16 -0000 1.162 *************** *** 1386,1390 **** for(i=0; i<size*stride; i+=stride) ! l[i] = pow(l[i], r); fts_set_object(ret, o); --- 1386,1390 ---- for(i=0; i<size*stride; i+=stride) ! l[i] = powf(l[i], r); fts_set_object(ret, o); *************** *** 1690,1693 **** --- 1690,1720 ---- } + + #define FVEC_METHOD_MATH_FUNC_1(NAME, FUNC) \ + static fts_method_status_t \ + fvec_ ## NAME (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) \ + { \ + fvec_t *self = (fvec_t *) o; \ + float *ptr; \ + int size, stride; \ + int i; \ + \ + fvec_get_vector(self, &ptr, &size, &stride); \ + \ + for (i = 0; i < size * stride; i += stride) \ + ptr[i] = FUNC(ptr[i]); \ + \ + fts_set_object(ret, o); \ + return fts_ok; \ + } + + FVEC_METHOD_MATH_FUNC_1(trunc, truncf) + FVEC_METHOD_MATH_FUNC_1(round, roundf) + FVEC_METHOD_MATH_FUNC_1(ceil, ceilf) + FVEC_METHOD_MATH_FUNC_1(floor, floorf) + + + + /****************************************************************************** * *************** *** 1963,1967 **** for (i = 0; i < size * stride; i += stride) ! prod *= pow(p[i], root); fts_set_float(ret, prod); --- 1990,1994 ---- for (i = 0; i < size * stride; i += stride) ! prod *= powf(p[i], root); fts_set_float(ret, prod); *************** *** 2318,2321 **** --- 2345,2352 ---- fts_class_message_void(cl, fts_new_symbol("sqrabs"), fvec_sqrabs); fts_class_message_void(cl, fts_new_symbol("sqrt"), fvec_sqrt); + fts_class_message_void(cl, fts_new_symbol("trunc"), fvec_trunc); + fts_class_message_void(cl, fts_new_symbol("round"), fvec_round); + fts_class_message_void(cl, fts_new_symbol("ceil"), fvec_ceil); + fts_class_message_void(cl, fts_new_symbol("floor"), fvec_floor); fts_class_message_void(cl, fts_new_symbol("cumsum"), fvec_cumsum); *************** *** 2396,2399 **** --- 2427,2435 ---- fts_class_doc(cl, fts_new_symbol("sqrabs"), NULL, "calulate square of absolute values of current values"); fts_class_doc(cl, fts_new_symbol("sqrt"), NULL, "calulate square root of absolute values of current values"); + fts_class_doc(cl, fts_new_symbol("trunc"), NULL, "truncate to integer values"); + fts_class_doc(cl, fts_new_symbol("round"), NULL, "round to integral values nearest to current values"); + fts_class_doc(cl, fts_new_symbol("floor"), NULL, "round to largest integral values not greater than current values"); + fts_class_doc(cl, fts_new_symbol("ceil"), NULL, "round to smallest integral values not less than current values"); + fts_class_doc(cl, fts_new_symbol("cumsum"), NULL, "calculate cumulative sum vector"); fts_class_doc(cl, fts_new_symbol("clip"), "[<lower limit>] <upper limit>", "clip values within given limits"); Index: fmat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fmat.c,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** fmat.c 10 Jan 2007 13:13:00 -0000 1.152 --- fmat.c 10 Jan 2007 16:40:16 -0000 1.153 *************** *** 2256,2260 **** for(i=0; i<size; i++) ! l[i] = pow(l[i], r[i]); fts_object_changed(o); --- 2256,2260 ---- for(i=0; i<size; i++) ! l[i] = powf(l[i], r[i]); fts_object_changed(o); *************** *** 2278,2282 **** for(i=0; i<size; i++) ! p[i] = pow(p[i], r); fts_object_changed(o); --- 2278,2282 ---- for(i=0; i<size; i++) ! p[i] = powf(p[i], r); fts_object_changed(o); *************** *** 2805,2808 **** --- 2805,2833 ---- } + #define FMAT_METHOD_MATH_FUNC_1(NAME, FUNC) \ + static fts_method_status_t \ + fmat_ ## NAME (fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) \ + { \ + fmat_t *self = (fmat_t *) o; \ + float *ptr = fmat_get_ptr(self); \ + int m = fmat_get_m(self); \ + int n = fmat_get_n(self); \ + int i; \ + \ + for (i = 0; i < m * n; i++) \ + ptr[i] = FUNC(ptr[i]); \ + \ + fts_object_changed(o); \ + fts_set_object(ret, o); \ + return fts_ok; \ + } + + FMAT_METHOD_MATH_FUNC_1(trunc, truncf) + FMAT_METHOD_MATH_FUNC_1(round, roundf) + FMAT_METHOD_MATH_FUNC_1(ceil, ceilf) + FMAT_METHOD_MATH_FUNC_1(floor, floorf) + + + /****************************************************************************** * *************** *** 4431,4434 **** --- 4456,4463 ---- fts_class_message_void(cl, fts_new_symbol("sqrabs"), fmat_sqrabs); fts_class_message_void(cl, fts_new_symbol("sqrt"), fmat_sqrt); + fts_class_message_void(cl, fts_new_symbol("trunc"), fmat_trunc); + fts_class_message_void(cl, fts_new_symbol("round"), fmat_trunc); + fts_class_message_void(cl, fts_new_symbol("ceil"), fmat_ceil); + fts_class_message_void(cl, fts_new_symbol("floor"), fmat_floor); fts_class_message_void(cl, sym_rect, fmat_convert_rect); *************** *** 4555,4558 **** --- 4584,4591 ---- fts_class_doc(cl, fts_new_symbol("sqrabs"), NULL, "calulate square of absolute values of current values"); fts_class_doc(cl, fts_new_symbol("sqrt"), NULL, "calulate square root of absolute values of current values"); + fts_class_doc(cl, fts_new_symbol("trunc"), NULL, "truncate to integer values"); + fts_class_doc(cl, fts_new_symbol("round"), NULL, "round to integral values nearest to current values"); + fts_class_doc(cl, fts_new_symbol("floor"), NULL, "round to largest integral values not greater than current values"); + fts_class_doc(cl, fts_new_symbol("ceil"), NULL, "round to smallest integral values not less than current values"); fts_class_doc(cl, fts_new_symbol("cmul"), "<num|fmat: operand>", "multiply current values of complex vector by given scalar or complex vector fmat (element by element)"); |
From: Diemo S. <di...@us...> - 2007-01-10 13:13:10
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2291 Modified Files: fvec.c fmat.c Log Message: added pow methods Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** fvec.c 21 Dec 2006 09:58:34 -0000 1.160 --- fvec.c 10 Jan 2007 13:12:59 -0000 1.161 *************** *** 1346,1349 **** --- 1346,1396 ---- } + + static fts_method_status_t + fvec_pow_fvec(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + fvec_t *self = (fvec_t *)o; + fts_object_t *right = fts_get_object(at); + float *l, *r; + int l_size, r_size; + int l_stride, r_stride; + int size; + int i; + + fvec_get_vector(self, &l, &l_size, &l_stride); + fmat_or_slice_vector(right, &r, &r_size, &r_stride); + + if(l_size < r_size) + size = l_size; + else + size = r_size; + + for(i=0; i<size; i++) + l[i * l_stride] = pow(l[i * l_stride], r[i * r_stride]); + + fts_set_object(ret, o); + + return fts_ok; + } + + static fts_method_status_t + fvec_pow_number(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + fvec_t *self = (fvec_t *)o; + float r = (float)fts_get_number_float(at); + float *l; + int size, stride; + int i; + + fvec_get_vector(self, &l, &size, &stride); + + for(i=0; i<size*stride; i+=stride) + l[i] = pow(l[i], r); + + fts_set_object(ret, o); + + return fts_ok; + } + static fts_method_status_t fvec_bus_fvec(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) *************** *** 2258,2261 **** --- 2305,2309 ---- fvec_message(cl, fts_new_symbol("mul"), fvec_mul_fvec, fvec_mul_number); fvec_message(cl, fts_new_symbol("div"), fvec_div_fvec, fvec_div_number); + fvec_message(cl, fts_new_symbol("pow"), fvec_pow_fvec, fvec_pow_number); fvec_message(cl, fts_new_symbol("bus"), fvec_bus_fvec, fvec_bus_number); fvec_message(cl, fts_new_symbol("vid"), fvec_vid_fvec, fvec_vid_number); *************** *** 2338,2341 **** --- 2386,2390 ---- fts_class_doc(cl, fts_new_symbol("mul"), "<num|fvec: operand>", "multiply current values by given scalar, fvec (element by element)"); fts_class_doc(cl, fts_new_symbol("div"), "<num|fvec: operand>", "divide current values by given scalar, fvec (element by element)"); + fts_class_doc(cl, fts_new_symbol("pow"), "<num|fvec: operand>", "take current values to the power of given scalar, fvec (element by element)"); fts_class_doc(cl, fts_new_symbol("bus"), "<num|fvec: operand>", "subtract current values from given scalar, fvec (element by element)"); fts_class_doc(cl, fts_new_symbol("vid"), "<num|fvec: operand>", "divide given scalar, fvec (element by element) by current values"); Index: fmat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fmat.c,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -d -r1.151 -r1.152 *** fmat.c 21 Dec 2006 09:58:34 -0000 1.151 --- fmat.c 10 Jan 2007 13:13:00 -0000 1.152 *************** *** 2236,2239 **** --- 2236,2290 ---- } + + static fts_method_status_t + fmat_pow_fmat(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + fmat_t *self = (fmat_t *)o; + fmat_t *right = (fmat_t *)fts_get_object(at); + int m = fmat_get_m(self); + int n = fmat_get_n(self); + + if(m > fmat_get_m(right)) + m = fmat_get_m(right); + + if(fmat_get_n(right) == n) + { + float *l = fmat_get_ptr(self); + float *r = fmat_get_ptr(right); + int size = m * n; + int i; + + for(i=0; i<size; i++) + l[i] = pow(l[i], r[i]); + + fts_object_changed(o); + fts_set_object(ret, o); + } + else + fmat_error_dimensions(self, right, "pow"); + + return fts_ok; + } + + + static fts_method_status_t + fmat_pow_number(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) + { + fmat_t *self = (fmat_t *)o; + float r = (float)fts_get_number_float(at); + int size = fmat_get_m(self) * fmat_get_n(self); + float *p = fmat_get_ptr(self); + int i; + + for(i=0; i<size; i++) + p[i] = pow(p[i], r); + + fts_object_changed(o); + fts_set_object(ret, o); + + return fts_ok; + } + + static fts_method_status_t fmat_bus_fmat(fts_object_t *o, fts_symbol_t s, int ac, const fts_atom_t *at, fts_atom_t *ret) *************** *** 4363,4366 **** --- 4414,4418 ---- fmat_message(cl, fts_new_symbol("mul"), fmat_mul_fmat, fmat_mul_number); fmat_message(cl, fts_new_symbol("div"), fmat_div_fmat, fmat_div_number); + fmat_message(cl, fts_new_symbol("pow"), fmat_pow_fmat, fmat_pow_number); fmat_message(cl, fts_new_symbol("bus"), fmat_bus_fmat, fmat_bus_number); fmat_message(cl, fts_new_symbol("vid"), fmat_vid_fmat, fmat_vid_number); *************** *** 4487,4490 **** --- 4539,4543 ---- fts_class_doc(cl, fts_new_symbol("mul"), "<num|fmat: operand>", "multiply current values by given scalar or fmat (element by element)"); fts_class_doc(cl, fts_new_symbol("div"), "<num|fmat: operand>", "divide current values by given scalar or fmat (element by element)"); + fts_class_doc(cl, fts_new_symbol("pow"), "<num|fmat: operand>", "take current values to the power of the given scalar or fmat (element by element)"); fts_class_doc(cl, fts_new_symbol("bus"), "<num|fmat: operand>", "subtract current values from given scalar or fmat (element by element)"); fts_class_doc(cl, fts_new_symbol("vid"), "<num|fmat: operand>", "divide given scalar or fmat (element by element) by current values"); *************** *** 4528,4531 **** --- 4581,4585 ---- fts_class_doc(cl, fts_new_symbol("apply"), "<expr: expression>", "apply expression each value (use $self and $x)"); + fts_class_doc(cl, fts_new_symbol("find"), "<expr: expression>", "leave indices where expression is true (use $x, $i and $self)"); fts_class_doc(cl, sym_rect, NULL, "convert complex polar vector to complex rectangular vector (matrix of 2 columns)"); |
From: Riccardo B. <bor...@us...> - 2006-12-22 15:13:12
|
Update of /cvsroot/jmax/jmax/include/fts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv29484 Modified Files: array.h Log Message: changes for FTM.1.7.11.BETA windows release (for Max45) Index: array.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/array.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** array.h 21 Dec 2006 09:58:33 -0000 1.20 --- array.h 22 Dec 2006 15:13:07 -0000 1.21 *************** *** 22,26 **** /** ! * FTS array * * The FTS array is a growable array of atoms. --- 22,26 ---- /** ! * Array * * The FTS array is a growable array of atoms. *************** *** 33,332 **** * can be made larger before adding a large number of elements. * ! * @defgroup fts_array FTS array ! * @ingroup fts_utils */ struct fts_array { ! fts_atom_t *atoms; ! int size; ! int alloc_increment; ! int alloc; }; - /** @name Basic array functions - * @{ */ - /** * Initializes an array * ! * @fn void fts_array_init(fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief initializes an array setting it's elements of the array to the given array of atoms ! * @param array pointer to the array ! * @param ac number of atoms ! * @param at array of atoms ! * @ingroup fts_array ! * @code ! ! { ! fts_array_t array; ! ! fts_array_init(&array, ac, at); ! ! ... do something with your array ... ! ! fts_array_destroy(&array); ! } ! ! * @endcode */ ! FTS_API void fts_array_init(fts_array_t *array, int ac, const fts_atom_t *at); /** ! * Frees an array * ! * @fn void fts_array_destroy(fts_array_t *array); ! * @brief frees an array ! * @param array pointer to the array ! * @ingroup fts_array ! */ ! FTS_API void fts_array_destroy(fts_array_t *array); ! ! /** ! * Set the content of the array ! * ! * @fn void fts_array_set(fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief set elements of the array to the given array of atoms ! * @param array pointer to the array ! * @param ac number of atoms ! * @param at array of atoms ! * @ingroup fts_array */ ! FTS_API void fts_array_set(fts_array_t *array, int ac, const fts_atom_t *at); /** ! * Clears the content of the array<BR> * After calling <CODE>fts_array_clear</CODE>, array will contain no elements, but ! * will keep its allocation state (corresponding to <CODE>fts_array_set_size(myarray, 0)</CODE>). * ! * @fn void fts_array_clear(fts_array_t *array); * @brief clears the content of the array ! * @param array pointer to the array ! * @ingroup fts_array */ ! FTS_API void fts_array_clear(fts_array_t *array); /** ! * Set the size of the array<BR> * If new size is greater that current size, VOID atoms will be added to the end. * If new size is smaller, all elements between new_size and current size will be * made VOID. * ! * @fn void fts_array_set_size(fts_array_t *array, int new_size); * @brief set the size of the array ! * @param array pointer to the array * @param new_size the new size ! * @ingroup fts_array ! */ ! FTS_API void fts_array_set_size(fts_array_t *array, int new_size); ! ! #ifdef AVOID_MACROS ! ! /** ! * @fn int fts_array_get_size(fts_array_t *array) ! * @brief get array size ! * @param array pointer to the array ! * @return the size of the array ! * @ingroup fts_array ! * ! * Get the number of elements in an array ! */ ! FTS_API int fts_array_get_size(fts_array_t *array); ! ! #else ! ! #define fts_array_get_size(array) ((array)->size) ! ! #endif ! ! /** ! * @def fts_atom_t *fts_array_get_atoms(fts_array_t *array) ! * @brief get a pointer to the raw array of atoms ! * @param array pointer to the array ! * @return a pointer to the content of the array ! * @ingroup fts_array */ ! FTS_API fts_atom_t *fts_array_get_atoms(fts_array_t *array); ! ! #else ! ! #define fts_array_get_atoms(array) ((array)->atoms) ! ! #endif ! ! /** ! * @fn void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t* at) ! * @brief set element at index ! * @param array pointer to the array ! * @param index the index ! * @param at element value ! * @ingroup fts_array ! */ ! FTS_API void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t *at); ! ! #ifdef AVOID_MACROS /** ! * @fn fts_atom_t *fts_array_get_element(fts_array_t *array, int index) ! * @brief get element by index ! * @param array pointer to the array ! * @param index the index ! * @return a pointer to the specified element of the array ! * @ingroup fts_array */ ! FTS_API fts_atom_t *fts_array_get_element(fts_array_t *array, int index); ! ! #else ! ! #define fts_array_get_element(array, index) ((array)->atoms + (index)) ! ! #endif ! ! /** @} */ ! ! /** @name Append, prepend, cut and insert elements of an array ! * @{ */ /** * Append elements at the end of the array * ! * @fn void fts_array_append(fts_array_t *array, int ac, const fts_atom_t *at) * @brief append elements at the end of the array ! * @param array pointer to the array * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append(fts_array_t *array, int ac, const fts_atom_t *at); /** * Append an int element at the end of array * ! * @fn void fts_array_append_int(fts_array_t *array, int i) * @brief append int at the end of array ! * @param array pointer to the array * @param i the int to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append_int(fts_array_t *array, int i); /** * Append a float element at the end of array * ! * @fn void fts_array_append_float(fts_array_t *array, float f) * @brief append float at the end of array ! * @param array pointer to the array * @param f the float to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append_float(fts_array_t *array, float f); /** * Append a symbol element at the end of array * ! * @fn void fts_array_append_symbol(fts_array_t *array, fts_symbol_t s) * @brief append symbol at the end of array ! * @param array pointer to the array * @param s the symbol to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append_symbol(fts_array_t *array, fts_symbol_t s); /** * Append an object element at the end of array * ! * @fn void fts_array_append_object(fts_array_t *array, fts_object_t * obj) * @brief append object at the end of array ! * @param array pointer to the array * @param obj the object ! * @ingroup fts_array */ ! FTS_API void fts_array_append_object(fts_array_t *array, fts_object_t * obj); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at) ! * @param array pointer to the array * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at) * @brief prepend elements to the array ! * @param array pointer to the array * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend an int element at the beginning of the array * ! * @fn void fts_array_prepend_int(fts_array_t *array, int i) * @brief prepend int to the array ! * @param array pointer to the array * @param i the int to prepend ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend_int(fts_array_t *array, int i); /** * Prepend a float element at the beginning of the array * ! * @fn void fts_array_prepend_float(fts_array_t *array, float f) * @brief prepend float to the array ! * @param array pointer to the array * @param f the float to prepend ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend_float(fts_array_t *array, float f); /** * Prepend a symbol element at the beginning of the array * ! * @fn void fts_array_prepend_float(fts_array_t *array, fts_symbol_t s) * @brief prepend symbol to the array ! * @param array pointer to the array * @param s the symbol to prepend ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend_symbol(fts_array_t *array, fts_symbol_t s); /** * Insert elements at given index of the array * ! * @fn void fts_array_insert(fts_array_t *array, int index, int ac, const fts_atom_t *at) * @brief insert elements at given index ! * @param array pointer to the array * @param index the index * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_insert(fts_array_t *array, int index, int ac, const fts_atom_t *at); /** * Cut given number of elements from given index of the array * ! * @fn void fts_array_cut(fts_array_t *array, int index, int n) * @brief cut elements from array ! * @param array pointer to the array * @param index the index * @param n the atoms count ! * @ingroup fts_array */ ! FTS_API void fts_array_cut(fts_array_t *array, int index, int n); ! ! /** @} */ ! ! /** @name Misc array functions ! * @{ */ /** --- 33,250 ---- * can be made larger before adding a large number of elements. * ! * @defgroup array array ! * @ingroup ftm_utils ! */ ! ! /** ! * @struct fts_array ! * @brief the fts array structure ! * @ingroup array */ struct fts_array { ! fts_atom_t *atoms; /**< atoms ...*/ ! int size; /**<size ...*/ ! int alloc_increment; /**< alloc_increment ... */ ! int alloc; /**<lloc ...*/ }; /** * Initializes an array * ! * @fn void fts_array_init( fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief initializes an array ! * @param array the array ! * @param ac the atoms count ! * @param at atoms to initialize the content of the array ! * @ingroup array */ ! FTS_API void fts_array_init( fts_array_t *array, int ac, const fts_atom_t *at); /** ! * Deinitializes an array * ! * @fn void fts_array_destroy( fts_array_t *array); ! * @brief deinitializes an array ! * @param array the array ! * @ingroup array */ ! FTS_API void fts_array_destroy( fts_array_t *array); /** ! * Clears the content of the array<BR> * After calling <CODE>fts_array_clear</CODE>, array will contain no elements, but ! * will keep its allocation state (i.e. its capacity will be its capacity before call). * ! * @fn void fts_array_clear( fts_array_t *array); * @brief clears the content of the array ! * @param array the array ! * @ingroup array */ ! FTS_API void fts_array_clear( fts_array_t *array); /** ! * Set the size of the array<BR> * If new size is greater that current size, VOID atoms will be added to the end. * If new size is smaller, all elements between new_size and current size will be * made VOID. * ! * @fn void fts_array_set_size( fts_array_t *array, int new_size); * @brief set the size of the array ! * @param array the array * @param new_size the new size ! * @ingroup array */ ! FTS_API void fts_array_set_size( fts_array_t *array, int new_size); /** ! * Set the content of the array ! * ! * @fn void fts_array_set( fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief set content of the array ! * @param array the array ! * @param ac the atoms count ! * @param at atoms to initialize the content of the array ! * @ingroup array */ ! FTS_API void fts_array_set( fts_array_t *array, int ac, const fts_atom_t *at); /** * Append elements at the end of the array * ! * @fn void fts_array_append( fts_array_t *array, int ac, const fts_atom_t *at) * @brief append elements at the end of the array ! * @param array the array * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_append( fts_array_t *array, int ac, const fts_atom_t *at); /** * Append an int element at the end of array * ! * @fn void fts_array_append_int(fts_array_t* array, int i) * @brief append int at the end of array ! * @param array the array * @param i the int to append ! * @ingroup array */ ! FTS_API void fts_array_append_int( fts_array_t *array, int i); /** * Append a float element at the end of array * ! * @fn void fts_array_append_float(fts_array_t* array, float f) * @brief append float at the end of array ! * @param array the array * @param f the float to append ! * @ingroup array */ ! FTS_API void fts_array_append_float( fts_array_t *array, float f); /** * Append a symbol element at the end of array * ! * @fn void fts_array_append_symbol(fts_array_t* array, fts_symbol_t s) * @brief append symbol at the end of array ! * @param array the array * @param s the symbol to append ! * @ingroup array */ ! FTS_API void fts_array_append_symbol( fts_array_t *array, fts_symbol_t s); /** * Append an object element at the end of array * ! * @fn void fts_array_append_symbol(fts_array_t* array, fts_symbol_t s) * @brief append object at the end of array ! * @param array the array * @param obj the object ! * @ingroup array */ ! FTS_API void fts_array_append_object( fts_array_t *array, fts_object_t * obj); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at) ! * @param array the array * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at) * @brief prepend elements to the array ! * @param array the array * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend an int element at the beginning of the array * ! * @fn void fts_array_prepend_int( fts_array_t *array, int i) * @brief prepend int to the array ! * @param array the array * @param i the int to prepend ! * @ingroup array */ ! FTS_API void fts_array_prepend_int( fts_array_t *array, int i); /** * Prepend a float element at the beginning of the array * ! * @fn void fts_array_prepend_float( fts_array_t *array, float f) * @brief prepend float to the array ! * @param array the array * @param f the float to prepend ! * @ingroup array */ ! FTS_API void fts_array_prepend_float( fts_array_t *array, float f); /** * Prepend a symbol element at the beginning of the array * ! * @fn void fts_array_prepend_float( fts_array_t *array, fts_symbol_t s) * @brief prepend symbol to the array ! * @param array the array * @param s the symbol to prepend ! * @ingroup array */ ! FTS_API void fts_array_prepend_symbol( fts_array_t *array, fts_symbol_t s); /** * Insert elements at given index of the array * ! * @fn void fts_array_insert( fts_array_t *array, int index, int ac, const fts_atom_t *at) * @brief insert elements at given index ! * @param array the array * @param index the index * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_insert( fts_array_t *array, int index, int ac, const fts_atom_t *at); /** * Cut given number of elements from given index of the array * ! * @fn void fts_array_cut( fts_array_t *array, int index, int n) * @brief cut elements from array ! * @param array the array * @param index the index * @param n the atoms count ! * @ingroup array */ ! FTS_API void fts_array_cut( fts_array_t *array, int index, int n); /** *************** *** 337,356 **** * @param org the source * @param copy the destination of the copy ! * @ingroup fts_array */ FTS_API void fts_array_copy(fts_array_t *org, fts_array_t *copy); #ifdef AVOID_MACROS /** ! * @fn void fts_array_get_values(fts_array_t *array, fts_iterator_t* iter) * @brief get an iterator on array elements ! * @param array pointer to the array * @param iter the iterator ! * @ingroup fts_array */ FTS_API void fts_array_get_values(fts_array_t *array, fts_iterator_t *iter); - /** @} */ - --- 255,313 ---- * @param org the source * @param copy the destination of the copy ! * @ingroup array */ FTS_API void fts_array_copy(fts_array_t *org, fts_array_t *copy); #ifdef AVOID_MACROS + /** + * @def fts_atom_t *fts_array_get_atoms(fts_array_t *array) + * @brief get array content + * @param array the array + * @return a pointer to the content of the array + * @ingroup array + */ + FTS_API fts_atom_t *fts_array_get_atoms(fts_array_t *array); + /** + * @fn int fts_array_get_size(fts_array_t *array) + * @brief get array size + * @param array the array + * @return the size of the array + * @ingroup array + * + * Get the number of elements in an array + */ + FTS_API int fts_array_get_size(fts_array_t *array); + /** + * @fn fts_atom_t *fts_array_get_element( fts_array_t *array, int index) + * @brief get element by index + * @param array the array + * @param index the index + * @return a pointer to the specified element of the array + * @ingroup array + */ + FTS_API fts_atom_t *fts_array_get_element( fts_array_t *array, int index); + #else + #define fts_array_get_atoms( array) ((array)->atoms) + #define fts_array_get_size( array) ((array)->size) + #define fts_array_get_element( array, index) ((array)->atoms + (index)) + #endif + /** + * @fn void fts_array_set_element(fts_array_t* array, int index, const fts_atom_t* at) + * @brief set element at index + * @param array the array + * @param index the index + * @param at element value + * @ingroup array + */ + FTS_API void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t *at); /** ! * @fn void fts_array_get_values(fts_array_t* array, fts_iterator_t* iter) * @brief get an iterator on array elements ! * @param array the array * @param iter the iterator ! * @ingroup array */ FTS_API void fts_array_get_values(fts_array_t *array, fts_iterator_t *iter); |
From: Norbert S. <nsc...@us...> - 2006-12-21 09:58:37
|
Update of /cvsroot/jmax/jmax/include/fts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3080/include/fts Modified Files: array.h class.h hashtable.h iterator.h message.h object.h Log Message: - refined doxygen doc - fixed bugs in fvec.c (methods maxi, mini and clip) Index: message.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/message.h,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** message.h 6 Oct 2006 15:07:49 -0000 1.33 --- message.h 21 Dec 2006 09:58:33 -0000 1.34 *************** *** 32,37 **** * @endcode * ! * @defgroup message message ! * @ingroup fts_obj_class_method_sym */ --- 32,37 ---- * @endcode * ! * @defgroup message FTS message ! * @ingroup fts_system */ Index: hashtable.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/hashtable.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** hashtable.h 4 Oct 2006 16:51:29 -0000 1.17 --- hashtable.h 21 Dec 2006 09:58:33 -0000 1.18 *************** *** 33,38 **** * big capacity; this will avoid a lot of intermediate automatic rehashing. * ! * @defgroup hashtable hashtable ! * @ingroup ftm_utils */ --- 33,38 ---- * big capacity; this will avoid a lot of intermediate automatic rehashing. * ! * @defgroup hashtable FTS hashtable ! * @ingroup fts_utils */ *************** *** 197,201 **** * Returns an iterator to enumerate the keys contained in the hashtable * ! * @fn void fts_hashtable_get_keys( fts_hashtable_t *h, fts_iterator_t *i) * @brief get iterator on keys * @param h the hashtable --- 197,201 ---- * Returns an iterator to enumerate the keys contained in the hashtable * ! * @fn void fts_hashtable_get_keys( const fts_hashtable_t *h, fts_iterator_t *i) * @brief get iterator on keys * @param h the hashtable *************** *** 208,212 **** * Returns an iterator to enumerate the values contained in the hashtable * ! * @fn void fts_hashtable_get_values( fts_hashtable_t *h, fts_iterator_t *i) * @brief get iterator on values * @param h the hashtable --- 208,212 ---- * Returns an iterator to enumerate the values contained in the hashtable * ! * @fn void fts_hashtable_get_values( const fts_hashtable_t *h, fts_iterator_t *i) * @brief get iterator on values * @param h the hashtable Index: iterator.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/iterator.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** iterator.h 4 Oct 2006 16:51:29 -0000 1.8 --- iterator.h 21 Dec 2006 09:58:33 -0000 1.9 *************** *** 52,57 **** * @endcode * ! * @defgroup iterator iterator ! * @ingroup ftm_utils */ --- 52,57 ---- * @endcode * ! * @defgroup iterator FTS iterator ! * @ingroup fts_utils */ Index: array.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/array.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** array.h 29 Sep 2006 14:25:31 -0000 1.19 --- array.h 21 Dec 2006 09:58:33 -0000 1.20 *************** *** 22,26 **** /** ! * Array * * The FTS array is a growable array of atoms. --- 22,26 ---- /** ! * FTS array * * The FTS array is a growable array of atoms. *************** *** 33,250 **** * can be made larger before adding a large number of elements. * ! * @defgroup array array ! * @ingroup ftm_utils ! */ ! ! /** ! * @struct fts_array ! * @brief the fts array structure ! * @ingroup array */ struct fts_array { ! fts_atom_t *atoms; /**< atoms ...*/ ! int size; /**<size ...*/ ! int alloc_increment; /**< alloc_increment ... */ ! int alloc; /**<lloc ...*/ }; /** * Initializes an array * ! * @fn void fts_array_init( fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief initializes an array ! * @param array the array ! * @param ac the atoms count ! * @param at atoms to initialize the content of the array ! * @ingroup array */ ! FTS_API void fts_array_init( fts_array_t *array, int ac, const fts_atom_t *at); /** ! * Deinitializes an array * ! * @fn void fts_array_destroy( fts_array_t *array); ! * @brief deinitializes an array ! * @param array the array ! * @ingroup array */ ! FTS_API void fts_array_destroy( fts_array_t *array); /** ! * Clears the content of the array<BR> * After calling <CODE>fts_array_clear</CODE>, array will contain no elements, but ! * will keep its allocation state (i.e. its capacity will be its capacity before call). * ! * @fn void fts_array_clear( fts_array_t *array); * @brief clears the content of the array ! * @param array the array ! * @ingroup array */ ! FTS_API void fts_array_clear( fts_array_t *array); /** ! * Set the size of the array<BR> * If new size is greater that current size, VOID atoms will be added to the end. * If new size is smaller, all elements between new_size and current size will be * made VOID. * ! * @fn void fts_array_set_size( fts_array_t *array, int new_size); * @brief set the size of the array ! * @param array the array * @param new_size the new size ! * @ingroup array */ ! FTS_API void fts_array_set_size( fts_array_t *array, int new_size); /** ! * Set the content of the array ! * ! * @fn void fts_array_set( fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief set content of the array ! * @param array the array ! * @param ac the atoms count ! * @param at atoms to initialize the content of the array ! * @ingroup array */ ! FTS_API void fts_array_set( fts_array_t *array, int ac, const fts_atom_t *at); /** * Append elements at the end of the array * ! * @fn void fts_array_append( fts_array_t *array, int ac, const fts_atom_t *at) * @brief append elements at the end of the array ! * @param array the array * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_append( fts_array_t *array, int ac, const fts_atom_t *at); /** * Append an int element at the end of array * ! * @fn void fts_array_append_int(fts_array_t* array, int i) * @brief append int at the end of array ! * @param array the array * @param i the int to append ! * @ingroup array */ ! FTS_API void fts_array_append_int( fts_array_t *array, int i); /** * Append a float element at the end of array * ! * @fn void fts_array_append_float(fts_array_t* array, float f) * @brief append float at the end of array ! * @param array the array * @param f the float to append ! * @ingroup array */ ! FTS_API void fts_array_append_float( fts_array_t *array, float f); /** * Append a symbol element at the end of array * ! * @fn void fts_array_append_symbol(fts_array_t* array, fts_symbol_t s) * @brief append symbol at the end of array ! * @param array the array * @param s the symbol to append ! * @ingroup array */ ! FTS_API void fts_array_append_symbol( fts_array_t *array, fts_symbol_t s); /** * Append an object element at the end of array * ! * @fn void fts_array_append_symbol(fts_array_t* array, fts_symbol_t s) * @brief append object at the end of array ! * @param array the array * @param obj the object ! * @ingroup array */ ! FTS_API void fts_array_append_object( fts_array_t *array, fts_object_t * obj); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at) ! * @param array the array * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at) * @brief prepend elements to the array ! * @param array the array * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_prepend( fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend an int element at the beginning of the array * ! * @fn void fts_array_prepend_int( fts_array_t *array, int i) * @brief prepend int to the array ! * @param array the array * @param i the int to prepend ! * @ingroup array */ ! FTS_API void fts_array_prepend_int( fts_array_t *array, int i); /** * Prepend a float element at the beginning of the array * ! * @fn void fts_array_prepend_float( fts_array_t *array, float f) * @brief prepend float to the array ! * @param array the array * @param f the float to prepend ! * @ingroup array */ ! FTS_API void fts_array_prepend_float( fts_array_t *array, float f); /** * Prepend a symbol element at the beginning of the array * ! * @fn void fts_array_prepend_float( fts_array_t *array, fts_symbol_t s) * @brief prepend symbol to the array ! * @param array the array * @param s the symbol to prepend ! * @ingroup array */ ! FTS_API void fts_array_prepend_symbol( fts_array_t *array, fts_symbol_t s); /** * Insert elements at given index of the array * ! * @fn void fts_array_insert( fts_array_t *array, int index, int ac, const fts_atom_t *at) * @brief insert elements at given index ! * @param array the array * @param index the index * @param ac the atoms count * @param at atoms to append ! * @ingroup array */ ! FTS_API void fts_array_insert( fts_array_t *array, int index, int ac, const fts_atom_t *at); /** * Cut given number of elements from given index of the array * ! * @fn void fts_array_cut( fts_array_t *array, int index, int n) * @brief cut elements from array ! * @param array the array * @param index the index * @param n the atoms count ! * @ingroup array */ ! FTS_API void fts_array_cut( fts_array_t *array, int index, int n); /** --- 33,332 ---- * can be made larger before adding a large number of elements. * ! * @defgroup fts_array FTS array ! * @ingroup fts_utils */ struct fts_array { ! fts_atom_t *atoms; ! int size; ! int alloc_increment; ! int alloc; }; + /** @name Basic array functions + * @{ */ + /** * Initializes an array * ! * @fn void fts_array_init(fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief initializes an array setting it's elements of the array to the given array of atoms ! * @param array pointer to the array ! * @param ac number of atoms ! * @param at array of atoms ! * @ingroup fts_array ! * @code ! ! { ! fts_array_t array; ! ! fts_array_init(&array, ac, at); ! ! ... do something with your array ... ! ! fts_array_destroy(&array); ! } ! ! * @endcode */ ! FTS_API void fts_array_init(fts_array_t *array, int ac, const fts_atom_t *at); /** ! * Frees an array * ! * @fn void fts_array_destroy(fts_array_t *array); ! * @brief frees an array ! * @param array pointer to the array ! * @ingroup fts_array */ ! FTS_API void fts_array_destroy(fts_array_t *array); /** ! * Set the content of the array ! * ! * @fn void fts_array_set(fts_array_t *array, int ac, const fts_atom_t *at) ! * @brief set elements of the array to the given array of atoms ! * @param array pointer to the array ! * @param ac number of atoms ! * @param at array of atoms ! * @ingroup fts_array ! */ ! FTS_API void fts_array_set(fts_array_t *array, int ac, const fts_atom_t *at); ! ! /** ! * Clears the content of the array<BR> * After calling <CODE>fts_array_clear</CODE>, array will contain no elements, but ! * will keep its allocation state (corresponding to <CODE>fts_array_set_size(myarray, 0)</CODE>). * ! * @fn void fts_array_clear(fts_array_t *array); * @brief clears the content of the array ! * @param array pointer to the array ! * @ingroup fts_array */ ! FTS_API void fts_array_clear(fts_array_t *array); /** ! * Set the size of the array<BR> * If new size is greater that current size, VOID atoms will be added to the end. * If new size is smaller, all elements between new_size and current size will be * made VOID. * ! * @fn void fts_array_set_size(fts_array_t *array, int new_size); * @brief set the size of the array ! * @param array pointer to the array * @param new_size the new size ! * @ingroup fts_array */ ! FTS_API void fts_array_set_size(fts_array_t *array, int new_size); ! ! #ifdef AVOID_MACROS /** ! * @fn int fts_array_get_size(fts_array_t *array) ! * @brief get array size ! * @param array pointer to the array ! * @return the size of the array ! * @ingroup fts_array ! * ! * Get the number of elements in an array */ ! FTS_API int fts_array_get_size(fts_array_t *array); ! ! #else ! ! #define fts_array_get_size(array) ((array)->size) ! ! #endif ! ! /** ! * @def fts_atom_t *fts_array_get_atoms(fts_array_t *array) ! * @brief get a pointer to the raw array of atoms ! * @param array pointer to the array ! * @return a pointer to the content of the array ! * @ingroup fts_array ! */ ! FTS_API fts_atom_t *fts_array_get_atoms(fts_array_t *array); ! ! #else ! ! #define fts_array_get_atoms(array) ((array)->atoms) ! ! #endif ! ! /** ! * @fn void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t* at) ! * @brief set element at index ! * @param array pointer to the array ! * @param index the index ! * @param at element value ! * @ingroup fts_array ! */ ! FTS_API void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t *at); ! ! #ifdef AVOID_MACROS ! ! /** ! * @fn fts_atom_t *fts_array_get_element(fts_array_t *array, int index) ! * @brief get element by index ! * @param array pointer to the array ! * @param index the index ! * @return a pointer to the specified element of the array ! * @ingroup fts_array ! */ ! FTS_API fts_atom_t *fts_array_get_element(fts_array_t *array, int index); ! ! #else ! ! #define fts_array_get_element(array, index) ((array)->atoms + (index)) ! ! #endif ! ! /** @} */ ! ! /** @name Append, prepend, cut and insert elements of an array ! * @{ */ /** * Append elements at the end of the array * ! * @fn void fts_array_append(fts_array_t *array, int ac, const fts_atom_t *at) * @brief append elements at the end of the array ! * @param array pointer to the array * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append(fts_array_t *array, int ac, const fts_atom_t *at); /** * Append an int element at the end of array * ! * @fn void fts_array_append_int(fts_array_t *array, int i) * @brief append int at the end of array ! * @param array pointer to the array * @param i the int to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append_int(fts_array_t *array, int i); /** * Append a float element at the end of array * ! * @fn void fts_array_append_float(fts_array_t *array, float f) * @brief append float at the end of array ! * @param array pointer to the array * @param f the float to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append_float(fts_array_t *array, float f); /** * Append a symbol element at the end of array * ! * @fn void fts_array_append_symbol(fts_array_t *array, fts_symbol_t s) * @brief append symbol at the end of array ! * @param array pointer to the array * @param s the symbol to append ! * @ingroup fts_array */ ! FTS_API void fts_array_append_symbol(fts_array_t *array, fts_symbol_t s); /** * Append an object element at the end of array * ! * @fn void fts_array_append_object(fts_array_t *array, fts_object_t * obj) * @brief append object at the end of array ! * @param array pointer to the array * @param obj the object ! * @ingroup fts_array */ ! FTS_API void fts_array_append_object(fts_array_t *array, fts_object_t * obj); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at) ! * @param array pointer to the array * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend elements at the beginning of the array * ! * @fn void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at) * @brief prepend elements to the array ! * @param array pointer to the array * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend(fts_array_t *array, int ac, const fts_atom_t *at); /** * Prepend an int element at the beginning of the array * ! * @fn void fts_array_prepend_int(fts_array_t *array, int i) * @brief prepend int to the array ! * @param array pointer to the array * @param i the int to prepend ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend_int(fts_array_t *array, int i); /** * Prepend a float element at the beginning of the array * ! * @fn void fts_array_prepend_float(fts_array_t *array, float f) * @brief prepend float to the array ! * @param array pointer to the array * @param f the float to prepend ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend_float(fts_array_t *array, float f); /** * Prepend a symbol element at the beginning of the array * ! * @fn void fts_array_prepend_float(fts_array_t *array, fts_symbol_t s) * @brief prepend symbol to the array ! * @param array pointer to the array * @param s the symbol to prepend ! * @ingroup fts_array */ ! FTS_API void fts_array_prepend_symbol(fts_array_t *array, fts_symbol_t s); /** * Insert elements at given index of the array * ! * @fn void fts_array_insert(fts_array_t *array, int index, int ac, const fts_atom_t *at) * @brief insert elements at given index ! * @param array pointer to the array * @param index the index * @param ac the atoms count * @param at atoms to append ! * @ingroup fts_array */ ! FTS_API void fts_array_insert(fts_array_t *array, int index, int ac, const fts_atom_t *at); /** * Cut given number of elements from given index of the array * ! * @fn void fts_array_cut(fts_array_t *array, int index, int n) * @brief cut elements from array ! * @param array pointer to the array * @param index the index * @param n the atoms count ! * @ingroup fts_array */ ! FTS_API void fts_array_cut(fts_array_t *array, int index, int n); ! ! /** @} */ ! ! /** @name Misc array functions ! * @{ */ /** *************** *** 255,313 **** * @param org the source * @param copy the destination of the copy ! * @ingroup array */ FTS_API void fts_array_copy(fts_array_t *org, fts_array_t *copy); #ifdef AVOID_MACROS - /** - * @def fts_atom_t *fts_array_get_atoms(fts_array_t *array) - * @brief get array content - * @param array the array - * @return a pointer to the content of the array - * @ingroup array - */ - FTS_API fts_atom_t *fts_array_get_atoms(fts_array_t *array); - /** - * @fn int fts_array_get_size(fts_array_t *array) - * @brief get array size - * @param array the array - * @return the size of the array - * @ingroup array - * - * Get the number of elements in an array - */ - FTS_API int fts_array_get_size(fts_array_t *array); - /** - * @fn fts_atom_t *fts_array_get_element( fts_array_t *array, int index) - * @brief get element by index - * @param array the array - * @param index the index - * @return a pointer to the specified element of the array - * @ingroup array - */ - FTS_API fts_atom_t *fts_array_get_element( fts_array_t *array, int index); - #else - #define fts_array_get_atoms( array) ((array)->atoms) - #define fts_array_get_size( array) ((array)->size) - #define fts_array_get_element( array, index) ((array)->atoms + (index)) - #endif - /** - * @fn void fts_array_set_element(fts_array_t* array, int index, const fts_atom_t* at) - * @brief set element at index - * @param array the array - * @param index the index - * @param at element value - * @ingroup array - */ - FTS_API void fts_array_set_element(fts_array_t *array, int index, const fts_atom_t *at); /** ! * @fn void fts_array_get_values(fts_array_t* array, fts_iterator_t* iter) * @brief get an iterator on array elements ! * @param array the array * @param iter the iterator ! * @ingroup array */ FTS_API void fts_array_get_values(fts_array_t *array, fts_iterator_t *iter); --- 337,356 ---- * @param org the source * @param copy the destination of the copy ! * @ingroup fts_array */ FTS_API void fts_array_copy(fts_array_t *org, fts_array_t *copy); #ifdef AVOID_MACROS /** ! * @fn void fts_array_get_values(fts_array_t *array, fts_iterator_t* iter) * @brief get an iterator on array elements ! * @param array pointer to the array * @param iter the iterator ! * @ingroup fts_array */ FTS_API void fts_array_get_values(fts_array_t *array, fts_iterator_t *iter); + /** @} */ + Index: object.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/object.h,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** object.h 6 Oct 2006 15:07:49 -0000 1.57 --- object.h 21 Dec 2006 09:58:33 -0000 1.58 *************** *** 26,31 **** * The FTS object * ! * @defgroup object fts object ! * @ingroup fts_obj_class_method_sym */ --- 26,31 ---- * The FTS object * ! * @defgroup object FTS object ! * @ingroup fts_system */ Index: class.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/class.h,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** class.h 9 Oct 2006 10:49:08 -0000 1.57 --- class.h 21 Dec 2006 09:58:33 -0000 1.58 *************** *** 26,31 **** * The FTS class * ! * @defgroup class class ! * @ingroup fts_obj_class_method_sym */ --- 26,31 ---- * The FTS class * ! * @defgroup class FTS class ! * @ingroup fts_system */ |
From: Norbert S. <nsc...@us...> - 2006-12-21 09:58:37
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3080/packages/data/c/src Modified Files: fmat.c fvec.c tabeditor.c Log Message: - refined doxygen doc - fixed bugs in fvec.c (methods maxi, mini and clip) Index: fmat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fmat.c,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -d -r1.150 -r1.151 *** fmat.c 19 Dec 2006 17:17:21 -0000 1.150 --- fmat.c 21 Dec 2006 09:58:34 -0000 1.151 *************** *** 903,907 **** int n = fmat_get_n(self); int row = fts_get_number_int(at); - int istup = 0; /* skip index argument */ --- 903,906 ---- *************** *** 937,941 **** int n = fmat_get_n(self); int col = fts_get_number_int(at); - int istup = 0; /* skip index argument */ --- 936,939 ---- Index: tabeditor.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/tabeditor.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** tabeditor.c 18 Sep 2006 14:48:00 -0000 1.46 --- tabeditor.c 21 Dec 2006 09:58:34 -0000 1.47 *************** *** 736,740 **** int start = fts_get_int(at + 2); int copy_size, size; ! int i, j; tabeditor_copy_by_client_request(o, NULL, ac - 2, at + 2, fts_nix); --- 736,740 ---- int start = fts_get_int(at + 2); int copy_size, size; ! int i; tabeditor_copy_by_client_request(o, NULL, ac - 2, at + 2, fts_nix); Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** fvec.c 19 Dec 2006 17:17:21 -0000 1.159 --- fvec.c 21 Dec 2006 09:58:34 -0000 1.160 *************** *** 1471,1477 **** if(f > high) ! f = high; else if(f < low) ! f = low; } --- 1471,1477 ---- if(f > high) ! ptr[i] = high; else if(f < low) ! ptr[i] = low; } *************** *** 1742,1746 **** int i, j; ! for(i=1, j=stride; i<size*stride; i++, j+=stride) { if(p[j] < min) --- 1742,1746 ---- int i, j; ! for(i=1, j=stride; i<size; i++, j+=stride) { if(p[j] < min) *************** *** 1772,1776 **** int i, j; ! for(i=1, j=stride; i<size*stride; i++, j+=stride) { if (p[j] > max) --- 1772,1776 ---- int i, j; ! for(i=1, j=stride; i<size; i++, j+=stride) { if (p[j] > max) |
From: Riccardo B. <bor...@us...> - 2006-12-19 17:17:25
|
Update of /cvsroot/jmax/jmax/packages/data/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv22696 Modified Files: fmat.c fvec.c Log Message: some change for windows compilation on VS8 Index: fmat.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fmat.c,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -d -r1.149 -r1.150 *** fmat.c 23 Nov 2006 11:59:28 -0000 1.149 --- fmat.c 19 Dec 2006 17:17:21 -0000 1.150 *************** *** 41,46 **** #endif ! #define ABS_MIN -3.40282347e+38F ! #define ABS_MAX 3.40282347e+38F #define LOG_MIN -103.28 --- 41,46 ---- #endif ! #define ABS_MIN -3.40282346e+38F ! #define ABS_MAX 3.40282346e+38F #define LOG_MIN -103.28 Index: fvec.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/data/c/src/fvec.c,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** fvec.c 13 Dec 2006 08:42:21 -0000 1.158 --- fvec.c 19 Dec 2006 17:17:21 -0000 1.159 *************** *** 38,43 **** #endif ! #define ABS_MIN -3.40282347e+38F ! #define ABS_MAX 3.40282347e+38F #define LOG_MIN -103.28 #define LOG_ARG_MIN (float)(1.4e-45) --- 38,43 ---- #endif ! #define ABS_MIN -3.40282346e+38F ! #define ABS_MAX 3.40282346e+38F #define LOG_MIN -103.28 #define LOG_ARG_MIN (float)(1.4e-45) |
From: Riccardo B. <bor...@us...> - 2006-12-19 17:16:06
|
Update of /cvsroot/jmax/jmax/packages/utils/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21878 Modified Files: floatfuns.c Log Message: some change for windows compilation on VS8 Index: floatfuns.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/utils/c/src/floatfuns.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** floatfuns.c 29 Nov 2005 15:40:18 -0000 1.17 --- floatfuns.c 19 Dec 2006 17:16:00 -0000 1.18 *************** *** 174,198 **** } ! #ifndef HAVE_SINF ! static float sinf( float f) { ! return (float)sin( f); } - #endif ! #ifndef HAVE_COSF ! static float cosf( float f) { ! return (float)cos( f); } - #endif ! #ifndef HAVE_SQRTF ! static float sqrtf (float f) { ! return (float) sqrt(f); } - #endif - FTS_MODULE_INIT(ffuns) --- 174,191 ---- } ! static float ff_sin( float f) { ! return (float)sin( (double)f); } ! static float ff_cos( float f) { ! return (float)cos( (double)f); } ! static float ff_sqrt (float f) { ! return (float) sqrt((double)f); } FTS_MODULE_INIT(ffuns) *************** *** 200,206 **** fts_hashtable_init( &the_fts_ffun_hashtable, FTS_HASHTABLE_SMALL); ! fts_ffun_new( fts_new_symbol( "sin"), sinf); ! fts_ffun_new( fts_new_symbol( "cos"), cosf); ! fts_ffun_new( fts_new_symbol( "sqrt"), sqrtf); #if HAVE_TANF --- 193,199 ---- fts_hashtable_init( &the_fts_ffun_hashtable, FTS_HASHTABLE_SMALL); ! fts_ffun_new( fts_new_symbol( "sin"), ff_sin); ! fts_ffun_new( fts_new_symbol( "cos"), ff_cos); ! fts_ffun_new( fts_new_symbol( "sqrt"), ff_sqrt); #if HAVE_TANF |
From: Riccardo B. <bor...@us...> - 2006-12-19 17:15:57
|
Update of /cvsroot/jmax/jmax/packages/sequence/c/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21838 Modified Files: trackeditor.c Log Message: some change for windows compilation on VS8 Index: trackeditor.c =================================================================== RCS file: /cvsroot/jmax/jmax/packages/sequence/c/src/trackeditor.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** trackeditor.c 19 Sep 2006 14:08:33 -0000 1.17 --- trackeditor.c 19 Dec 2006 17:15:49 -0000 1.18 *************** *** 503,507 **** if(ac >= 0) { ! fts_atom_t a[ac]; int i = 0; --- 503,507 ---- if(ac >= 0) { ! fts_atom_t a[1024]; int i = 0; |
From: Riccardo B. <bor...@us...> - 2006-12-19 17:15:31
|
Update of /cvsroot/jmax/jmax/include/fts In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21794 Modified Files: list.h Log Message: some change for windows compilation on VS8 Index: list.h =================================================================== RCS file: /cvsroot/jmax/jmax/include/fts/list.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** list.h 22 Jul 2003 16:10:37 -0000 1.8 --- list.h 19 Dec 2006 17:15:26 -0000 1.9 *************** *** 1,181 **** ! /* ! * jMax ! * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France. ! * ! * This program is free software; you can redistribute it and/or ! * modify it under the terms of the GNU Lesser General Public License ! * as published by the Free Software Foundation; either version 2.1 ! * of the License, or (at your option) any later version. ! * ! * See file COPYING.LIB for further informations on licensing terms. ! * ! * This program is distributed in the hope that it will be useful, ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! * GNU Lesser General Public License for more details. ! * ! * You should have received a copy of the GNU Lesser General Public License ! * along with this program; if not, write to the Free Software ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! * ! */ ! ! ! /** ! * Lists ! * ! * The API for FTS lists. ! * ! * @code ! { ! fts_list_t *list = NULL; ! fts_list_t *p; ! fts_atom_t a, *ap; ! int i; ! ! for (i = 0; i < 10; i++) { ! fts_set_int(&a, i); ! list = fts_list_append(list, &a); ! fts_post("appending %d\n", i); ! } ! ! p = list; ! while (p) { ! ap = fts_list_get( p); ! p = fts_list_next( p); ! fts_post("reading %d\n", fts_get_int(ap)); ! } ! ! p = fts_list_get_nth(list, 5); ! fts_post("5th element = %d\n", fts_get_int(fts_list_get(p))); ! ! for (i = 0; i < 5; i++) { ! fts_set_int(&a, i); ! list = fts_list_remove(list, &a); ! fts_post("removing %d\n", i); ! } ! ! fts_list_delete(list); ! } ! * @endcode ! * ! * @defgroup list list ! */ ! ! typedef struct _fts_list_t fts_list_t; ! ! #define fts_list_init(l) ((l) = NULL) ! ! /** ! * Appends a new node with the given data to the end of the list. The ! * functions returns the list. If the argument "list" is NULL, a new ! * list is allocated and returned. ! * ! * @fn fts_list_t *fts_list_append(fts_list_t *list, const fts_atom_t *data) ! * @param list the list ! * @param data the data of the new node ! * @return the new list ! * @ingroup list */ ! FTS_API fts_list_t *fts_list_append(fts_list_t *list, const fts_atom_t *data); ! ! /** ! * Prepends a new node with the given data to the beginning of the ! * list. The functions returns the list. If the argument "list" is ! * NULL, a new list is allocated and returned. ! * ! * @fn fts_list_t *fts_list_prepend(fts_list_t *list, const fts_atom_t *data) ! * @param list the list ! * @param data the data of the new node ! * @return the new list ! * @ingroup list */ ! FTS_API fts_list_t *fts_list_prepend(fts_list_t *list, const fts_atom_t *data); ! ! /** ! * Inserts a new node with the given data to the engiven position of the list. The ! * functions returns the list. If the argument "list" is NULL, a new ! * list is allocated and returned. If the position > list_size appends the new node ! * at the end of the list ! * ! * @fn fts_list_t *fts_list_insert(fts_list_t *list, const fts_atom_t *data, int index) ! * @param list the list ! * @param data the data of the new node ! * @param index the position in the list of the new node ! * @return the new list ! * @ingroup list */ ! FTS_API fts_list_t *fts_list_insert(fts_list_t *list, const fts_atom_t *data, int index); ! ! /** ! * Removes a new node from the list. Returns the list with the data ! * removed. The functions returns the list or NULL if the list has no ! * more nodes. ! * ! * @fn fts_list_t *fts_list_remove(fts_list_t *list, const fts_atom_t *data) ! * @param list the list ! * @param data the data to be removed ! * @return the new list ! * @ingroup list */ ! FTS_API fts_list_t *fts_list_remove(fts_list_t *list, const fts_atom_t *data); ! ! /** ! * Returns the next node of the list or NULL when the end of the list ! * is reached. ! * ! * @fn fts_list_t *fts_list_next(fts_list_t *list) ! * @param list the list ! * @return the next node ! * @ingroup list */ ! FTS_API fts_list_t *fts_list_next(fts_list_t *list); ! ! /** ! * Returns the data associated with the first node of the list. ! * ! * @fn fts_atom_t *fts_list_get(fts_list_t *list); ! * @param list the list ! * @return a pointer to the atom contained in first node ! * @ingroup list */ ! FTS_API fts_atom_t *fts_list_get(fts_list_t *list); ! ! /** ! * Sets the data associated with the first node of the list. ! * ! * @fn void fts_list_set(fts_list_t *list, const fts_atom_t *data) ! * @param list the list ! * @param data the new data of the node ! * @ingroup list */ ! FTS_API void fts_list_set(fts_list_t *list, const fts_atom_t *data); ! ! /** ! * Returns the n-th node of the list or NULL if the length of the list ! * is smaller than n. ! * ! * @fn fts_list_t *fts_list_get_nth(fts_list_t *list, int n) ! * @param list the list ! * @param n the node number ! * @return the n-th node ! * @ingroup list */ ! FTS_API fts_list_t *fts_list_get_nth(fts_list_t *list, int n); ! ! /** ! * Deletes the list and all its nodes. ! * ! * @fn void fts_list_delete(fts_list_t *list) ! * @param list the list ! * @ingroup list */ ! FTS_API void fts_list_delete( fts_list_t *list); ! ! /*********************************************** ! * ! * List iterator ! */ ! ! /** ! * Returns a new iterator object for this list. ! * ! * @fn void fts_list_get_values( const fts_list_t *list, fts_iterator_t *i ) ! * @param list the list to be iterated ! * @param i the iterator ! * @ingroup list */ ! FTS_API void fts_list_get_values( const fts_list_t *list, fts_iterator_t *i ); ! FTS_API int fts_list_get_size( const fts_list_t *list); ! ! --- 1,362 ---- ! /* ! ! * jMax ! ! * Copyright (C) 1994, 1995, 1998, 1999 by IRCAM-Centre Georges Pompidou, Paris, France. ! ! * ! ! * This program is free software; you can redistribute it and/or ! ! * modify it under the terms of the GNU Lesser General Public License ! ! * as published by the Free Software Foundation; either version 2.1 ! ! * of the License, or (at your option) any later version. ! ! * ! ! * See file COPYING.LIB for further informations on licensing terms. ! ! * ! ! * This program is distributed in the hope that it will be useful, ! ! * but WITHOUT ANY WARRANTY; without even the implied warranty of ! ! * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! ! * GNU Lesser General Public License for more details. ! ! * ! ! * You should have received a copy of the GNU Lesser General Public License ! ! * along with this program; if not, write to the Free Software ! ! * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! ! * ! ! */ ! ! ! ! ! ! /** ! ! * Lists ! ! * ! ! * The API for FTS lists. ! ! * ! ! * @code ! ! { ! ! fts_list_t *list = NULL; ! ! fts_list_t *p; ! ! fts_atom_t a, *ap; ! ! int i; ! ! ! ! for (i = 0; i < 10; i++) { ! ! fts_set_int(&a, i); ! ! list = fts_list_append(list, &a); ! ! fts_post("appending %d\n", i); ! ! } ! ! ! ! p = list; ! ! while (p) { ! ! ap = fts_list_get( p); ! ! p = fts_list_next( p); ! ! fts_post("reading %d\n", fts_get_int(ap)); ! ! } ! ! ! ! p = fts_list_get_nth(list, 5); ! ! fts_post("5th element = %d\n", fts_get_int(fts_list_get(p))); ! ! ! ! for (i = 0; i < 5; i++) { ! ! fts_set_int(&a, i); ! ! list = fts_list_remove(list, &a); ! ! fts_post("removing %d\n", i); ! ! } ! ! ! ! fts_list_delete(list); ! ! } ! ! * @endcode ! ! * ! ! * @defgroup list list ! ! */ ! ! ! ! typedef struct _fts_list_t fts_list_t; ! ! ! ! #define fts_list_init(l) ((l) = NULL) ! ! ! ! /** ! ! * Appends a new node with the given data to the end of the list. The ! ! * functions returns the list. If the argument "list" is NULL, a new ! ! * list is allocated and returned. ! ! * ! ! * @fn fts_list_t *fts_list_append(fts_list_t *list, const fts_atom_t *data) ! ! * @param list the list ! ! * @param data the data of the new node ! ! * @return the new list ! ! * @ingroup list */ ! ! FTS_API fts_list_t *fts_list_append(fts_list_t *list, const fts_atom_t *data); ! ! ! ! /** ! ! * Prepends a new node with the given data to the beginning of the ! ! * list. The functions returns the list. If the argument "list" is ! ! * NULL, a new list is allocated and returned. ! ! * ! ! * @fn fts_list_t *fts_list_prepend(fts_list_t *list, const fts_atom_t *data) ! ! * @param list the list ! ! * @param data the data of the new node ! ! * @return the new list ! ! * @ingroup list */ ! ! FTS_API fts_list_t *fts_list_prepend(fts_list_t *list, const fts_atom_t *data); ! ! ! ! /** ! ! * Inserts a new node with the given data to the engiven position of the list. The ! ! * functions returns the list. If the argument "list" is NULL, a new ! ! * list is allocated and returned. If the position > list_size appends the new node ! ! * at the end of the list ! ! * ! ! * @fn fts_list_t *fts_list_insert(fts_list_t *list, const fts_atom_t *data, int index) ! ! * @param list the list ! ! * @param data the data of the new node ! ! * @param index the position in the list of the new node ! ! * @return the new list ! ! * @ingroup list */ ! ! FTS_API fts_list_t *fts_list_insert(fts_list_t *list, const fts_atom_t *data, int index); ! ! ! ! /** ! ! * Removes a new node from the list. Returns the list with the data ! ! * removed. The functions returns the list or NULL if the list has no ! ! * more nodes. ! ! * ! ! * @fn fts_list_t *fts_list_remove(fts_list_t *list, const fts_atom_t *data) ! ! * @param list the list ! ! * @param data the data to be removed ! ! * @return the new list ! ! * @ingroup list */ ! ! FTS_API fts_list_t *fts_list_remove(fts_list_t *list, const fts_atom_t *data); ! ! ! ! /** ! ! * Returns the next node of the list or NULL when the end of the list ! ! * is reached. ! ! * ! ! * @fn fts_list_t *fts_list_next(fts_list_t *list) ! ! * @param list the list ! ! * @return the next node ! ! * @ingroup list */ ! ! FTS_API fts_list_t *fts_list_next(fts_list_t *list); ! ! ! ! /** ! ! * Returns the data associated with the first node of the list. ! ! * ! ! * @fn fts_atom_t *fts_list_get(fts_list_t *list); ! ! * @param list the list ! ! * @return a pointer to the atom contained in first node ! ! * @ingroup list */ ! ! FTS_API fts_atom_t *fts_list_get(fts_list_t *list); ! ! ! ! /** ! ! * Sets the data associated with the first node of the list. ! ! * ! ! * @fn void fts_list_set(fts_list_t *list, const fts_atom_t *data) ! ! * @param list the list ! ! * @param data the new data of the node ! ! * @ingroup list */ ! ! FTS_API void fts_list_set(fts_list_t *list, const fts_atom_t *data); ! ! ! ! /** ! ! * Returns the n-th node of the list or NULL if the length of the list ! ! * is smaller than n. ! ! * ! ! * @fn fts_list_t *fts_list_get_nth(fts_list_t *list, int n) ! ! * @param list the list ! ! * @param n the node number ! ! * @return the n-th node ! ! * @ingroup list */ ! ! FTS_API fts_list_t *fts_list_get_nth(fts_list_t *list, int n); ! ! ! ! /** ! ! * Deletes the list and all its nodes. ! ! * ! ! * @fn void fts_list_delete(fts_list_t *list) ! ! * @param list the list ! ! * @ingroup list */ ! ! FTS_API void fts_list_delete( fts_list_t *list); ! ! ! ! /*********************************************** ! ! * ! ! * List iterator ! ! */ ! ! ! ! /** ! ! * Returns a new iterator object for this list. ! ! * ! ! * @fn void fts_list_get_values( const fts_list_t *list, fts_iterator_t *i ) ! ! * @param list the list to be iterated ! ! * @param i the iterator ! ! * @ingroup list */ ! ! FTS_API void fts_list_get_values( const fts_list_t *list, fts_iterator_t *i ); ! ! FTS_API int fts_list_get_size( const fts_list_t *list); ! ! ! ! ! |