Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
how to expose a simple const char *array[]?
- X-seq: zsh-workers 34745
 
- From: Roman Neuhauser <neuhauser@xxxxxxxxxx>
 
- To: zsh-workers@xxxxxxx
 
- Subject: how to expose a simple const char *array[]?
 
- Date: Thu, 19 Mar 2015 15:59:47 +0100
 
- List-help: <mailto:zsh-workers-help@zsh.org>
 
- List-id: Zsh Workers List <zsh-workers.zsh.org>
 
- List-post: <mailto:zsh-workers@zsh.org>
 
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
 
hello,
i need a little help in exposing an array from zsh.
i'm trying to wrap the contents of Src/zshpaths.h in a module, initial
smoke tests look ok except this one thing: FPATH_SUBDIRS as an array.
the other modules that expose arrays use array_gsu structures as the
values need to be generated on the fly.  my case should be simpler so i
thought i'd get away without any fanfare, but it segfaults on access.
#define FPATH_SUBDIRS { "Calendar", "Chpwd", "Completion" /* , ... */ }
#ifdef FPATH_SUBDIRS
static const char *fpath_subdirs[] = FPATH_SUBDIRS;
#else
static const char *fpath_subdirs[] = { NULL };
#endif
static struct paramdef patab[] = {
    PARAMDEF("module_dir",      PM_SCALAR|PM_READONLY, &module_dir, NULL),
    PARAMDEF("sitescript_dir",  PM_SCALAR|PM_READONLY, &sitescript_dir, NULL),
    PARAMDEF("script_dir",      PM_SCALAR|PM_READONLY, &script_dir, NULL),
    PARAMDEF("sitefpath_dir",   PM_SCALAR|PM_READONLY, &sitefpath_dir, NULL),
    PARAMDEF("fixed_fpath_dir", PM_SCALAR|PM_READONLY, &fixed_fpath_dir, NULL),
    PARAMDEF("fpath_dir",       PM_SCALAR|PM_READONLY, &fpath_dir, NULL),
    PARAMDEF("fpath_subdirs",   PM_ARRAY |PM_READONLY, &fpath_subdirs, NULL)
};
it's surely doing something stupid...
-- 
roman
Messages sorted by:
Reverse Date,
Date,
Thread,
Author