Electronic Music mailing list archives

Previous Message: Re: contanenating tables
Next Message: Re: Scoring

From: Istvan Varga ()
Date: Apr 29, 2005
Subject: Re: --strset option, strtod and strtol opcodes
Gabriel Maldonado wrote:

> is there a maximum length for an "S" string?

With the current implementation, there is a maximum length, because
string variables are stored in the same way as a-rate variables, that
is, an array of MYFLT of which the size cannot be changed at performance
time. You can set the maximum length with the -+max_str_len option
(defaults to 256). Note that the size of string constants (as opposed
to variables) is not limited.
It is possible to make some changes to have strings with fully dynamic
length, by storing a structure that contains a char* pointer and
information like the current buffer size, instead of the string itself,
i.e. an opcode would access strings like this (assuming that the pointer
is the first member of the structure):

     typedef struct {
         OPDS    h;
         MYFLT   *str;
         ...

     char *s = *((char**) p->str);

instead of the current way:

     char *s = (char*) p->str;

Of course, this would need changes to existing opcodes.
--  [EMAIL REMOVED]               (or to http://www.cs.bath.ac.uk/cgi-bin/csound ) [EMAIL REMOVED] 

+ --strset option, strtod and strtol opcodes Istvan Varga (04/29/05)
+---Re: --strset option, strtod and strtol opcodes Gabriel Maldonado (04/29/05)
+------Re: --strset option, strtod and strtol opcodes Istvan Varga (04/29/05)

Previous Message: Re: contanenating tables
Next Message: Re: Scoring