~ubuntu-branches/ubuntu/precise/csound/precise

« back to all changes in this revision

Viewing changes to Opcodes/ftgen.c

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2012-04-19 09:26:46 UTC
  • mfrom: (3.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20120419092646-96xbj1n6atuqosk2
Tags: 1:5.17.6~dfsg-1
* New upstream release
 - Do not build the wiimote opcodes (we need wiiuse).
* Add new API function to symbols file
* Disable lua opcodes, they were broken. Requires OpenMP to be enabled.
* Backport fixes from upstream:
  - Link dssi4cs with dl. Backport
  - Fix building of CsoundAC

Show diffs side-by-side

added added

removed removed

Lines of Context:
252
252
        memset(&header, 0, sizeof(FUNC));
253
253
        /* IMPORTANT!! If FUNC structure and/or GEN01ARGS structure
254
254
           will be modified, the following code has to be modified too */
255
 
        fgets(s, 64, file);
256
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
255
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;
 
256
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;
 
257
        s1 = strchr(s, ' ')+1;
257
258
        header.flen = strtol(s1, &endptr, 10);
258
259
        if (UNLIKELY(endptr==NULL)) goto err4;
259
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
260
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
260
261
        header.lenmask = strtol(s1, &endptr, 10);
261
262
        if (UNLIKELY(endptr==NULL)) goto err4;
262
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
263
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
263
264
        header.lobits = strtol(s1, &endptr, 10);
264
265
        if (UNLIKELY(endptr==NULL)) goto err4;
265
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
266
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
266
267
        header.lomask = strtol(s1, &endptr, 10);
267
268
        if (UNLIKELY(endptr==NULL)) goto err4;
268
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
269
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
269
270
        header.lodiv = (MYFLT)strtol(s1, &endptr, 10);
270
271
        if (UNLIKELY(endptr==NULL)) goto err4;
271
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
272
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
272
273
        header.cvtbas = (MYFLT)strtol(s1, &endptr, 10);
273
274
        if (UNLIKELY(endptr==NULL)) goto err4;
274
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
275
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
275
276
        header.cpscvt = (MYFLT)strtol(s1, &endptr, 10);
276
277
        if (UNLIKELY(endptr==NULL)) goto err4;
277
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
278
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
278
279
        header.loopmode1 = (int16) strtol(s1, &endptr, 10);
279
280
        if (UNLIKELY(endptr==NULL)) goto err4;
280
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
281
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
281
282
        header.loopmode2 = (int16) strtol(s1, &endptr, 10);
282
283
        if (UNLIKELY(endptr==NULL)) goto err4;
283
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
284
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
284
285
        header.begin1 = strtol(s1, &endptr, 10);
285
286
        if (UNLIKELY(endptr==NULL)) goto err4;
286
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
287
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
287
288
        header.end1 = strtol(s1, &endptr, 10);
288
289
        if (UNLIKELY(endptr==NULL)) goto err4;
289
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
290
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
290
291
        header.begin2 = strtol(s1, &endptr, 10);
291
292
        if (UNLIKELY(endptr==NULL)) goto err4;
292
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
293
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
293
294
        header.end2 = strtol(s1, &endptr, 10);
294
295
        if (UNLIKELY(endptr==NULL)) goto err4;
295
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
296
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
296
297
        header.soundend = strtol(s1, &endptr, 10);
297
298
        if (UNLIKELY(endptr==NULL)) goto err4;
298
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
299
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
299
300
        header.flenfrms = strtol(s1, &endptr, 10);
300
301
        if (UNLIKELY(endptr==NULL)) goto err4;
301
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
302
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
302
303
        header.nchanls = strtol(s1, &endptr, 10);
303
304
        if (UNLIKELY(endptr==NULL)) goto err4;
304
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
305
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
305
306
        header.fno = strtol(s1, &endptr, 10);
306
307
        if (UNLIKELY(endptr==NULL)) goto err4;
307
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
308
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
308
309
        header.gen01args.gen01 = (MYFLT)strtod(s1, &endptr);
309
310
        if (UNLIKELY(endptr==NULL)) goto err4;
310
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
311
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
311
312
        header.gen01args.ifilno = (MYFLT)strtod(s1, &endptr);
312
313
        if (UNLIKELY(endptr==NULL)) goto err4;
313
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
314
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
314
315
        header.gen01args.iskptim = (MYFLT)strtod(s1, &endptr);
315
316
        if (UNLIKELY(endptr==NULL)) goto err4;
316
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
317
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
317
318
        header.gen01args.iformat = (MYFLT)strtod(s1, &endptr);
318
319
        if (UNLIKELY(endptr==NULL)) goto err4;
319
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
320
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
320
321
        header.gen01args.channel = (MYFLT)strtod(s1, &endptr);
321
322
        if (UNLIKELY(endptr==NULL)) goto err4;
322
 
        fgets(s, 64, file);  s1 = strchr(s, ' ')+1;
 
323
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
323
324
        header.gen01args.sample_rate = (MYFLT)strtod(s1, &endptr);
324
325
        if (UNLIKELY(endptr==NULL)) goto err4;
325
 
        fgets(s, 64, file);
 
326
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;  s1 = strchr(s, ' ')+1;
326
327
        /* WARNING! skips header.gen01args.strarg from saving/loading
327
328
           in text format */
328
329
        header.fno = (int32) fno;
332
333
        memcpy(ftp, &header, sizeof(FUNC) - sizeof(MYFLT));
333
334
        memset(&(ftp->ftable[0]), 0, sizeof(MYFLT) * (ftp->flen + 1));
334
335
        for (j = 0; j <= ftp->flen; j++) {
335
 
          fgets(s, 64, file);
 
336
          if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;
336
337
          ftp->ftable[j] = (MYFLT) strtod(s, &endptr);
337
338
          if (UNLIKELY(endptr==NULL)) goto err4;
338
339
        }
339
 
        fgets(s, 64, file);
 
340
        if (UNLIKELY(NULL==fgets(s, 64, file))) goto err4;
340
341
        argp++;
341
342
      }
342
343
    }
494
495
#define S(x)    sizeof(x)
495
496
 
496
497
static OENTRY localops[] = {
497
 
  { "ftgen",    S(FTGEN),     1,  "i",  "iiiTTm", (SUBR) ftgen, NULL, NULL    },
498
 
  { "ftgentmp", S(FTGEN),     1,  "i",  "iiiiTm", (SUBR) ftgentmp, NULL, NULL },
499
 
  { "ftfree",   S(FTFREE),    1,  "",   "ii",     (SUBR) ftfree, NULL, NULL   },
500
 
  { "ftsave",   S(FTLOAD),    1,  "",   "Tim",    (SUBR) ftsave, NULL, NULL   },
501
 
  { "ftload",   S(FTLOAD),    1,  "",   "Tim",    (SUBR) ftload, NULL, NULL   },
502
 
  { "ftsavek",  S(FTLOAD_K),  3,  "",   "Tkim",   (SUBR) ftsave_k_set,
 
498
  { "ftgen",    S(FTGEN),     TW|1,  "i",  "iiiTTm", (SUBR) ftgen, NULL, NULL    },
 
499
  { "ftgentmp", S(FTGEN),     TW|1,  "i",  "iiiiTm", (SUBR) ftgentmp, NULL, NULL },
 
500
  { "ftfree",   S(FTFREE),    TW|1,  "",   "ii",     (SUBR) ftfree, NULL, NULL   },
 
501
  { "ftsave",   S(FTLOAD),    TR|1,  "",   "Tim",    (SUBR) ftsave, NULL, NULL   },
 
502
  { "ftload",   S(FTLOAD),    TR|1,  "",   "Tim",    (SUBR) ftload, NULL, NULL   },
 
503
  { "ftsavek",  S(FTLOAD_K),  TW|3,  "",   "Tkim",   (SUBR) ftsave_k_set,
503
504
                                                  (SUBR) ftsave_k, NULL       },
504
 
  { "ftloadk",  S(FTLOAD_K),  3,  "",   "Tkim",   (SUBR) ftsave_k_set,
 
505
  { "ftloadk",  S(FTLOAD_K),  TW|3,  "",   "Tkim",   (SUBR) ftsave_k_set,
505
506
                                                  (SUBR) ftload_k, NULL       }
506
507
};
507
508