Logo Search packages:      
Sourcecode: csound version File versions  Download package

PUBLIC char** csoundListUtilities ( CSOUND *  csound  ) 

Returns a NULL terminated list of registered utility names. The caller is responsible for freeing the returned array with csoundDeleteUtilityList(), however, the names should not be changed or freed. The return value may be NULL in case of an error.

Definition at line 142 of file utility.c.

References csoundListUtilities().

Referenced by csoundListUtilities().

{
    csUtility_t *p = (csUtility_t*) csound->utility_db;
    char        **lst;
    int         utilCnt = 0;

    /* find out the number of utilities */
    while (p != NULL)
      p = p->nxt, utilCnt++;
    /* allocate list */
    lst = (char**) malloc(sizeof(char*) * (utilCnt + 1));
    if (lst == NULL)
      return NULL;
    /* store pointers to utility names */
    utilCnt = 0;
    p = (csUtility_t*) csound->utility_db;
    while (p != NULL) {
      lst[utilCnt++] = (char*) p->name;
      p = p->nxt;
    }
    lst[utilCnt] = NULL;
    qsort(lst, utilCnt, sizeof(char*), cmp_func);
    /* return with pointer to list */
    return lst;
}


Generated by  Doxygen 1.6.0   Back to index