Note geanyfunctions.h must be included last.

Use triple quoted text for file header.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3965 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-07-14 13:26:19 +00:00
parent 99641558bb
commit 80ac9273ee
2 changed files with 19 additions and 6 deletions

View File

@ -3,6 +3,8 @@
* @file geanyfunctions.h @ref geany_functions wrappers. * @file geanyfunctions.h @ref geany_functions wrappers.
* This allows the use of normal API function names in plugins. * This allows the use of normal API function names in plugins.
* You need to declare the @ref geany_functions symbol yourself. * You need to declare the @ref geany_functions symbol yourself.
*
* Note: This must be included after all other API headers.
*/ */
#ifndef GEANY_FUNCTIONS_H #ifndef GEANY_FUNCTIONS_H

View File

@ -55,6 +55,20 @@ def get_api_tuple(str):
return 'p_' + m.group(1), m.group(2) return 'p_' + m.group(1), m.group(2)
header = \
'''/* This file is generated automatically by genapi.py - do not edit.
*
* @file %s @ref geany_functions wrappers.
* This allows the use of normal API function names in plugins.
* You need to declare the @ref geany_functions symbol yourself.
*
* Note: This must be included after all other API headers.
*/
#ifndef GEANY_FUNCTIONS_H
#define GEANY_FUNCTIONS_H
'''
if __name__ == "__main__": if __name__ == "__main__":
outfile = 'geanyfunctions.h' outfile = 'geanyfunctions.h'
@ -63,15 +77,12 @@ if __name__ == "__main__":
sys.exit("No function names read!") sys.exit("No function names read!")
f = open(outfile, 'w') f = open(outfile, 'w')
print >>f, '/* This file is generated automatically by genapi.py - do not edit.\n *\n' +\ print >>f, header % (outfile)
' * @file %s @ref geany_functions wrappers.\n' % (outfile) +\
' * This allows the use of normal API function names in plugins.\n' +\
' * You need to declare the @ref geany_functions symbol yourself.\n */\n'
print >>f, '#ifndef GEANY_FUNCTIONS_H'
print >>f, '#define GEANY_FUNCTIONS_H\n'
for fname in fnames: for fname in fnames:
ptr, name = get_api_tuple(fname) ptr, name = get_api_tuple(fname)
print >>f, '#define %s \\\n\tgeany_functions->%s->%s' % (fname, ptr, name) print >>f, '#define %s \\\n\tgeany_functions->%s->%s' % (fname, ptr, name)
print >>f, '\n#endif' print >>f, '\n#endif'
f.close f.close