John Henckel a skrivas:
> It's true that when the new ABC standard become approved (I say, hopefully) 
> then a lot of software will need to be rewritten to handle the new file 
> format.

Not sure: most of the ABC syntax is already well parsed.

>  Perhaps someone could write a really portable ABC parser and then
> give away the source code that each developer can just "plug it in" to 
> their ABC tool (abc2midi, abc2abc, abc2ps, abc2win, abc2???, 
> etc...)  There's no sense in everyone reinventing the wheel.

OK, I propose my parser which is used by both abcm2ps for printing and
tclabc/tkabc for editing and playing (the same structures are also used
for MIDI import).

It is composed of 2 files: the first one contains the parser structure
definitions (abcparse.h), and the other ine is an ANSI C source
(abcparse.c) which contains 3 main functions:

- memory allocator definition: alloc/free (the free function may be
  null when memory is freed by some external function as in abcm2ps).
  This initialization function also defines what is the memory
  space used by the application. As a result, each ABC symbol will
  contain:
        - the ABC syntax as read by the parser (abcparse),
        - some extra space to be used by the application.

- parse: from a memory ABC file, this routine returns a pointer to
  a linked list of tunes, each tune containing a linked list of
  ABC symbols. Each ABC symbol is the (most?) exact representation
  of an ABC syntax element, and lets space for the application
  program.

- free the memory space: this function frees the memory allocated
  by the parser. It does nothing when the free allocator function
  is null (abcm2ps).

Some internal functions have been made public to permit dynamic
insertion or deletion of ABC symbols, as parsing more ABC syntax (this
lastest function is mainly used in tkabc for 'paste' purpose).

About complexity, abcparse.c is only 2000 lines of code (easy to
modify/extend), and the structures are linear (only 3 pointer levels).

-- 
Ken ar c'henta� |             ** Breizh ha Linux atav! **
                |               http://moinejf.free.fr/
P�p� Jef        |       please, on reply, mailto:[EMAIL PROTECTED]
                |    or mailto:[EMAIL PROTECTED]


To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html

Reply via email to