GUIDOLib  1.6.8
A Music Score Rendering Engine
Functions
Parsing GMN files, strings and guido streams

Functions

GuidoParser * GuidoOpenParser ()
 Creates a new parser. More...
 
GuidoErrCode GuidoCloseParser (GuidoParser *p)
 Close a guido parser and releases all the associated ressources. More...
 
const char * GuidoGetStream (const GuidoStream *gStream)
 returns the string of the GuidoStream More...
 
void GuidoFreeStreamString (const char *str)
 free a string previously returned by GuidoGetStream More...
 
ARHandler GuidoFile2AR (GuidoParser *p, const char *file)
 Parse a file and create the corresponding AR. More...
 
ARHandler GuidoString2AR (GuidoParser *p, const char *str)
 Parse a string and create the corresponding AR. More...
 
ARHandler GuidoStream2AR (GuidoParser *p, GuidoStream *stream)
 Parse a GuidoStream and create the corresponding AR. More...
 
const char * GuidoStream2GuidoString (GuidoStream *stream)
 Finalize a GuidoStream and create the corresponding clean GuidoString. More...
 
GuidoErrCode GuidoParserGetErrorCode (GuidoParser *p, int &line, int &col, const char **msg)
 Get the error syntax line/column. More...
 
GuidoStream * GuidoOpenStream ()
 Open a guido stream. More...
 
GuidoErrCode GuidoCloseStream (GuidoStream *s)
 Close a guido stream. More...
 
GuidoErrCode GuidoWriteStream (GuidoStream *s, const char *str)
 Write data to the stream. More...
 
GuidoErrCode GuidoResetStream (GuidoStream *s)
 Erase all stream content in order to reuse it. More...
 

Detailed Description

Function Documentation

◆ GuidoCloseParser()

GuidoErrCode GuidoCloseParser ( GuidoParser *  p)

Close a guido parser and releases all the associated ressources.

Parameters
pa parser previously opened with GuidoOpenParser
Returns
a Guido error code.

◆ GuidoCloseStream()

GuidoErrCode GuidoCloseStream ( GuidoStream *  s)

Close a guido stream.

Parameters
sa GuidoStream
Returns
a Guido error code.

◆ GuidoFile2AR()

ARHandler GuidoFile2AR ( GuidoParser *  p,
const char *  file 
)

Parse a file and create the corresponding AR.

Parameters
pa parser previously opened with GuidoOpenParser
filethe file to parse.
Returns
a ARHandler or 0 in case of error.

◆ GuidoFreeStreamString()

void GuidoFreeStreamString ( const char *  str)

free a string previously returned by GuidoGetStream

Parameters
stra pointer to the string

◆ GuidoGetStream()

const char* GuidoGetStream ( const GuidoStream *  gStream)

returns the string of the GuidoStream

Parameters
gStreama GuidoStream
Returns
a pointer to a char * (must be freed by GuidoFreeStreamString

◆ GuidoOpenParser()

GuidoParser* GuidoOpenParser ( )

Creates a new parser.

Returns
a guido parser.

◆ GuidoOpenStream()

GuidoStream* GuidoOpenStream ( )

Open a guido stream.

Guido streams are intended to implement real-time input to the parser. In particular, streams allow to retrieve an AR in while the stream is still opened.

Returns
a guido stream.

◆ GuidoParserGetErrorCode()

GuidoErrCode GuidoParserGetErrorCode ( GuidoParser *  p,
int &  line,
int &  col,
const char **  msg 
)

Get the error syntax line/column.

Parameters
pa parser previously opened with GuidoOpenParser
linea reference that will contain a line number in case of syntax error
cola reference that will contain a column number in case of syntax error
msga string that will contain the error message
Returns
a Guido error code.

◆ GuidoResetStream()

GuidoErrCode GuidoResetStream ( GuidoStream *  s)

Erase all stream content in order to reuse it.

Parameters
sa GuidoStream previoulsy opened with GuidoOpenStream
Returns
a Guido error code.

◆ GuidoStream2AR()

ARHandler GuidoStream2AR ( GuidoParser *  p,
GuidoStream *  stream 
)

Parse a GuidoStream and create the corresponding AR.

Parameters
pa parser previously opened with GuidoOpenParser
streamthe GuidoStream to parse.
Returns
a ARHandler or 0 in case of error.

◆ GuidoStream2GuidoString()

const char* GuidoStream2GuidoString ( GuidoStream *  stream)

Finalize a GuidoStream and create the corresponding clean GuidoString.

Parameters
streamthe GuidoStream to clean
Returns
the Guido string.

◆ GuidoString2AR()

ARHandler GuidoString2AR ( GuidoParser *  p,
const char *  str 
)

Parse a string and create the corresponding AR.

Parameters
pa parser previously opened with GuidoOpenParser
strthe string to parse.
Returns
a ARHandler or 0 in case of error.

◆ GuidoWriteStream()

GuidoErrCode GuidoWriteStream ( GuidoStream *  s,
const char *  str 
)

Write data to the stream.

Writing data to a stream may be viewed as writing gmn code by portion. Syntax errors concerning music/voice/tag/event/parameter non-closure won't be declared as such (GuidoWriteStream uses an automatic-closure mechanism). When a syntax error (other than a non-closure) occurs when writting data to the stream, the stream becomes invalid and should be closed. Further attempts to write data will always result in a syntax error.

Regarding syntax errors, allowed incomplete constructs are :

  • opened music i.e. { without closing }
  • opened voice i.e. [ without closing ]
  • opened range tag i.e. ( without closing )
  • opened range parameter i.e. < without closing > but with at least one parameter
  • opened chord i.e. ( without closing ) but with at least one note
    Note
    for incomplete chords and range parameters, the ',' separator must always be followed by a note or a parameter. For example, don't write "{a," and then "b}" but "{a" and then ",b}".
    Parameters
    sa GuidoStream previoulsy opened with GuidoOpenStream
    stra string containing a portion of gmn code
    Returns
    a Guido error code.

Guido Project Copyright © 2019 Grame-CNCM