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