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