mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:03:03 +01:00
Postfix for #8197: Add generated files for OO API for C language to distribution; Use macros instead functions, removed static library
This commit is contained in:
parent
446b436a62
commit
3a993adae6
@ -248,7 +248,6 @@ copyFiles() {
|
||||
|
||||
#include (.h .pas files)
|
||||
cp $BuiltFBDir/include/*.h ${TargetDir}@FB_INCDIR@
|
||||
# cp $BuiltFBDir/include/firebird/impl/iberror_c.h ${TargetDir}@FB_INCDIR@/firebird/impl
|
||||
cp $BuiltFBDir/include/firebird/*.h ${TargetDir}@FB_INCDIR@/firebird
|
||||
tar -C $BuiltFBDir/include/firebird -cf - impl | tar -C ${TargetDir}@FB_INCDIR@/firebird -x
|
||||
if [ "$CLIENT_ONLY_FLG" = "N" ]; then
|
||||
@ -262,7 +261,6 @@ copyFiles() {
|
||||
if [ "$CLIENT_ONLY_FLG" = "N" ]; then
|
||||
cp -f $BuiltFBDir/lib/libib_util.so ${TargetDir}@FB_LIBDIR@/libib_util.so
|
||||
fi
|
||||
copyIfExists $BuiltFBDir/lib/libfb_c_api.a ${TargetDir}@FB_LIBDIR@
|
||||
|
||||
if [ "$TomMathBuild" = "Y" ]; then
|
||||
makeDirs @FB_LIBDIR@/.tm
|
||||
|
@ -596,7 +596,7 @@ createLinksInSystemLib() {
|
||||
origDirLinksInSystemLib=`pwd`
|
||||
|
||||
cd @FB_LIBDIR@
|
||||
Libraries=`echo libfbclient.@SHRLIB_EXT@* libib_util.@SHRLIB_EXT@ libfb_c_api.a`
|
||||
Libraries=`echo libfbclient.@SHRLIB_EXT@* libib_util.@SHRLIB_EXT@`
|
||||
|
||||
cd /
|
||||
for l in $Libraries
|
||||
|
@ -120,10 +120,7 @@ API_PAS_FILE=$(INCLD_ROOT)/gen/Firebird.pas
|
||||
API_C_HEADER=fb_c_api.h
|
||||
API_C_H_FILE=$(FIREBIRD)/include/firebird/$(API_C_HEADER)
|
||||
API_C_TMP_FILE=$(TMP_ROOT)/fb_c_api.tmp
|
||||
API_C_IMPL_FILE=$(INCLD_ROOT)/gen/fb_c_api.c
|
||||
API_C_TEMPLATE=$(IDL_ROOT)/fb_c_api.hdr
|
||||
API_C_LIBRARY=$(LIB)/libfb_c_api.a
|
||||
API_C_TMP_OBJ=$(TMP_ROOT)/fb_c_api.obj
|
||||
MISC=$(SRC_ROOT)/misc
|
||||
PAS_ROOT=$(MISC)/pascal
|
||||
PASCAL_SOURCES=$(wildcard $(PAS_ROOT)/*)
|
||||
@ -136,20 +133,17 @@ RPL_AWK_SRC=$(MISC)/def_awk.c
|
||||
RPL_GREP=$(GEN_ROOT)/isc_grep
|
||||
RPL_GREP_SRC=$(MISC)/isc_grep.c
|
||||
|
||||
updateCloopInterfaces : $(API_H_FILE) $(API_PAS_FILE)
|
||||
updateCloopInterfaces : $(API_H_FILE) $(API_PAS_FILE) $(API_C_H_FILE)
|
||||
|
||||
$(API_H_FILE): $(IDL_FILE)
|
||||
$(CLOOP) $< c++ $@ IDL_FB_INTERFACES_H Firebird I
|
||||
|
||||
$(API_C_TMP_FILE): $(IDL_FILE)
|
||||
$(CLOOP) $< c-header $@ FB_C_API_H I
|
||||
$(CLOOP) $< c-header $@ FB_C_API_H I macro
|
||||
|
||||
$(API_C_H_FILE): $(API_C_TEMPLATE) $(API_C_TMP_FILE)
|
||||
cat $(API_C_TEMPLATE) $(API_C_TMP_FILE) >$(API_C_H_FILE)
|
||||
|
||||
$(API_C_IMPL_FILE): $(IDL_FILE)
|
||||
$(CLOOP) $< c-impl $@ $(API_C_HEADER) I
|
||||
|
||||
#
|
||||
# This way firebird.pas can be created not using own mini-utilities.
|
||||
# They were added to be able to build on windows, this code is left for reference.
|
||||
@ -707,13 +701,13 @@ $(COMPAT_SQL): $(SRC_COMPAT_SQL)
|
||||
# all the rest we need to build
|
||||
#
|
||||
|
||||
.PHONY: message_file tzdata gbak_files api_c_library
|
||||
.PHONY: message_file tzdata gbak_files
|
||||
|
||||
FDB_FILES := $(SECURITY_FDB) $(FIREBIRD)/examples/empbuild/employee.fdb
|
||||
GBAK_FILES := $(FDB_FILES:.fdb=.gbak)
|
||||
GBAK_FILES := $(subst Native,$(TARGET),$(GBAK_FILES))
|
||||
|
||||
rest: tzdata api_c_library
|
||||
rest: message_file tzdata
|
||||
|
||||
cross_rest: tzdata
|
||||
$(MAKE) $(BUILD_FILE)
|
||||
@ -739,13 +733,6 @@ $(BUILD_FILE): $(BUILD_Objects)
|
||||
|
||||
gbak_files: $(GBAK_FILES)
|
||||
|
||||
api_c_library: $(API_C_LIBRARY)
|
||||
|
||||
$(API_C_LIBRARY): $(API_C_IMPL_FILE) $(API_C_H_FILE) $(FIREBIRD_MSG) # use $(FIREBIRD_MSG) as timemark for iberror_c.h
|
||||
$(CC) $(WCFLAGS) -I$(FIREBIRD)/include -c $(API_C_IMPL_FILE) -o $(API_C_TMP_OBJ)
|
||||
-$(RM) $@
|
||||
$(STATICLIB_LINK) $@ $(API_C_TMP_OBJ)
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* MODULE: 01.create.c
|
||||
* DESCRIPTION: Minimal sample of using interfaces from plain C.
|
||||
*
|
||||
* Run something like this to build: cc 01.create.c -lfb_c_api -lfbclient
|
||||
* Run something like this to build: cc 01.create.c -lfbclient
|
||||
*
|
||||
* The contents of this file are subject to the Initial
|
||||
* Developer's Public License Version 1.0 (the "License");
|
||||
|
69
extern/cloop/src/cloop/Generator.cpp
vendored
69
extern/cloop/src/cloop/Generator.cpp
vendored
@ -716,11 +716,16 @@ void CppGenerator::generate()
|
||||
|
||||
|
||||
CHeaderGenerator::CHeaderGenerator(const string& filename, const string& prefix, Parser* parser,
|
||||
const string& headerGuard)
|
||||
const string& headerGuard, const std::string& parMacro)
|
||||
: CBasedGenerator(filename, prefix, false),
|
||||
parser(parser),
|
||||
headerGuard(headerGuard)
|
||||
headerGuard(headerGuard),
|
||||
macro(false)
|
||||
{
|
||||
if (parMacro.length() > 0 && parMacro != "macro")
|
||||
throw runtime_error("Last (#6) param should be exactly 'macro' or missing");
|
||||
|
||||
macro = parMacro.length() > 0;
|
||||
}
|
||||
|
||||
void CHeaderGenerator::generate()
|
||||
@ -824,14 +829,24 @@ void CHeaderGenerator::generate()
|
||||
{
|
||||
Method* method = *j;
|
||||
|
||||
fprintf(out, "CLOOP_EXTERN_C %s %s%s_%s(%sstruct %s%s* self",
|
||||
convertType(method->returnTypeRef).c_str(),
|
||||
prefix.c_str(),
|
||||
interface->name.c_str(),
|
||||
method->name.c_str(),
|
||||
(method->isConst ? "const " : ""),
|
||||
prefix.c_str(),
|
||||
interface->name.c_str());
|
||||
if (macro)
|
||||
{
|
||||
fprintf(out, "#define %s%s_%s(self",
|
||||
prefix.c_str(),
|
||||
interface->name.c_str(),
|
||||
method->name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(out, "CLOOP_EXTERN_C %s %s%s_%s(%sstruct %s%s* self",
|
||||
convertType(method->returnTypeRef).c_str(),
|
||||
prefix.c_str(),
|
||||
interface->name.c_str(),
|
||||
method->name.c_str(),
|
||||
(method->isConst ? "const " : ""),
|
||||
prefix.c_str(),
|
||||
interface->name.c_str());
|
||||
}
|
||||
|
||||
for (vector<Parameter*>::iterator k = method->parameters.begin();
|
||||
k != method->parameters.end();
|
||||
@ -839,11 +854,39 @@ void CHeaderGenerator::generate()
|
||||
{
|
||||
Parameter* parameter = *k;
|
||||
|
||||
fprintf(out, ", %s %s",
|
||||
convertType(parameter->typeRef).c_str(), parameter->name.c_str());
|
||||
if (macro)
|
||||
{
|
||||
fprintf(out, ", %s",
|
||||
parameter->name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(out, ", %s %s",
|
||||
convertType(parameter->typeRef).c_str(), parameter->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(out, ");\n");
|
||||
if (macro)
|
||||
{
|
||||
fprintf(out, ") %s(self)->vtable->%s(self",
|
||||
method->returnTypeRef.token.type != Token::TYPE_VOID ? "(" : "",
|
||||
method->name.c_str());
|
||||
|
||||
for (vector<Parameter*>::iterator k = method->parameters.begin();
|
||||
k != method->parameters.end();
|
||||
++k)
|
||||
{
|
||||
Parameter* parameter = *k;
|
||||
|
||||
fprintf(out, ", (%s)",
|
||||
parameter->name.c_str());
|
||||
}
|
||||
|
||||
fprintf(out, ")%s\n",
|
||||
method->returnTypeRef.token.type != Token::TYPE_VOID ? ")" : "");
|
||||
}
|
||||
else
|
||||
fprintf(out, ");\n");
|
||||
}
|
||||
|
||||
fprintf(out, "\n");
|
||||
|
3
extern/cloop/src/cloop/Generator.h
vendored
3
extern/cloop/src/cloop/Generator.h
vendored
@ -90,7 +90,7 @@ class CHeaderGenerator : public CBasedGenerator
|
||||
{
|
||||
public:
|
||||
CHeaderGenerator(const std::string& filename, const std::string& prefix, Parser* parser,
|
||||
const std::string& headerGuard);
|
||||
const std::string& headerGuard, const std::string& macro);
|
||||
|
||||
public:
|
||||
virtual void generate();
|
||||
@ -98,6 +98,7 @@ public:
|
||||
private:
|
||||
Parser* parser;
|
||||
std::string headerGuard;
|
||||
bool macro;
|
||||
};
|
||||
|
||||
|
||||
|
7
extern/cloop/src/cloop/Main.cpp
vendored
7
extern/cloop/src/cloop/Main.cpp
vendored
@ -82,12 +82,15 @@ static void run(int argc, const char* argv[])
|
||||
else if (outFormat == "c-header")
|
||||
{
|
||||
if (argc < 6)
|
||||
throw runtime_error(paramError("c-header", "headerGuard prefix"));
|
||||
throw runtime_error(paramError("c-header", "headerGuard prefix [macro]"));
|
||||
|
||||
string headerGuard(argv[4]);
|
||||
string prefix(argv[5]);
|
||||
string macro;
|
||||
if (argc == 7)
|
||||
macro = argv[6];
|
||||
|
||||
generator.reset(new CHeaderGenerator(outFilename, prefix, &parser, headerGuard));
|
||||
generator.reset(new CHeaderGenerator(outFilename, prefix, &parser, headerGuard, macro));
|
||||
}
|
||||
else if (outFormat == "c-impl")
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user