plugin_howto

How to write new plugins

Writing a new plugin for lcd4linux is quite easy, if you follow these steps:

  • Get the SVN (Subversion) version: This is very important, because it makes it much easier for us to commit your changes into the official code. If you need help with SVN, look at the SVN section at the Download page.
  • There's no need to keep two seperate directories (one with the original, one with your modifications): Subversion does this job for you.
  • Always do a svn up before editing, to ensure you're working on current code.
  • use plugin_sample.c as a template, but do not simply copy it, but let subversion do the job:
 svn cp plugin_sample.c plugin_<yourname>.c
 
  • edit plugin_<yourname>.c
    • add a short description what this plugin is for
    • add your copyright notice (important: your name and email)
    • Please do not modify the GPL part! (Yes, you have to put your code under GPL, otherwise I'll refuse your patch)
    • do some documentation (I know that real programmers write programs, not documentation, but…)
    • use one or more of the example functions as templates for your own functions
    • register your new functions in the init() function, delete the sample ones
  • edit plugin.c, add prototypes and the call to your plugin_init_* and plugin_exit_* function (just search for sample, copy&paste the corresponding areas, but try to keep it in alphabetical order)
  • edit Makefile.am and add your plugin_*.c to EXTRA_lcd4linux_SOURCES (again, copy&paste the sample areas, take care for alphabetical order)
  • edit plugins.m4 and copy&paste all sample areas (alphabetical order, please)
  • run ./bootstrap, ./configure and make
  • test with interactive mode (lcd4linux -i)
  • run ./indent.sh to apply coding style (this does source code formatting)
  • send us a patch:
    • run svn diff >your_patch.diff and send us the file
    • run svn commit -m “<your log message>” if you have SVN developer access and 'you know what you're doing'
  • add documentation to the wiki!!!

It's easy, believe me!


  • plugin_howto.txt
  • Last modified: 2020/07/17 18:33
  • (external edit)