X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Foidtoc.tcl;h=7ef102c03ef266526d6af68d26d62c0b14e8a823;hp=17469e35562544f86d2b6e3d9e702bfe204c3b63;hb=53862bf9e7756842158d38b1bb25f2c094b8d3d7;hpb=517b3b01c47fb87ed9656ee9b184eda54b6d0c99 diff --git a/src/oidtoc.tcl b/src/oidtoc.tcl index 17469e3..7ef102c 100644 --- a/src/oidtoc.tcl +++ b/src/oidtoc.tcl @@ -2,7 +2,7 @@ # Copyright (c) Index Data 2006-2007 # See the file LICENSE for details. # -# $Id: oidtoc.tcl,v 1.2 2007-04-18 08:08:02 adam Exp $ +# $Id: oidtoc.tcl,v 1.3 2007-04-24 12:55:15 adam Exp $ # # Converts a CSV file with Object identifiers to C @@ -45,23 +45,34 @@ proc oid_to_c {srcdir input cname hname} { set preamble " \\brief Standard Object Identifiers: Generated from $input */" puts $cfile $preamble puts $hfile $preamble + puts $hfile "\#ifndef OID_STD_H" + puts $hfile "\#define OID_STD_H" - + # Define this. So that we don't get duplicate declartions with MSVC + puts $cfile "\#define OID_STD_H" puts $cfile "\#include " puts $cfile "" + # To avoid LNK4049 + puts $hfile "\#ifdef YAZ_DLL" + puts $hfile "\#define OID_EXPORT YAZ_EXPORT" + puts $hfile "\#else" + puts $hfile "\#define OID_EXPORT YAZ_IMPORT" + puts $hfile "\#endif" + + puts $hfile "YAZ_BEGIN_CDECL" foreach oid $oids { set lname [string tolower [lindex $oid 2]] set lname [string map {- _ . _ { } _ ( {} ) {}} $lname] set prefix [string tolower [lindex $oid 0]] - puts -nonewline $cfile "const int yaz_oid_${prefix}_${lname}\[\] = \{" + puts -nonewline $cfile "YAZ_EXPORT const int yaz_oid_${prefix}_${lname}\[\] = \{" puts -nonewline $cfile [string map {. ,} [lindex $oid 1]] puts $cfile ",-1\};" - puts $hfile "extern const int yaz_oid_${prefix}_${lname}\[\];" + puts $hfile "OID_EXPORT extern const int yaz_oid_${prefix}_${lname}\[\];" } - puts $cfile "struct yaz_oid_entry yaz_oid_standard_entries\[\] =" + puts $cfile "YAZ_EXPORT struct yaz_oid_entry yaz_oid_standard_entries\[\] =" puts $cfile "\{" foreach oid $oids { set lname [string tolower [lindex $oid 2]] @@ -77,7 +88,9 @@ proc oid_to_c {srcdir input cname hname} { puts $cfile "\t\{CLASS_NOP, 0, 0\}" puts $cfile "\};" - puts $hfile "extern struct yaz_oid_entry yaz_oid_standard_entries\[\];" + puts $hfile "OID_EXPORT extern struct yaz_oid_entry yaz_oid_standard_entries\[\];" + puts $hfile "YAZ_END_CDECL" + puts $hfile "\#endif" close $cfile close $hfile }