C , 2011-11-10 21:38 +0000, Chris Morley rakstīja:
> On 10/11/2011 18:20, My Th wrote:
> > Hi!
> >
> > These plugins are not wrapped for static compilation:
> > ABINITFormat
> > CacaoInternalFormat
> > CanSmilesNS
> > CASTEPFormat
> > EEMCharges
> > FPCount
> > GROFormat
> > InChICompareFormat
> > InChIKeyFormat
> > L5
> > MyFpType
> > NoCharges
> > OpAddFileName
> > OpGenAlias
> > OpLargest
> > OpNewV
> > OpSmallest
> > SecondOpAlign
> > Tautomers
> > XSFFormat
> > XXXFormat
> >
> > Is there a reason to not wrap any of them? (Apart of XXXFormat which is
> > an example plugin.) Some of them clearly look just forgotten there.
> 
> Some of these are only in example code, MyFPType, FPCount, or are not in 
> my version of the code, OpNewV, SecondOpAlign. Tautomers is not (yet) a 
> plugin.

I generated the list using shell commands and looking for class
instances (each command should be on one line):

# Dynamic plugin instances
grep -rh '^[[:blank:]]*[[:alpha:]]\+[[:blank:]]*
\bthe[[:alpha:]]*[[:upper:]][[:alnum:]]*\([(]\|;\)' src/* | awk '{ print
$2 }' | cut -d '(' -f1 | sed s/\;// | sort > dynamic_instances.txt

# Static plugin instances
grep '^[[:blank:]]*OB_STATIC_PLUGIN([[:alpha:]]*,[[:blank:]]*the[A-Z]*'
include/openbabel/plugin.h | awk '{FS="[,][ ]*"}; { print $2 }' | sed
s/\)// | sort > static_instances.txt

# Instances without static version
diff -U 999 dynamic_instances.txt static_instances.txt | grep '^-t' |
sed s/-//

> 
> I guess the code in plugin.h and plugin.cpp for the static build is hand 
> generated, but for maintainability it really ought to be automated. 
> There may be better ways, but a possibility would be to add a macro to 
> the declaration of each plugin global instance, e.g.
> 
>    STATICLIBASSIST SMIFormat theSMIFormat;
> 
> STATICLIBASSIST would be defined as nothing, but a pre-build step in a 
> static library build could grep the cpp files to provide the information 
> to construct the code needed. Any new plugins would be written with the 
> macro and so would be automatically included.

Sounds like obfuscating code.. In any case I think it should be
docummented in the code why certain plugins are not to be built for
static builds. And also a note in docs about adding new formats, that
plugins have to be marked for static build, e.g., here [1] and in the
comments of exampleformat.cpp.


Reinis

[1] http://openbabel.org/wiki/HowTo:Add_A_New_File_Format



------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to