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