]> git.donarmstrong.com Git - lilypond.git/blob - TODO
patch::: 1.1.44.jcn1
[lilypond.git] / TODO
1 -*-outline-layout:(2 (-1 -1 0 :) 0);outline-stylish-prefixes:nil -*-
2
3 * GNU LilyPond TODO
4 Features you cannot find in the doco as working, should be
5 mentioned here.  This is an assorted collection of stuff that will be
6 done, might be done, or is an idea that I want to think about
7
8 Most of the items are marked in the code as well
9 Grep for TODO and ugh/ugr/urg.  
10
11 .* BUGS
12 . * junk separate mudela versioning. 
13 . * PostScript
14 .  * header for PS enteredby = "bla <bla@bar.com>"
15 .  * ps/lily.ps see comments.
16 . * down tuplet spanner.
17 . * didot / big point.
18 . * devise standard for functioning of Vertical_align_element.
19 . * midi key.
20 . * Repeats
21 .  * input/bugs/rep.ly (moved from test)
22 .  * unfold broken: 
23 .   * without alternatives: repeat unfold 4 { a b c d }
24 .   * count > alternatives: repeat unfold 79 { a b c d } 
25 \alternative { { c c c c } { d d d d } }
26 .  * kind of 'initial property' iso fold/volta(semi)/unfold strings
27 . * fix singleStaffBracket
28 . * declare performers in \midi
29 . * fix MIDI
30 . * \shape 1st dim skipped? 
31 . * turn slope-damping on/off
32 . * tremolo stuff
33 . * We need feta-din*.mf files for more sizes than 10.
34 . * feta-accordeon has some 'strange turning paths' on 300dpi
35 . * fix dynamics decently, ie. use kerning & ligatures.  
36 . * dots & rest collisions?
37 . * mudela-book.py
38 .  * fix \mudelafile{} to have decent functionality
39 .  * P.P.S. It can be cool in mudela-book to distinguish in
40 pre,postMudelaExample, whether MudelaExample is epsed or not: ( if
41 this fragment is floating eps, than 1, otherwise 2). say
42 preMudelaExample[eps]{}, and change it in document body sometimes.
43 .  * use less RE's
44 . * slurs colllide with lyrics.
45 . * Is there any reasonable way to do this: I would like to have one file
46 that can generate the same tune in two different modes without having
47 to go through and rewrite all the music in the other mode.
48
49 Long lyrics don't get a space at the end.  They just run right up
50 against the next lyric.  (I don't think this used to be the case.)
51
52 Lyrics and scripts collide.
53
54 \key b; \time 4/4; looks bad.  The clef and time signature are too close.
55
56 restStyle=mensural doesn't seem to work (lots of characters not found
57 for rests.fly)
58 . * Phrasing:  Indicating the textual underlay of a piece, or
59 otherwise dividing a piece into phrases.
60
61 There are distinct ways of specifying the first two (although at
62 present, they're not properly distinguished) but no distinct way to
63 specify the third.  Should there be?
64 . * rest collision minimum dist.
65 . * a note with a circle after it, meaning:
66
67    note + circle = note + 1/4 of its length
68
69    the circle is like a dot that's not filled in.  for example, on
70    page three, the c-sharp on the second line should be a quarter with 
71    a circle, not a quarter tied to a sixteenth.  is this at all
72    possible with lily?
73 . * tuplets that are written as "number : note", for example
74    "3 : [image of a half note here]".  possible?
75 . * repeat engraver, gallina.ly
76
77 . * Matanya's tips: 
78 .  * spacing for prefatory matter
79 .  * accidentals closer to note head
80 .  * to space the staffs/staffgroups contained in the score.  
81
82 In the orchestscore.ly file, I tried:
83 \paper{
84     \translator {
85         \OrchestralScoreContext
86         minVerticalAlign = 3.0*\staffheight;
87     }
88     \translator { 
89         \StaffGroupContext
90         minVerticalAlign = 3.0*\staffheight;
91     }
92     \translator { 
93         \StaffContext
94         minVerticalAlign = 3.0*\staffheight;
95     }
96 }
97 .  * heavier beams?
98
99 .* Cleanups needed
100 . * Beam
101 . * Stem
102 . * Slur
103 . * Rhythmic_grouping
104 . * Duration
105 . * Collision
106 . * Rest_collision
107 . * clef grav prop's 
108 . * parser
109
110 .* TODO before 1.2
111 . * Morally pure LilyPond.
112 .  * Remove mutopia ramblings.
113 .  * Remove non-free software links.
114 .  * Remove meta article LilyPond.
115 . * break priority setting from SCM.
116 . * Gade score
117 .  * remove [] in favour of auto-beamer
118 . * hangOnClef with non-breakable clefs.
119 . * Aha, the problem is the new TeX code generation for changing fonts.
120 > (The explanation below is mostly intended for Han-Wen and Jan)
121 > Before, the font was changed with macros declared separately for 
122 > pure TeX and LaTeX, but now all the fonts are declared directly in
123 > the generated code using the low-level TeX commands. This circumvents
124 > the fontencoding mechanism of LaTeX and is a potential source of
125 > problems also for us users of the Latin-1 character set. 
126 > I think it still works since the inputencoding latin1 is 
127 > declared by ly2dvi, but it still means that e.g. an o with
128 > umlaut is typeset as a combination of the two symbols 'o' and
129 > 'umlaut' instead of as a single character, as would be the case
130 > if fontencoding OT1 had been used. This shouldn't give any 
131 > difference in layout, though. One of the main argument for using
132 > fontencoding OT1 is for the hyphenation mechanism to work, an 
133 > argument that's clearly irrelevant in our application. Yet we
134 > see the problem for August.
135 . * Abstraction for engravers:
136 .  * make "in-between" engraver (Tie, Extender)
137 .  * make wide_spanner_engraver (line_group_spanne,r staff_symbol)
138 . * remove Interval dim_ from Dimension_cache and rename the struct.
139 . * do scaled fonts generally 
140 . * Spacing.
141 . * The Lilypond accidental symbols are available through the TeX macros, 
142 \textflat, \textsharp and \textnatural defined in the init file
143 lilyponddefs.tex. All the symbols are defined in the files fetaXX.tex
144 where XX corresponds to the size. I don't know where (or even if) they
145 are installed but they are generated in the mf/out/ directory during the
146 compilation.
147 . * make dependencies () a virtual function.
148 . * one big ly2dvi input that includes *all* tests.
149 . * store req -> element, element -> element causes for warnings
150 . * include examples in RPM.
151 . * fix partial measures in meaningful way.
152 . * add scripts to bars eg.  |^"bla" 
153 . * relative mode for mi2mu
154 . * uniformise recent feta contributions.
155 .  * use SCM and Molecules for {accordeon stuff, }
156 .  * bigger and fatter 4/4 C
157 . * sort out directory stuff.
158 .  * --prefix option?
159 .  * -I option per filetype?
160 .  * kpathsea?
161 . * ly2dvi/lilypond logfile.
162 . * fractional chord durs.
163 . * hang Item on Spanner
164 . * do --safe for PS output?
165 . * convert-mudela --output
166 . * Staff_margin (with a partial measure.)
167 . * fix pletvisibility properties:
168 .  * bracket on/off/no-bracket-when-beam
169 .  * num on/off/no-num-when-beam
170 . * fix: standchen.
171 . * junk text{sharp,flat,etc}
172 . * fix convert-mudela manpage
173 . * decimal point in \paper {}
174 . * {  \voiceone <a'4.*2/3  d''4.*2/3 fis''4.*2/3>  [g''8 fis'' e''] d''4 |}
175          and
176          { \voicetwo  d'4 d'2.*2/3 } spacing
177 . * tied notes for MIDI
178 . * sharp / flat on trills (in MIDI ??)
179 . * scm-ify \property values.
180 . * move class Lookup {} into scm
181 . * msgfmt -o check?
182 . * \breathmark TeX macro 
183 . * add new glyphs to font.ly
184 . * formatting of input stuff. 
185 . * \notes{ a \< b \cr } vs \notes{ a \< b \! }
186 . * space after bars?
187 . * 'hinterfleisch' before bar (e.g. wtk1-fugue2)?
188 . * Summary of minor spelling irregularities:
189 .  *  capitalization/use of underscores in property names
190 .  * fix SkipBars  -> skipBars
191 . * broken scripts:
192         lbheel = \script { "bheel" 0 0 -1  0 0 }
193         rbheel = \script { "bheel" 0 0 1 0 0 }
194         lbtoe = \script { "btoe" 0 0 -1 0 0 }
195         rbtoe = \script { "btoe" 0 0 1 0 0 }
196         lfheel = \script { "fheel" 0 0 -1  0 0 }
197         rfheel = \script { "fheel" 0 0 1 0 0 }
198         lftoe = \script { "ftoe" 0 0 -1 0 0 }
199         rftoe = \script { "ftoe" 0 0 1 0 0 }
200         and also
201         portato= \script { "portato" 0 -1 0 1 0 }
202 . * ly2dvi
203 .  * bottomnote for ly2dvi
204 .  * deps for ly2dvi
205
206 .* STUFF
207 . * compulsory hshift
208 . * Give # lines in linebreaking.  
209 . * arrows on slurs.
210 . * rewrite context defs using Scheme
211 . * \selectmusic to cut pieces from music. 
212 . * TODO: merge atom & molecule; make  tree from molecule.
213 . * Align_element::padding  ?
214 . * typo checks on property names?
215 . * use streambufs and iostream
216         to provide IO handling for TeX stream, mudela stream, data-file.
217 . * seriously buffer TeX output (do profile of writing .5 mb TeX file.)
218 . * strip EXEs before installing
219 . * zip target for binary windows dist (JBR)
220 . * junking \skip req in lyrics
221 . * mi2mu empty staffs.
222 . * use Fourier transformation for rhythmic quantisation.
223 . * horizontal centering of dynamics 
224 . * $DEPENDENCIES_OUTPUT support
225 . * Xdvi zooming ?! Try to understand GS garbage collection.
226 gs: Error: /undefined in draw_beam
227 gs: Operand stack:
228 . * fix vertical alignment and stafflines
229 . * declaring Performers
230 . * *.yo: fix pod manpage layout legacy
231 . * text-items clash with stems/beams
232 . * --include, -I option for ly2dvi (pass on to lily)
233 . * fix placement of beam-less abbrev
234 . * \meter 3/4;
235         <{\voiceone cis4. cis8 cis4 | cis4 cis cis | r1 }
236          {\voicetwo cis,4 r r | r2. | r1 }> |
237         }
238 . * Musical_pitch (analogous to Duration and Rhythmic_req)
239           think about, analogous to pitch: 
240            * { a4 a16 } c <-- duration of c?
241            * < a4 b8 > c <-- duration of c?
242 . * \tempo 4. = 90;
243 . * fix audio-items (don't use (input) requests, but copy data)
244 . * make sure all ex's have a mudela-version
245 . * do rest-collisions for Multi_measure_rests as well.
246 . * split error/warning in error/warning/non_fatal_error
247 . * add a Duration_convert member to Duration_iter to set parameters.
248         Junk global duration settings. 
249 . * en-,discouraged linebreaking: 
250 .  * handle DISALLOW < penalty > FORCE
251 .  * discourage breaking of slurs
252 . * fix variable define/lookup parser global<->paper
253 . * fix title/instrument placements; see input/test/title.ly
254 . * <\voiceone c4. \voicetwo c4>
255 . * add full cello suites to web site (kom op, Maarten!)
256 . * add mudela-book-doc source to webstie.
257 . * Rethink Time_description
258 \cadenza , \meter, \grouping should all be \properties
259 . * rename
260 .  * measure -> bar
261 .  * abbrev -> tremolo
262 .  * abbreviation-beam -> (measured/unmeasured) tremolo
263 .  * partial -> anacrouse
264 . * robustify Beam (in case of no stems, 32nd notes)
265 . * move paper vars into engraver properties
266 . * check for groff / troff/ nroff et
267 . * more intelligent file searching
268 . * disable spaces in TeX stuff
269 . * handle ^C for tmp/file creation.
270 . * make LilyPond RPM fully relocatable
271 . * dots & rest collisions.
272 . * the warning about the negative slur/tie length appears twice
273 which is irritating.
274 . * better hshift (dots, distance, head dependent)
275 . * clefs (AG): The "8" should appear closer to the actual clef,
276 touching it.
277 . * put errorlevel in Input class
278 . * junk nesting slurs
279 . * integrate midi-elts from mi2mu and lily?
280 . * distinguish between unset and empty properties. 
281
282 .* FONT
283 . * the bracket is ugly (wings are too parabolic, should be more circular)
284 . * versioning for Feta
285 . * rewrite dynamic signs.  They're kind of spaghetti now. 
286 . * The `3' in the meter key is a one or two pixels too thin (at 600dpi)
287         in the middle:
288 . * design macro for penstroke with rounded endings
289 . * timesig C: fat yet less curved.  Check out relations. 
290 . * design decent macro for bulbed endings
291 . * printer dependencies.
292 . * versioning  
293 . * lo-res fixes.
294 . * work out sizes of character fonts.
295 . * more symbols
296 .  * piano pedals: Ped/*
297 .  * maxima notehead
298 .  * coda signs: Segno, O+
299 .  * glissando, arpeggio
300 .  * lengthened trill
301 . * include important spacing dims in fetalog 
302 . * scalability: use blot_diameter everywhere, make font chubbier for
303     small sizes.
304
305 .* 3RD PARTY BUGS
306 . * GNU diff 2.7: diff -rN does not see a new directory with empty file
307 . * check out GCC signatures?
308 . * glibc 2.0:
309           f = fopen ("/dev/null", "r")
310           assert (feof (f))
311
312 . * tetex: mfplain.mem
313 .* 3RD PARTY PROJECTS:
314 . * make GCC warn about ctor that leaves member vars  uninitialised.
315 . * GNU patch 
316 .  * 'double-fix' mode: ignore identical fix, rather than suggest 
317             to revert patch direction when (more or less? exactly) the same 
318             thing is fixed
319 .* PROJECTS
320 . * Scripts:
321 .  * stack scripts in chords:
322           % fingering:        footing:
323             < a-4 c-2 g-1 >   < c-\ltoe e-\lheel >
324 .  * script-spacing
325 .  * slur parts as a script
326 .  * stack parameterised scripts for fingering and footing:
327
328 . * convert-mudela:
329 .  * automatically add  a \version if not present.
330 .  * better parsing
331 .  * make smarter
332 .  * convert-mudela -e empty.ly
333
334 . * emacs mudela-mode
335 .  *  should handle block comments too.
336 .  *  handle lexer modes (\header, \melodic, \lyric) etc.
337 .  *  indentation
338 .  *  notenames?
339 .  *  fontlock: \melodic \melodic
340
341 . * use properties for:
342 .  * default tempo.
343 .  * cadenza mode? 
344
345 . * page handling:
346 .  * PS output
347 .  * optimal pagebreaking.
348
349 . * Unicode support? -> man 7 unicode
350 .  * 16 bit Strings
351 .  * -u switch
352 .  * detect of 16/8 bit files
353 .  * examples to go with it.
354
355 . * \header
356 .  * output header info to MIDI too.
357
358 . * a musical dictionary. See Documentation/vocabulary-*, other
359 languages:
360 .  * explanations
361 .  * italian
362 .  * german
363 .  * dutch
364 .  * swedish
365          .. ?
366
367 . * chords
368 .  * guitar chords (fret diagrams)
369 .  * other chord name styles (american(?) style)
370 .  * basso continuo
371 .  * MIDI output?
372
373 . * Debug logs:
374 .  * derive lily_stream, Dstream, texstream from ostream?
375 .  * indentable stream as baseclass for TeX stream, lily stream, Dstream.
376 .  * use dstream feature in mi2mu
377 .  * integrate IO checking into stream class
378
379 . * input converters
380 .  * NIFF?
381 .  * ABC? 
382 .  * SMDL?
383
384 . * add to MIDI output:
385 .  * tempo change
386 .  * ornaments (and trills?)
387 .  * slurs
388 .  * accents
389 .  * dynamics
390 > Would it be hard to add support for proper dynamics in MIDI output?  I
391 > would really like to have this feature...
392
393 To answer this, I have to give a little background.  Please say so if
394 I am being obtuse.
395
396 Both audio and notation elements are created decentrally, when
397 LilyPond says "Interpreting music ... [8][16] etc."  After all
398 elements are created, they are processed again to calculate all
399 parameters.  After that is done, they are dumped onto the output (the
400 MIDI stream or the TeX file).
401
402 The audio and notation elements are created by objects called
403 performer and engraver respectively.  They work by taking a chunk of
404 input (a so-called request), and using the request to create an audio
405 or notation element.
406
407 After some processing, the engraver sends the created elements to
408 its enclosing notation/performance context.
409
410 In the case of notation, engravers can also modify existing elements
411 created by sibling engravers.  Eg. the beam-engraver will modify stems
412 when it creates a beam over a couple of stems.  This is done in
413 Engraver::do_acknowledge_element () and
414 Engraver::do_process_acknowledged ().
415
416 In the case of audio, there are no mechanisms to modify existing audio
417 elements. After the audio elements are created, they are sent directly
418 to the enclosing context (an instance of Performer_group_performer),
419 through the method Performer::play ()
420
421 Concretely spoken, for dynamics you have to write a performer
422 (Dynamics_performer), that will take the input requests. If I
423 understand correctly, every MIDI note played must have its dynamic
424 strength set separately.  That means the the Dynamics_performer must
425 set the strength of every Audio_note it finds.  This means that one
426 has to modify existing Audio items.  The best way of doing this is
427 with a broadcast/acknowledge process.
428
429 So the best way of handling this, is
430
431   1 supporting dynamic settings in Audio_note
432
433   2 mimicking the broadcast/acknowledge mechanism of the Engravers in
434   the Performers
435
436   3 using that mechanism to write a Dynamics_performer that will modify
437   any notes it finds to set appropriate strengths.
438
439 You could also kludge this by deriving from Performer_group_performer
440 a performer that also sets dynamics within notes, but that is not the
441 elegant way to do it.
442
443 I'd say that the work involved is not hard, but you have to be fluent
444 with C++ and need some insight into the working of Notation Contexts
445 and friends.  I guess I could do it in a day or so, but if you are not
446 so fluent with the inner workings of LilyPond, it could take you some
447 more time (A few more days?).
448
449 Please note, that I am *not* going to code this myself: my days are
450 valuable, and I think I have more interesting things to do than fixing
451 the MIDI output (I don't even have a soundcard).  But I *do* want to help
452 you or other people with implementing this, so if you need help, don't
453 hesitate to ask.
454
455 .  * account for rhythmic position in measure
456 .  * etc.
457
458 . * grace notes
459 .  * make separate class for Grace_*_engravers 
460         (which is at Voice_gravs level)
461 .  * make encapsulated spacing problems.
462
463 . * accidentals per Voice_group
464
465 . * Output class, handles : (smallish)
466 .  * help text /(c) notice?
467 .  * version line
468 .  * warning /errors/progress
469 .  * abort on error/warning; exit status
470 .  * quiet/ignore-version options
471 .  * logfile output
472
473 . * PS 
474 .  * speed up PS code.
475 .  * PS lines to .eps files
476 .  * write custom prolog
477
478 . * SGML input
479
480 . * Documentation
481 .  * remove links to non-free SW.
482 .  * internal documentation
483 .  * a general paper. 
484 .  * \properties
485 .   * left/rightbeamcount
486 .   * various other new properties.
487 .  * introduction?
488 .  * info?
489 .  * LaTeX?
490 .  * more manpages?
491 .  * Doc (C) stuff of sheet music
492 .  * a better format?  SGML?  TeX?  Info?
493 .  * a better tutorial
494
495 . * more spanners (smallish)
496 .  * Glissando
497 .  * trill
498
499 . * Rewrite Stem, Beam and Rhythmic_grouping (hairy)
500 .  * [c8. c32 c32]
501 .  * doc on Rhythmic_grouping
502 .  * general shaving on Beam and Stem
503 .  * use plet grouping
504 .  * separate visual from rhythmic info even more
505 .  * beams over bars
506
507 . * lines:
508 .  * Ledger lines, should be separate item: Ledger_lines
509 .  * set different line sizes / thicknesses
510 .  * beam stem showthrough, inter beam sizes (french vs german style)
511
512 . * Collisions
513 .  * left/right note balls should be handled by Collision:
514         < \multi 2; { \stem 1; <b c> } { <f as b> } >
515
516 . * Keys:
517 .  * merge key{item} & localkey{item}?
518 .  * spacing, national styles?
519
520 . * Support for TAB
521 .  * redo Notehead to allow digits as heads
522 .  * add a \tablature {} lexer mode for easy entering
523
524 . * should adjust stemlength for flag number.
525
526 . * breaking:
527 .  * caching breakpoints
528 .  * saving them
529 .  * specify number of lines
530
531 .* INPUTLANGUAGE
532 . * \rhythms 4 16 16 16 16; c c c c c -> c4 c16 etc. 
533 . * Language:
534 .  * \translator -> ?
535 .  * fix \partial 
536 .  * \bla {} vs \bla ; 
537 .  * mix engraver hacking with music ?
538 .  * \once\property  KEY = VAL
539 .  * \addtranslator, \removetranslator
540 .  * junk ^ and _ for scripts
541 .  * junk _ for lyrics.
542 .  * abstract grammar.
543 . * Figure out semicolons.
544 . * c4 4 4 4 for c4 c4 c4 c4?
545 . * <c f a>4 ?
546 . * Viola mode?
547
548                 @c c g e g 
549         for
550                 c g es g, 
551
552                 @A c g e g
553         for
554                 cis gis e gis
555 . * configure pitch_byte
556 . * rest name configurable
557
558
559 .* SMALLISH PROJECTS
560
561 . * Faulenzer sign (% repeat).  Perhaps also use \repeat syntax?
562
563 . * fix confusing naming in Engraver vs Engraver_group_engraver (context)
564
565 . * progress when creating MIDI elts.
566
567 . * A range for context errors (eg. mark both { and }. )
568
569 . * lyric in staff  (sharpsharp in staff, text below)
570
571 . * half sharps/flats
572
573 . * write Dynamic_line (to group dynamics horizontally)
574
575 . * use Real for all y positions.
576
577 . * half-sharps, half-flats
578
579 . * adaptive accidental spacing.
580
581 . * handle EOF graciously in error messages.
582
583 . * midi esp.: use I32 iso int where 32 bits are needed (or assumed...)
584
585 . * stafftypes: voice names/ instrument names.
586
587 . * lily \tempo
588
589 . *   % toe to bheel   four to five
590             %   ^_u            4_5  
591             %     -                           
592             %  --|x--         --|x--
593             %  --|---         --|---
594             %  --|---         --|---
595           (where "to" is a tiny bow)
596
597 . * auxilliary file for caching info.
598
599 . * Text_crescendo
600
601 . * revise calcideal
602
603 .* IDEAS
604 . * Output data structures of Mudela in XML/SGML.
605 . * create libmudela, or liblily_frontend
606 . * move MIDI stuff (including Quantization) to a ANSI C libmidi library.
607 . * Spacing_request for manually adjusting spacing
608 . * caching breakpoints
609 . * used fixedpoint arithmetic for min. energy.
610 . * move towards incremental algorithms.
611 . * versioning stuff (cvt mudela, mudela, etc.)
612 . * dynamic loading of engravers? 
613 .* SMOBS
614 Han-Wen Nienhuys <hanwen@cs.uu.nl> writes:
615
616 >       class Foo_class {
617 >               Foo_smob *smob_ptr_;
618 >       }
619
620 >       struct Foo_smob {
621 >               Foo_class *class_ptr_
622 >       }
623
624 Usually you can get away without having this interlinked structure.
625 One piece of information you need when exporting objects to scheme is
626 the smob tag for your class.  You might store this value (a long) into
627 a class static variable, or a file static variable.  I'll use a class
628 static variable in this example.
629
630 I typically use code that works like this (untested code ahead):
631
632 class Foo_class {
633     static long *Foo_smob_tag;
634     SCM obj; // representation as a scheme object, description comes later
635 }
636
637 // call this once on startup
638 void init_Foo_class {
639     static scm_smobfuns type_rec;
640
641     type_rec.mark = foo_mark;
642     type_rec.free = foo_free;
643     type_rec.print = foo_display;
644     type_rec.equalp = 0;
645     Foo_class::Foo_smob_tag = new int(scm_new_smob(type_rec));
646 }
647
648 When you want to export an object to scheme, you put a pointer to the
649 object itself in the cdr of the cell, and the tag in the car of the
650 cell.  The code looks like this:
651
652 // Is this a Foo?
653 static int
654 foo_p(SCM obj)
655 {
656     return(SCM_NIMP(obj) && SCM_CAR(obj) == Foo_class::Foo_smob_tag);
657 }
658
659 // given a Scheme representation, return, a C++ representation
660 static Foo_class *
661 foo_unbox(SCM obj)
662 {
663     return((Foo_class*)SCM_CDR(obj));
664 }
665
666 // the SCM representation of the object is stored inside itself
667 // this will become useful when destructor gets called
668 static SCM
669 foo_box(Foo_class *foo)
670 {
671     SCM_DEFER_INTS;
672     SCM_NEWCELL(foo->obj);
673     SCM_SETCAR(foo->obj, Foo_class::Foo_smob_tag);
674     SCM_SETCDR(foo->obj, (SCM)foo);
675     SCM_ALLOW_INTS;
676     return foo->obj;
677 }
678
679 > C++ determines life time, so what is the strategy?
680
681 What happens now when the destructor gets called?  Lets set the cdr to
682 NULL, and then check for that in all of the primitive functions that
683 use your smob.  We'll call this notion 'live'; a scheme object is
684 'live' if the C++ representation still exists, it's dead if the C++
685 object is gone.  You can still have references to dead objects in
686 scheme code; it's just an error to use them.  This idea is stolen from
687 Emacs's handling of buffers ('buffer-live-p' and friends).
688
689 Add another function, foo_live_p:
690
691 static int
692 foo_live_p(SCM obj)
693 {
694     return(foo_p(obj) && SCM_CDR(obj) != NULL);
695 }
696
697 In you destructor, you need to do:
698
699 ~Foo_class()
700 {
701     SCM_CDR(this->obj, NULL);
702 }
703
704 When writing new primitives, now just check foo_live_p().
705
706 I hope the above helps,
707
708
709 * OUTLINE SETUP
710 .* .EMACS
711 ;;; from outline.el
712 (defvar outline-font-lock-keywords
713   '(;; Highlight headings according to the level.
714     ;; must change this to allout node layout
715     ;;("^\\(\\*+\\)[ \t]*\\(.+\\)?[ \t]*$"
716     ("^\\([.]*[ ]*[*]\\)[ \t]*\\(.*\\)$"
717      (1 font-lock-string-face)
718      (2 (let ((len (- (match-end 1) (match-beginning 1))))
719           (or (cdr (assq len '((1 . font-lock-function-name-face)
720                                (2 . font-lock-keyword-face)
721                                (3 . font-lock-comment-face))))
722               font-lock-variable-name-face))
723         nil t))
724     ;; Highlight citations of the form [1] and [Mar94].
725     ("\\[\\([A-Z][A-Za-z]+\\)*[0-9]+\\]" . font-lock-type-face))
726   "Additional expressions to highlight in Outline mode.")
727
728 (add-hook 'outline-mode-hook
729           '(lambda ()
730             (setq font-lock-maximum-decoration t)
731             (setq font-lock-maximum-decoration t)
732             (make-local-variable 'font-lock-defaults)
733             (setq font-lock-defaults '(outline-font-lock-keywords t))
734             (font-lock-mode global-font-lock-mode)
735         ))
736  
737 (require 'allout)
738 (outline-init 't)