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