2 function-documentation.cc -- Scheme doc strings.
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
12 #include "std-string.hh"
13 #include "lily-guile.hh"
17 static SCM doc_hash_table
;
20 ly_check_name (string cxx
, string scm_name
)
22 string mangle
= mangle_cxx_identifier (cxx
);
23 if (mangle
!= scm_name
)
25 programming_error ("wrong cxx name: " + mangle
+ ", " + cxx
+ ", " + scm_name
);
31 ly_add_function_documentation (SCM func
,
40 doc_hash_table
= scm_permanent_object (scm_c_make_hash_table (59));
42 string s
= string (" - ") + "LilyPond procedure: " + fname
+ " " + varlist
45 scm_set_procedure_property_x (func
, ly_symbol2scm ("documentation"),
47 SCM entry
= scm_cons (ly_string2scm (varlist
), ly_string2scm (doc
));
48 scm_hashq_set_x (doc_hash_table
, ly_symbol2scm (fname
.c_str ()), entry
);
51 LY_DEFINE (ly_get_all_function_documentation
, "ly:get-all-function-documentation",
53 "Get a hash table with all LilyPond Scheme extension functions.")
55 return doc_hash_table
;
61 map
<void *, string
> type_names
;
64 ly_add_type_predicate (void *ptr
,
67 type_names
[ptr
] = name
;
71 predicate_to_typename (void *ptr
)
73 if (type_names
.find (ptr
) == type_names
.end ())
75 programming_error ("Unknown type predicate");
76 return "unknown type";
79 return type_names
[ptr
];
82 /* type predicates. */
86 #include "music-function.hh"
87 #include "performance.hh"
88 #include "paper-score.hh"
89 #include "global-context.hh"
95 ly_add_type_predicate ((void*) &is_direction
, "direction");
96 ly_add_type_predicate ((void*) &is_music_function
, "Music_function");
97 ly_add_type_predicate ((void*) &ly_is_port
, "port");
98 ly_add_type_predicate ((void*) &ly_cheap_is_list
, "list");
99 ly_add_type_predicate ((void*) &unsmob_global_context
, "Global_context");
100 ly_add_type_predicate ((void*) &unsmob_input
, "Input");
101 ly_add_type_predicate ((void*) &unsmob_moment
, "Moment");
102 ly_add_type_predicate ((void*) &unsmob_paper_score
, "Paper_score");
103 ly_add_type_predicate ((void*) &unsmob_performance
, "Performance");
105 ly_add_type_predicate ((void*) &is_axis
, "axis");
106 ly_add_type_predicate ((void*) &is_number_pair
, "number pair");
107 ly_add_type_predicate ((void*) &ly_is_list
, "list");
108 ly_add_type_predicate ((void*) &ly_is_procedure
, "procedure");
109 ly_add_type_predicate ((void*) &ly_is_symbol
, "symbol");
110 ly_add_type_predicate ((void*) &scm_is_bool
, "boolean");
111 ly_add_type_predicate ((void*) &scm_is_integer
, "integer");
112 ly_add_type_predicate ((void*) &scm_is_number
, "number");
113 ly_add_type_predicate ((void*) &scm_is_pair
, "pair");
114 ly_add_type_predicate ((void*) &scm_is_rational
, "rational");
115 ly_add_type_predicate ((void*) &scm_is_string
, "string");
116 ly_add_type_predicate ((void*) &scm_is_vector
, "vector");
117 ly_add_type_predicate ((void*) &unsmob_item
, "Item");
118 ly_add_type_predicate ((void*) &unsmob_music
, "Music");
119 ly_add_type_predicate ((void*) &unsmob_spanner
, "Spanner");
122 ADD_SCM_INIT_FUNC (func_doc
, init_func_doc
);