zsh-workers
 help / color / mirror / code / Atom feed
* how to expose a simple const char *array[]?
@ 2015-03-19 14:59 Roman Neuhauser
  2015-03-19 21:59 ` Roman Neuhauser
  2015-03-19 22:40 ` Bart Schaefer
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Neuhauser @ 2015-03-19 14:59 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-19 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-19 14:59 how to expose a simple const char *array[]? Roman Neuhauser
2015-03-19 21:59 ` Roman Neuhauser
2015-03-19 22:40 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).