[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3262 - in GNUnet: contrib src/setup/lib
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3262 - in GNUnet: contrib src/setup/lib |
Date: |
Sat, 19 Aug 2006 20:14:56 -0700 (PDT) |
Author: grothoff
Date: 2006-08-19 20:14:53 -0700 (Sat, 19 Aug 2006)
New Revision: 3262
Modified:
GNUnet/contrib/config-daemon.scm
GNUnet/src/setup/lib/tree.c
Log:
docs
Modified: GNUnet/contrib/config-daemon.scm
===================================================================
--- GNUnet/contrib/config-daemon.scm 2006-08-20 03:00:33 UTC (rev 3261)
+++ GNUnet/contrib/config-daemon.scm 2006-08-20 03:14:53 UTC (rev 3262)
@@ -1,3 +1,29 @@
+;; This is not a stand-alone guile application.
+;; It can only be executed from within gnunet-setup.
+;;
+;; GNUnet setup defines a function "build-tree-node"
+;; (with arguments section, option, description, help,
+;; children, visible, value and range) which is
+;; used by the script to create the configuration tree.
+;;
+;; GNUnet setup also defines a function "change-visible"
+;; (with arguments context, option, section, yesno) which
+;; can be used by the script to dynamically change the
+;; visibility of options.
+;;
+;; Finally, GNUnet setup defines a function "get-option"
+;; (with arguments context, option, section) which
+;; can be used to query the current value of an option.
+;;
+;;
+;; GNUnet setup requires two functions from this script.
+;; First, a function "setup" which constructs the
+;; configuration tree.
+;;
+;; Second, a function "change" which is notified whenever
+;; configuration options are changed; the script can then
+;; change the visibility of other options.
+;;
(define (change ctx root changed)
( 0 ) )
Modified: GNUnet/src/setup/lib/tree.c
===================================================================
--- GNUnet/src/setup/lib/tree.c 2006-08-20 03:00:33 UTC (rev 3261)
+++ GNUnet/src/setup/lib/tree.c 2006-08-20 03:14:53 UTC (rev 3262)
@@ -111,6 +111,41 @@
return NULL;
}
+SCM get_option(SCM smob,
+ SCM option,
+ SCM section) {
+ TC * tc;
+ char * opt;
+ char * sec;
+ struct GNS_Tree * t;
+
+ SCM_ASSERT(SCM_SMOB_PREDICATE(tc_tag, smob), smob, SCM_ARG1,
"change_visible");
+ SCM_ASSERT(scm_string_p(option), option, SCM_ARG2, "change_visible");
+ SCM_ASSERT(scm_string_p(section), section, SCM_ARG3, "change_visible");
+ tc = (TC *) SCM_SMOB_DATA(smob);
+ opt = scm_to_locale_string(option);
+ sec = scm_to_locale_string(section);
+ t = tree_lookup(tc->root,
+ sec,
+ opt);
+ if (t == NULL)
+ return SCM_EOL;
+ switch (t->type & (-1 ^ GNS_KindMask) ) {
+ case 0:
+ return SCM_EOL; /* no value */
+ case GNS_Boolean:
+ return (t->value.Boolean.val) ? SCM_BOOL_T : SCM_BOOL_F;
+ case GNS_UInt64:
+ return scm_from_uint64(t->value.UInt64.val);
+ case GNS_Double:
+ return scm_from_double(t->value.Double.val);
+ case GNS_String:
+ return scm_from_locale_string(t->value.String.val);
+ }
+ GE_BREAK(NULL, 0);
+ return SCM_EOL;
+}
+
/**
* Change the visibility of an entry in the
* tree (and notify listeners about change).
@@ -258,6 +293,9 @@
scm_c_define_gsubr("build-tree-node",
8, 0, 0,
&build_tree_node);
+ scm_c_define_gsubr("get-option",
+ 3, 0, 0,
+ &get_option);
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3262 - in GNUnet: contrib src/setup/lib,
grothoff <=