(ly:make-music-head
(lambda (where type)
(context-spec-music
- (context-spec-music (make-property-set whichBar type) 'Timing)
+ (context-spec-music (make-property-set 'whichBar type) 'Timing)
'Score))
(list string?)
*/
#include "identifier-smob.hh"
-/*
- C&P from example/box.c
- */
+
scm_t_bits package_tag;
-/* Print a textual represenation of the smob to a given port. */
static int
print_box (SCM b, SCM port, scm_print_state *)
{
LY_DEFINE (package_identifier, "ly:export", 1,0,0, (SCM arg),
"Export a Scheme object to the parser, so it is treated as an identifier.")
{
- /* This macro creates the new objects, stores the value `#f' into it
- and returns it to the caller. */
SCM_RETURN_NEWSMOB (package_tag, arg);
}
-/* This is the primitive `box-ref' which returns the object stored in
- the box. */
SCM
unpack_identifier (SCM box)
{
#define IMPLEMENT_TYPE_P(CL, FUNCNAME)\
+SCM CL ## _type_p_proc;\
void init_type_ ## CL ()\
{\
SCM subr = scm_c_define_gsubr (FUNCNAME, 1, 0, 0, (Scheme_function_unknown) CL::smob_p);\
+ CL ## _type_p_proc = subr;\
ly_add_function_documentation (subr, FUNCNAME, "(SCM x)", "Is @var{x} a @code{" #CL "} object?");\
scm_c_export (FUNCNAME, NULL);\
}\
return CL::unsmob (s); \
}
-#define DECLARE_TYPE_P(CL) extern SCM CL_ ## _type_p_proc
+#define DECLARE_TYPE_P(CL) extern SCM CL ## _type_p_proc
#endif /* SMOBS_HH */
int
music_head_type (SCM func)
{
- SCM type= scm_object_property (func, ly_symbol2scm ("music-head-signature"));
+ SCM type= scm_object_property (func, ly_symbol2scm ("music-head-signature-keyword"));
if (type == ly_symbol2scm ("scm"))
{
return MUSIC_HEAD_SCM;
*/
#include "music-head.hh"
#include "string.hh"
-
-/*
- C&P from example/box.c
- */
+#include "music.hh"
static scm_t_bits music_head_tag;
}
-/* This defines the primitve `make-music_head', which returns a new smob of
- type `music_head', initialized to `#f'. */
LY_DEFINE (ly_make_music_head, "ly:make-music-head", 2, 0, 0,
(SCM func, SCM signature),
"Make a function to process music, to be used for the "
"Its arguments. @code{signature} is a list containing either "
"@code{ly:music?} predicates or other type predicates.")
{
- /* This macro creates the new objects, stores the value `#f' into it
- and returns it to the caller. */
String str = "";
-
- int k = 0;
for (SCM s = signature; ly_c_pair_p (s); s = ly_cdr (s))
{
if (str != "")
if (ly_car (s) == Music_type_p_proc)
str += "music";
- else if (ly_procedure_p (ly_car (s)))
+ else if (ly_c_procedure_p (ly_car (s)))
str += "scm";
-
- k++;
}
scm_set_object_property_x (func, ly_symbol2scm ("music-head-signature"),
}
-/* This is the primitive `music_head-ref' which returns the object stored in
- the music_head. */
SCM
get_music_head_transform (SCM music_head)
{
SCM m = scm_call_2 ($1, make_input (THIS->pop_spot ()),
$3);
if (unsmob_music (m))
- $$ = unsmob_music (m);
+ { $$ = unsmob_music (m);
+ scm_gc_protect_object (m);
+ }
else
{
THIS->parser_error ("MUSIC_HEAD should return Music");