File: README.Plugins

package info (click to toggle)
gregorio 0.9.2-1.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 9,008 kB
  • ctags: 1,025
  • sloc: ansic: 12,432; sh: 9,653; python: 1,679; lex: 1,098; yacc: 748; perl: 248; makefile: 227; xml: 215; sed: 16
file content (64 lines) | stat: -rw-r--r-- 2,132 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

0. Introduction
   ------------

Gregorio plugins are dynamically loaded shared libraries.  So as to limit their
usage to what they were designed for as much as possible, they should only
export predefined symbols.

1. How to declare a gregorio plugin
   --------------------------------

Basically, a plugin should include "plugin.h" and provide at least one of two
functions:

 - a function which purpose is to read a Gregorian chant score in a given file
   format and to translate it into the gregorio internal structure using
   libgregorio functions

    typedef gregorio_score *(*gregorio_read_func)(FILE *);

 - a function which purpose is to write a Gregorian chant score in a given
   output file format using its in-memory representation

    typedef void (*gregorio_write_func)(FILE *, gregorio_score *);

A plugin can of course provide both functions.

It is strongly advised to make this or these functions static so they are not
directly exported.  They are accessed through the exported gregorio_plugin_info
structure you must define using the following syntax:

DECLARE_PLUGIN(plugin_id)
{
  .id = "plugin_id",
  .name = "plugin name",
  .description = "a lenghty description of what the plugin can do",
  .author = "plugin author contact information",

  .type = GREGORIO_PLUGIN_BOTH,

  .file_extension = "xxx",

  .read = plugin_read_score,
  .write = plugin_write_score
};

The important fields are:

 - id: this plugin id is what the user has to pass to gregorio as a command line
   argument to activate this particular plugin
 - name: a nicer plugin name than the id.  Could be used in GUI applications
 - type: must be set to GREGORIO_PLUGIN_INPUT, GREGORIO_PLUGIN_OUTPUT or
   GREGORIO_PLUGIN_BOTH depending on whether the plugin provides input, output
   or both capabilities
 - file_extension: only used for output capabilities.  Allows gregorio to
   compute a default output filename
 - read: pointer to the gregorio_read_func function
 - write: pointer to the gregorio_write_func function

2. Example
   -------

You can find a gregorio plugin skeleton in the main gregorio tarball, in
plugins/skel.