## Data Process Plug-ins

Data Process Plug-ins — Data processing by external programs

## Registration

When the plug-in is called with `register` as its first argument it should dump following information about self to standard output (each on a separate line) and terminate:

- plug-in name
- menu path
- run modes

This information correspond to similar data process module information. All fields are case-sensitive. The run modes line consists of a space-separated sublist of:

`interactive`
`noninteractive`
`modal`
`with_defaults`

Note however, truly interactive plug-ins are not supported (and maybe they never will, because it is hard to do this without making plug-ins derived works of Gwyddion), only modal ones.

So the output of plugin my_plugin when run as my_plugin register could look:

    my_plugin
    /_Plug-ins/My Plug-in
    noninteractive with_defaults

## Data Processing

When the plug-in is called with `run` as its first argument then the second argument is equal to actual run mode (one of those it printed during registration) and the third one is the name of a dump file to process.

The plug-in reads the data from dump file, mangles them at its pleasure and then overwrite the very same file with the result (do not forget to use `ftruncate()` first or its Win32 equivalent to avoid surprises).

The plug-in does not need to write back fields it didn't modify, values from the original data are used then. E.g., when the resolution does not change, it is enough to dump the data alone. This also means it can safely ignore anything it does not understand in the dump file.